From b696756a6131d9101453904fff823ff6bbb8a159 Mon Sep 17 00:00:00 2001 From: audrasjb Date: Sun, 9 Jul 2023 21:25:23 +0000 Subject: [PATCH] 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]. Props costdev, audrasjb. See #58459. Built from https://develop.svn.wordpress.org/trunk@56178 git-svn-id: http://core.svn.wordpress.org/trunk@55690 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-image-editor-imagick.php | 30 ++++++++++++------- wp-includes/class-wp-image-editor.php | 26 ++++++++++------ wp-includes/class-wp-locale-switcher.php | 6 ++-- wp-includes/class-wp-locale.php | 6 ++-- wp-includes/class-wp-oembed.php | 7 +++-- wp-includes/class-wp-query.php | 18 +++++++---- .../class-wp-text-diff-renderer-table.php | 12 +++++--- wp-includes/class-wp-textdomain-registry.php | 6 ++-- wp-includes/version.php | 2 +- 9 files changed, 74 insertions(+), 39 deletions(-) diff --git a/wp-includes/class-wp-image-editor-imagick.php b/wp-includes/class-wp-image-editor-imagick.php index 69ab7b176c..0df7d4180f 100644 --- a/wp-includes/class-wp-image-editor-imagick.php +++ b/wp-includes/class-wp-image-editor-imagick.php @@ -102,8 +102,10 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { return false; } - // setIteratorIndex is optional unless mime is an animated format. - // Here, we just say no if you are missing it and aren't loading a jpeg. + /* + * setIteratorIndex is optional unless mime is an animated format. + * Here, we just say no if you are missing it and aren't loading a jpeg. + */ if ( ! method_exists( 'Imagick', 'setIteratorIndex' ) && 'image/jpeg' !== $mime_type ) { return false; } @@ -602,8 +604,10 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { $this->image->setImagePage( $src_w, $src_h, 0, 0 ); if ( $dst_w || $dst_h ) { - // If destination width/height isn't specified, - // use same as width/height from source. + /* + * If destination width/height isn't specified, + * use same as width/height from source. + */ if ( ! $dst_w ) { $dst_w = $src_w; } @@ -957,8 +961,10 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { */ protected function pdf_setup() { try { - // By default, PDFs are rendered in a very low resolution. - // We want the thumbnail to be readable, so increase the rendering DPI. + /* + * By default, PDFs are rendered in a very low resolution. + * We want the thumbnail to be readable, so increase the rendering DPI. + */ $this->image->setResolution( 128, 128 ); // Only load the first page. @@ -986,12 +992,16 @@ class WP_Image_Editor_Imagick extends WP_Image_Editor { } try { - // When generating thumbnails from cropped PDF pages, Imagemagick uses the uncropped - // area (resulting in unnecessary whitespace) unless the following option is set. + /* + * When generating thumbnails from cropped PDF pages, Imagemagick uses the uncropped + * area (resulting in unnecessary whitespace) unless the following option is set. + */ $this->image->setOption( 'pdf:use-cropbox', true ); - // Reading image after Imagick instantiation because `setResolution` - // only applies correctly before the image is read. + /* + * Reading image after Imagick instantiation because `setResolution` + * only applies correctly before the image is read. + */ $this->image->readImage( $filename ); } catch ( Exception $e ) { // Attempt to run `gs` without the `use-cropbox` option. See #48853. diff --git a/wp-includes/class-wp-image-editor.php b/wp-includes/class-wp-image-editor.php index fed0fc16e8..fa5a8ef178 100644 --- a/wp-includes/class-wp-image-editor.php +++ b/wp-includes/class-wp-image-editor.php @@ -349,8 +349,10 @@ abstract class WP_Image_Editor { $file_mime = $this->mime_type; } - // Check to see if specified mime-type is the same as type implied by - // file extension. If so, prefer extension from file. + /* + * Check to see if specified mime-type is the same as type implied by + * file extension. If so, prefer extension from file. + */ if ( ! $mime_type || ( $file_mime == $mime_type ) ) { $mime_type = $file_mime; $new_ext = $file_ext; @@ -384,8 +386,10 @@ abstract class WP_Image_Editor { $new_ext = $this->get_extension( $mime_type ); } - // Double-check that the mime-type selected is supported by the editor. - // If not, choose a default instead. + /* + * Double-check that the mime-type selected is supported by the editor. + * If not, choose a default instead. + */ if ( ! $this->supports_mime_type( $mime_type ) ) { /** * Filters default mime type prior to getting the file extension. @@ -400,9 +404,11 @@ abstract class WP_Image_Editor { $new_ext = $this->get_extension( $mime_type ); } - // Ensure both $filename and $new_ext are not empty. - // $this->get_extension() returns false on error which would effectively remove the extension - // from $filename. That shouldn't happen, files without extensions are not supported. + /* + * Ensure both $filename and $new_ext are not empty. + * $this->get_extension() returns false on error which would effectively remove the extension + * from $filename. That shouldn't happen, files without extensions are not supported. + */ if ( $filename && $new_ext ) { $dir = pathinfo( $filename, PATHINFO_DIRNAME ); $ext = pathinfo( $filename, PATHINFO_EXTENSION ); @@ -515,8 +521,10 @@ abstract class WP_Image_Editor { $result = $this->flip( false, true ); break; case 3: - // Rotate 180 degrees or flip horizontally and vertically. - // Flipping seems faster and uses less resources. + /* + * Rotate 180 degrees or flip horizontally and vertically. + * Flipping seems faster and uses less resources. + */ $result = $this->flip( true, true ); break; case 4: diff --git a/wp-includes/class-wp-locale-switcher.php b/wp-includes/class-wp-locale-switcher.php index 75e344f19f..d07490f107 100644 --- a/wp-includes/class-wp-locale-switcher.php +++ b/wp-includes/class-wp-locale-switcher.php @@ -255,8 +255,10 @@ class WP_Locale_Switcher { continue; } - // Unload current text domain but allow them to be reloaded - // after switching back or to another locale. + /* + * Unload current text domain but allow them to be reloaded + * after switching back or to another locale. + */ unload_textdomain( $domain, true ); get_translations_for_domain( $domain ); } diff --git a/wp-includes/class-wp-locale.php b/wp-includes/class-wp-locale.php index 140b93b482..36be8ee37a 100644 --- a/wp-includes/class-wp-locale.php +++ b/wp-includes/class-wp-locale.php @@ -219,8 +219,10 @@ class WP_Locale { $this->meridiem['AM'] = __( 'AM' ); $this->meridiem['PM'] = __( 'PM' ); - // Numbers formatting. - // See https://www.php.net/number_format + /* + * Numbers formatting. + * See https://www.php.net/number_format + */ /* translators: $thousands_sep argument for https://www.php.net/number_format, default is ',' */ $thousands_sep = __( 'number_format_thousands_sep' ); diff --git a/wp-includes/class-wp-oembed.php b/wp-includes/class-wp-oembed.php index efce9b3388..91f9cd68be 100644 --- a/wp-includes/class-wp-oembed.php +++ b/wp-includes/class-wp-oembed.php @@ -620,9 +620,10 @@ class WP_oEmbed { } if ( PHP_VERSION_ID < 80000 ) { - // This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading - // is disabled by default, so this function is no longer needed to protect against XXE attacks. - // phpcs:ignore PHPCompatibility.FunctionUse.RemovedFunctions.libxml_disable_entity_loaderDeprecated + /* + * This function has been deprecated in PHP 8.0 because in libxml 2.9.0, external entity loading + * is disabled by default, so this function is no longer needed to protect against XXE attacks. + */ $loader = libxml_disable_entity_loader( true ); } diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index bdfce5e52c..4e1ce2e425 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -1616,8 +1616,10 @@ class WP_Query { $search_orderby .= $wpdb->prepare( "WHEN {$wpdb->posts}.post_title LIKE %s THEN 1 ", $like ); } - // Sanity limit, sort as sentence when more than 6 terms - // (few searches are longer than 6 terms and most titles are not). + /* + * Sanity limit, sort as sentence when more than 6 terms + * (few searches are longer than 6 terms and most titles are not). + */ if ( $num_terms < 7 ) { // All words in title. $search_orderby .= 'WHEN ' . implode( ' AND ', $q['search_orderby_title'] ) . ' THEN 2 '; @@ -3509,8 +3511,10 @@ class WP_Query { $this->posts = apply_filters_ref_array( 'the_posts', array( $this->posts, &$this ) ); } - // Ensure that any posts added/modified via one of the filters above are - // of the type WP_Post and are filtered. + /* + * Ensure that any posts added/modified via one of the filters above are + * of the type WP_Post and are filtered. + */ if ( $this->posts ) { $this->post_count = count( $this->posts ); @@ -3553,8 +3557,10 @@ class WP_Query { private function set_found_posts( $q, $limits ) { global $wpdb; - // Bail if posts is an empty array. Continue if posts is an empty string, - // null, or false to accommodate caching plugins that fill posts later. + /* + * Bail if posts is an empty array. Continue if posts is an empty string, + * null, or false to accommodate caching plugins that fill posts later. + */ if ( $q['no_found_rows'] || ( is_array( $this->posts ) && ! $this->posts ) ) { return; } diff --git a/wp-includes/class-wp-text-diff-renderer-table.php b/wp-includes/class-wp-text-diff-renderer-table.php index cca7781b54..0174fed359 100644 --- a/wp-includes/class-wp-text-diff-renderer-table.php +++ b/wp-includes/class-wp-text-diff-renderer-table.php @@ -285,8 +285,10 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer { if ( preg_match_all( '!(.*?|.*?)!', $diff, $diff_matches ) ) { // Length of all text between or . $stripped_matches = strlen( strip_tags( implode( ' ', $diff_matches[0] ) ) ); - // Since we count length of text between or (instead of picking just one), - // we double the length of chars not in those tags. + /* + * Since we count length of text between or (instead of picking just one), + * we double the length of chars not in those tags. + */ $stripped_diff = strlen( strip_tags( $diff ) ) * 2 - $stripped_matches; $diff_ratio = $stripped_matches / $stripped_diff; if ( $diff_ratio > $this->_diff_threshold ) { @@ -416,8 +418,10 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer { $orig_rows_copy = $orig_rows; $final_rows = array_keys( $final_matches ); - // Interleaves rows with blanks to keep matches aligned. - // We may end up with some extraneous blank rows, but we'll just ignore them later. + /* + * Interleaves rows with blanks to keep matches aligned. + * We may end up with some extraneous blank rows, but we'll just ignore them later. + */ foreach ( $orig_rows_copy as $orig_row ) { $final_pos = array_search( $orig_matches[ $orig_row ], $final_rows, true ); $orig_pos = (int) array_search( $orig_row, $orig_rows, true ); diff --git a/wp-includes/class-wp-textdomain-registry.php b/wp-includes/class-wp-textdomain-registry.php index fc3994ad15..99d72eb7a3 100644 --- a/wp-includes/class-wp-textdomain-registry.php +++ b/wp-includes/class-wp-textdomain-registry.php @@ -201,8 +201,10 @@ class WP_Textdomain_Registry { return $found_location; } - // If no path is found for the given locale and a custom path has been set - // using load_plugin_textdomain/load_theme_textdomain, use that one. + /* + * If no path is found for the given locale and a custom path has been set + * using load_plugin_textdomain/load_theme_textdomain, use that one. + */ if ( 'en_US' !== $locale && isset( $this->custom_paths[ $domain ] ) ) { $fallback_location = rtrim( $this->custom_paths[ $domain ], '/' ) . '/'; $this->set( $domain, $locale, $fallback_location ); diff --git a/wp-includes/version.php b/wp-includes/version.php index 0e09d6ba92..6172339037 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.3-beta3-56177'; +$wp_version = '6.3-beta3-56178'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.