Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.
Built from https://develop.svn.wordpress.org/trunk@47122


git-svn-id: http://core.svn.wordpress.org/trunk@46922 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov
2020-01-29 00:45:18 +00:00
parent e336b24edd
commit 001ffe81fb
497 changed files with 6841 additions and 5486 deletions

View File

@@ -28,18 +28,18 @@ class WP_Embed {
* Constructor
*/
public function __construct() {
// Hack to get the [embed] shortcode to run before wpautop()
// Hack to get the [embed] shortcode to run before wpautop().
add_filter( 'the_content', array( $this, 'run_shortcode' ), 8 );
add_filter( 'widget_text_content', array( $this, 'run_shortcode' ), 8 );
// Shortcode placeholder for strip_shortcodes()
// Shortcode placeholder for strip_shortcodes().
add_shortcode( 'embed', '__return_false' );
// Attempts to embed all URLs in a post
// Attempts to embed all URLs in a post.
add_filter( 'the_content', array( $this, 'autoembed' ), 8 );
add_filter( 'widget_text_content', array( $this, 'autoembed' ), 8 );
// After a post is saved, cache oEmbed items via Ajax
// After a post is saved, cache oEmbed items via Ajax.
add_action( 'edit_form_advanced', array( $this, 'maybe_run_ajax_cache' ) );
add_action( 'edit_page_form', array( $this, 'maybe_run_ajax_cache' ) );
}
@@ -59,16 +59,16 @@ class WP_Embed {
public function run_shortcode( $content ) {
global $shortcode_tags;
// Back up current registered shortcodes and clear them all out
// Back up current registered shortcodes and clear them all out.
$orig_shortcode_tags = $shortcode_tags;
remove_all_shortcodes();
add_shortcode( 'embed', array( $this, 'shortcode' ) );
// Do the shortcode (only the [embed] one is registered)
// Do the shortcode (only the [embed] one is registered).
$content = do_shortcode( $content, true );
// Put the original shortcodes back
// Put the original shortcodes back.
$shortcode_tags = $orig_shortcode_tags;
return $content;
@@ -161,11 +161,11 @@ class WP_Embed {
$this->last_attr = $attr;
// kses converts & into & and we need to undo this
// KSES converts & into & and we need to undo this.
// See https://core.trac.wordpress.org/ticket/11311
$url = str_replace( '&', '&', $url );
// Look for known internal handlers
// Look for known internal handlers.
ksort( $this->handlers );
foreach ( $this->handlers as $priority => $handlers ) {
foreach ( $handlers as $id => $handler ) {
@@ -339,7 +339,7 @@ class WP_Embed {
return apply_filters( 'embed_oembed_html', $html, $url, $attr, $post_ID );
}
// Still unknown
// Still unknown.
return $this->maybe_make_link( $url );
}
@@ -381,7 +381,7 @@ class WP_Embed {
return;
}
// Trigger a caching
// Trigger a caching.
if ( ! empty( $post->post_content ) ) {
$this->post_ID = $post->ID;
$this->usecache = false;
@@ -486,7 +486,7 @@ class WP_Embed {
);
if ( ! empty( $oembed_post_query->posts ) ) {
// Note: 'fields'=>'ids' is not being used in order to cache the post object as it will be needed.
// Note: 'fields' => 'ids' is not being used in order to cache the post object as it will be needed.
$oembed_post_id = $oembed_post_query->posts[0]->ID;
wp_cache_set( $cache_key, $oembed_post_id, $cache_group );