Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (9 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r38810 r42343  
    3939        }
    4040
    41         _doing_it_wrong( $function, sprintf(
    42                 /* translators: 1: wp_enqueue_scripts, 2: admin_enqueue_scripts, 3: login_enqueue_scripts */
    43                 __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
    44                 '<code>wp_enqueue_scripts</code>',
    45                 '<code>admin_enqueue_scripts</code>',
    46                 '<code>login_enqueue_scripts</code>'
    47         ), '3.3.0' );
     41        _doing_it_wrong(
     42                $function, sprintf(
     43                        /* translators: 1: wp_enqueue_scripts, 2: admin_enqueue_scripts, 3: login_enqueue_scripts */
     44                        __( 'Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.' ),
     45                        '<code>wp_enqueue_scripts</code>',
     46                        '<code>admin_enqueue_scripts</code>',
     47                        '<code>login_enqueue_scripts</code>'
     48                ), '3.3.0'
     49        );
    4850}
    4951
     
    109111
    110112        if ( false !== stripos( $data, '</script>' ) ) {
    111                 _doing_it_wrong( __FUNCTION__, sprintf(
    112                         /* translators: 1: <script>, 2: wp_add_inline_script() */
    113                         __( 'Do not pass %1$s tags to %2$s.' ),
    114                         '<code>&lt;script&gt;</code>',
    115                         '<code>wp_add_inline_script()</code>'
    116                 ), '4.5.0' );
     113                _doing_it_wrong(
     114                        __FUNCTION__, sprintf(
     115                                /* translators: 1: <script>, 2: wp_add_inline_script() */
     116                                __( 'Do not pass %1$s tags to %2$s.' ),
     117                                '<code>&lt;script&gt;</code>',
     118                                '<code>wp_add_inline_script()</code>'
     119                        ), '4.5.0'
     120                );
    117121                $data = trim( preg_replace( '#<script[^>]*>(.*)</script>#is', '$1', $data ) );
    118122        }
     
    168172 *     }
    169173 *
    170  *
    171174 * @see WP_Dependencies::localize()
    172175 * @link https://core.trac.wordpress.org/ticket/11520
     
    217220        ) {
    218221                $no = array(
    219                         'jquery', 'jquery-core', 'jquery-migrate', 'jquery-ui-core', 'jquery-ui-accordion',
    220                         'jquery-ui-autocomplete', 'jquery-ui-button', 'jquery-ui-datepicker', 'jquery-ui-dialog',
    221                         'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-menu', 'jquery-ui-mouse',
    222                         'jquery-ui-position', 'jquery-ui-progressbar', 'jquery-ui-resizable', 'jquery-ui-selectable',
    223                         'jquery-ui-slider', 'jquery-ui-sortable', 'jquery-ui-spinner', 'jquery-ui-tabs',
    224                         'jquery-ui-tooltip', 'jquery-ui-widget', 'underscore', 'backbone',
     222                        'jquery',
     223                        'jquery-core',
     224                        'jquery-migrate',
     225                        'jquery-ui-core',
     226                        'jquery-ui-accordion',
     227                        'jquery-ui-autocomplete',
     228                        'jquery-ui-button',
     229                        'jquery-ui-datepicker',
     230                        'jquery-ui-dialog',
     231                        'jquery-ui-draggable',
     232                        'jquery-ui-droppable',
     233                        'jquery-ui-menu',
     234                        'jquery-ui-mouse',
     235                        'jquery-ui-position',
     236                        'jquery-ui-progressbar',
     237                        'jquery-ui-resizable',
     238                        'jquery-ui-selectable',
     239                        'jquery-ui-slider',
     240                        'jquery-ui-sortable',
     241                        'jquery-ui-spinner',
     242                        'jquery-ui-tabs',
     243                        'jquery-ui-tooltip',
     244                        'jquery-ui-widget',
     245                        'underscore',
     246                        'backbone',
    225247                );
    226248
     
    267289        _wp_scripts_maybe_doing_it_wrong( __FUNCTION__ );
    268290
    269 
    270291        if ( $src || $in_footer ) {
    271292                $_handle = explode( '?', $handle );
     
    332353 * @return bool True on success, false on failure.
    333354 */
    334 function wp_script_add_data( $handle, $key, $value ){
     355function wp_script_add_data( $handle, $key, $value ) {
    335356        return wp_scripts()->add_data( $handle, $key, $value );
    336357}
Note: See TracChangeset for help on using the changeset viewer.