Ticket #29476: 29476.patch
File 29476.patch, 2.8 KB (added by , 10 years ago) |
---|
-
src/wp-admin/includes/ajax-actions.php
2484 2484 if ( ! $src = esc_url_raw( $src ) ) 2485 2485 wp_send_json_error(); 2486 2486 2487 if ( ! $ title = trim( wp_unslash( $_POST['title'] ) ) )2488 $ title= wp_basename( $src );2487 if ( ! $link_text = trim( wp_unslash( $_POST['link_text'] ) ) ) 2488 $link_text = wp_basename( $src ); 2489 2489 2490 2490 $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 ); 2491 2491 … … 2498 2498 if ( $check_embed !== $fallback ) { 2499 2499 // TinyMCE view for [embed] will parse this 2500 2500 $html = '[embed]' . $src . '[/embed]'; 2501 } elseif ( $ title) {2502 $html = '<a href="' . esc_url( $src ) . '">' . $ title. '</a>';2501 } elseif ( $link_text ) { 2502 $html = '<a href="' . esc_url( $src ) . '">' . $link_text . '</a>'; 2503 2503 } else { 2504 2504 $html = ''; 2505 2505 } … … 2511 2511 $type = $ext_type; 2512 2512 2513 2513 /** This filter is documented in wp-admin/includes/media.php */ 2514 $html = apply_filters( $type . '_send_to_editor_url', $html, $src, $ title);2514 $html = apply_filters( $type . '_send_to_editor_url', $html, $src, $link_text ); 2515 2515 2516 2516 wp_send_json_success( $html ); 2517 2517 } -
src/wp-includes/js/media-editor.js
880 880 881 881 if ( 'link' === type ) { 882 882 _.defaults( embed, { 883 title: embed.url,883 linkText: embed.linkText, 884 884 linkUrl: embed.url 885 885 }); 886 886 … … 1034 1034 */ 1035 1035 link: function( embed ) { 1036 1036 return wp.media.post( 'send-link-to-editor', { 1037 nonce: wp.media.view.settings.nonce.sendToEditor,1038 src: embed.linkUrl,1039 title: embed.title,1040 html: wp.media.string.link( embed ),1041 post_id: wp.media.view.settings.post.id1037 nonce: wp.media.view.settings.nonce.sendToEditor, 1038 src: embed.linkUrl, 1039 link_text: embed.linkText, 1040 html: wp.media.string.link( embed ), 1041 post_id: wp.media.view.settings.post.id 1042 1042 }); 1043 1043 } 1044 1044 }, -
src/wp-includes/media-template.php
814 814 <script type="text/html" id="tmpl-embed-link-settings"> 815 815 <label class="setting link-text"> 816 816 <span><?php _e( 'Link Text' ); ?></span> 817 <input type="text" class="alignment" data-setting="link -text" />817 <input type="text" class="alignment" data-setting="linkText" /> 818 818 </label> 819 819 <div class="embed-container" style="display: none;"> 820 820 <div class="embed-preview"></div>