wp/wp-includes/class-wp-embed.php
changeset 18 be944660c56a
parent 16 a86126ab1dd4
child 19 3d72ae0968f4
equal deleted inserted replaced
17:34716fd837a4 18:be944660c56a
    29 	 */
    29 	 */
    30 	public function __construct() {
    30 	public function __construct() {
    31 		// Hack to get the [embed] shortcode to run before wpautop().
    31 		// Hack to get the [embed] shortcode to run before wpautop().
    32 		add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 );
    32 		add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 );
    33 		add_filter( 'widget_text_content', array( $this, 'run_shortcode' ), 8 );
    33 		add_filter( 'widget_text_content', array( $this, 'run_shortcode' ), 8 );
       
    34 		add_filter( 'widget_block_content', array( $this, 'run_shortcode' ), 8 );
    34 
    35 
    35 		// Shortcode placeholder for strip_shortcodes().
    36 		// Shortcode placeholder for strip_shortcodes().
    36 		add_shortcode( 'embed', '__return_false' );
    37 		add_shortcode( 'embed', '__return_false' );
    37 
    38 
    38 		// Attempts to embed all URLs in a post.
    39 		// Attempts to embed all URLs in a post.
    39 		add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
    40 		add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
    40 		add_filter( 'widget_text_content', array( $this, 'autoembed' ), 8 );
    41 		add_filter( 'widget_text_content', array( $this, 'autoembed' ), 8 );
       
    42 		add_filter( 'widget_block_content', array( $this, 'autoembed' ), 8 );
    41 
    43 
    42 		// After a post is saved, cache oEmbed items via Ajax.
    44 		// After a post is saved, cache oEmbed items via Ajax.
    43 		add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) );
    45 		add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) );
    44 		add_action( 'edit_page_form', array( $this, 'maybe_run_ajax_cache' ) );
    46 		add_action( 'edit_page_form', array( $this, 'maybe_run_ajax_cache' ) );
    45 	}
    47 	}
    82 		$post = get_post();
    84 		$post = get_post();
    83 
    85 
    84 		if ( ! $post || empty( $_GET['message'] ) ) {
    86 		if ( ! $post || empty( $_GET['message'] ) ) {
    85 			return;
    87 			return;
    86 		}
    88 		}
    87 
       
    88 		?>
    89 		?>
    89 <script type="text/javascript">
    90 <script type="text/javascript">
    90 	jQuery(document).ready(function($){
    91 	jQuery(document).ready(function($){
    91 		$.get("<?php echo admin_url( 'admin-ajax.php?action=oembed-cache&post=' . $post->ID, 'relative' ); ?>");
    92 		$.get("<?php echo esc_url( admin_url( 'admin-ajax.php', 'relative' ) ) . '?action=oembed-cache&post=' . $post->ID; ?>");
    92 	});
    93 	});
    93 </script>
    94 </script>
    94 		<?php
    95 		<?php
    95 	}
    96 	}
    96 
    97