Switch oEmbed option to control discovery. Tweak whitelist and settings page. Props Viper007Bond. see #10337

git-svn-id: https://develop.svn.wordpress.org/trunk@12136 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren
2009-11-02 14:41:35 +00:00
parent 2c459fea5e
commit b552dbdd9b
6 changed files with 21 additions and 22 deletions
+3 -4
View File
@@ -928,8 +928,7 @@ class WP_Embed {
add_filter( 'the_content', array(&$this, 'autoembed'), 8 );
// After a post is saved, cache oEmbed items via AJAX
if ( get_option('embed_useoembed') )
add_action( 'edit_form_advanced', array(&$this, 'maybe_run_ajax_cache') );
add_action( 'edit_form_advanced', array(&$this, 'maybe_run_ajax_cache') );
}
/**
@@ -1059,7 +1058,7 @@ class WP_Embed {
$post_ID = $this->post_ID;
// Unknown URL format. Let oEmbed have a go.
if ( $post_ID && get_option('embed_useoembed') ) {
if ( $post_ID ) {
// Check for a cached result (stored in the post meta)
$cachekey = '_oembed_' . md5( $url . implode( '|', $attr ) );
@@ -1075,7 +1074,7 @@ class WP_Embed {
}
// Use oEmbed to get the HTML
$attr['discover'] = author_can( $post_ID, 'unfiltered_html' );
$attr['discover'] = ( get_option( 'embed_oembed_discover' ) && author_can( $post_ID, 'unfiltered_html' ) ) ? true : false;
$html = wp_oembed_get( $url, $attr );
// Cache the result