WordPress.org

Make WordPress Core

Ticket #21134: 21134.patch

File 21134.patch, 12.0 KB (added by azaozz, 6 years ago)
  • wp-includes/class.wp-dependencies.php

     
    177177        function enqueue( $handles ) {
    178178                foreach ( (array) $handles as $handle ) {
    179179                        $handle = explode('?', $handle);
    180                         if ( !in_array($handle[0], $this->queue) && isset($this->registered[$handle[0]]) ) {
     180                        if ( !in_array($handle[0], $this->queue) ) {
    181181                                $this->queue[] = $handle[0];
    182182                                if ( isset($handle[1]) )
    183183                                        $this->args[$handle[0]] = $handle[1];
  • wp-includes/class.wp-scripts.php

     
    3131        var $default_dirs;
    3232
    3333        function __construct() {
    34                 $this->init();
    3534                add_action( 'init', array( $this, 'init' ), 0 );
    3635        }
    3736
  • wp-includes/script-loader.php

     
    6262        $scripts->add( 'utils', "/wp-admin/js/utils$suffix.js" );
    6363
    6464        $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
    65         did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
     65        $scripts->localize( 'common', 'commonL10n', array(
    6666                'warnDelete' => __("You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete.")
    6767        ) );
    6868
    6969        $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
    7070
    7171        $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
    72         did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array(
     72        $scripts->localize( 'quicktags', 'quicktagsL10n', array(
    7373                'wordLookup' => __('Enter a word to look up:'),
    7474                'dictionaryLookup' => esc_attr(__('Dictionary lookup')),
    7575                'lookup' => esc_attr(__('lookup')),
     
    9393        $scripts->add( 'prototype', '/wp-includes/js/prototype.js', array(), '1.6.1');
    9494
    9595        $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 );
    96         did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
     96        $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
    9797                'noPerm' => __('You do not have permission to do that.'),
    9898                'broken' => __('An unidentified error has occurred.')
    9999        ) );
    100100
    101101        $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
    102         did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
     102        $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
    103103                'dismiss' => __('Dismiss'),
    104104        ) );
    105105
     
    170170        $scripts->add( 'jquery-touch-punch', "/wp-includes/js/jquery/jquery.ui.touch-punch.js", array('jquery-ui-widget', 'jquery-ui-mouse'), '0.2.2', 1 );
    171171
    172172        $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20111117', 1 );
    173         did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
     173        $scripts->localize( 'thickbox', 'thickboxL10n', array(
    174174                        'next' => __('Next >'),
    175175                        'prev' => __('< Prev'),
    176176                        'image' => __('Image'),
     
    227227        $scripts->add( 'plupload-all', false, array('plupload', 'plupload-html5', 'plupload-flash', 'plupload-silverlight', 'plupload-html4'), '1.5.4' );
    228228
    229229        $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array('plupload-all', 'jquery') );
    230         did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
     230        $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
    231231
    232232        $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array('plupload-all', 'jquery', 'json2') );
    233         did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
     233        $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
    234234
    235235        // keep 'swfupload' for back-compat.
    236236        $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113');
     
    246246        }
    247247
    248248        $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524');
    249         did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
     249        $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
    250250
    251251        $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js" );
    252252
     
    255255        $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.8', 1 );
    256256
    257257        $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array('jquery'), false, 1 );
    258         did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
     258        $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
    259259                'empty' => __('Strength indicator'),
    260260                'short' => __('Very weak'),
    261261                'bad' => __('Weak'),
     
    272272        $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
    273273
    274274        $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wpdialogs' ), false, 1 );
    275         did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array(
     275        $scripts->localize( 'wplink', 'wpLinkL10n', array(
    276276                'title' => __('Insert/edit link'),
    277277                'update' => __('Update'),
    278278                'save' => __('Add Link'),
     
    285285        $scripts->add( 'wpdialogs-popup', "/wp-includes/js/tinymce/plugins/wpdialogs/js/popup$suffix.js", array( 'wpdialogs' ), false, 1 );
    286286
    287287        $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), false, 1 );
    288         did_action( 'init' ) && $scripts->localize( 'word-count', 'wordCountL10n', array(
     288        $scripts->localize( 'word-count', 'wordCountL10n', array(
    289289                /* translators: If your word count is based on single characters (East Asian characters),
    290290                   enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
    291291                'type' => 'characters' == _x( 'words', 'word count: words or characters?' ) ? 'c' : 'w',
     
    299299        $scripts->add( 'customize-loader',   "/wp-includes/js/customize-loader$suffix.js",   array( 'customize-base' ), false, 1 );
    300300        $scripts->add( 'customize-preview',  "/wp-includes/js/customize-preview$suffix.js",  array( 'customize-base' ), false, 1 );
    301301        $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base' ), false, 1 );
    302         did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
     302        $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
    303303                'activate'  => __( 'Save & Activate' ),
    304304                'save'      => __( 'Save & Publish' ),
    305305                'saved'     => __( 'Saved' ),
     
    311311        if ( is_admin() ) {
    312312                $scripts->add( 'ajaxcat', "/wp-admin/js/cat$suffix.js", array( 'wp-lists' ) );
    313313                $scripts->add_data( 'ajaxcat', 'group', 1 );
    314                 did_action( 'init' ) && $scripts->localize( 'ajaxcat', 'catL10n', array(
     314                $scripts->localize( 'ajaxcat', 'catL10n', array(
    315315                        'add' => esc_attr(__('Add')),
    316316                        'how' => __('Separate multiple categories with commas.')
    317317                ) );
     
    319319                $scripts->add( 'admin-categories', "/wp-admin/js/categories$suffix.js", array('wp-lists'), false, 1 );
    320320
    321321                $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array('jquery', 'wp-ajax-response'), false, 1 );
    322                 did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
     322                $scripts->localize( 'admin-tags', 'tagsl10n', array(
    323323                        'noPerm' => __('You do not have permission to do that.'),
    324324                        'broken' => __('An unidentified error has occurred.')
    325325                ));
     
    327327                $scripts->add( 'admin-custom-fields', "/wp-admin/js/custom-fields$suffix.js", array('wp-lists'), false, 1 );
    328328
    329329                $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
    330                 did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
     330                $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
    331331                        'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
    332332                        'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
    333333                        'replyApprove' => __( 'Approve and Reply' ),
     
    339339                $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
    340340
    341341                $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array('suggest', 'wp-lists', 'postbox'), false, 1 );
    342                 did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
     342                $scripts->localize( 'post', 'postL10n', array(
    343343                        'ok' => __('OK'),
    344344                        'cancel' => __('Cancel'),
    345345                        'publishOn' => __('Publish on:'),
     
    365365
    366366                $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array('jquery') );
    367367                $scripts->add_data( 'comment', 'group', 1 );
    368                 did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
     368                $scripts->localize( 'comment', 'commentL10n', array(
    369369                        'submittedOn' => __('Submitted on:')
    370370                ) );
    371371
     
    379379                $scripts->add( 'theme-preview', "/wp-admin/js/theme-preview$suffix.js", array( 'thickbox', 'jquery' ), false, 1 );
    380380
    381381                $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
    382                 did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
     382                $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
    383383                        'error' => __('Error while saving the changes.'),
    384384                        'ntdeltitle' => __('Remove From Bulk Edit'),
    385385                        'notitle' => __('(no title)'),
     
    387387                ) );
    388388
    389389                $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 );
    390                 did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
     390                $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
    391391                        'error' => __('Error while saving the changes.')
    392392                ) );
    393393
    394394                $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), false, 1 );
    395                 did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
     395                $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
    396396                        'plugin_information' => __('Plugin Information:'),
    397397                        'ays' => __('Are you sure you want to install this plugin?')
    398398                ) );
     
    406406                $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery-ui-draggable' ), false, 1 );
    407407
    408408                $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
    409                 did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
     409                $scripts->localize( 'image-edit', 'imageEditL10n', array(
    410410                        'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
    411411                ));
    412412
    413413                $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
    414                 did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
     414                $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
    415415                        'setThumbnail' => __( 'Use as featured image' ),
    416416                        'saving' => __( 'Saving...' ),
    417417                        'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
     
    420420
    421421                // Navigation Menus
    422422                $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array('jquery-ui-sortable') );
    423                 did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
     423                $scripts->localize( 'nav-menu', 'navMenuL10n', array(
    424424                        'noResultsFound' => _x('No results found.', 'search results'),
    425425                        'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
    426426                        'saveAlert' => __('The changes you made will be lost if you navigate away from this page.')