Make WordPress Core

Changeset 56193


Ignore:
Timestamp:
07/10/2023 10:58:33 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], [56180], [56191], [56192].

Props costdev, audrasjb.
See #58459.

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

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-header-image-setting.php

    r53411 r56193  
    4646                }
    4747
    48                 // If the value doesn't exist (removed or random),
    49                 // use the header_image value.
     48                /*
     49                 * If the value doesn't exist (removed or random),
     50                 * use the header_image value.
     51                 */
    5052                if ( ! $value ) {
    5153                        $value = $this->manager->get_setting( 'header_image' )->post_value();
  • trunk/src/wp-includes/customize/class-wp-customize-media-control.php

    r50810 r56193  
    8989                if ( is_object( $this->setting ) ) {
    9090                        if ( $this->setting->default ) {
    91                                 // Fake an attachment model - needs all fields used by template.
    92                                 // Note that the default value must be a URL, NOT an attachment ID.
     91                                /*
     92                                 * Fake an attachment model - needs all fields used by template.
     93                                 * Note that the default value must be a URL, NOT an attachment ID.
     94                                 */
    9395                                $ext  = substr( $this->setting->default, -3 );
    9496                                $type = in_array( $ext, array( 'jpg', 'png', 'gif', 'bmp', 'webp' ), true ) ? 'image' : 'document';
  • trunk/src/wp-includes/customize/class-wp-customize-themes-section.php

    r55276 r56193  
    185185         */
    186186        protected function filter_drawer_content_template() {
    187                 // @todo Use the .org API instead of the local core feature list.
    188                 // The .org API is currently outdated and will be reconciled when the .org themes directory is next redesigned.
     187                /*
     188                 * @todo Use the .org API instead of the local core feature list.
     189                 * The .org API is currently outdated and will be reconciled when the .org themes directory is next redesigned.
     190                 */
    189191                $feature_list = get_theme_feature_list( false );
    190192                ?>
  • trunk/src/wp-includes/rest-api/class-wp-rest-request.php

    r55988 r56193  
    474474                $params = array();
    475475                foreach ( $order as $type ) {
    476                         // array_merge() / the "+" operator will mess up
    477                         // numeric keys, so instead do a manual foreach.
     476                        /*
     477                         * array_merge() / the "+" operator will mess up
     478                         * numeric keys, so instead do a manual foreach.
     479                         */
    478480                        foreach ( (array) $this->params[ $type ] as $key => $value ) {
    479481                                $params[ $key ] = $value;
  • trunk/src/wp-includes/rest-api/class-wp-rest-server.php

    r56156 r56193  
    702702
    703703                foreach ( $data['_links'] as $rel => $links ) {
    704                         // If a list of relations was specified, and the link relation
    705                         // is not in the list of allowed relations, don't process the link.
     704                        /*
     705                         * If a list of relations was specified, and the link relation
     706                         * is not in the list of allowed relations, don't process the link.
     707                         */
    706708                        if ( is_array( $embed ) && ! in_array( $rel, $embed, true ) ) {
    707709                                continue;
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

    r56168 r56193  
    203203
    204204                if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
    205                         // Set a custom header with the attachment_id.
    206                         // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
     205                        /*
     206                         * Set a custom header with the attachment_id.
     207                         * Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
     208                         */
    207209                        header( 'X-WP-Upload-Attachment-ID: ' . $attachment_id );
    208210                }
     
    212214                require_once ABSPATH . 'wp-admin/includes/image.php';
    213215
    214                 // Post-process the upload (create image sub-sizes, make PDF thumbnails, etc.) and insert attachment meta.
    215                 // At this point the server may run out of resources and post-processing of uploaded images may fail.
     216                /*
     217                 * Post-process the upload (create image sub-sizes, make PDF thumbnails, etc.) and insert attachment meta.
     218                 * At this point the server may run out of resources and post-processing of uploaded images may fail.
     219                 */
    216220                wp_update_attachment_metadata( $attachment_id, wp_generate_attachment_metadata( $attachment_id, $file ) );
    217221
     
    563567                $image_name = wp_basename( $image_file, ".{$image_ext}" );
    564568
    565                 // Do not append multiple `-edited` to the file name.
    566                 // The user may be editing a previously edited image.
     569                /*
     570                 * Do not append multiple `-edited` to the file name.
     571                 * The user may be editing a previously edited image.
     572                 */
    567573                if ( preg_match( '/-edited(-\d+)?$/', $image_name ) ) {
    568574                        // Remove any `-1`, `-2`, etc. `wp_unique_filename()` will add the proper number.
     
    626632
    627633                if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
    628                         // Set a custom header with the attachment_id.
    629                         // Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
     634                        /*
     635                         * Set a custom header with the attachment_id.
     636                         * Used by the browser/client to resume creating image sub-sizes after a PHP fatal error.
     637                         */
    630638                        header( 'X-WP-Upload-Attachment-ID: ' . $new_attachment_id );
    631639                }
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

    r56163 r56193  
    230230
    231231                if ( $is_draft && (int) $post->post_author === $user_id && ! $post_lock ) {
    232                         // Draft posts for the same author: autosaving updates the post and does not create a revision.
    233                         // Convert the post object to an array and add slashes, wp_update_post() expects escaped array.
     232                        /*
     233                         * Draft posts for the same author: autosaving updates the post and does not create a revision.
     234                         * Convert the post object to an array and add slashes, wp_update_post() expects escaped array.
     235                         */
    234236                        $autosave_id = wp_update_post( wp_slash( (array) $prepared_post ), true );
    235237                } else {
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

    r54891 r56193  
    17621762                $posts_controller = $post_type->get_rest_controller();
    17631763
    1764                 // Ensure the posts controller is specifically a WP_REST_Posts_Controller instance
    1765                 // before using methods specific to that controller.
     1764                /*
     1765                 * Ensure the posts controller is specifically a WP_REST_Posts_Controller instance
     1766                 * before using methods specific to that controller.
     1767                 */
    17661768                if ( ! $posts_controller instanceof WP_REST_Posts_Controller ) {
    17671769                        $posts_controller = new WP_REST_Posts_Controller( $post->post_type );
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php

    r55104 r56193  
    577577
    578578                foreach ( $additional_fields as $field_name => $field_options ) {
    579                         // For back-compat, include any field with an empty schema
    580                         // because it won't be present in $this->get_item_schema().
     579                        /*
     580                         * For back-compat, include any field with an empty schema
     581                         * because it won't be present in $this->get_item_schema().
     582                         */
    581583                        if ( is_null( $field_options['schema'] ) ) {
    582584                                $properties[ $field_name ] = $field_options;
     
    631633                                // Check for nested fields if $field is not a direct match.
    632634                                $nested_fields = explode( '.', $field );
    633                                 // A nested field is included so long as its top-level property
    634                                 // is present in the schema.
     635                                /*
     636                                 * A nested field is included so long as its top-level property
     637                                 * is present in the schema.
     638                                 */
    635639                                if ( in_array( $nested_fields[0], $fields, true ) ) {
    636640                                        $response_fields[] = $field;
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php

    r56105 r56193  
    6262                                '/%s/themes/(?P<stylesheet>%s)',
    6363                                $this->rest_base,
    64                                 // Matches theme's directory: `/themes/<subdirectory>/<theme>/` or `/themes/<theme>/`.
    65                                 // Excludes invalid directory name characters: `/:<>*?"|`.
     64                                /*
     65                                 * Matches theme's directory: `/themes/<subdirectory>/<theme>/` or `/themes/<theme>/`.
     66                                 * Excludes invalid directory name characters: `/:<>*?"|`.
     67                                 */
    6668                                '[^\/:<>\*\?"\|]+(?:\/[^\/:<>\*\?"\|]+)?'
    6769                        ),
     
    566568         */
    567569        public function get_theme_item_permissions_check( $request ) {
    568                 // Verify if the current user has edit_theme_options capability.
    569                 // This capability is required to edit/view/delete templates.
     570                /*
     571                 * Verify if the current user has edit_theme_options capability.
     572                 * This capability is required to edit/view/delete templates.
     573                 */
    570574                if ( ! current_user_can( 'edit_theme_options' ) ) {
    571575                        return new WP_Error(
     
    639643         */
    640644        public function get_theme_items_permissions_check( $request ) { // phpcs:ignore VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
    641                 // Verify if the current user has edit_theme_options capability.
    642                 // This capability is required to edit/view/delete templates.
     645                /*
     646                 * Verify if the current user has edit_theme_options capability.
     647                 * This capability is required to edit/view/delete templates.
     648                 */
    643649                if ( ! current_user_can( 'edit_theme_options' ) ) {
    644650                        return new WP_Error(
  • trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

    r55248 r56193  
    10641064                        }
    10651065
    1066                         // (Note that internally this falls through to `wp_delete_post()`
    1067                         // if the Trash is disabled.)
     1066                        /*
     1067                         * (Note that internally this falls through to `wp_delete_post()`
     1068                         * if the Trash is disabled.)
     1069                         */
    10681070                        $result   = wp_trash_post( $id );
    10691071                        $post     = get_post( $id );
     
    12701272                }
    12711273
    1272                 // Sending a null date or date_gmt value resets date and date_gmt to their
    1273                 // default values (`0000-00-00 00:00:00`).
     1274                /*
     1275                 * Sending a null date or date_gmt value resets date and date_gmt to their
     1276                 * default values (`0000-00-00 00:00:00`).
     1277                 */
    12741278                if (
    12751279                        ( ! empty( $schema['properties']['date_gmt'] ) && $request->has_param( 'date_gmt' ) && null === $request['date_gmt'] ) ||
Note: See TracChangeset for help on using the changeset viewer.