From e12621eccb371fba2025eafacf04b4e3df50b793 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Mon, 26 Nov 2012 22:08:50 +0000 Subject: [PATCH] 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 git-svn-id: https://develop.svn.wordpress.org/trunk@22847 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-admin/includes/ajax-actions.php | 16 ++++++++-------- wp-includes/js/media-editor.js | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/wp-admin/includes/ajax-actions.php b/wp-admin/includes/ajax-actions.php index 544c8be8b9..f3e2855b9a 100644 --- a/wp-admin/includes/ajax-actions.php +++ b/wp-admin/includes/ajax-actions.php @@ -1947,22 +1947,22 @@ function wp_ajax_send_attachment_to_editor() { wp_update_post( array( 'ID' => $id, 'post_parent' => $insert_into_post_id ) ); } - $html = isset( $attachment['title'] ) ? $attachment['title'] : ''; + $rel = $url = ''; + $html = $title = isset( $attachment['post_title'] ) ? $attachment['post_title'] : ''; if ( ! empty( $attachment['url'] ) ) { - $rel = ''; - if ( strpos($attachment['url'], 'attachment_id') || get_attachment_link( $id ) == $attachment['url'] ) + $url = $attachment['url']; + if ( strpos( $url, 'attachment_id') || get_attachment_link( $id ) == $url ) $rel = ' rel="attachment wp-att-' . $id . '"'; - $html = '' . $html . ''; + $html = '' . $html . ''; } remove_filter( 'media_send_to_editor', 'image_media_send_to_editor', 10, 3 ); if ( 'image' === substr( $post->post_mime_type, 0, 5 ) ) { - $url = $attachment['url']; - $align = isset( $attachment['image-align'] ) ? $attachment['image-align'] : 'none'; + $align = isset( $attachment['align'] ) ? $attachment['align'] : 'none'; $size = isset( $attachment['image-size'] ) ? $attachment['image-size'] : 'medium'; - $alt = isset( $attachment['image-alt'] ) ? $attachment['image-alt'] : ''; - $caption = isset( $attachment['caption'] ) ? $attachment['caption'] : ''; + $alt = isset( $attachment['image_alt'] ) ? $attachment['image_alt'] : ''; + $caption = isset( $attachment['post_excerpt'] ) ? $attachment['post_excerpt'] : ''; $title = ''; // We no longer insert title tags into tags, as they are redundant. $html = get_image_send_to_editor( $id, $caption, $title, $align, $url, (bool) $rel, $size, $alt ); } diff --git a/wp-includes/js/media-editor.js b/wp-includes/js/media-editor.js index 4215ce63b9..9f944acb09 100644 --- a/wp-includes/js/media-editor.js +++ b/wp-includes/js/media-editor.js @@ -431,12 +431,12 @@ if ( 'image' === attachment.type ) { html = wp.media.string.image( props ); - options['caption'] = caption; + options.post_excerpt = caption; _.each({ - align: 'image-align', + align: 'align', size: 'image-size', - alt: 'image-alt' + alt: 'image_alt' }, function( option, prop ) { if ( props[ prop ] ) options[ option ] = props[ prop ]; @@ -444,7 +444,7 @@ } else { html = wp.media.string.link( props ); - options.title = props.title; + options.post_title = props.title; } return media.post( 'send-attachment-to-editor', {