Press This: small clean-up when generating the suggested content. Ensure all keys are always set in the array that is passed through the filter.

See #31637.

git-svn-id: https://develop.svn.wordpress.org/trunk@31836 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Andrew Ozz 2015-03-20 00:18:00 +00:00
parent dd8511c35b
commit f2aa089166
1 changed files with 6 additions and 10 deletions

View File

@ -1002,21 +1002,17 @@ class WP_Press_This {
} }
} }
$default_html = array( 'quote' => '', 'link' => '', 'embed' => '' );
require_once( ABSPATH . WPINC . '/class-oembed.php' ); require_once( ABSPATH . WPINC . '/class-oembed.php' );
$oembed = _wp_oembed_get_object(); $oembed = _wp_oembed_get_object();
if ( ! empty( $data['u'] ) && $oembed->get_provider( $data['u'], array( 'discover' => false ) ) ) { if ( ! empty( $data['u'] ) && $oembed->get_provider( $data['u'], array( 'discover' => false ) ) ) {
$default_html = array( $default_html['embed'] = '<p>[embed]' . $data['u'] . '[/embed]</p>';
'quote' => '',
'link' => '',
'embed' => '<p>[embed]' . $data['u'] . '[/embed]</p>',
);
} else { } else {
$default_html = array( $default_html['quote'] = '<blockquote>%1$s</blockquote>';
'quote' => '<blockquote>%1$s</blockquote>', $default_html['link'] = '<p>' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
'link' => '<p>' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) . ' <em><a href="%1$s">%2$s</a></em></p>';
' <em><a href="%1$s">%2$s</a></em></p>',
);
} }
/** /**