Make WordPress Core


Ignore:
Timestamp:
07/10/2023 10:36:06 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].

Props costdev, audrasjb.
See #58459.

File:
1 edited

Legend:

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

    r56164 r56191  
    218218        $img_url_basename = wp_basename( $img_url );
    219219
    220         // If the file isn't an image, attempt to replace its URL with a rendered image from its meta.
    221         // Otherwise, a non-image type could be returned.
     220        /*
     221         * If the file isn't an image, attempt to replace its URL with a rendered image from its meta.
     222         * Otherwise, a non-image type could be returned.
     223         */
    222224        if ( ! $is_image ) {
    223225                if ( ! empty( $meta['sizes']['full'] ) ) {
     
    653655        }
    654656
    655         // The return array matches the parameters to imagecopyresampled().
    656         // int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
     657        /*
     658         * The return array matches the parameters to imagecopyresampled().
     659         * int dst_x, int dst_y, int src_x, int src_y, int dst_w, int dst_h, int src_w, int src_h
     660         */
    657661        return array( 0, 0, (int) $s_x, (int) $s_y, (int) $new_w, (int) $new_h, (int) $crop_w, (int) $crop_h );
    658662}
     
    10781082                }
    10791083
    1080                 // If the default value of `lazy` for the `loading` attribute is overridden
    1081                 // to omit the attribute for this image, ensure it is not included.
     1084                /*
     1085                 * If the default value of `lazy` for the `loading` attribute is overridden
     1086                 * to omit the attribute for this image, ensure it is not included.
     1087                 */
    10821088                if ( isset( $attr['loading'] ) && ! $attr['loading'] ) {
    10831089                        unset( $attr['loading'] );
     
    17601766 */
    17611767function wp_lazy_loading_enabled( $tag_name, $context ) {
    1762         // By default add to all 'img' and 'iframe' tags.
    1763         // See https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading
    1764         // See https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-loading
     1768        /*
     1769         * By default add to all 'img' and 'iframe' tags.
     1770         * See https://html.spec.whatwg.org/multipage/embedded-content.html#attr-img-loading
     1771         * See https://html.spec.whatwg.org/multipage/iframe-embed-object.html#attr-iframe-loading
     1772         */
    17651773        $default = ( 'img' === $tag_name || 'iframe' === $tag_name );
    17661774
     
    18261834
    18271835                                        if ( $attachment_id ) {
    1828                                                 // If exactly the same image tag is used more than once, overwrite it.
    1829                                                 // All identical tags will be replaced later with 'str_replace()'.
     1836                                                /*
     1837                                                 * If exactly the same image tag is used more than once, overwrite it.
     1838                                                 * All identical tags will be replaced later with 'str_replace()'.
     1839                                                 */
    18301840                                                $images[ $tag ] = $attachment_id;
    18311841                                                break;
     
    20412051 */
    20422052function wp_img_tag_add_decoding_attr( $image, $context ) {
    2043         // Only apply the decoding attribute to images that have a src attribute that
    2044         // starts with a double quote, ensuring escaped JSON is also excluded.
     2053        /*
     2054         * Only apply the decoding attribute to images that have a src attribute that
     2055         * starts with a double quote, ensuring escaped JSON is also excluded.
     2056         */
    20452057        if ( ! str_contains( $image, ' src="' ) ) {
    20462058                return $image;
     
    21592171 */
    21602172function wp_iframe_tag_add_loading_attr( $iframe, $context ) {
    2161         // Iframes with fallback content (see `wp_filter_oembed_result()`) should not be lazy-loaded because they are
    2162         // visually hidden initially.
     2173        /*
     2174         * Iframes with fallback content (see `wp_filter_oembed_result()`) should not be lazy-loaded because they are
     2175         * visually hidden initially.
     2176         */
    21632177        if ( str_contains( $iframe, ' data-secret="' ) ) {
    21642178                return $iframe;
    21652179        }
    21662180
    2167         // Get loading attribute value to use. This must occur before the conditional check below so that even iframes that
    2168         // are ineligible for being lazy-loaded are considered.
     2181        /*
     2182         * Get loading attribute value to use. This must occur before the conditional check below so that even iframes that
     2183         * are ineligible for being lazy-loaded are considered.
     2184         */
    21692185        $optimization_attrs = wp_get_loading_optimization_attributes(
    21702186                'iframe',
     
    35233539        }
    35243540
    3525         // MediaElement.js has issues with some URL formats for Vimeo and YouTube,
    3526         // so update the URL to prevent the ME.js player from breaking.
     3541        /*
     3542         * MediaElement.js has issues with some URL formats for Vimeo and YouTube,
     3543         * so update the URL to prevent the ME.js player from breaking.
     3544         */
    35273545        if ( 'mediaelement' === $library ) {
    35283546                if ( $is_youtube ) {
     
    39914009                $file_info = wp_check_filetype( $args['path'] );
    39924010
    3993                 // If $file_info['type'] is false, then we let the editor attempt to
    3994                 // figure out the file type, rather than forcing a failure based on extension.
     4011                /*
     4012                 * If $file_info['type'] is false, then we let the editor attempt to
     4013                 * figure out the file type, rather than forcing a failure based on extension.
     4014                 */
    39954015                if ( isset( $file_info ) && $file_info['type'] ) {
    39964016                        $args['mime_type'] = $file_info['type'];
     
    40894109                        ! call_user_func( array( $implementation, 'supports_mime_type' ), $args['output_mime_type'] )
    40904110                ) {
    4091                         // This implementation supports the imput type but not the output type.
    4092                         // Keep looking to see if we can find an implementation that supports both.
     4111                        /*
     4112                         * This implementation supports the imput type but not the output type.
     4113                         * Keep looking to see if we can find an implementation that supports both.
     4114                         */
    40934115                        $supports_input = $implementation;
    40944116                        continue;
     
    43834405                                $size_meta = $meta['sizes'][ $size ];
    43844406
    4385                                 // We have the actual image size, but might need to further constrain it if content_width is narrower.
    4386                                 // Thumbnail, medium, and full sizes are also checked against the site's height/width options.
     4407                                /*
     4408                                 * We have the actual image size, but might need to further constrain it if content_width is narrower.
     4409                                 * Thumbnail, medium, and full sizes are also checked against the site's height/width options.
     4410                                 */
    43874411                                list( $width, $height ) = image_constrain_size_for_editor( $size_meta['width'], $size_meta['height'], $size, 'edit' );
    43884412
     
    45144538        $args     = wp_parse_args( $args, $defaults );
    45154539
    4516         // We're going to pass the old thickbox media tabs to `media_upload_tabs`
    4517         // to ensure plugins will work. We will then unset those tabs.
     4540        /*
     4541         * We're going to pass the old thickbox media tabs to `media_upload_tabs`
     4542         * to ensure plugins will work. We will then unset those tabs.
     4543         */
    45184544        $tabs = array(
    45194545                // handler action suffix => tab label
     
    48594885        $strings['settings'] = $settings;
    48604886
    4861         // Ensure we enqueue media-editor first, that way media-views
    4862         // is registered internally before we try to localize it. See #24724.
     4887        /*
     4888         * Ensure we enqueue media-editor first, that way media-views
     4889         * is registered internally before we try to localize it. See #24724.
     4890         */
    48634891        wp_enqueue_script( 'media-editor' );
    48644892        wp_localize_script( 'media-views', '_wpMediaViewsL10n', $strings );
     
    54555483        }
    54565484
    5457         // For PHP versions that don't support WebP images,
    5458         // extract the image size info from the file headers.
     5485        /*
     5486         * For PHP versions that don't support WebP images,
     5487         * extract the image size info from the file headers.
     5488         */
    54595489        if ( 'image/webp' === wp_get_image_mime( $filename ) ) {
    54605490                $webp_info = wp_get_webp_info( $filename );
     
    55175547        }
    55185548
    5519         // The headers are a little different for each of the three formats.
    5520         // Header values based on WebP docs, see https://developers.google.com/speed/webp/docs/riff_container.
     5549        /*
     5550         * The headers are a little different for each of the three formats.
     5551         * Header values based on WebP docs, see https://developers.google.com/speed/webp/docs/riff_container.
     5552         */
    55215553        switch ( substr( $magic, 12, 4 ) ) {
    55225554                // Lossy WebP.
Note: See TracChangeset for help on using the changeset viewer.