From fed67453a153ed5cfb47431f47357736f78fcb79 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Thu, 26 Mar 2015 01:16:58 +0000 Subject: [PATCH] Press This: on sites that support oEmbed, if the user has selected some text, quote it below the embed. Props stephdau. Fixes #31763. git-svn-id: https://develop.svn.wordpress.org/trunk@31894 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/class-wp-press-this.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/wp-admin/includes/class-wp-press-this.php b/src/wp-admin/includes/class-wp-press-this.php index 92d6f95fe3..eb2eb6d856 100644 --- a/src/wp-admin/includes/class-wp-press-this.php +++ b/src/wp-admin/includes/class-wp-press-this.php @@ -1009,6 +1009,11 @@ class WP_Press_This { if ( ! empty( $data['u'] ) && $oembed->get_provider( $data['u'], array( 'discover' => false ) ) ) { $default_html['embed'] = '

[embed]' . $data['u'] . '[/embed]

'; + + if ( ! empty( $data['s'] ) ) { + // If the user has selected some text, do quote it. + $default_html['quote'] = '
%1$s
'; + } } else { $default_html['quote'] = '
%1$s
'; $default_html['link'] = '

' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) . @@ -1030,7 +1035,7 @@ class WP_Press_This { } // Wrap suggested content in the specified HTML. - if ( ! empty( $default_html['quote'] ) ) { + if ( ! empty( $default_html['quote'] ) && $text ) { $content .= sprintf( $default_html['quote'], $text ); }