Make WordPress Core

Changeset 32055


Ignore:
Timestamp:
04/06/2015 06:24:53 PM (12 years ago)
Author:
helen
Message:

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.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r32007 r32055  
    24852485                wp_send_json_error();
    24862486
    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 );
    24892489
    24902490        $post = get_post( isset( $_POST['post_id'] ) ? $_POST['post_id'] : 0 );
    … …  
    24992499                // TinyMCE view for [embed] will parse this
    25002500                $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>';
    25032503        } else {
    25042504                $html = '';
    … …  
    25122512
    25132513        /** 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 );
    25152515
    25162516        wp_send_json_success( $html );
  • trunk/src/wp-includes/js/media-editor.js

    r29802 r32055  
    881881                                if ( 'link' === type ) {
    882882                                        _.defaults( embed, {
    883                                                 title:   embed.url,
     883                                                linkText: embed.linkText,
    884884                                                linkUrl: embed.url
    885885                                        });
    … …  
    10351035                        link: function( embed ) {
    10361036                                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.id
     1037                                        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
    10421042                                });
    10431043                        }
  • trunk/src/wp-includes/media-template.php

    r31960 r32055  
    815815                <label class="setting link-text">
    816816                        <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" />
    818818                </label>
    819819                <div class="embed-container" style="display: none;">
Note: See TracChangeset for help on using the changeset viewer.