Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (7 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/script-loader.php

    r42251 r42343  
    5757    if ( ! $guessurl = site_url() ) {
    5858        $guessed_url = true;
    59         $guessurl = wp_guess_url();
    60     }
    61 
    62     $scripts->base_url = $guessurl;
    63     $scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
     59        $guessurl    = wp_guess_url();
     60    }
     61
     62    $scripts->base_url        = $guessurl;
     63    $scripts->content_url     = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : '';
    6464    $scripts->default_version = get_bloginfo( 'version' );
    65     $scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/');
    66 
    67     $suffix = SCRIPT_DEBUG ? '' : '.min';
     65    $scripts->default_dirs    = array( '/wp-admin/js/', '/wp-includes/js/' );
     66
     67    $suffix     = SCRIPT_DEBUG ? '' : '.min';
    6868    $dev_suffix = $develop_src ? '' : '.min';
    6969
    7070    $scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
    71     did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array(
    72         'url' => (string) SITECOOKIEPATH,
    73         'uid' => (string) get_current_user_id(),
    74         'time' => (string) time(),
    75         'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
    76     ) );
    77 
    78     $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
    79     did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
    80         'warnDelete'   => __( "You are about to permanently delete these items from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ),
    81         'dismiss'      => __( 'Dismiss this notice.' ),
    82         'collapseMenu' => __( 'Collapse Main menu' ),
    83         'expandMenu'   => __( 'Expand Main menu' ),
    84     ) );
     71    did_action( 'init' ) && $scripts->localize(
     72        'utils', 'userSettings', array(
     73            'url'    => (string) SITECOOKIEPATH,
     74            'uid'    => (string) get_current_user_id(),
     75            'time'   => (string) time(),
     76            'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
     77        )
     78    );
     79
     80    $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils' ), false, 1 );
     81    did_action( 'init' ) && $scripts->localize(
     82        'common', 'commonL10n', array(
     83            'warnDelete'   => __( "You are about to permanently delete these items from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ),
     84            'dismiss'      => __( 'Dismiss this notice.' ),
     85            'collapseMenu' => __( 'Collapse Main menu' ),
     86            'expandMenu'   => __( 'Expand Main menu' ),
     87        )
     88    );
    8589
    8690    $scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );
     
    8993
    9094    $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
    91     did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array(
    92         'closeAllOpenTags'      => __( 'Close all open tags' ),
    93         'closeTags'             => __( 'close tags' ),
    94         'enterURL'              => __( 'Enter the URL' ),
    95         'enterImageURL'         => __( 'Enter the URL of the image' ),
    96         'enterImageDescription' => __( 'Enter a description of the image' ),
    97         'textdirection'         => __( 'text direction' ),
    98         'toggleTextdirection'   => __( 'Toggle Editor Text Direction' ),
    99         'dfw'                   => __( 'Distraction-free writing mode' ),
    100         'strong'          => __( 'Bold' ),
    101         'strongClose'     => __( 'Close bold tag' ),
    102         'em'              => __( 'Italic' ),
    103         'emClose'         => __( 'Close italic tag' ),
    104         'link'            => __( 'Insert link' ),
    105         'blockquote'      => __( 'Blockquote' ),
    106         'blockquoteClose' => __( 'Close blockquote tag' ),
    107         'del'             => __( 'Deleted text (strikethrough)' ),
    108         'delClose'        => __( 'Close deleted text tag' ),
    109         'ins'             => __( 'Inserted text' ),
    110         'insClose'        => __( 'Close inserted text tag' ),
    111         'image'           => __( 'Insert image' ),
    112         'ul'              => __( 'Bulleted list' ),
    113         'ulClose'         => __( 'Close bulleted list tag' ),
    114         'ol'              => __( 'Numbered list' ),
    115         'olClose'         => __( 'Close numbered list tag' ),
    116         'li'              => __( 'List item' ),
    117         'liClose'         => __( 'Close list item tag' ),
    118         'code'            => __( 'Code' ),
    119         'codeClose'       => __( 'Close code tag' ),
    120         'more'            => __( 'Insert Read More tag' ),
    121     ) );
    122 
    123     $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
    124 
    125     $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), false, 1 );
     95    did_action( 'init' ) && $scripts->localize(
     96        'quicktags', 'quicktagsL10n', array(
     97            'closeAllOpenTags'      => __( 'Close all open tags' ),
     98            'closeTags'             => __( 'close tags' ),
     99            'enterURL'              => __( 'Enter the URL' ),
     100            'enterImageURL'         => __( 'Enter the URL of the image' ),
     101            'enterImageDescription' => __( 'Enter a description of the image' ),
     102            'textdirection'         => __( 'text direction' ),
     103            'toggleTextdirection'   => __( 'Toggle Editor Text Direction' ),
     104            'dfw'                   => __( 'Distraction-free writing mode' ),
     105            'strong'                => __( 'Bold' ),
     106            'strongClose'           => __( 'Close bold tag' ),
     107            'em'                    => __( 'Italic' ),
     108            'emClose'               => __( 'Close italic tag' ),
     109            'link'                  => __( 'Insert link' ),
     110            'blockquote'            => __( 'Blockquote' ),
     111            'blockquoteClose'       => __( 'Close blockquote tag' ),
     112            'del'                   => __( 'Deleted text (strikethrough)' ),
     113            'delClose'              => __( 'Close deleted text tag' ),
     114            'ins'                   => __( 'Inserted text' ),
     115            'insClose'              => __( 'Close inserted text tag' ),
     116            'image'                 => __( 'Insert image' ),
     117            'ul'                    => __( 'Bulleted list' ),
     118            'ulClose'               => __( 'Close bulleted list tag' ),
     119            'ol'                    => __( 'Numbered list' ),
     120            'olClose'               => __( 'Close numbered list tag' ),
     121            'li'                    => __( 'List item' ),
     122            'liClose'               => __( 'Close list item tag' ),
     123            'code'                  => __( 'Code' ),
     124            'codeClose'             => __( 'Close code tag' ),
     125            'more'                  => __( 'Insert Read More tag' ),
     126        )
     127    );
     128
     129    $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array( 'prototype' ), '3517m' );
     130
     131    $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array( 'utils', 'jquery' ), false, 1 );
    126132
    127133    // Back-compat for old DFW. To-do: remove at the end of 2016.
    128134    $scripts->add( 'wp-fullscreen-stub', "/wp-admin/js/wp-fullscreen-stub$suffix.js", array(), false, 1 );
    129135
    130     $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 );
    131     did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
    132         'noPerm' => __('Sorry, you are not allowed to do that.'),
    133         'broken' => __('An unidentified error has occurred.')
    134     ) );
     136    $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array( 'jquery' ), false, 1 );
     137    did_action( 'init' ) && $scripts->localize(
     138        'wp-ajax-response', 'wpAjax', array(
     139            'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
     140            'broken' => __( 'An unidentified error has occurred.' ),
     141        )
     142    );
    135143
    136144    $scripts->add( 'wp-api-request', "/wp-includes/js/api-request$suffix.js", array( 'jquery' ), false, 1 );
    137145    // `wpApiSettings` is also used by `wp-api`, which depends on this script.
    138     did_action( 'init' ) && $scripts->localize( 'wp-api-request', 'wpApiSettings', array(
    139         'root'          => esc_url_raw( get_rest_url() ),
    140         'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
    141         'versionString' => 'wp/v2/',
    142     ) );
     146    did_action( 'init' ) && $scripts->localize(
     147        'wp-api-request', 'wpApiSettings', array(
     148            'root'          => esc_url_raw( get_rest_url() ),
     149            'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
     150            'versionString' => 'wp/v2/',
     151        )
     152    );
    143153
    144154    $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
    145     did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
    146         'dismiss' => __('Dismiss'),
    147     ) );
    148 
    149     $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 );
    150 
    151     $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 );
    152     did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',
     155    did_action( 'init' ) && $scripts->localize(
     156        'wp-pointer', 'wpPointerL10n', array(
     157            'dismiss' => __( 'Dismiss' ),
     158        )
     159    );
     160
     161    $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
     162
     163    $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array( 'jquery' ), false, 1 );
     164    did_action( 'init' ) && $scripts->localize(
     165        'heartbeat', 'heartbeatSettings',
    153166        /**
    154167         * Filters the Heartbeat settings.
     
    161174    );
    162175
    163     $scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 );
    164     did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array(
    165         'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
    166 
    167         /**
    168          * Filters the authentication check interval.
    169          *
    170          * @since 3.6.0
    171          *
    172          * @param int $interval The interval in which to check a user's authentication.
    173          *                      Default 3 minutes in seconds, or 180.
    174          */
    175         'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
    176     ) );
     176    $scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array( 'heartbeat' ), false, 1 );
     177    did_action( 'init' ) && $scripts->localize(
     178        'wp-auth-check', 'authcheckL10n', array(
     179            'beforeunload' => __( 'Your session has expired. You can log in again from this page or go to the login page.' ),
     180
     181            /**
     182             * Filters the authentication check interval.
     183             *
     184             * @since 3.6.0
     185             *
     186             * @param int $interval The interval in which to check a user's authentication.
     187             *                      Default 3 minutes in seconds, or 180.
     188             */
     189            'interval'     => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
     190        )
     191    );
    177192
    178193    $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
    179194
    180195    // WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
    181     $scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
    182     $scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
    183     $scripts->add( 'scriptaculous-builder', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');
    184     $scripts->add( 'scriptaculous-dragdrop', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
    185     $scripts->add( 'scriptaculous-effects', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');
    186     $scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');
     196    $scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1' );
     197    $scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array( 'prototype' ), '1.9.0' );
     198    $scripts->add( 'scriptaculous-builder', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array( 'scriptaculous-root' ), '1.9.0' );
     199    $scripts->add( 'scriptaculous-dragdrop', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array( 'scriptaculous-builder', 'scriptaculous-effects' ), '1.9.0' );
     200    $scripts->add( 'scriptaculous-effects', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array( 'scriptaculous-root' ), '1.9.0' );
     201    $scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array( 'scriptaculous-effects' ), '1.9.0' );
    187202    $scripts->add( 'scriptaculous-sound', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
    188     $scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');
    189     $scripts->add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') );
     203    $scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array( 'scriptaculous-root' ), '1.9.0' );
     204    $scripts->add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );
    190205
    191206    // not used in core, replaced by Jcrop.js
    192     $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') );
     207    $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
    193208
    194209    // jQuery
     
    198213
    199214    // full jQuery UI
    200     $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array('jquery'), '1.11.4', 1 );
    201     $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array('jquery'), '1.11.4', 1 );
    202 
    203     $scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    204     $scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    205     $scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    206     $scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    207     $scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    208     $scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    209     $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    210     $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    211     $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-scale'), '1.11.4', 1 );
    212     $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    213     $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-size'), '1.11.4', 1 );
    214     $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    215     $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    216     $scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    217     $scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
    218 
    219     $scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
     215    $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
     216    $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
     217
     218    $scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     219    $scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     220    $scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     221    $scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     222    $scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     223    $scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     224    $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     225    $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     226    $scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.11.4', 1 );
     227    $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     228    $scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.11.4', 1 );
     229    $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     230    $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     231    $scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     232    $scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
     233
     234    $scripts->add( 'jquery-ui-accordion', "/wp-includes/js/jquery/ui/accordion$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    220235    $scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 );
    221     $scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
    222     $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array('jquery-ui-core'), '1.11.4', 1 );
    223     $scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array('jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position'), '1.11.4', 1 );
    224     $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
    225     $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array('jquery-ui-draggable'), '1.11.4', 1 );
     236    $scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
     237    $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array( 'jquery-ui-core' ), '1.11.4', 1 );
     238    $scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position' ), '1.11.4', 1 );
     239    $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
     240    $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array( 'jquery-ui-draggable' ), '1.11.4', 1 );
    226241    $scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
    227242    $scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    228     $scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array('jquery'), '1.11.4', 1 );
    229     $scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
    230     $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
    231     $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
    232     $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array('jquery-ui-menu'), '1.11.4', 1 );
    233     $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
    234     $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
     243    $scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
     244    $scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
     245    $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
     246    $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
     247    $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array( 'jquery-ui-menu' ), '1.11.4', 1 );
     248    $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
     249    $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
    235250    $scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 );
    236     $scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
     251    $scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
    237252    $scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
    238     $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '1.11.4', 1 );
     253    $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
    239254
    240255    // Strings for 'jquery-ui-autocomplete' live region messages
    241     did_action( 'init' ) && $scripts->localize( 'jquery-ui-autocomplete', 'uiAutocompleteL10n', array(
    242         'noResults' => __( 'No results found.' ),
    243         /* translators: Number of results found when using jQuery UI Autocomplete */
    244         'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),
    245         /* translators: %d: Number of results found when using jQuery UI Autocomplete */
    246         'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
    247         'itemSelected' => __( 'Item selected.' ),
    248     ) );
     256    did_action( 'init' ) && $scripts->localize(
     257        'jquery-ui-autocomplete', 'uiAutocompleteL10n', array(
     258            'noResults'    => __( 'No results found.' ),
     259            /* translators: Number of results found when using jQuery UI Autocomplete */
     260            'oneResult'    => __( '1 result found. Use up and down arrow keys to navigate.' ),
     261            /* translators: %d: Number of results found when using jQuery UI Autocomplete */
     262            'manyResults'  => __( '%d results found. Use up and down arrow keys to navigate.' ),
     263            'itemSelected' => __( 'Item selected.' ),
     264        )
     265    );
    249266
    250267    // deprecated, not used in core, most functionality is included in jQuery 1.3
    251     $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '4.2.1', 1 );
     268    $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.2.1', 1 );
    252269
    253270    // jQuery plugins
    254     $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 );
    255     $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
    256     $scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
    257     $scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2', 1 );
    258     $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m', 1 );
    259     $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 );
    260     $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 );
     271    $scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.min.js', array( 'jquery' ), '2.1.1', 1 );
     272    $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array( 'jquery' ), '20m', 1 );
     273    $scripts->add( 'jquery-query', '/wp-includes/js/jquery/jquery.query.js', array( 'jquery' ), '2.1.7', 1 );
     274    $scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2', 1 );
     275    $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 );
     276    $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 );
     277    $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 );
    261278
    262279    // Not used any more, registered for backwards compatibility.
    263     $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
     280    $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 );
    264281
    265282    // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
    266283    // It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
    267     $scripts->add( 'imagesloaded', "/wp-includes/js/imagesloaded.min.js", array(), '3.2.0', 1 );
    268     $scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array( 'imagesloaded' ), '3.3.2', 1 );
     284    $scripts->add( 'imagesloaded', '/wp-includes/js/imagesloaded.min.js', array(), '3.2.0', 1 );
     285    $scripts->add( 'masonry', '/wp-includes/js/masonry.min.js', array( 'imagesloaded' ), '3.3.2', 1 );
    269286    $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 );
    270287
    271     $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
    272     did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
    273         'next' => __('Next >'),
    274         'prev' => __('< Prev'),
    275         'image' => __('Image'),
    276         'of' => __('of'),
    277         'close' => __('Close'),
    278         'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
    279         'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
    280     ) );
    281 
    282     $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12');
    283 
    284     $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417');
     288    $scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array( 'jquery' ), '3.1-20121105', 1 );
     289    did_action( 'init' ) && $scripts->localize(
     290        'thickbox', 'thickboxL10n', array(
     291            'next'             => __( 'Next >' ),
     292            'prev'             => __( '< Prev' ),
     293            'image'            => __( 'Image' ),
     294            'of'               => __( 'of' ),
     295            'close'            => __( 'Close' ),
     296            'noiframes'        => __( 'This feature requires inline frames. You have iframes disabled or your browser does not support them.' ),
     297            'loadingAnimation' => includes_url( 'js/thickbox/loadingAnimation.gif' ),
     298        )
     299    );
     300
     301    $scripts->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.js', array( 'jquery' ), '0.9.12' );
     302
     303    $scripts->add( 'swfobject', '/wp-includes/js/swfobject.js', array(), '2.2-20120417' );
    285304
    286305    // Error messages for Plupload.
    287306    $uploader_l10n = array(
    288         'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
    289         'file_exceeds_size_limit' => __('%s exceeds the maximum upload size for this site.'),
    290         'zero_byte_file' => __('This file is empty. Please try another.'),
    291         'invalid_filetype' => __('Sorry, this file type is not permitted for security reasons.'),
    292         'not_an_image' => __('This file is not an image. Please try another.'),
    293         'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
    294         'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),
    295         'default_error' => __('An error occurred in the upload. Please try again later.'),
    296         'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
    297         'upload_limit_exceeded' => __('You may only upload 1 file.'),
    298         'http_error' => __('HTTP error.'),
    299         'upload_failed' => __('Upload failed.'),
     307        'queue_limit_exceeded'      => __( 'You have attempted to queue too many files.' ),
     308        'file_exceeds_size_limit'   => __( '%s exceeds the maximum upload size for this site.' ),
     309        'zero_byte_file'            => __( 'This file is empty. Please try another.' ),
     310        'invalid_filetype'          => __( 'Sorry, this file type is not permitted for security reasons.' ),
     311        'not_an_image'              => __( 'This file is not an image. Please try another.' ),
     312        'image_memory_exceeded'     => __( 'Memory exceeded. Please try another smaller file.' ),
     313        'image_dimensions_exceeded' => __( 'This is larger than the maximum size. Please try another.' ),
     314        'default_error'             => __( 'An error occurred in the upload. Please try again later.' ),
     315        'missing_upload_url'        => __( 'There was a configuration error. Please contact the server administrator.' ),
     316        'upload_limit_exceeded'     => __( 'You may only upload 1 file.' ),
     317        'http_error'                => __( 'HTTP error.' ),
     318        'upload_failed'             => __( 'Upload failed.' ),
    300319        /* translators: 1: Opening link tag, 2: Closing link tag */
    301         'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.'),
    302         'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.'),
    303         'io_error' => __('IO error.'),
    304         'security_error' => __('Security error.'),
    305         'file_cancelled' => __('File canceled.'),
    306         'upload_stopped' => __('Upload stopped.'),
    307         'dismiss' => __('Dismiss'),
    308         'crunching' => __('Crunching…'),
    309         'deleted' => __('moved to the trash.'),
    310         'error_uploading' => __('“%s” has failed to upload.')
     320        'big_upload_failed'         => __( 'Please try uploading this file with the %1$sbrowser uploader%2$s.' ),
     321        'big_upload_queued'         => __( '%s exceeds the maximum upload size for the multi-file uploader when used in your browser.' ),
     322        'io_error'                  => __( 'IO error.' ),
     323        'security_error'            => __( 'Security error.' ),
     324        'file_cancelled'            => __( 'File canceled.' ),
     325        'upload_stopped'            => __( 'Upload stopped.' ),
     326        'dismiss'                   => __( 'Dismiss' ),
     327        'crunching'                 => __( 'Crunching…' ),
     328        'deleted'                   => __( 'moved to the trash.' ),
     329        'error_uploading'           => __( '“%s” has failed to upload.' ),
    311330    );
    312331
     
    325344
    326345    // keep 'swfupload' for back-compat.
    327     $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113');
     346    $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113' );
    328347    $scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
    329     $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524');
     348    $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array( 'swfupload-all', 'jquery' ), '2201-20110524' );
    330349    did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
    331350
     
    336355
    337356    $scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 );
    338     $scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore','jquery' ), '1.2.3', 1 );
    339 
    340     $scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 );
    341     did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array(
    342         'ajax' => array(
    343             'url' => admin_url( 'admin-ajax.php', 'relative' ),
    344         ),
    345     ) );
    346 
    347     $scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array('jquery'), false, 1 );
    348 
    349     $scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 );
     357    $scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.2.3', 1 );
     358
     359    $scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array( 'underscore', 'jquery' ), false, 1 );
     360    did_action( 'init' ) && $scripts->localize(
     361        'wp-util', '_wpUtilSettings', array(
     362            'ajax' => array(
     363                'url' => admin_url( 'admin-ajax.php', 'relative' ),
     364            ),
     365        )
     366    );
     367
     368    $scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array( 'jquery' ), false, 1 );
     369
     370    $scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array( 'backbone', 'wp-util' ), false, 1 );
    350371
    351372    $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
    352373
    353     $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1 );
     374    $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array( 'jquery' ), false, 1 );
    354375
    355376    $scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.6-78496d1' );
    356377    $scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.6-78496d1', 1 );
    357     $scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1);
    358 
    359     did_action( 'init' ) && $scripts->add_inline_script( 'mediaelement-core', sprintf( 'var mejsL10n = %s;', wp_json_encode( array(
    360         'language' => strtolower( strtok( is_admin() ? get_user_locale() : get_locale(), '_-' ) ),
    361         'strings'  => array(
    362             'mejs.install-flash'       => __( 'You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/' ),
    363             'mejs.fullscreen-off'      => __( 'Turn off Fullscreen' ),
    364             'mejs.fullscreen-on'       => __( 'Go Fullscreen' ),
    365             'mejs.download-video'      => __( 'Download Video' ),
    366             'mejs.fullscreen'          => __( 'Fullscreen' ),
    367             'mejs.time-jump-forward'   => array( __( 'Jump forward 1 second' ), __( 'Jump forward %1 seconds' ) ),
    368             'mejs.loop'                => __( 'Toggle Loop' ),
    369             'mejs.play'                => __( 'Play' ),
    370             'mejs.pause'               => __( 'Pause' ),
    371             'mejs.close'               => __( 'Close' ),
    372             'mejs.time-slider'         => __( 'Time Slider' ),
    373             'mejs.time-help-text'      => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
    374             'mejs.time-skip-back'      => array( __( 'Skip back 1 second' ), __( 'Skip back %1 seconds' ) ),
    375             'mejs.captions-subtitles'  => __( 'Captions/Subtitles' ),
    376             'mejs.captions-chapters'   => __( 'Chapters' ),
    377             'mejs.none'                => __( 'None' ),
    378             'mejs.mute-toggle'         => __( 'Mute Toggle' ),
    379             'mejs.volume-help-text'    => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
    380             'mejs.unmute'              => __( 'Unmute' ),
    381             'mejs.mute'                => __( 'Mute' ),
    382             'mejs.volume-slider'       => __( 'Volume Slider' ),
    383             'mejs.video-player'        => __( 'Video Player' ),
    384             'mejs.audio-player'        => __( 'Audio Player' ),
    385             'mejs.ad-skip'             => __( 'Skip ad' ),
    386             'mejs.ad-skip-info'        => array( __( 'Skip in 1 second' ), __( 'Skip in %1 seconds' ) ),
    387             'mejs.source-chooser'      => __( 'Source Chooser' ),
    388             'mejs.stop'                => __( 'Stop' ),
    389             'mejs.speed-rate'          => __( 'Speed Rate' ),
    390             'mejs.live-broadcast'      => __( 'Live Broadcast' ),
    391             'mejs.afrikaans'           => __( 'Afrikaans' ),
    392             'mejs.albanian'            => __( 'Albanian' ),
    393             'mejs.arabic'              => __( 'Arabic' ),
    394             'mejs.belarusian'          => __( 'Belarusian' ),
    395             'mejs.bulgarian'           => __( 'Bulgarian' ),
    396             'mejs.catalan'             => __( 'Catalan' ),
    397             'mejs.chinese'             => __( 'Chinese' ),
    398             'mejs.chinese-simplified'  => __( 'Chinese (Simplified)' ),
    399             'mejs.chinese-traditional' => __( 'Chinese (Traditional)' ),
    400             'mejs.croatian'            => __( 'Croatian' ),
    401             'mejs.czech'               => __( 'Czech' ),
    402             'mejs.danish'              => __( 'Danish' ),
    403             'mejs.dutch'               => __( 'Dutch' ),
    404             'mejs.english'             => __( 'English' ),
    405             'mejs.estonian'            => __( 'Estonian' ),
    406             'mejs.filipino'            => __( 'Filipino' ),
    407             'mejs.finnish'             => __( 'Finnish' ),
    408             'mejs.french'              => __( 'French' ),
    409             'mejs.galician'            => __( 'Galician' ),
    410             'mejs.german'              => __( 'German' ),
    411             'mejs.greek'               => __( 'Greek' ),
    412             'mejs.haitian-creole'      => __( 'Haitian Creole' ),
    413             'mejs.hebrew'              => __( 'Hebrew' ),
    414             'mejs.hindi'               => __( 'Hindi' ),
    415             'mejs.hungarian'           => __( 'Hungarian' ),
    416             'mejs.icelandic'           => __( 'Icelandic' ),
    417             'mejs.indonesian'          => __( 'Indonesian' ),
    418             'mejs.irish'               => __( 'Irish' ),
    419             'mejs.italian'             => __( 'Italian' ),
    420             'mejs.japanese'            => __( 'Japanese' ),
    421             'mejs.korean'              => __( 'Korean' ),
    422             'mejs.latvian'             => __( 'Latvian' ),
    423             'mejs.lithuanian'          => __( 'Lithuanian' ),
    424             'mejs.macedonian'          => __( 'Macedonian' ),
    425             'mejs.malay'               => __( 'Malay' ),
    426             'mejs.maltese'             => __( 'Maltese' ),
    427             'mejs.norwegian'           => __( 'Norwegian' ),
    428             'mejs.persian'             => __( 'Persian' ),
    429             'mejs.polish'              => __( 'Polish' ),
    430             'mejs.portuguese'          => __( 'Portuguese' ),
    431             'mejs.romanian'            => __( 'Romanian' ),
    432             'mejs.russian'             => __( 'Russian' ),
    433             'mejs.serbian'             => __( 'Serbian' ),
    434             'mejs.slovak'              => __( 'Slovak' ),
    435             'mejs.slovenian'           => __( 'Slovenian' ),
    436             'mejs.spanish'             => __( 'Spanish' ),
    437             'mejs.swahili'             => __( 'Swahili' ),
    438             'mejs.swedish'             => __( 'Swedish' ),
    439             'mejs.tagalog'             => __( 'Tagalog' ),
    440             'mejs.thai'                => __( 'Thai' ),
    441             'mejs.turkish'             => __( 'Turkish' ),
    442             'mejs.ukrainian'           => __( 'Ukrainian' ),
    443             'mejs.vietnamese'          => __( 'Vietnamese' ),
    444             'mejs.welsh'               => __( 'Welsh' ),
    445             'mejs.yiddish'             => __( 'Yiddish' ),
    446             ),
    447         ) ) ), 'before' );
    448 
    449 
    450     $scripts->add( 'mediaelement-vimeo', "/wp-includes/js/mediaelement/renderers/vimeo.min.js", array('mediaelement'), '4.2.6-78496d1', 1 );
    451     $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array('mediaelement'), false, 1 );
     378    $scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 );
     379
     380    did_action( 'init' ) && $scripts->add_inline_script(
     381        'mediaelement-core', sprintf(
     382            'var mejsL10n = %s;', wp_json_encode(
     383                array(
     384                    'language' => strtolower( strtok( is_admin() ? get_user_locale() : get_locale(), '_-' ) ),
     385                    'strings'  => array(
     386                        'mejs.install-flash'       => __( 'You are using a browser that does not have Flash player enabled or installed. Please turn on your Flash player plugin or download the latest version from https://get.adobe.com/flashplayer/' ),
     387                        'mejs.fullscreen-off'      => __( 'Turn off Fullscreen' ),
     388                        'mejs.fullscreen-on'       => __( 'Go Fullscreen' ),
     389                        'mejs.download-video'      => __( 'Download Video' ),
     390                        'mejs.fullscreen'          => __( 'Fullscreen' ),
     391                        'mejs.time-jump-forward'   => array( __( 'Jump forward 1 second' ), __( 'Jump forward %1 seconds' ) ),
     392                        'mejs.loop'                => __( 'Toggle Loop' ),
     393                        'mejs.play'                => __( 'Play' ),
     394                        'mejs.pause'               => __( 'Pause' ),
     395                        'mejs.close'               => __( 'Close' ),
     396                        'mejs.time-slider'         => __( 'Time Slider' ),
     397                        'mejs.time-help-text'      => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
     398                        'mejs.time-skip-back'      => array( __( 'Skip back 1 second' ), __( 'Skip back %1 seconds' ) ),
     399                        'mejs.captions-subtitles'  => __( 'Captions/Subtitles' ),
     400                        'mejs.captions-chapters'   => __( 'Chapters' ),
     401                        'mejs.none'                => __( 'None' ),
     402                        'mejs.mute-toggle'         => __( 'Mute Toggle' ),
     403                        'mejs.volume-help-text'    => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
     404                        'mejs.unmute'              => __( 'Unmute' ),
     405                        'mejs.mute'                => __( 'Mute' ),
     406                        'mejs.volume-slider'       => __( 'Volume Slider' ),
     407                        'mejs.video-player'        => __( 'Video Player' ),
     408                        'mejs.audio-player'        => __( 'Audio Player' ),
     409                        'mejs.ad-skip'             => __( 'Skip ad' ),
     410                        'mejs.ad-skip-info'        => array( __( 'Skip in 1 second' ), __( 'Skip in %1 seconds' ) ),
     411                        'mejs.source-chooser'      => __( 'Source Chooser' ),
     412                        'mejs.stop'                => __( 'Stop' ),
     413                        'mejs.speed-rate'          => __( 'Speed Rate' ),
     414                        'mejs.live-broadcast'      => __( 'Live Broadcast' ),
     415                        'mejs.afrikaans'           => __( 'Afrikaans' ),
     416                        'mejs.albanian'            => __( 'Albanian' ),
     417                        'mejs.arabic'              => __( 'Arabic' ),
     418                        'mejs.belarusian'          => __( 'Belarusian' ),
     419                        'mejs.bulgarian'           => __( 'Bulgarian' ),
     420                        'mejs.catalan'             => __( 'Catalan' ),
     421                        'mejs.chinese'             => __( 'Chinese' ),
     422                        'mejs.chinese-simplified'  => __( 'Chinese (Simplified)' ),
     423                        'mejs.chinese-traditional' => __( 'Chinese (Traditional)' ),
     424                        'mejs.croatian'            => __( 'Croatian' ),
     425                        'mejs.czech'               => __( 'Czech' ),
     426                        'mejs.danish'              => __( 'Danish' ),
     427                        'mejs.dutch'               => __( 'Dutch' ),
     428                        'mejs.english'             => __( 'English' ),
     429                        'mejs.estonian'            => __( 'Estonian' ),
     430                        'mejs.filipino'            => __( 'Filipino' ),
     431                        'mejs.finnish'             => __( 'Finnish' ),
     432                        'mejs.french'              => __( 'French' ),
     433                        'mejs.galician'            => __( 'Galician' ),
     434                        'mejs.german'              => __( 'German' ),
     435                        'mejs.greek'               => __( 'Greek' ),
     436                        'mejs.haitian-creole'      => __( 'Haitian Creole' ),
     437                        'mejs.hebrew'              => __( 'Hebrew' ),
     438                        'mejs.hindi'               => __( 'Hindi' ),
     439                        'mejs.hungarian'           => __( 'Hungarian' ),
     440                        'mejs.icelandic'           => __( 'Icelandic' ),
     441                        'mejs.indonesian'          => __( 'Indonesian' ),
     442                        'mejs.irish'               => __( 'Irish' ),
     443                        'mejs.italian'             => __( 'Italian' ),
     444                        'mejs.japanese'            => __( 'Japanese' ),
     445                        'mejs.korean'              => __( 'Korean' ),
     446                        'mejs.latvian'             => __( 'Latvian' ),
     447                        'mejs.lithuanian'          => __( 'Lithuanian' ),
     448                        'mejs.macedonian'          => __( 'Macedonian' ),
     449                        'mejs.malay'               => __( 'Malay' ),
     450                        'mejs.maltese'             => __( 'Maltese' ),
     451                        'mejs.norwegian'           => __( 'Norwegian' ),
     452                        'mejs.persian'             => __( 'Persian' ),
     453                        'mejs.polish'              => __( 'Polish' ),
     454                        'mejs.portuguese'          => __( 'Portuguese' ),
     455                        'mejs.romanian'            => __( 'Romanian' ),
     456                        'mejs.russian'             => __( 'Russian' ),
     457                        'mejs.serbian'             => __( 'Serbian' ),
     458                        'mejs.slovak'              => __( 'Slovak' ),
     459                        'mejs.slovenian'           => __( 'Slovenian' ),
     460                        'mejs.spanish'             => __( 'Spanish' ),
     461                        'mejs.swahili'             => __( 'Swahili' ),
     462                        'mejs.swedish'             => __( 'Swedish' ),
     463                        'mejs.tagalog'             => __( 'Tagalog' ),
     464                        'mejs.thai'                => __( 'Thai' ),
     465                        'mejs.turkish'             => __( 'Turkish' ),
     466                        'mejs.ukrainian'           => __( 'Ukrainian' ),
     467                        'mejs.vietnamese'          => __( 'Vietnamese' ),
     468                        'mejs.welsh'               => __( 'Welsh' ),
     469                        'mejs.yiddish'             => __( 'Yiddish' ),
     470                    ),
     471                )
     472            )
     473        ), 'before'
     474    );
     475
     476    $scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.6-78496d1', 1 );
     477    $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array( 'mediaelement' ), false, 1 );
    452478    $mejs_settings = array(
    453         'pluginPath'    => includes_url( 'js/mediaelement/', 'relative' ),
    454         'classPrefix'   => 'mejs-',
    455         'stretching'    => 'responsive',
    456     );
    457     did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings',
     479        'pluginPath'  => includes_url( 'js/mediaelement/', 'relative' ),
     480        'classPrefix' => 'mejs-',
     481        'stretching'  => 'responsive',
     482    );
     483    did_action( 'init' ) && $scripts->localize(
     484        'mediaelement', '_wpmejsSettings',
    458485        /**
    459486         * Filters the MediaElement configuration settings.
     
    474501    $scripts->add( 'code-editor', "/wp-admin/js/code-editor$suffix.js", array( 'jquery', 'wp-codemirror', 'underscore' ) );
    475502    $scripts->add( 'wp-theme-plugin-editor', "/wp-admin/js/theme-plugin-editor$suffix.js", array( 'wp-util', 'wp-sanitize', 'jquery', 'jquery-ui-core', 'wp-a11y', 'underscore' ) );
    476     did_action( 'init' ) && $scripts->add_inline_script( 'wp-theme-plugin-editor', sprintf( 'wp.themePluginEditor.l10n = %s;', wp_json_encode( array(
    477         'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
    478         'saveError' => __( 'Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.' ),
    479         'lintError' => array(
    480             /* translators: %d: error count */
    481             '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 ),
    482             /* translators: %d: error count */
    483             '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.
    484         ),
    485     ) ) ) );
     503    did_action( 'init' ) && $scripts->add_inline_script(
     504        'wp-theme-plugin-editor', sprintf(
     505            'wp.themePluginEditor.l10n = %s;', wp_json_encode(
     506                array(
     507                    'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
     508                    'saveError' => __( 'Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP.' ),
     509                    'lintError' => array(
     510                        /* translators: %d: error count */
     511                        '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 ),
     512                        /* translators: %d: error count */
     513                        '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.
     514                    ),
     515                )
     516            )
     517        )
     518    );
    486519
    487520    $scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
    488521
    489522    $scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
    490     did_action( 'init' ) && $scripts->localize( 'zxcvbn-async', '_zxcvbnSettings', array(
    491         'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
    492     ) );
     523    did_action( 'init' ) && $scripts->localize(
     524        'zxcvbn-async', '_zxcvbnSettings', array(
     525            'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
     526        )
     527    );
    493528
    494529    $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
    495     did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
    496         'unknown'  => _x( 'Password strength unknown', 'password strength' ),
    497         'short'    => _x( 'Very weak', 'password strength' ),
    498         'bad'      => _x( 'Weak', 'password strength' ),
    499         'good'     => _x( 'Medium', 'password strength' ),
    500         'strong'   => _x( 'Strong', 'password strength' ),
    501         'mismatch' => _x( 'Mismatch', 'password mismatch' ),
    502     ) );
     530    did_action( 'init' ) && $scripts->localize(
     531        'password-strength-meter', 'pwsL10n', array(
     532            'unknown'  => _x( 'Password strength unknown', 'password strength' ),
     533            'short'    => _x( 'Very weak', 'password strength' ),
     534            'bad'      => _x( 'Weak', 'password strength' ),
     535            'good'     => _x( 'Medium', 'password strength' ),
     536            'strong'   => _x( 'Strong', 'password strength' ),
     537            'mismatch' => _x( 'Mismatch', 'password mismatch' ),
     538        )
     539    );
    503540
    504541    $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
    505     did_action( 'init' ) && $scripts->localize( 'user-profile', 'userProfileL10n', array(
    506         'warn'     => __( 'Your new password has not been saved.' ),
    507         'warnWeak' => __( 'Confirm use of weak password' ),
    508         'show'     => __( 'Show' ),
    509         'hide'     => __( 'Hide' ),
    510         'cancel'   => __( 'Cancel' ),
    511         'ariaShow' => esc_attr__( 'Show password' ),
    512         'ariaHide' => esc_attr__( 'Hide password' ),
    513     ) );
     542    did_action( 'init' ) && $scripts->localize(
     543        'user-profile', 'userProfileL10n', array(
     544            'warn'     => __( 'Your new password has not been saved.' ),
     545            'warnWeak' => __( 'Confirm use of weak password' ),
     546            'show'     => __( 'Show' ),
     547            'hide'     => __( 'Hide' ),
     548            'cancel'   => __( 'Cancel' ),
     549            'ariaShow' => esc_attr__( 'Show password' ),
     550            'ariaHide' => esc_attr__( 'Hide password' ),
     551        )
     552    );
    514553
    515554    $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
     
    520559
    521560    $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
    522     did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array(
    523         'title' => __('Insert/edit link'),
    524         'update' => __('Update'),
    525         'save' => __('Add Link'),
    526         'noTitle' => __('(no title)'),
    527         'noMatchesFound' => __('No results found.'),
    528         'linkSelected' => __( 'Link selected.' ),
    529         'linkInserted' => __( 'Link inserted.' ),
    530     ) );
     561    did_action( 'init' ) && $scripts->localize(
     562        'wplink', 'wpLinkL10n', array(
     563            'title'          => __( 'Insert/edit link' ),
     564            'update'         => __( 'Update' ),
     565            'save'           => __( 'Add Link' ),
     566            'noTitle'        => __( '(no title)' ),
     567            'noMatchesFound' => __( 'No results found.' ),
     568            'linkSelected'   => __( 'Link selected.' ),
     569            'linkInserted'   => __( 'Link inserted.' ),
     570        )
     571    );
    531572
    532573    $scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
     
    536577    $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
    537578
    538     $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '1.8.1', 1 );
    539 
    540     $scripts->add( 'customize-base',     "/wp-includes/js/customize-base$suffix.js",    array( 'jquery', 'json2', 'underscore' ), false, 1 );
    541     $scripts->add( 'customize-loader',   "/wp-includes/js/customize-loader$suffix.js",  array( 'customize-base' ), false, 1 );
    542     $scripts->add( 'customize-preview',  "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
    543     $scripts->add( 'customize-models',   "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 );
    544     $scripts->add( 'customize-views',    "/wp-includes/js/customize-views.js", array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 );
     579    $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.8.1', 1 );
     580
     581    $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );
     582    $scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 );
     583    $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
     584    $scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 );
     585    $scripts->add( 'customize-views', '/wp-includes/js/customize-views.js', array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 );
    545586    $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util', 'jquery-ui-core' ), false, 1 );
    546     did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
    547         'activate'           => __( 'Activate & Publish' ),
    548         'save'               => __( 'Save & Publish' ), // @todo Remove as not required.
    549         'publish'            => __( 'Publish' ),
    550         'published'          => __( 'Published' ),
    551         'saveDraft'          => __( 'Save Draft' ),
    552         'draftSaved'         => __( 'Draft Saved' ),
    553         'updating'           => __( 'Updating' ),
    554         'schedule'           => _x( 'Schedule', 'customizer changeset action/button label' ),
    555         'scheduled'          => _x( 'Scheduled', 'customizer changeset status' ),
    556         'invalid'            => __( 'Invalid' ),
    557         'saveBeforeShare'    => __( 'Please save your changes in order to share the preview.' ),
    558         'futureDateError'    => __( 'You must supply a future date to schedule.' ),
    559         'saveAlert'          => __( 'The changes you made will be lost if you navigate away from this page.' ),
    560         'saved'              => __( 'Saved' ),
    561         'cancel'             => __( 'Cancel' ),
    562         'close'              => __( 'Close' ),
    563         'action'             => __( 'Action' ),
    564         'discardChanges'     => __( 'Discard changes' ),
    565         'cheatin'            => __( 'Cheatin’ uh?' ),
    566         'notAllowed'         => __( 'Sorry, you are not allowed to customize this site.' ),
    567         'previewIframeTitle' => __( 'Site Preview' ),
    568         'loginIframeTitle'   => __( 'Session expired' ),
    569         'collapseSidebar'    => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),
    570         'expandSidebar'      => _x( 'Show Controls', 'label for hide controls button without length constraints' ),
    571         'untitledBlogName'   => __( '(Untitled)' ),
    572         'unknownRequestFail' => __( 'Looks like something’s gone wrong. Wait a couple seconds, and then try again.' ),
    573         'themeDownloading'   => __( 'Downloading your new theme…' ),
    574         'themePreviewWait'   => __( 'Setting up your live preview. This may take a bit.' ),
    575         'revertingChanges'   => __( 'Reverting unpublished changes…' ),
    576         'trashConfirm'       => __( 'Are you sure you’d like to discard your unpublished changes?' ),
    577         /* translators: %s: Display name of the user who has taken over the changeset in customizer. */
    578         'takenOverMessage'   => __( '%s has taken over and is currently customizing.' ),
    579         /* translators: %s: URL to the Customizer to load the autosaved version */
    580         'autosaveNotice'     => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
    581         'videoHeaderNotice'  => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
    582         // Used for overriding the file types allowed in plupload.
    583         'allowedFiles'       => __( 'Allowed Files' ),
    584         'customCssError'     => array(
    585             /* translators: %d: error count */
    586             '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 ),
    587             /* translators: %d: error count */
    588             '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.
    589         ),
    590         'pageOnFrontError' => __( 'Homepage and posts page must be different.' ),
    591         'saveBlockedError' => array(
    592             /* translators: %s: number of invalid settings */
    593             'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
    594             /* translators: %s: number of invalid settings */
    595             '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.
    596         ),
    597         'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
    598         'themePreviewUnavailable' => __( 'Sorry, you can&#8217;t preview new themes when you have changes scheduled or saved as a draft. Please publish your changes, or wait until they publish to preview new themes.' ),
    599         'themeInstallUnavailable' => sprintf(
    600             /* translators: %s: URL to Add Themes admin screen */
    601             __( 'You won&#8217;t be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
    602             esc_url( admin_url( 'theme-install.php' ) )
    603         ),
    604         'publishSettings' => __( 'Publish Settings' ),
    605         'invalidDate'     => __( 'Invalid date.' ),
    606         'invalidValue'    => __( 'Invalid value.' ),
    607     ) );
     587    did_action( 'init' ) && $scripts->localize(
     588        'customize-controls', '_wpCustomizeControlsL10n', array(
     589            'activate'                => __( 'Activate &amp; Publish' ),
     590            'save'                    => __( 'Save &amp; Publish' ), // @todo Remove as not required.
     591            'publish'                 => __( 'Publish' ),
     592            'published'               => __( 'Published' ),
     593            'saveDraft'               => __( 'Save Draft' ),
     594            'draftSaved'              => __( 'Draft Saved' ),
     595            'updating'                => __( 'Updating' ),
     596            'schedule'                => _x( 'Schedule', 'customizer changeset action/button label' ),
     597            'scheduled'               => _x( 'Scheduled', 'customizer changeset status' ),
     598            'invalid'                 => __( 'Invalid' ),
     599            'saveBeforeShare'         => __( 'Please save your changes in order to share the preview.' ),
     600            'futureDateError'         => __( 'You must supply a future date to schedule.' ),
     601            'saveAlert'               => __( 'The changes you made will be lost if you navigate away from this page.' ),
     602            'saved'                   => __( 'Saved' ),
     603            'cancel'                  => __( 'Cancel' ),
     604            'close'                   => __( 'Close' ),
     605            'action'                  => __( 'Action' ),
     606            'discardChanges'          => __( 'Discard changes' ),
     607            'cheatin'                 => __( 'Cheatin&#8217; uh?' ),
     608            'notAllowed'              => __( 'Sorry, you are not allowed to customize this site.' ),
     609            'previewIframeTitle'      => __( 'Site Preview' ),
     610            'loginIframeTitle'        => __( 'Session expired' ),
     611            'collapseSidebar'         => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),
     612            'expandSidebar'           => _x( 'Show Controls', 'label for hide controls button without length constraints' ),
     613            'untitledBlogName'        => __( '(Untitled)' ),
     614            'unknownRequestFail'      => __( 'Looks like something&#8217;s gone wrong. Wait a couple seconds, and then try again.' ),
     615            'themeDownloading'        => __( 'Downloading your new theme&hellip;' ),
     616            'themePreviewWait'        => __( 'Setting up your live preview. This may take a bit.' ),
     617            'revertingChanges'        => __( 'Reverting unpublished changes&hellip;' ),
     618            'trashConfirm'            => __( 'Are you sure you&#8217;d like to discard your unpublished changes?' ),
     619            /* translators: %s: Display name of the user who has taken over the changeset in customizer. */
     620            'takenOverMessage'        => __( '%s has taken over and is currently customizing.' ),
     621            /* translators: %s: URL to the Customizer to load the autosaved version */
     622            'autosaveNotice'          => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
     623            'videoHeaderNotice'       => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
     624            // Used for overriding the file types allowed in plupload.
     625            'allowedFiles'            => __( 'Allowed Files' ),
     626            'customCssError'          => array(
     627                /* translators: %d: error count */
     628                '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 ),
     629                /* translators: %d: error count */
     630                '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.
     631            ),
     632            'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
     633            'saveBlockedError'        => array(
     634                /* translators: %s: number of invalid settings */
     635                'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
     636                /* translators: %s: number of invalid settings */
     637                '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.
     638            ),
     639            'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
     640            'themePreviewUnavailable' => __( 'Sorry, you can&#8217;t preview new themes when you have changes scheduled or saved as a draft. Please publish your changes, or wait until they publish to preview new themes.' ),
     641            'themeInstallUnavailable' => sprintf(
     642                /* translators: %s: URL to Add Themes admin screen */
     643                __( 'You won&#8217;t be able to install new themes from here yet since your install requires SFTP credentials. For now, please <a href="%s">add themes in the admin</a>.' ),
     644                esc_url( admin_url( 'theme-install.php' ) )
     645            ),
     646            'publishSettings'         => __( 'Publish Settings' ),
     647            'invalidDate'             => __( 'Invalid date.' ),
     648            'invalidValue'            => __( 'Invalid value.' ),
     649        )
     650    );
    608651    $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
    609652
     
    620663    $scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
    621664    $scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
    622     did_action( 'init' ) && $scripts->localize( 'media-models', '_wpMediaModelsL10n', array(
    623         'settings' => array(
    624             'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
    625             'post' => array( 'id' => 0 ),
    626         ),
    627     ) );
     665    did_action( 'init' ) && $scripts->localize(
     666        'media-models', '_wpMediaModelsL10n', array(
     667            'settings' => array(
     668                'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
     669                'post'    => array( 'id' => 0 ),
     670            ),
     671        )
     672    );
    628673
    629674    $scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" );
     
    631676    // To enqueue media-views or media-editor, call wp_enqueue_media().
    632677    // Both rely on numerous settings, styles, and templates to operate correctly.
    633     $scripts->add( 'media-views',  "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement', 'wp-api-request' ), false, 1 );
     678    $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement', 'wp-api-request' ), false, 1 );
    634679    $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
    635680    $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
     
    640685    if ( is_admin() ) {
    641686        $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
    642         did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
    643             'noPerm' => __('Sorry, you are not allowed to do that.'),
    644             'broken' => __('An unidentified error has occurred.')
    645         ));
    646 
    647         $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
    648         did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
    649             'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
    650             'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
    651             'replyApprove' => __( 'Approve and Reply' ),
    652             'reply' => __( 'Reply' ),
    653             'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
    654             'warnCommentChanges' => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),
    655             'docTitleComments' => __( 'Comments' ),
    656             /* translators: %s: comments count */
    657             'docTitleCommentsCount' => __( 'Comments (%s)' ),
    658         ) );
    659 
    660         $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );
    661 
    662         $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
    663         did_action( 'init' ) && $scripts->localize( 'postbox', 'postBoxL10n', array(
    664             'postBoxEmptyString' => __( 'Drag boxes here' ),
    665         ) );
     687        did_action( 'init' ) && $scripts->localize(
     688            'admin-tags', 'tagsl10n', array(
     689                'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
     690                'broken' => __( 'An unidentified error has occurred.' ),
     691            )
     692        );
     693
     694        $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 );
     695        did_action( 'init' ) && $scripts->localize(
     696            'admin-comments', 'adminCommentsL10n', array(
     697                'hotkeys_highlight_first' => isset( $_GET['hotkeys_highlight_first'] ),
     698                'hotkeys_highlight_last'  => isset( $_GET['hotkeys_highlight_last'] ),
     699                'replyApprove'            => __( 'Approve and Reply' ),
     700                'reply'                   => __( 'Reply' ),
     701                'warnQuickEdit'           => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
     702                'warnCommentChanges'      => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),
     703                'docTitleComments'        => __( 'Comments' ),
     704                /* translators: %s: comments count */
     705                'docTitleCommentsCount'   => __( 'Comments (%s)' ),
     706            )
     707        );
     708
     709        $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
     710
     711        $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable' ), false, 1 );
     712        did_action( 'init' ) && $scripts->localize(
     713            'postbox', 'postBoxL10n', array(
     714                'postBoxEmptyString' => __( 'Drag boxes here' ),
     715            )
     716        );
    666717
    667718        $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
    668719
    669720        $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
    670         did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array(
    671             'tagDelimiter' => _x( ',', 'tag delimiter' ),
    672             'removeTerm'   => __( 'Remove term:' ),
    673             'termSelected' => __( 'Term selected.' ),
    674             'termAdded'    => __( 'Term added.' ),
    675             'termRemoved'  => __( 'Term removed.' ),
    676         ) );
     721        did_action( 'init' ) && $scripts->localize(
     722            'tags-suggest', 'tagsSuggestL10n', array(
     723                'tagDelimiter' => _x( ',', 'tag delimiter' ),
     724                'removeTerm'   => __( 'Remove term:' ),
     725                'termSelected' => __( 'Term selected.' ),
     726                'termAdded'    => __( 'Term added.' ),
     727                'termRemoved'  => __( 'Term removed.' ),
     728            )
     729        );
    677730
    678731        $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 );
    679         did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
    680             'ok' => __('OK'),
    681             'cancel' => __('Cancel'),
    682             'publishOn' => __('Publish on:'),
    683             'publishOnFuture' =>  __('Schedule for:'),
    684             'publishOnPast' => __('Published on:'),
    685             /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
    686             'dateFormat' => __('%1$s %2$s, %3$s @ %4$s:%5$s'),
    687             'showcomm' => __('Show more comments'),
    688             'endcomm' => __('No more comments found.'),
    689             'publish' => __('Publish'),
    690             'schedule' => _x('Schedule', 'post action/button label'),
    691             'update' => __('Update'),
    692             'savePending' => __('Save as Pending'),
    693             'saveDraft' => __('Save Draft'),
    694             'private' => __('Private'),
    695             'public' => __('Public'),
    696             'publicSticky' => __('Public, Sticky'),
    697             'password' => __('Password Protected'),
    698             'privatelyPublished' => __('Privately Published'),
    699             'published' => __('Published'),
    700             'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
    701             'savingText' => __('Saving Draft&#8230;'),
    702             'permalinkSaved' => __( 'Permalink saved' ),
    703         ) );
     732        did_action( 'init' ) && $scripts->localize(
     733            'post', 'postL10n', array(
     734                'ok'                 => __( 'OK' ),
     735                'cancel'             => __( 'Cancel' ),
     736                'publishOn'          => __( 'Publish on:' ),
     737                'publishOnFuture'    => __( 'Schedule for:' ),
     738                'publishOnPast'      => __( 'Published on:' ),
     739                /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
     740                'dateFormat'         => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ),
     741                'showcomm'           => __( 'Show more comments' ),
     742                'endcomm'            => __( 'No more comments found.' ),
     743                'publish'            => __( 'Publish' ),
     744                'schedule'           => _x( 'Schedule', 'post action/button label' ),
     745                'update'             => __( 'Update' ),
     746                'savePending'        => __( 'Save as Pending' ),
     747                'saveDraft'          => __( 'Save Draft' ),
     748                'private'            => __( 'Private' ),
     749                'public'             => __( 'Public' ),
     750                'publicSticky'       => __( 'Public, Sticky' ),
     751                'password'           => __( 'Password Protected' ),
     752                'privatelyPublished' => __( 'Privately Published' ),
     753                'published'          => __( 'Published' ),
     754                'saveAlert'          => __( 'The changes you made will be lost if you navigate away from this page.' ),
     755                'savingText'         => __( 'Saving Draft&#8230;' ),
     756                'permalinkSaved'     => __( 'Permalink saved' ),
     757            )
     758        );
    704759
    705760        $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
     
    709764        $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
    710765        $scripts->add_data( 'comment', 'group', 1 );
    711         did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
    712             'submittedOn' => __( 'Submitted on:' ),
    713             /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
    714             'dateFormat' => __( '%1$s %2$s, %3$s @ %4$s:%5$s' )
    715         ) );
     766        did_action( 'init' ) && $scripts->localize(
     767            'comment', 'commentL10n', array(
     768                'submittedOn' => __( 'Submitted on:' ),
     769                /* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
     770                'dateFormat'  => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ),
     771            )
     772        );
    716773
    717774        $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
    718775
    719776        $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
    720         did_action( 'init' ) && $scripts->add_inline_script( 'admin-widgets', sprintf( 'wpWidgets.l10n = %s;', wp_json_encode( array(
    721             'save' => __( 'Save' ),
    722             'saved' => __( 'Saved' ),
    723             'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
    724         ) ) ) );
     777        did_action( 'init' ) && $scripts->add_inline_script(
     778            'admin-widgets', sprintf(
     779                'wpWidgets.l10n = %s;', wp_json_encode(
     780                    array(
     781                        'save'      => __( 'Save' ),
     782                        'saved'     => __( 'Saved' ),
     783                        'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
     784                    )
     785                )
     786            )
     787        );
    725788
    726789        $scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
     
    737800
    738801        $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
    739         did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
    740             'error'      => __( 'Error while saving the changes.' ),
    741             'ntdeltitle' => __( 'Remove From Bulk Edit' ),
    742             'notitle'    => __( '(no title)' ),
    743             'comma'      => trim( _x( ',', 'tag delimiter' ) ),
    744             'saved'      => __( 'Changes saved.' ),
    745         ) );
     802        did_action( 'init' ) && $scripts->localize(
     803            'inline-edit-post', 'inlineEditL10n', array(
     804                'error'      => __( 'Error while saving the changes.' ),
     805                'ntdeltitle' => __( 'Remove From Bulk Edit' ),
     806                'notitle'    => __( '(no title)' ),
     807                'comma'      => trim( _x( ',', 'tag delimiter' ) ),
     808                'saved'      => __( 'Changes saved.' ),
     809            )
     810        );
    746811
    747812        $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
    748         did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
    749             'error' => __( 'Error while saving the changes.' ),
    750             'saved' => __( 'Changes saved.' ),
    751         ) );
     813        did_action( 'init' ) && $scripts->localize(
     814            'inline-edit-tax', 'inlineEditL10n', array(
     815                'error' => __( 'Error while saving the changes.' ),
     816                'saved' => __( 'Changes saved.' ),
     817            )
     818        );
    752819
    753820        $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
    754         did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
    755             'plugin_information' => __( 'Plugin:' ),
    756             'plugin_modal_label' => __( 'Plugin details' ),
    757             'ays' => __('Are you sure you want to install this plugin?')
    758         ) );
     821        did_action( 'init' ) && $scripts->localize(
     822            'plugin-install', 'plugininstallL10n', array(
     823                'plugin_information' => __( 'Plugin:' ),
     824                'plugin_modal_label' => __( 'Plugin details' ),
     825                'ays'                => __( 'Are you sure you want to install this plugin?' ),
     826            )
     827        );
    759828
    760829        $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
    761         did_action( 'init' ) && $scripts->localize( 'updates', '_wpUpdatesSettings', array(
    762             'ajax_nonce' => wp_create_nonce( 'updates' ),
    763             'l10n'       => array(
    764                 /* translators: %s: Search string */
    765                 'searchResults'              => __( 'Search results for &#8220;%s&#8221;' ),
    766                 'searchResultsLabel'         => __( 'Search Results' ),
    767                 'noPlugins'                  => __( 'You do not appear to have any plugins available at this time.' ),
    768                 'noItemsSelected'            => __( 'Please select at least one item to perform this action on.' ),
    769                 'updating'                   => __( 'Updating...' ), // No ellipsis.
    770                 'pluginUpdated'              => _x( 'Updated!', 'plugin' ),
    771                 'themeUpdated'               => _x( 'Updated!', 'theme' ),
    772                 'update'                     => __( 'Update' ),
    773                 'updateNow'                  => __( 'Update Now' ),
    774                 /* translators: %s: Plugin name and version */
    775                 'pluginUpdateNowLabel'       => _x( 'Update %s now', 'plugin' ),
    776                 'updateFailedShort'          => __( 'Update Failed!' ),
    777                 /* translators: %s: Error string for a failed update */
    778                 'updateFailed'               => __( 'Update Failed: %s' ),
    779                 /* translators: %s: Plugin name and version */
    780                 'pluginUpdatingLabel'        => _x( 'Updating %s...', 'plugin' ), // No ellipsis.
    781                 /* translators: %s: Plugin name and version */
    782                 'pluginUpdatedLabel'         => _x( '%s updated!', 'plugin' ),
    783                 /* translators: %s: Plugin name and version */
    784                 'pluginUpdateFailedLabel'    => _x( '%s update failed', 'plugin' ),
    785                 /* translators: Accessibility text */
    786                 'updatingMsg'                => __( 'Updating... please wait.' ), // No ellipsis.
    787                 /* translators: Accessibility text */
    788                 'updatedMsg'                 => __( 'Update completed successfully.' ),
    789                 /* translators: Accessibility text */
    790                 'updateCancel'               => __( 'Update canceled.' ),
    791                 'beforeunload'               => __( 'Updates may not complete if you navigate away from this page.' ),
    792                 'installNow'                 => __( 'Install Now' ),
    793                 /* translators: %s: Plugin name */
    794                 'pluginInstallNowLabel'      => _x( 'Install %s now', 'plugin' ),
    795                 'installing'                 => __( 'Installing...' ),
    796                 'pluginInstalled'            => _x( 'Installed!', 'plugin' ),
    797                 'themeInstalled'             => _x( 'Installed!', 'theme' ),
    798                 'installFailedShort'         => __( 'Installation Failed!' ),
    799                 /* translators: %s: Error string for a failed installation */
    800                 'installFailed'              => __( 'Installation failed: %s' ),
    801                 /* translators: %s: Plugin name and version */
    802                 'pluginInstallingLabel'      => _x( 'Installing %s...', 'plugin' ), // no ellipsis
    803                 /* translators: %s: Theme name and version */
    804                 'themeInstallingLabel'       => _x( 'Installing %s...', 'theme' ), // no ellipsis
    805                 /* translators: %s: Plugin name and version */
    806                 'pluginInstalledLabel'       => _x( '%s installed!', 'plugin' ),
    807                 /* translators: %s: Theme name and version */
    808                 'themeInstalledLabel'        => _x( '%s installed!', 'theme' ),
    809                 /* translators: %s: Plugin name and version */
    810                 'pluginInstallFailedLabel'   => _x( '%s installation failed', 'plugin' ),
    811                 /* translators: %s: Theme name and version */
    812                 'themeInstallFailedLabel'    => _x( '%s installation failed', 'theme' ),
    813                 'installingMsg'              => __( 'Installing... please wait.' ),
    814                 'installedMsg'               => __( 'Installation completed successfully.' ),
    815                 /* translators: %s: Activation URL */
    816                 'importerInstalledMsg'       => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),
    817                 /* translators: %s: Theme name */
    818                 'aysDelete'                  => __( 'Are you sure you want to delete %s?' ),
    819                 /* translators: %s: Plugin name */
    820                 'aysDeleteUninstall'         => __( 'Are you sure you want to delete %s and its data?' ),
    821                 'aysBulkDelete'              => __( 'Are you sure you want to delete the selected plugins and their data?' ),
    822                 'aysBulkDeleteThemes'        => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),
    823                 'deleting'                   => __( 'Deleting...' ),
    824                 /* translators: %s: Error string for a failed deletion */
    825                 'deleteFailed'               => __( 'Deletion failed: %s' ),
    826                 'pluginDeleted'              => _x( 'Deleted!', 'plugin' ),
    827                 'themeDeleted'               => _x( 'Deleted!', 'theme' ),
    828                 'livePreview'                => __( 'Live Preview' ),
    829                 'activatePlugin'             => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),
    830                 'activateTheme'              => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),
    831                 /* translators: %s: Plugin name */
    832                 'activatePluginLabel'        => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),
    833                 /* translators: %s: Theme name */
    834                 'activateThemeLabel'         => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),
    835                 'activateImporter'           => __( 'Run Importer' ),
    836                 /* translators: %s: Importer name */
    837                 'activateImporterLabel'      => __( 'Run %s' ),
    838                 'unknownError'               => __( 'An unidentified error has occurred.' ),
    839                 'connectionError'            => __( 'Connection lost or the server is busy. Please try again later.' ),
    840                 'nonceError'                 => __( 'An error has occurred. Please reload the page and try again.' ),
    841                 'pluginsFound'               => __( 'Number of plugins found: %d' ),
    842                 'noPluginsFound'             => __( 'No plugins found. Try a different search.' ),
    843             ),
    844         ) );
    845 
    846         $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
     830        did_action( 'init' ) && $scripts->localize(
     831            'updates', '_wpUpdatesSettings', array(
     832                'ajax_nonce' => wp_create_nonce( 'updates' ),
     833                'l10n'       => array(
     834                    /* translators: %s: Search string */
     835                    'searchResults'            => __( 'Search results for &#8220;%s&#8221;' ),
     836                    'searchResultsLabel'       => __( 'Search Results' ),
     837                    'noPlugins'                => __( 'You do not appear to have any plugins available at this time.' ),
     838                    'noItemsSelected'          => __( 'Please select at least one item to perform this action on.' ),
     839                    'updating'                 => __( 'Updating...' ), // No ellipsis.
     840                    'pluginUpdated'            => _x( 'Updated!', 'plugin' ),
     841                    'themeUpdated'             => _x( 'Updated!', 'theme' ),
     842                    'update'                   => __( 'Update' ),
     843                    'updateNow'                => __( 'Update Now' ),
     844                    /* translators: %s: Plugin name and version */
     845                    'pluginUpdateNowLabel'     => _x( 'Update %s now', 'plugin' ),
     846                    'updateFailedShort'        => __( 'Update Failed!' ),
     847                    /* translators: %s: Error string for a failed update */
     848                    'updateFailed'             => __( 'Update Failed: %s' ),
     849                    /* translators: %s: Plugin name and version */
     850                    'pluginUpdatingLabel'      => _x( 'Updating %s...', 'plugin' ), // No ellipsis.
     851                    /* translators: %s: Plugin name and version */
     852                    'pluginUpdatedLabel'       => _x( '%s updated!', 'plugin' ),
     853                    /* translators: %s: Plugin name and version */
     854                    'pluginUpdateFailedLabel'  => _x( '%s update failed', 'plugin' ),
     855                    /* translators: Accessibility text */
     856                    'updatingMsg'              => __( 'Updating... please wait.' ), // No ellipsis.
     857                    /* translators: Accessibility text */
     858                    'updatedMsg'               => __( 'Update completed successfully.' ),
     859                    /* translators: Accessibility text */
     860                    'updateCancel'             => __( 'Update canceled.' ),
     861                    'beforeunload'             => __( 'Updates may not complete if you navigate away from this page.' ),
     862                    'installNow'               => __( 'Install Now' ),
     863                    /* translators: %s: Plugin name */
     864                    'pluginInstallNowLabel'    => _x( 'Install %s now', 'plugin' ),
     865                    'installing'               => __( 'Installing...' ),
     866                    'pluginInstalled'          => _x( 'Installed!', 'plugin' ),
     867                    'themeInstalled'           => _x( 'Installed!', 'theme' ),
     868                    'installFailedShort'       => __( 'Installation Failed!' ),
     869                    /* translators: %s: Error string for a failed installation */
     870                    'installFailed'            => __( 'Installation failed: %s' ),
     871                    /* translators: %s: Plugin name and version */
     872                    'pluginInstallingLabel'    => _x( 'Installing %s...', 'plugin' ), // no ellipsis
     873                    /* translators: %s: Theme name and version */
     874                    'themeInstallingLabel'     => _x( 'Installing %s...', 'theme' ), // no ellipsis
     875                    /* translators: %s: Plugin name and version */
     876                    'pluginInstalledLabel'     => _x( '%s installed!', 'plugin' ),
     877                    /* translators: %s: Theme name and version */
     878                    'themeInstalledLabel'      => _x( '%s installed!', 'theme' ),
     879                    /* translators: %s: Plugin name and version */
     880                    'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ),
     881                    /* translators: %s: Theme name and version */
     882                    'themeInstallFailedLabel'  => _x( '%s installation failed', 'theme' ),
     883                    'installingMsg'            => __( 'Installing... please wait.' ),
     884                    'installedMsg'             => __( 'Installation completed successfully.' ),
     885                    /* translators: %s: Activation URL */
     886                    'importerInstalledMsg'     => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),
     887                    /* translators: %s: Theme name */
     888                    'aysDelete'                => __( 'Are you sure you want to delete %s?' ),
     889                    /* translators: %s: Plugin name */
     890                    'aysDeleteUninstall'       => __( 'Are you sure you want to delete %s and its data?' ),
     891                    'aysBulkDelete'            => __( 'Are you sure you want to delete the selected plugins and their data?' ),
     892                    'aysBulkDeleteThemes'      => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),
     893                    'deleting'                 => __( 'Deleting...' ),
     894                    /* translators: %s: Error string for a failed deletion */
     895                    'deleteFailed'             => __( 'Deletion failed: %s' ),
     896                    'pluginDeleted'            => _x( 'Deleted!', 'plugin' ),
     897                    'themeDeleted'             => _x( 'Deleted!', 'theme' ),
     898                    'livePreview'              => __( 'Live Preview' ),
     899                    'activatePlugin'           => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),
     900                    'activateTheme'            => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),
     901                    /* translators: %s: Plugin name */
     902                    'activatePluginLabel'      => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),
     903                    /* translators: %s: Theme name */
     904                    'activateThemeLabel'       => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),
     905                    'activateImporter'         => __( 'Run Importer' ),
     906                    /* translators: %s: Importer name */
     907                    'activateImporterLabel'    => __( 'Run %s' ),
     908                    'unknownError'             => __( 'An unidentified error has occurred.' ),
     909                    'connectionError'          => __( 'Connection lost or the server is busy. Please try again later.' ),
     910                    'nonceError'               => __( 'An error has occurred. Please reload the page and try again.' ),
     911                    'pluginsFound'             => __( 'Number of plugins found: %d' ),
     912                    'noPluginsFound'           => __( 'No plugins found. Try a different search.' ),
     913                ),
     914            )
     915        );
     916
     917        $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array( 'jquery' ), '1.2' );
    847918
    848919        $scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
    849920        $scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
    850         did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
    851             'clear'            => __( 'Clear' ),
    852             'clearAriaLabel'   => __( 'Clear color' ),
    853             'defaultString'    => __( 'Default' ),
    854             'defaultAriaLabel' => __( 'Select default color' ),
    855             'pick'             => __( 'Select Color' ),
    856             'defaultLabel'     => __( 'Color value' ),
    857         ) );
     921        did_action( 'init' ) && $scripts->localize(
     922            'wp-color-picker', 'wpColorPickerL10n', array(
     923                'clear'            => __( 'Clear' ),
     924                'clearAriaLabel'   => __( 'Clear color' ),
     925                'defaultString'    => __( 'Default' ),
     926                'defaultAriaLabel' => __( 'Select default color' ),
     927                'pick'             => __( 'Select Color' ),
     928                'defaultLabel'     => __( 'Color value' ),
     929            )
     930        );
    858931
    859932        $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 );
     
    863936        $scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
    864937        $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
    865         did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array(
    866             'error' => __( 'An error has occurred. Please reload the page and try again.' ),
    867         ));
    868 
    869         $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
    870         did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
    871             'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
    872         ));
     938        did_action( 'init' ) && $scripts->localize(
     939            'media', 'attachMediaBoxL10n', array(
     940                'error' => __( 'An error has occurred. Please reload the page and try again.' ),
     941            )
     942        );
     943
     944        $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'json2', 'imgareaselect' ), false, 1 );
     945        did_action( 'init' ) && $scripts->localize(
     946            'image-edit', 'imageEditL10n', array(
     947                'error' => __( 'Could not load the preview image. Please reload the page and try again.' ),
     948            )
     949        );
    873950
    874951        $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
    875         did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
    876             'setThumbnail' => __( 'Use as featured image' ),
    877             'saving' => __( 'Saving...' ), // no ellipsis
    878             'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
    879             'done' => __( 'Done' )
    880         ) );
     952        did_action( 'init' ) && $scripts->localize(
     953            'set-post-thumbnail', 'setPostThumbnailL10n', array(
     954                'setThumbnail' => __( 'Use as featured image' ),
     955                'saving'       => __( 'Saving...' ), // no ellipsis
     956                'error'        => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
     957                'done'         => __( 'Done' ),
     958            )
     959        );
    881960
    882961        // Navigation Menus
    883962        $scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox', 'json2' ) );
    884         did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
    885             'noResultsFound' => __( 'No results found.' ),
    886             'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
    887             'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
    888             'untitled' => _x( '(no label)', 'missing menu item navigation label' )
    889         ) );
    890 
    891         $scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 );
     963        did_action( 'init' ) && $scripts->localize(
     964            'nav-menu', 'navMenuL10n', array(
     965                'noResultsFound' => __( 'No results found.' ),
     966                'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
     967                'saveAlert'      => __( 'The changes you made will be lost if you navigate away from this page.' ),
     968                'untitled'       => _x( '(no label)', 'missing menu item navigation label' ),
     969            )
     970        );
     971
     972        $scripts->add( 'custom-header', '/wp-admin/js/custom-header.js', array( 'jquery-masonry' ), false, 1 );
    892973        $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
    893         $scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array('jquery'), false, 1 );
     974        $scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array( 'jquery' ), false, 1 );
    894975
    895976        $scripts->add( 'svg-painter', '/wp-admin/js/svg-painter.js', array( 'jquery' ), false, 1 );
     
    915996    include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
    916997
    917     if ( ! defined( 'SCRIPT_DEBUG' ) )
     998    if ( ! defined( 'SCRIPT_DEBUG' ) ) {
    918999        define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
    919 
    920     if ( ! $guessurl = site_url() )
     1000    }
     1001
     1002    if ( ! $guessurl = site_url() ) {
    9211003        $guessurl = wp_guess_url();
    922 
    923     $styles->base_url = $guessurl;
    924     $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
     1004    }
     1005
     1006    $styles->base_url        = $guessurl;
     1007    $styles->content_url     = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : '';
    9251008    $styles->default_version = get_bloginfo( 'version' );
    926     $styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
    927     $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
     1009    $styles->text_direction  = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
     1010    $styles->default_dirs    = array( '/wp-admin/', '/wp-includes/css/' );
    9281011
    9291012    // Open Sans is no longer used by core, but may be relied upon by themes and plugins.
     
    9591042
    9601043    // Admin CSS
    961     $styles->add( 'common',              "/wp-admin/css/common$suffix.css" );
    962     $styles->add( 'forms',               "/wp-admin/css/forms$suffix.css" );
    963     $styles->add( 'admin-menu',          "/wp-admin/css/admin-menu$suffix.css" );
    964     $styles->add( 'dashboard',           "/wp-admin/css/dashboard$suffix.css" );
    965     $styles->add( 'list-tables',         "/wp-admin/css/list-tables$suffix.css" );
    966     $styles->add( 'edit',                "/wp-admin/css/edit$suffix.css" );
    967     $styles->add( 'revisions',           "/wp-admin/css/revisions$suffix.css" );
    968     $styles->add( 'media',               "/wp-admin/css/media$suffix.css" );
    969     $styles->add( 'themes',              "/wp-admin/css/themes$suffix.css" );
    970     $styles->add( 'about',               "/wp-admin/css/about$suffix.css" );
    971     $styles->add( 'nav-menus',           "/wp-admin/css/nav-menus$suffix.css" );
    972     $styles->add( 'widgets',             "/wp-admin/css/widgets$suffix.css", array( 'wp-pointer' ) );
    973     $styles->add( 'site-icon',           "/wp-admin/css/site-icon$suffix.css" );
    974     $styles->add( 'l10n',                "/wp-admin/css/l10n$suffix.css" );
    975     $styles->add( 'code-editor',         "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) );
     1044    $styles->add( 'common', "/wp-admin/css/common$suffix.css" );
     1045    $styles->add( 'forms', "/wp-admin/css/forms$suffix.css" );
     1046    $styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" );
     1047    $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" );
     1048    $styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" );
     1049    $styles->add( 'edit', "/wp-admin/css/edit$suffix.css" );
     1050    $styles->add( 'revisions', "/wp-admin/css/revisions$suffix.css" );
     1051    $styles->add( 'media', "/wp-admin/css/media$suffix.css" );
     1052    $styles->add( 'themes', "/wp-admin/css/themes$suffix.css" );
     1053    $styles->add( 'about', "/wp-admin/css/about$suffix.css" );
     1054    $styles->add( 'nav-menus', "/wp-admin/css/nav-menus$suffix.css" );
     1055    $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array( 'wp-pointer' ) );
     1056    $styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" );
     1057    $styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" );
     1058    $styles->add( 'code-editor', "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) );
    9761059
    9771060    $styles->add( 'wp-admin', false, array( 'dashicons', 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus', 'widgets', 'site-icon', 'l10n' ) );
    9781061
    979     $styles->add( 'login',               "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
    980     $styles->add( 'install',             "/wp-admin/css/install$suffix.css", array( 'buttons' ) );
    981     $styles->add( 'wp-color-picker',     "/wp-admin/css/color-picker$suffix.css" );
    982     $styles->add( 'customize-controls',  "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
    983     $styles->add( 'customize-widgets',   "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
     1062    $styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
     1063    $styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'buttons' ) );
     1064    $styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" );
     1065    $styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
     1066    $styles->add( 'customize-widgets', "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
    9841067    $styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) );
    9851068
     
    9881071
    9891072    // Common dependencies
    990     $styles->add( 'buttons',   "/wp-includes/css/buttons$suffix.css" );
     1073    $styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" );
    9911074    $styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
    9921075
    9931076    // Includes CSS
    994     $styles->add( 'admin-bar',            "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
    995     $styles->add( 'wp-auth-check',        "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
    996     $styles->add( 'editor-buttons',       "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
    997     $styles->add( 'media-views',          "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
    998     $styles->add( 'wp-pointer',           "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
    999     $styles->add( 'customize-preview',    "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) );
     1077    $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
     1078    $styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
     1079    $styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
     1080    $styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
     1081    $styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
     1082    $styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) );
    10001083    $styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" );
    10011084    $styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );
    10021085
    10031086    // External libraries and friends
    1004     $styles->add( 'imgareaselect',       '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
     1087    $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
    10051088    $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
    1006     $styles->add( 'mediaelement',        "/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css", array(), '4.2.6-78496d1' );
    1007     $styles->add( 'wp-mediaelement',     "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
    1008     $styles->add( 'thickbox',            '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
    1009     $styles->add( 'wp-codemirror',       '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
     1089    $styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.6-78496d1' );
     1090    $styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
     1091    $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
     1092    $styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
    10101093
    10111094    // Deprecated CSS
    10121095    $styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
    1013     $styles->add( 'farbtastic',       "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
    1014     $styles->add( 'jcrop',            "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12' );
     1096    $styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
     1097    $styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.css', array(), '0.9.12' );
    10151098    $styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
    10161099    $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
     
    10191102    $rtl_styles = array(
    10201103        // wp-admin
    1021         'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus',
    1022         'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'customize-preview',
    1023         'ie', 'login',
     1104        'common',
     1105        'forms',
     1106        'admin-menu',
     1107        'dashboard',
     1108        'list-tables',
     1109        'edit',
     1110        'revisions',
     1111        'media',
     1112        'themes',
     1113        'about',
     1114        'nav-menus',
     1115        'widgets',
     1116        'site-icon',
     1117        'l10n',
     1118        'install',
     1119        'wp-color-picker',
     1120        'customize-controls',
     1121        'customize-widgets',
     1122        'customize-nav-menus',
     1123        'customize-preview',
     1124        'ie',
     1125        'login',
    10241126        // wp-includes
    1025         'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
     1127        'buttons',
     1128        'admin-bar',
     1129        'wp-auth-check',
     1130        'editor-buttons',
     1131        'media-views',
     1132        'wp-pointer',
    10261133        'wp-jquery-ui-dialog',
    10271134        // deprecated
    1028         'deprecated-media', 'farbtastic',
     1135        'deprecated-media',
     1136        'farbtastic',
    10291137    );
    10301138
     
    10461154 */
    10471155function wp_prototype_before_jquery( $js_array ) {
    1048     if ( false === $prototype = array_search( 'prototype', $js_array, true ) )
     1156    if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) {
    10491157        return $js_array;
    1050 
    1051     if ( false === $jquery = array_search( 'jquery', $js_array, true ) )
     1158    }
     1159
     1160    if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) {
    10521161        return $js_array;
    1053 
    1054     if ( $prototype < $jquery )
     1162    }
     1163
     1164    if ( $prototype < $jquery ) {
    10551165        return $js_array;
    1056 
    1057     unset($js_array[$prototype]);
     1166    }
     1167
     1168    unset( $js_array[ $prototype ] );
    10581169
    10591170    array_splice( $js_array, $jquery, 0, 'prototype' );
     
    10711182function wp_just_in_time_script_localization() {
    10721183
    1073     wp_localize_script( 'autosave', 'autosaveL10n', array(
    1074         'autosaveInterval' => AUTOSAVE_INTERVAL,
    1075         'blog_id' => get_current_blog_id(),
    1076     ) );
    1077 
    1078     wp_localize_script( 'mce-view', 'mceViewL10n', array(
    1079         'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
    1080     ) );
    1081 
    1082     wp_localize_script( 'word-count', 'wordCountL10n', array(
    1083         /*
    1084          * translators: If your word count is based on single characters (e.g. East Asian characters),
    1085          * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
    1086          * Do not translate into your own language.
    1087          */
    1088         'type' => _x( 'words', 'Word count type. Do not translate!' ),
    1089         'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
    1090     ) );
     1184    wp_localize_script(
     1185        'autosave', 'autosaveL10n', array(
     1186            'autosaveInterval' => AUTOSAVE_INTERVAL,
     1187            'blog_id'          => get_current_blog_id(),
     1188        )
     1189    );
     1190
     1191    wp_localize_script(
     1192        'mce-view', 'mceViewL10n', array(
     1193            'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
     1194        )
     1195    );
     1196
     1197    wp_localize_script(
     1198        'word-count', 'wordCountL10n', array(
     1199            /*
     1200             * translators: If your word count is based on single characters (e.g. East Asian characters),
     1201             * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
     1202             * Do not translate into your own language.
     1203             */
     1204            'type'       => _x( 'words', 'Word count type. Do not translate!' ),
     1205            'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
     1206        )
     1207    );
    10911208}
    10921209
     
    11101227    $datepicker_date_format = str_replace(
    11111228        array(
    1112             'd', 'j', 'l', 'z', // Day.
    1113             'F', 'M', 'n', 'm', // Month.
    1114             'Y', 'y'            // Year.
     1229            'd',
     1230            'j',
     1231            'l',
     1232            'z', // Day.
     1233            'F',
     1234            'M',
     1235            'n',
     1236            'm', // Month.
     1237            'Y',
     1238            'y',            // Year.
    11151239        ),
    11161240        array(
    1117             'dd', 'd', 'DD', 'o',
    1118             'MM', 'M', 'm', 'mm',
    1119             'yy', 'y'
     1241            'dd',
     1242            'd',
     1243            'DD',
     1244            'o',
     1245            'MM',
     1246            'M',
     1247            'm',
     1248            'mm',
     1249            'yy',
     1250            'y',
    11201251        ),
    11211252        get_option( 'date_format' )
    11221253    );
    11231254
    1124     $datepicker_defaults = wp_json_encode( array(
    1125         'closeText'       => __( 'Close' ),
    1126         'currentText'     => __( 'Today' ),
    1127         'monthNames'      => array_values( $wp_locale->month ),
    1128         'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
    1129         'nextText'        => __( 'Next' ),
    1130         'prevText'        => __( 'Previous' ),
    1131         'dayNames'        => array_values( $wp_locale->weekday ),
    1132         'dayNamesShort'   => array_values( $wp_locale->weekday_abbrev ),
    1133         'dayNamesMin'     => array_values( $wp_locale->weekday_initial ),
    1134         'dateFormat'      => $datepicker_date_format,
    1135         'firstDay'        => absint( get_option( 'start_of_week' ) ),
    1136         'isRTL'           => $wp_locale->is_rtl(),
    1137     ) );
     1255    $datepicker_defaults = wp_json_encode(
     1256        array(
     1257            'closeText'       => __( 'Close' ),
     1258            'currentText'     => __( 'Today' ),
     1259            'monthNames'      => array_values( $wp_locale->month ),
     1260            'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
     1261            'nextText'        => __( 'Next' ),
     1262            'prevText'        => __( 'Previous' ),
     1263            'dayNames'        => array_values( $wp_locale->weekday ),
     1264            'dayNamesShort'   => array_values( $wp_locale->weekday_abbrev ),
     1265            'dayNamesMin'     => array_values( $wp_locale->weekday_initial ),
     1266            'dateFormat'      => $datepicker_date_format,
     1267            'firstDay'        => absint( get_option( 'start_of_week' ) ),
     1268            'isRTL'           => $wp_locale->is_rtl(),
     1269        )
     1270    );
    11381271
    11391272    wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
     
    11711304    $events_client = new WP_Community_Events( $user_id, $saved_location );
    11721305
    1173     wp_localize_script( 'dashboard', 'communityEventsData', array(
    1174         'nonce' => wp_create_nonce( 'community_events' ),
    1175         'cache' => $events_client->get_cached_events(),
    1176 
    1177         'l10n' => array(
    1178             'enter_closest_city' => __( 'Enter your closest city to find nearby events.' ),
    1179             'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ),
    1180             'attend_event_near_generic' => __( 'Attend an upcoming event near you.' ),
    1181 
    1182             /*
    1183              * These specific examples were chosen to highlight the fact that a
    1184              * state is not needed, even for cities whose name is not unique.
    1185              * It would be too cumbersome to include that in the instructions
    1186              * to the user, so it's left as an implication.
    1187              */
    1188             /* translators: %s is the name of the city we couldn't locate.
    1189              * Replace the examples with cities related to your locale. Test that
    1190              * they match the expected location and have upcoming events before
    1191              * including them. If no cities related to your locale have events,
    1192              * then use cities related to your locale that would be recognizable
    1193              * to most users. Use only the city name itself, without any region
    1194              * or country. Use the endonym (native locale name) instead of the
    1195              * English name if possible.
    1196              */
    1197             'could_not_locate_city' => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
    1198 
    1199             // This one is only used with wp.a11y.speak(), so it can/should be more brief.
    1200             /* translators: %s: the name of a city */
    1201             'city_updated' => __( 'City updated. Listing events near %s.' ),
    1202         )
    1203     ) );
     1306    wp_localize_script(
     1307        'dashboard', 'communityEventsData', array(
     1308            'nonce' => wp_create_nonce( 'community_events' ),
     1309            'cache' => $events_client->get_cached_events(),
     1310
     1311            'l10n'  => array(
     1312                'enter_closest_city'              => __( 'Enter your closest city to find nearby events.' ),
     1313                'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ),
     1314                'attend_event_near_generic'       => __( 'Attend an upcoming event near you.' ),
     1315
     1316                /*
     1317                 * These specific examples were chosen to highlight the fact that a
     1318                 * state is not needed, even for cities whose name is not unique.
     1319                 * It would be too cumbersome to include that in the instructions
     1320                 * to the user, so it's left as an implication.
     1321                 */
     1322                /* translators: %s is the name of the city we couldn't locate.
     1323                 * Replace the examples with cities related to your locale. Test that
     1324                 * they match the expected location and have upcoming events before
     1325                 * including them. If no cities related to your locale have events,
     1326                 * then use cities related to your locale that would be recognizable
     1327                 * to most users. Use only the city name itself, without any region
     1328                 * or country. Use the endonym (native locale name) instead of the
     1329                 * English name if possible.
     1330                 */
     1331                'could_not_locate_city'           => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
     1332
     1333                // This one is only used with wp.a11y.speak(), so it can/should be more brief.
     1334                /* translators: %s: the name of a city */
     1335                'city_updated'                    => __( 'City updated. Listing events near %s.' ),
     1336            ),
     1337        )
     1338    );
    12041339}
    12051340
     
    12271362    global $_wp_admin_css_colors;
    12281363
    1229     if ( wp_installing() )
     1364    if ( wp_installing() ) {
    12301365        return preg_replace( '#^wp-admin/#', './', $src );
     1366    }
    12311367
    12321368    if ( 'colors' == $handle ) {
    1233         $color = get_user_option('admin_color');
    1234 
    1235         if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
     1369        $color = get_user_option( 'admin_color' );
     1370
     1371        if ( empty( $color ) || ! isset( $_wp_admin_css_colors[ $color ] ) ) {
    12361372            $color = 'fresh';
    1237 
    1238         $color = $_wp_admin_css_colors[$color];
    1239         $url = $color->url;
     1373        }
     1374
     1375        $color = $_wp_admin_css_colors[ $color ];
     1376        $url   = $color->url;
    12401377
    12411378        if ( ! $url ) {
     
    12441381
    12451382        $parsed = parse_url( $src );
    1246         if ( isset($parsed['query']) && $parsed['query'] ) {
     1383        if ( isset( $parsed['query'] ) && $parsed['query'] ) {
    12471384            wp_parse_str( $parsed['query'], $qv );
    12481385            $url = add_query_arg( $qv, $url );
     
    12721409    global $concatenate_scripts;
    12731410
    1274     if ( ! did_action('wp_print_scripts') ) {
     1411    if ( ! did_action( 'wp_print_scripts' ) ) {
    12751412        /** This action is documented in wp-includes/functions.wp-scripts.php */
    12761413        do_action( 'wp_print_scripts' );
     
    13451482
    13461483    $zip = $compress_scripts ? 1 : 0;
    1347     if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
     1484    if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
    13481485        $zip = 'gzip';
     1486    }
    13491487
    13501488    if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
    13511489
    1352         if ( !empty($wp_scripts->print_code) ) {
     1490        if ( ! empty( $wp_scripts->print_code ) ) {
    13531491            echo "\n<script type='text/javascript'>\n";
    13541492            echo "/* <![CDATA[ */\n"; // not needed in HTML 5
     
    13621500
    13631501        $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
    1364         echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
    1365     }
    1366 
    1367     if ( !empty($wp_scripts->print_html) )
     1502        echo "<script type='text/javascript' src='" . esc_attr( $src ) . "'></script>\n";
     1503    }
     1504
     1505    if ( ! empty( $wp_scripts->print_html ) ) {
    13681506        echo $wp_scripts->print_html;
     1507    }
    13691508}
    13701509
     
    13821521 */
    13831522function wp_print_head_scripts() {
    1384     if ( ! did_action('wp_print_scripts') ) {
     1523    if ( ! did_action( 'wp_print_scripts' ) ) {
    13851524        /** This action is documented in wp-includes/functions.wp-scripts.php */
    13861525        do_action( 'wp_print_scripts' );
     
    14521591    script_concat_settings();
    14531592    $wp_styles->do_concat = $concatenate_scripts;
    1454     $wp_styles->do_items(false);
     1593    $wp_styles->do_items( false );
    14551594
    14561595    /**
     
    15191658
    15201659    $zip = $compress_css ? 1 : 0;
    1521     if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
     1660    if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
    15221661        $zip = 'gzip';
     1662    }
    15231663
    15241664    if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
     
    15301670
    15311671        $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver;
    1532         echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
    1533 
    1534         if ( !empty($wp_styles->print_code) ) {
     1672        echo "<link rel='stylesheet' href='" . esc_attr( $href ) . "' type='text/css' media='all' />\n";
     1673
     1674        if ( ! empty( $wp_styles->print_code ) ) {
    15351675            echo "<style type='text/css'>\n";
    15361676            echo $wp_styles->print_code;
     
    15391679    }
    15401680
    1541     if ( !empty($wp_styles->print_html) )
     1681    if ( ! empty( $wp_styles->print_html ) ) {
    15421682        echo $wp_styles->print_html;
     1683    }
    15431684}
    15441685
     
    15551696    global $concatenate_scripts, $compress_scripts, $compress_css;
    15561697
    1557     $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') );
    1558 
    1559     if ( ! isset($concatenate_scripts) ) {
    1560         $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
    1561         if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
     1698    $compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' == ini_get( 'output_handler' ) );
     1699
     1700    if ( ! isset( $concatenate_scripts ) ) {
     1701        $concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true;
     1702        if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
    15621703            $concatenate_scripts = false;
    1563     }
    1564 
    1565     if ( ! isset($compress_scripts) ) {
    1566         $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
    1567         if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
     1704        }
     1705    }
     1706
     1707    if ( ! isset( $compress_scripts ) ) {
     1708        $compress_scripts = defined( 'COMPRESS_SCRIPTS' ) ? COMPRESS_SCRIPTS : true;
     1709        if ( $compress_scripts && ( ! get_site_option( 'can_compress_scripts' ) || $compressed_output ) ) {
    15681710            $compress_scripts = false;
    1569     }
    1570 
    1571     if ( ! isset($compress_css) ) {
    1572         $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true;
    1573         if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
     1711        }
     1712    }
     1713
     1714    if ( ! isset( $compress_css ) ) {
     1715        $compress_css = defined( 'COMPRESS_CSS' ) ? COMPRESS_CSS : true;
     1716        if ( $compress_css && ( ! get_site_option( 'can_compress_scripts' ) || $compressed_output ) ) {
    15741717            $compress_css = false;
     1718        }
    15751719    }
    15761720}
Note: See TracChangeset for help on using the changeset viewer.