From 2f368bf39617681630f81229c4e05269f7b5429d Mon Sep 17 00:00:00 2001 From: Helen Hou-Sandi Date: Mon, 6 Apr 2015 18:24:53 +0000 Subject: [PATCH] Insert from URL: Make sure the link text is actually used. Turns out there were more pieces to renaming the field. props iseulde. fixes #29476. git-svn-id: https://develop.svn.wordpress.org/trunk@32055 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/ajax-actions.php | 10 +++++----- src/wp-includes/js/media-editor.js | 12 ++++++------ src/wp-includes/media-template.php | 2 +- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/wp-admin/includes/ajax-actions.php b/src/wp-admin/includes/ajax-actions.php index 40d8ca27a1..7a01af9657 100644 --- a/src/wp-admin/includes/ajax-actions.php +++ b/src/wp-admin/includes/ajax-actions.php @@ -2484,8 +2484,8 @@ function wp_ajax_send_link_to_editor() { if ( ! $src = esc_url_raw( $src ) ) wp_send_json_error(); - if ( ! $title = trim( wp_unslash( $_POST['title'] ) ) ) - $title = wp_basename( $src ); + if ( ! $link_text = trim( wp_unslash( $_POST['link_text'] ) ) ) + $link_text = wp_basename( $src ); $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 ); @@ -2498,8 +2498,8 @@ function wp_ajax_send_link_to_editor() { if ( $check_embed !== $fallback ) { // TinyMCE view for [embed] will parse this $html = '[embed]' . $src . '[/embed]'; - } elseif ( $title ) { - $html = '' . $title . ''; + } elseif ( $link_text ) { + $html = '' . $link_text . ''; } else { $html = ''; } @@ -2511,7 +2511,7 @@ function wp_ajax_send_link_to_editor() { $type = $ext_type; /** This filter is documented in wp-admin/includes/media.php */ - $html = apply_filters( $type . '_send_to_editor_url', $html, $src, $title ); + $html = apply_filters( $type . '_send_to_editor_url', $html, $src, $link_text ); wp_send_json_success( $html ); } diff --git a/src/wp-includes/js/media-editor.js b/src/wp-includes/js/media-editor.js index c4ff48426f..a8576fae27 100644 --- a/src/wp-includes/js/media-editor.js +++ b/src/wp-includes/js/media-editor.js @@ -880,7 +880,7 @@ if ( 'link' === type ) { _.defaults( embed, { - title: embed.url, + linkText: embed.linkText, linkUrl: embed.url }); @@ -1034,11 +1034,11 @@ */ link: function( embed ) { return wp.media.post( 'send-link-to-editor', { - nonce: wp.media.view.settings.nonce.sendToEditor, - src: embed.linkUrl, - title: embed.title, - html: wp.media.string.link( embed ), - post_id: wp.media.view.settings.post.id + nonce: wp.media.view.settings.nonce.sendToEditor, + src: embed.linkUrl, + link_text: embed.linkText, + html: wp.media.string.link( embed ), + post_id: wp.media.view.settings.post.id }); } }, diff --git a/src/wp-includes/media-template.php b/src/wp-includes/media-template.php index f5f024d354..65b9b15597 100644 --- a/src/wp-includes/media-template.php +++ b/src/wp-includes/media-template.php @@ -814,7 +814,7 @@ function wp_print_media_templates() {