Make WordPress Core

Changeset 56180


Ignore:
Timestamp:
07/09/2023 09:46:24 PM (3 years ago)
Author:
audrasjb
Message:

Docs: Replace multiple single line comments with multi-line comments.

This changeset updates various comments as per WordPress PHP Inline Documentation Standards.
See https://developer.wordpress.org/coding-standards/inline-documentation-standards/php/#5-inline-comments.

Follow-up to [56174], [56175], [56176], [56177], [56178], [56179].

Props costdev, audrasjb.
See #58459.

Location:
trunk/src/wp-includes
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-theme.php

    r55941 r56180  
    322322                } else {
    323323                        $this->headers = get_file_data( $this->theme_root . '/' . $theme_file, self::$file_headers, 'theme' );
    324                         // Default themes always trump their pretenders.
    325                         // Properly identify default themes that are inside a directory within wp-content/themes.
     324                        /*
     325                         * Default themes always trump their pretenders.
     326                         * Properly identify default themes that are inside a directory within wp-content/themes.
     327                         */
    326328                        $default_theme_slug = array_search( $this->headers['Name'], self::$default_themes, true );
    327329                        if ( $default_theme_slug ) {
     
    390392                // If we got our data from cache, we can assume that 'template' is pointing to the right place.
    391393                if ( ! is_array( $cache ) && $this->template != $this->stylesheet && ! file_exists( $this->theme_root . '/' . $this->template . '/index.php' ) ) {
    392                         // If we're in a directory of themes inside /themes, look for the parent nearby.
    393                         // wp-content/themes/directory-of-themes/*
     394                        /*
     395                         * If we're in a directory of themes inside /themes, look for the parent nearby.
     396                         * wp-content/themes/directory-of-themes/*
     397                         */
    394398                        $parent_dir  = dirname( $this->stylesheet );
    395399                        $directories = search_theme_directories();
     
    398402                                $this->template = $parent_dir . '/' . $this->template;
    399403                        } elseif ( $directories && isset( $directories[ $this->template ] ) ) {
    400                                 // Look for the template in the search_theme_directories() results, in case it is in another theme root.
    401                                 // We don't look into directories of themes, just the theme root.
     404                                /*
     405                                 * Look for the template in the search_theme_directories() results, in case it is in another theme root.
     406                                 * We don't look into directories of themes, just the theme root.
     407                                 */
    402408                                $theme_root_template = $directories[ $this->template ]['theme_root'];
    403409                        } else {
     
    16661672                }
    16671673
    1668                 // This is all super old MU back compat joy.
    1669                 // 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
     1674                /*
     1675                 * This is all super old MU back compat joy.
     1676                 * 'allowedthemes' keys things by stylesheet. 'allowed_themes' keyed things by name.
     1677                 */
    16701678                if ( false === $allowed_themes[ $blog_id ] ) {
    16711679                        if ( $current ) {
  • trunk/src/wp-includes/class-wp-user.php

    r55732 r56180  
    200200
    201201                if ( 'id' === $field ) {
    202                         // Make sure the value is numeric to avoid casting objects, for example,
    203                         // to int 1.
     202                        // Make sure the value is numeric to avoid casting objects, for example, to int 1.
    204203                        if ( ! is_numeric( $value ) ) {
    205204                                return false;
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r56167 r56180  
    138138                        'metaWeblog.newMediaObject'        => 'this:mw_newMediaObject',
    139139
    140                         // MetaWeblog API aliases for Blogger API.
    141                         // See http://www.xmlrpc.com/stories/storyReader$2460
     140                        /*
     141                         * MetaWeblog API aliases for Blogger API.
     142                         * See http://www.xmlrpc.com/stories/storyReader$2460
     143                         */
    142144                        'metaWeblog.deletePost'            => 'this:blogger_deletePost',
    143145                        'metaWeblog.getUsersBlogs'         => 'this:blogger_getUsersBlogs',
     
    31223124                do_action( 'xmlrpc_call', 'wp.deletePage', $args, $this );
    31233125
    3124                 // Get the current page based on the 'page_id' and
    3125                 // make sure it is a page and not a post.
     3126                /*
     3127                 * Get the current page based on the 'page_id' and
     3128                 * make sure it is a page and not a post.
     3129                 */
    31263130                $actual_page = get_post( $page_id, ARRAY_A );
    31273131                if ( ! $actual_page || ( 'page' !== $actual_page['post_type'] ) ) {
     
    34123416                }
    34133417
    3414                 // If no slug was provided, make it empty
    3415                 // so that WordPress will generate one.
     3418                /*
     3419                 * If no slug was provided, make it empty
     3420                 * so that WordPress will generate one.
     3421                 */
    34163422                if ( empty( $category['slug'] ) ) {
    34173423                        $category['slug'] = '';
    34183424                }
    34193425
    3420                 // If no parent_id was provided, make it empty
    3421                 // so that it will be a top-level page (no parent).
     3426                /*
     3427                 * If no parent_id was provided, make it empty
     3428                 * so that it will be a top-level page (no parent).
     3429                 */
    34223430                if ( ! isset( $category['parent_id'] ) ) {
    34233431                        $category['parent_id'] = '';
     
    56195627                $this->attach_uploads( $post_id, $post_content );
    56205628
    5621                 // Handle post formats if assigned, value is validated earlier
    5622                 // in this function.
     5629                /*
     5630                 * Handle post formats if assigned, value is validated earlier
     5631                 * in this function.
     5632                 */
    56235633                if ( isset( $content_struct['wp_post_format'] ) ) {
    56245634                        set_post_format( $post_id, $content_struct['wp_post_format'] );
     
    69997009                                }
    70007010
    7001                                 // We're going to use this fake tag to mark the context in a bit.
    7002                                 // The marker is needed in case the link text appears more than once in the paragraph.
     7011                                /*
     7012                                 * We're going to use this fake tag to mark the context in a bit.
     7013                                 * The marker is needed in case the link text appears more than once in the paragraph.
     7014                                 */
    70037015                                $excerpt = preg_replace( '|\</?wpcontext\>|', '', $para );
    70047016
  • trunk/src/wp-includes/class-wp.php

    r55988 r56180  
    201201                        }
    202202
    203                         // The requested permalink is in $pathinfo for path info requests and
    204                         // $req_uri for other requests.
     203                        // The requested permalink is in $pathinfo for path info requests and $req_uri for other requests.
    205204                        if ( ! empty( $pathinfo ) && ! preg_match( '|^.*' . $wp_rewrite->index . '$|', $pathinfo ) ) {
    206205                                $requested_path = $pathinfo;
  • trunk/src/wp-includes/class-wpdb.php

    r56066 r56180  
    21562156                }
    21572157
    2158                 // We need to check for an IPv6 address first.
    2159                 // An IPv6 address will always contain at least two colons.
     2158                /*
     2159                 * We need to check for an IPv6 address first.
     2160                 * An IPv6 address will always contain at least two colons.
     2161                 */
    21602162                if ( substr_count( $host, ':' ) > 1 ) {
    21612163                        $pattern = '#^(?:\[)?(?P<host>[0-9a-fA-F:]+)(?:\]:(?P<port>[\d]+))?#';
     
    22142216
    22152217                for ( $tries = 1; $tries <= $this->reconnect_retries; $tries++ ) {
    2216                         // On the last try, re-enable warnings. We want to see a single instance
    2217                         // of the "unable to connect" message on the bail() screen, if it appears.
     2218                        /*
     2219                         * On the last try, re-enable warnings. We want to see a single instance
     2220                         * of the "unable to connect" message on the bail() screen, if it appears.
     2221                         */
    22182222                        if ( $this->reconnect_retries === $tries && WP_DEBUG ) {
    22192223                                error_reporting( $error_reporting );
     
    22312235                }
    22322236
    2233                 // If template_redirect has already happened, it's too late for wp_die()/dead_db().
    2234                 // Let's just return and hope for the best.
     2237                /*
     2238                 * If template_redirect has already happened, it's too late for wp_die()/dead_db().
     2239                 * Let's just return and hope for the best.
     2240                 */
    22352241                if ( did_action( 'template_redirect' ) ) {
    22362242                        return false;
     
    22652271                $this->bail( $message, 'db_connect_fail' );
    22662272
    2267                 // Call dead_db() if bail didn't die, because this database is no more.
    2268                 // It has ceased to be (at least temporarily).
     2273                /*
     2274                 * Call dead_db() if bail didn't die, because this database is no more.
     2275                 * It has ceased to be (at least temporarily).
     2276                 */
    22692277                dead_db();
    22702278        }
     
    23142322                if ( $this->check_current_query && ! $this->check_ascii( $query ) ) {
    23152323                        $stripped_query = $this->strip_invalid_text_from_query( $query );
    2316                         // strip_invalid_text_from_query() can perform queries, so we need
    2317                         // to flush again, just to make sure everything is clear.
     2324                        /*
     2325                         * strip_invalid_text_from_query() can perform queries, so we need
     2326                         * to flush again, just to make sure everything is clear.
     2327                         */
    23182328                        $this->flush();
    23192329                        if ( $stripped_query !== $query ) {
     
    23432353                                        $mysql_errno = mysqli_errno( $this->dbh );
    23442354                                } else {
    2345                                         // $dbh is defined, but isn't a real connection.
    2346                                         // Something has gone horribly wrong, let's try a reconnect.
     2355                                        /*
     2356                                         * $dbh is defined, but isn't a real connection.
     2357                                         * Something has gone horribly wrong, let's try a reconnect.
     2358                                         */
    23472359                                        $mysql_errno = 2006;
    23482360                                }
     
    31233135                        return $this->last_result;
    31243136                } elseif ( OBJECT_K === $output ) {
    3125                         // Return an array of row objects with keys from column 1.
    3126                         // (Duplicates are discarded.)
     3137                        /*
     3138                         * Return an array of row objects with keys from column 1.
     3139                         * (Duplicates are discarded.)
     3140                         */
    31273141                        if ( $this->last_result ) {
    31283142                                foreach ( $this->last_result as $row ) {
     
    35303544                        } else {
    35313545                                $length = false;
    3532                                 // Since we have no length, we'll never truncate. Initialize the variable to false.
    3533                                 // True would take us through an unnecessary (for this case) codepath below.
     3546                                /*
     3547                                 * Since we have no length, we'll never truncate. Initialize the variable to false.
     3548                                 * True would take us through an unnecessary (for this case) codepath below.
     3549                                 */
    35343550                                $truncate_by_byte_length = false;
    35353551                        }
  • trunk/src/wp-includes/comment.php

    r55988 r56180  
    652652        global $wpdb;
    653653
    654         // Simple duplicate check.
    655         // expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
     654        /*
     655         * Simple duplicate check.
     656         * expected_slashed ($comment_post_ID, $comment_author, $comment_author_email, $comment_content)
     657         */
    656658        $dupe = $wpdb->prepare(
    657659                "SELECT comment_ID FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = %s AND comment_approved != 'trash' AND ( comment_author = %s ",
     
    13531355                        continue; }
    13541356
    1355                 // Do some escaping magic so that '#' chars
    1356                 // in the spam words don't break things:
     1357                // Do some escaping magic so that '#' chars in the spam words don't break things:
    13571358                $word = preg_quote( $word, '#' );
    13581359
  • trunk/src/wp-includes/cron.php

    r55988 r56180  
    542542 */
    543543function wp_clear_scheduled_hook( $hook, $args = array(), $wp_error = false ) {
    544         // Backward compatibility.
    545         // Previously, this function took the arguments as discrete vars rather than an array like the rest of the API.
     544        /*
     545         * Backward compatibility.
     546         * Previously, this function took the arguments as discrete vars rather than an array like the rest of the API.
     547         */
    546548        if ( ! is_array( $args ) ) {
    547549                _deprecated_argument( __FUNCTION__, '3.0.0', __( 'This argument has changed to an array to match the behavior of the other cron functions.' ) );
  • trunk/src/wp-includes/default-constants.php

    r56042 r56180  
    9696        }
    9797
    98         // Add define( 'WP_DEBUG_DISPLAY', null ); to wp-config.php to use the globally configured setting
    99         // for 'display_errors' and not force errors to be displayed. Use false to force 'display_errors' off.
     98        /*
     99         * Add define( 'WP_DEBUG_DISPLAY', null ); to wp-config.php to use the globally configured setting
     100         * for 'display_errors' and not force errors to be displayed. Use false to force 'display_errors' off.
     101         */
    100102        if ( ! defined( 'WP_DEBUG_DISPLAY' ) ) {
    101103                define( 'WP_DEBUG_DISPLAY', true );
     
    111113        }
    112114
    113         // Add define( 'SCRIPT_DEBUG', true ); to wp-config.php to enable loading of non-minified,
    114         // non-concatenated scripts and stylesheets.
     115        /*
     116         * Add define( 'SCRIPT_DEBUG', true ); to wp-config.php to enable loading of non-minified,
     117         * non-concatenated scripts and stylesheets.
     118         */
    115119        if ( ! defined( 'SCRIPT_DEBUG' ) ) {
    116120                if ( ! empty( $wp_version ) ) {
  • trunk/src/wp-includes/embed.php

    r53912 r56180  
    511511        );
    512512
    513         // Note that the script must be placed after the <blockquote> and <iframe> due to a regexp parsing issue in
    514         // `wp_filter_oembed_result()`. Because of the regex pattern starts with `|(<blockquote>.*?</blockquote>)?.*|`
    515         // wherein the <blockquote> is marked as being optional, if it is not at the beginning of the string then the group
    516         // will fail to match and everything will be matched by `.*` and not included in the group. This regex issue goes
    517         // back to WordPress 4.4, so in order to not break older installs this script must come at the end.
     513        /*
     514         * Note that the script must be placed after the <blockquote> and <iframe> due to a regexp parsing issue in
     515         * `wp_filter_oembed_result()`. Because of the regex pattern starts with `|(<blockquote>.*?</blockquote>)?.*|`
     516         * wherein the <blockquote> is marked as being optional, if it is not at the beginning of the string then the group
     517         * will fail to match and everything will be matched by `.*` and not included in the group. This regex issue goes
     518         * back to WordPress 4.4, so in order to not break older installs this script must come at the end.
     519         */
    518520        $output .= wp_get_inline_script_tag(
    519521                file_get_contents( ABSPATH . WPINC . '/js/wp-embed' . wp_scripts_get_suffix() . '.js' )
  • trunk/src/wp-includes/feed.php

    r55988 r56180  
    798798
    799799        $feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' );
    800         // We must manually overwrite $feed->sanitize because SimplePie's constructor
    801         // sets it before we have a chance to set the sanitization class.
     800        /*
     801         * We must manually overwrite $feed->sanitize because SimplePie's constructor
     802         * sets it before we have a chance to set the sanitization class.
     803         */
    802804        $feed->sanitize = new WP_SimplePie_Sanitize_KSES();
    803805
Note: See TracChangeset for help on using the changeset viewer.