Make WordPress Core


Ignore:
Timestamp:
01/29/2020 12:43:23 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Docs: Improve inline comments per the documentation standards.

Includes minor code layout fixes for better readability.

See #48303.

File:
1 edited

Legend:

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

    r47106 r47122  
    5252        && false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $force_uncompressed;
    5353
    54     // Load tinymce.js when running from /src, otherwise load wp-tinymce.js.gz (in production) or
    55     // tinymce.min.js (when SCRIPT_DEBUG is true).
     54    // Load tinymce.js when running from /src, otherwise load wp-tinymce.js.gz (in production)
     55    // or tinymce.min.js (when SCRIPT_DEBUG is true).
    5656    if ( $compressed ) {
    5757        $scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.js', array(), $tinymce_version );
     
    199199            // Test presence of feature...
    200200            '( ' . $test . ' ) || ' .
    201             // ...appending polyfill on any failures. Cautious viewers may balk
    202             // at the `document.write`. Its caveat of synchronous mid-stream
    203             // blocking write is exactly the behavior we need though.
     201            /*
     202             * ...appending polyfill on any failures. Cautious viewers may balk
     203             * at the `document.write`. Its caveat of synchronous mid-stream
     204             * blocking write is exactly the behavior we need though.
     205             */
    204206            'document.write( \'<script src="' .
    205207            $src .
     
    594596
    595597    if ( $suffixes === null ) {
    596         include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
     598        // Include an unmodified $wp_version.
     599        include( ABSPATH . WPINC . '/version.php' );
    597600
    598601        $develop_src = false !== strpos( $wp_version, '-src' );
     
    796799    $scripts->add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );
    797800
    798     // not used in core, replaced by Jcrop.js
     801    // Not used in core, replaced by Jcrop.js.
    799802    $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
    800803
    801     // jQuery
     804    // jQuery.
    802805    $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4-wp' );
    803806    $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4-wp' );
    804807    $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
    805808
    806     // full jQuery UI
     809    // Full jQuery UI.
    807810    $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
    808811    $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
     
    845848    $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
    846849
    847     // Strings for 'jquery-ui-autocomplete' live region messages
     850    // Strings for 'jquery-ui-autocomplete' live region messages.
    848851    did_action( 'init' ) && $scripts->localize(
    849852        'jquery-ui-autocomplete',
     
    859862    );
    860863
    861     // deprecated, not used in core, most functionality is included in jQuery 1.3
     864    // Deprecated, not used in core, most functionality is included in jQuery 1.3.
    862865    $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.2.1', 1 );
    863866
    864     // jQuery plugins
     867    // jQuery plugins.
    865868    $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.min.js', array( 'jquery' ), '2.1.2', 1 );
    866869    $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array( 'jquery' ), '20m', 1 );
     
    943946    did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
    944947
    945     // keep 'swfupload' for back-compat.
     948    // Keep 'swfupload' for back-compat.
    946949    $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113' );
    947950    $scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
     
    11061109                        'singular' => _n( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.', 1 ),
    11071110                        /* translators: %d: Error count. */
    1108                         'plural'   => _n( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
     1111                        'plural'   => _n( 'There is %d error which must be fixed before you can update this file.', 'There are %d errors which must be fixed before you can update this file.', 2 ),
     1112                        // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    11091113                    ),
    11101114                )
     
    12331237            'autosaveNotice'          => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
    12341238            'videoHeaderNotice'       => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
    1235             // Used for overriding the file types allowed in plupload.
     1239            // Used for overriding the file types allowed in Plupload.
    12361240            'allowedFiles'            => __( 'Allowed Files' ),
    12371241            'customCssError'          => array(
     
    12391243                'singular' => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 1 ),
    12401244                /* translators: %d: Error count. */
    1241                 'plural'   => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
     1245                'plural'   => _n( 'There is %d error which must be fixed before you can save.', 'There are %d errors which must be fixed before you can save.', 2 ),
     1246                // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    12421247            ),
    12431248            'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
     
    12461251                'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
    12471252                /* translators: %s: Number of invalid settings. */
    1248                 'plural'   => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ), // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
     1253                'plural'   => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ),
     1254                // @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
    12491255            ),
    12501256            'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
     
    15251531                    'installFailed'            => __( 'Installation failed: %s' ),
    15261532                    /* translators: %s: Plugin name and version. */
    1527                     'pluginInstallingLabel'    => _x( 'Installing %s...', 'plugin' ), // no ellipsis
     1533                    'pluginInstallingLabel'    => _x( 'Installing %s...', 'plugin' ), // No ellipsis.
    15281534                    /* translators: %s: Theme name and version. */
    1529                     'themeInstallingLabel'     => _x( 'Installing %s...', 'theme' ), // no ellipsis
     1535                    'themeInstallingLabel'     => _x( 'Installing %s...', 'theme' ), // No ellipsis.
    15301536                    /* translators: %s: Plugin name and version. */
    15311537                    'pluginInstalledLabel'     => _x( '%s installed!', 'plugin' ),
     
    16171623            array(
    16181624                'setThumbnail' => __( 'Use as featured image' ),
    1619                 'saving'       => __( 'Saving...' ), // no ellipsis
     1625                'saving'       => __( 'Saving...' ), // No ellipsis.
    16201626                'error'        => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
    16211627                'done'         => __( 'Done' ),
     
    16631669 */
    16641670function wp_default_styles( &$styles ) {
    1665     include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
     1671    // Include an unmodified $wp_version.
     1672    include( ABSPATH . WPINC . '/version.php' );
    16661673
    16671674    if ( ! defined( 'SCRIPT_DEBUG' ) ) {
     
    17051712        }
    17061713
    1707         // Hotlink Open Sans, for now
     1714        // Hotlink Open Sans, for now.
    17081715        $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets&display=fallback";
    17091716    }
     
    17141721    $suffix = SCRIPT_DEBUG ? '' : '.min';
    17151722
    1716     // Admin CSS
     1723    // Admin CSS.
    17171724    $styles->add( 'common', "/wp-admin/css/common$suffix.css" );
    17181725    $styles->add( 'forms', "/wp-admin/css/forms$suffix.css" );
     
    17441751    $styles->add_data( 'ie', 'conditional', 'lte IE 7' );
    17451752
    1746     // Common dependencies
     1753    // Common dependencies.
    17471754    $styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" );
    17481755    $styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
    17491756
    1750     // Includes CSS
     1757    // Includes CSS.
    17511758    $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
    17521759    $styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
     
    17581765    $styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );
    17591766
    1760     // External libraries and friends
     1767    // External libraries and friends.
    17611768    $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
    17621769    $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
     
    17661773    $styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
    17671774
    1768     // Deprecated CSS
     1775    // Deprecated CSS.
    17691776    $styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
    17701777    $styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
    17711778    $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.css', array(), '0.9.12' );
    17721779    $styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
    1773     $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
    1774 
    1775     // Packages styles
     1780    $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6.
     1781
     1782    // Packages styles.
    17761783    $fonts_url = '';
    17771784
     
    18331840    }
    18341841
    1835     // RTL CSS
     1842    // RTL CSS.
    18361843    $rtl_styles = array(
    1837         // Admin CSS
     1844        // Admin CSS.
    18381845        'common',
    18391846        'forms',
     
    18591866        'login',
    18601867        'site-health',
    1861         // Includes CSS
     1868        // Includes CSS.
    18621869        'buttons',
    18631870        'admin-bar',
     
    18671874        'wp-pointer',
    18681875        'wp-jquery-ui-dialog',
    1869         // Package styles
     1876        // Package styles.
    18701877        'wp-block-library-theme',
    18711878        'wp-edit-blocks',
     
    18781885        'wp-list-reusable-blocks',
    18791886        'wp-nux',
    1880         // Deprecated CSS
     1887        // Deprecated CSS.
    18811888        'deprecated-media',
    18821889        'farbtastic',
     
    19921999            'm', // Month.
    19932000            'Y',
    1994             'y',            // Year.
     2001            'y', // Year.
    19952002        ),
    19962003        array(
     
    22512258        if ( ! empty( $wp_scripts->print_code ) ) {
    22522259            echo "\n<script{$type_attr}>\n";
    2253             echo "/* <![CDATA[ */\n"; // not needed in HTML 5
     2260            echo "/* <![CDATA[ */\n"; // Not needed in HTML 5.
    22542261            echo $wp_scripts->print_code;
    22552262            echo "/* ]]> */\n";
     
    22942301
    22952302    if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
    2296         return array(); // no need to run if nothing is queued
     2303        return array(); // No need to run if nothing is queued.
    22972304    }
    22982305    return print_head_scripts();
Note: See TracChangeset for help on using the changeset viewer.