Skip to content

Commit add61a8

Browse files
committed
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. git-svn-id: https://develop.svn.wordpress.org/trunk@56193 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 2a66e49 commit add61a8

11 files changed

+72
-36
lines changed

src/wp-includes/customize/class-wp-customize-header-image-setting.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ public function update( $value ) {
4545
$custom_image_header = new Custom_Image_Header( $admin_head_callback, $admin_preview_callback );
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();
5254
}

src/wp-includes/customize/class-wp-customize-media-control.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ public function to_json() {
8888

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';
9597

src/wp-includes/customize/class-wp-customize-themes-section.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,10 @@ protected function filter_bar_content_template() {
184184
* @since 4.9.0
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
?>
191193
<# if ( 'wporg' === data.action ) { #>

src/wp-includes/rest-api/class-wp-rest-request.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -473,8 +473,10 @@ public function get_params() {
473473

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;
480482
}

src/wp-includes/rest-api/class-wp-rest-server.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -701,8 +701,10 @@ protected function embed_links( $data, $embed = true ) {
701701
$embedded = array();
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;
708710
}

src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php

+16-8
Original file line numberDiff line numberDiff line change
@@ -202,17 +202,21 @@ public function create_item( $request ) {
202202
wp_after_insert_post( $attachment, false, null );
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
}
209211

210212
// Include media and image functions to get access to wp_generate_attachment_metadata().
211213
require_once ABSPATH . 'wp-admin/includes/media.php';
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

218222
$response = $this->prepare_item_for_response( $attachment, $request );
@@ -562,8 +566,10 @@ public function edit_media_item( $request ) {
562566
$image_ext = pathinfo( $image_file, PATHINFO_EXTENSION );
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.
569575
$image_name = preg_replace( '/-edited(-\d+)?$/', '-edited', $image_name );
@@ -625,8 +631,10 @@ public function edit_media_item( $request ) {
625631
}
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
}
632640

src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -229,8 +229,10 @@ public function create_item( $request ) {
229229
$is_draft = 'draft' === $post->post_status || 'auto-draft' === $post->post_status;
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 {
236238
// Non-draft posts: create or update the post autosave.

src/wp-includes/rest-api/endpoints/class-wp-rest-comments-controller.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -1761,8 +1761,10 @@ protected function check_read_post_permission( $post, $request ) {
17611761

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 );
17681770
}

src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -576,8 +576,10 @@ public function get_fields_for_response( $request ) {
576576
$additional_fields = $this->get_additional_fields();
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;
583585
}
@@ -630,8 +632,10 @@ static function( $response_fields, $field ) use ( $fields ) {
630632
}
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;
637641
}

src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php

+12-6
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ public function register_routes() {
6161
sprintf(
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
),
6870
array(
@@ -565,8 +567,10 @@ public function get_item_schema() {
565567
* @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
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(
572576
'rest_cannot_manage_global_styles',
@@ -638,8 +642,10 @@ public function get_theme_item( $request ) {
638642
* @return true|WP_Error True if the request has read access for the item, WP_Error object otherwise.
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(
645651
'rest_cannot_manage_global_styles',

src/wp-includes/rest-api/endpoints/class-wp-rest-posts-controller.php

+8-4
Original file line numberDiff line numberDiff line change
@@ -1063,8 +1063,10 @@ public function delete_item( $request ) {
10631063
);
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 );
10701072
$response = $this->prepare_item_for_response( $post, $request );
@@ -1269,8 +1271,10 @@ protected function prepare_item_for_database( $request ) {
12691271
}
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'] ) ||
12761280
( ! empty( $schema['properties']['date'] ) && $request->has_param( 'date' ) && null === $request['date'] )

0 commit comments

Comments
 (0)