WordPress.org

Make WordPress Core

Changeset 22847


Ignore:
Timestamp:
11/26/2012 10:08:50 PM (6 years ago)
Author:
ryan
Message:

In wp.media.editor:send, revert back to the old field names used by media_upload_form_handler() for easier back compat.
Fix notices in wp_ajax_send_attachment_to_editor().

Props nacin, azaozz, miqrogroove
fixes #22553

Location:
trunk
Files:
2 edited

Legend:

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

    r22845 r22847  
    19481948    }
    19491949
    1950     $html = isset( $attachment['title'] ) ? $attachment['title'] : '';
     1950    $rel = $url = '';
     1951    $html = $title = isset( $attachment['post_title'] ) ? $attachment['post_title'] : '';
    19511952    if ( ! empty( $attachment['url'] ) ) {
    1952         $rel = '';
    1953         if ( strpos($attachment['url'], 'attachment_id') || get_attachment_link( $id ) == $attachment['url'] )
     1953        $url = $attachment['url'];
     1954        if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url )
    19541955            $rel = ' rel="attachment wp-att-' . $id . '"';
    1955         $html = '<a href="' . esc_url( $attachment['url'] ) . '"' . $rel . '>' . $html . '</a>';
     1956        $html = '<a href="' . esc_url( $url ) . '"' . $rel . '>' . $html . '</a>';
    19561957    }
    19571958
     
    19591960
    19601961    if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) {
    1961         $url = $attachment['url'];
    1962         $align = isset( $attachment['image-align'] ) ? $attachment['image-align'] : 'none';
     1962        $align = isset( $attachment['align'] ) ? $attachment['align'] : 'none';
    19631963        $size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium';
    1964         $alt = isset( $attachment['image-alt'] ) ? $attachment['image-alt'] : '';
    1965         $caption = isset( $attachment['caption'] ) ? $attachment['caption'] : '';
     1964        $alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : '';
     1965        $caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : '';
    19661966        $title = ''; // We no longer insert title tags into <img> tags, as they are redundant.
    19671967        $html = get_image_send_to_editor( $id, $caption, $title, $align, $url, (bool) $rel, $size, $alt );
  • trunk/wp-includes/js/media-editor.js

    r22843 r22847  
    432432                if ( 'image' === attachment.type ) {
    433433                    html = wp.media.string.image( props );
    434                     options['caption'] = caption;
     434                    options.post_excerpt = caption;
    435435
    436436                    _.each({
    437                         align: 'image-align',
     437                        align: 'align',
    438438                        size:  'image-size',
    439                         alt:   'image-alt'
     439                        alt:   'image_alt'
    440440                    }, function( option, prop ) {
    441441                        if ( props[ prop ] )
     
    445445                } else {
    446446                    html = wp.media.string.link( props );
    447                     options.title = props.title;
     447                    options.post_title = props.title;
    448448                }
    449449
Note: See TracChangeset for help on using the changeset viewer.