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
This commit is contained in:
Andrew Ozz 2015-03-26 01:16:58 +00:00
parent e1353e1fe8
commit fed67453a1
1 changed files with 6 additions and 1 deletions

View File

@ -1009,6 +1009,11 @@ class WP_Press_This {
if ( ! empty( $data['u'] ) && $oembed->get_provider( $data['u'], array( 'discover' => false ) ) ) {
$default_html['embed'] = '<p>[embed]' . $data['u'] . '[/embed]</p>';
if ( ! empty( $data['s'] ) ) {
// If the user has selected some text, do quote it.
$default_html['quote'] = '<blockquote>%1$s</blockquote>';
}
} else {
$default_html['quote'] = '<blockquote>%1$s</blockquote>';
$default_html['link'] = '<p>' . _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 );
}