-
@@ -827,11 +831,15 @@ class WP_Press_This {
labels->separate_items_with_commas; ?>
-
+
@@ -994,11 +1002,22 @@ class WP_Press_This {
}
}
- $default_html = array(
- 'quote' => '
%1$s
',
- 'link' => '
' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
- ' %2$s
',
- );
+ require_once( ABSPATH . WPINC . '/class-oembed.php' );
+ $oembed = _wp_oembed_get_object();
+
+ if ( ! empty( $data['u'] ) && $oembed->get_provider( $data['u'], array( 'discover' => false ) ) ) {
+ $default_html = array(
+ 'quote' => '',
+ 'link' => '',
+ 'embed' => '
[embed]' . $data['u'] . '[/embed]
',
+ );
+ } else {
+ $default_html = array(
+ 'quote' => '
%1$s
',
+ 'link' => '
' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
+ ' %2$s
',
+ );
+ }
/**
* Filter the default HTML for the Press This editor.
@@ -1010,9 +1029,13 @@ class WP_Press_This {
*/
$default_html = apply_filters( 'press_this_suggested_html', $default_html, $data );
+ if ( ! empty( $default_html['embed'] ) ) {
+ $content .= $default_html['embed'];
+ }
+
// Wrap suggested content in the specified HTML.
if ( ! empty( $default_html['quote'] ) ) {
- $content = sprintf( $default_html['quote'], $text );
+ $content .= sprintf( $default_html['quote'], $text );
}
// Add source attribution if there is one available.