wp/wp-includes/script-loader.php
changeset 7 cf61fcea0001
parent 5 5e2f62d02dcd
child 9 177826044cd9
equal deleted inserted replaced
6:490d5cc509ed 7:cf61fcea0001
     1 <?php
     1 <?php
     2 /**
     2 /**
     3  * WordPress scripts and styles default loader.
     3  * WordPress scripts and styles default loader.
     4  *
       
     5  * Most of the functionality that existed here was moved to
       
     6  * {@link http://backpress.automattic.com/ BackPress}. WordPress themes and
       
     7  * plugins will only be concerned about the filters and actions set in this
       
     8  * file.
       
     9  *
     4  *
    10  * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
     5  * Several constants are used to manage the loading, concatenating and compression of scripts and CSS:
    11  * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
     6  * define('SCRIPT_DEBUG', true); loads the development (non-minified) versions of all scripts and CSS, and disables compression and concatenation,
    12  * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
     7  * define('CONCATENATE_SCRIPTS', false); disables compression and concatenation of scripts and CSS,
    13  * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
     8  * define('COMPRESS_SCRIPTS', false); disables compression of scripts,
    19  * as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted.
    14  * as option 'can_compress_scripts' (0/1). The test will run again if that option is deleted.
    20  *
    15  *
    21  * @package WordPress
    16  * @package WordPress
    22  */
    17  */
    23 
    18 
    24 /** BackPress: WordPress Dependencies Class */
    19 /** WordPress Dependency Class */
       
    20 require( ABSPATH . WPINC . '/class-wp-dependency.php' );
       
    21 
       
    22 /** WordPress Dependencies Class */
    25 require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
    23 require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
    26 
    24 
    27 /** BackPress: WordPress Scripts Class */
    25 /** WordPress Scripts Class */
    28 require( ABSPATH . WPINC . '/class.wp-scripts.php' );
    26 require( ABSPATH . WPINC . '/class.wp-scripts.php' );
    29 
    27 
    30 /** BackPress: WordPress Scripts Functions */
    28 /** WordPress Scripts Functions */
    31 require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
    29 require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
    32 
    30 
    33 /** BackPress: WordPress Styles Class */
    31 /** WordPress Styles Class */
    34 require( ABSPATH . WPINC . '/class.wp-styles.php' );
    32 require( ABSPATH . WPINC . '/class.wp-styles.php' );
    35 
    33 
    36 /** BackPress: WordPress Styles Functions */
    34 /** WordPress Styles Functions */
    37 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
    35 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
    38 
    36 
    39 /**
    37 /**
    40  * Register all WordPress scripts.
    38  * Register all WordPress scripts.
    41  *
    39  *
    42  * Localizes some of them.
    40  * Localizes some of them.
    43  * args order: $scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );
    41  * args order: `$scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );`
    44  * when last arg === 1 queues the script for the footer
    42  * when last arg === 1 queues the script for the footer
    45  *
    43  *
    46  * @since 2.6.0
    44  * @since 2.6.0
    47  *
    45  *
    48  * @param object $scripts WP_Scripts object.
    46  * @param WP_Scripts $scripts WP_Scripts object.
    49  */
    47  */
    50 function wp_default_scripts( &$scripts ) {
    48 function wp_default_scripts( &$scripts ) {
    51 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
    49 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
    52 
    50 
    53 	$develop_src = false !== strpos( $wp_version, '-src' );
    51 	$develop_src = false !== strpos( $wp_version, '-src' );
    77 		'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
    75 		'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
    78 	) );
    76 	) );
    79 
    77 
    80 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
    78 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
    81 	did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
    79 	did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
    82 		'warnDelete' => __( "You are about to permanently delete the selected items.\n  'Cancel' to stop, 'OK' to delete." ),
    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." ),
    83 		'dismiss'    => __( 'Dismiss this notice.' ),
    81 		'dismiss'      => __( 'Dismiss this notice.' ),
       
    82 		'collapseMenu' => __( 'Collapse Main menu' ),
       
    83 		'expandMenu'   => __( 'Expand Main menu' ),
    84 	) );
    84 	) );
    85 
    85 
    86 	$scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );
    86 	$scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );
    87 
    87 
    88 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
    88 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
    89 
    89 
    90 	$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
    90 	$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
    91 	did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array(
    91 	did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array(
    92 		'closeAllOpenTags'      => esc_attr__( 'Close all open tags' ),
    92 		'closeAllOpenTags'      => __( 'Close all open tags' ),
    93 		'closeTags'             => esc_attr__( 'close tags' ),
    93 		'closeTags'             => __( 'close tags' ),
    94 		'enterURL'              => __( 'Enter the URL' ),
    94 		'enterURL'              => __( 'Enter the URL' ),
    95 		'enterImageURL'         => __( 'Enter the URL of the image' ),
    95 		'enterImageURL'         => __( 'Enter the URL of the image' ),
    96 		'enterImageDescription' => __( 'Enter a description of the image' ),
    96 		'enterImageDescription' => __( 'Enter a description of the image' ),
    97 		'fullscreen'            => __( 'fullscreen' ),
    97 		'textdirection'         => __( 'text direction' ),
    98 		'toggleFullscreen'      => esc_attr__( 'Toggle fullscreen mode' ),
    98 		'toggleTextdirection'   => __( 'Toggle Editor Text Direction' ),
    99 		'textdirection'         => esc_attr__( 'text direction' ),
    99 		'dfw'                   => __( 'Distraction-free writing mode' ),
   100 		'toggleTextdirection'   => esc_attr__( 'Toggle Editor Text Direction' ),
   100 		'strong'          => __( 'Bold' ),
   101 		'dfw'                   => esc_attr__( 'Distraction-free writing mode' )
   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' ),
   102 	) );
   121 	) );
   103 
   122 
   104 	$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
   123 	$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
   105 
   124 
   106 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), false, 1 );
   125 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), false, 1 );
   107 
   126 
   108 	$scripts->add( 'wp-fullscreen', "/wp-admin/js/wp-fullscreen$suffix.js", array('jquery'), false, 1 );
   127 	// Back-compat for old DFW. To-do: remove at the end of 2016.
       
   128 	$scripts->add( 'wp-fullscreen-stub', "/wp-admin/js/wp-fullscreen-stub$suffix.js", array(), false, 1 );
   109 
   129 
   110 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 );
   130 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 );
   111 	did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
   131 	did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
   112 		'noPerm' => __('You do not have permission to do that.'),
   132 		'noPerm' => __('Sorry, you are not allowed to do that.'),
   113 		'broken' => __('An unidentified error has occurred.')
   133 		'broken' => __('Something went wrong.')
       
   134 	) );
       
   135 
       
   136 	$scripts->add( 'wp-api-request', "/wp-includes/js/api-request$suffix.js", array( 'jquery' ), false, 1 );
       
   137 	// `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/',
   114 	) );
   142 	) );
   115 
   143 
   116 	$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
   144 	$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
   117 	did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
   145 	did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
   118 		'dismiss' => __('Dismiss'),
   146 		'dismiss' => __('Dismiss'),
   121 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 );
   149 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 );
   122 
   150 
   123 	$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 );
   151 	$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 );
   124 	did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',
   152 	did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',
   125 		/**
   153 		/**
   126 		 * Filter the Heartbeat settings.
   154 		 * Filters the Heartbeat settings.
   127 		 *
   155 		 *
   128 		 * @since 3.6.0
   156 		 * @since 3.6.0
   129 		 *
   157 		 *
   130 		 * @param array $settings Heartbeat settings array.
   158 		 * @param array $settings Heartbeat settings array.
   131 		 */
   159 		 */
   135 	$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 );
   163 	$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 );
   136 	did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array(
   164 	did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array(
   137 		'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
   165 		'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
   138 
   166 
   139 		/**
   167 		/**
   140 		 * Filter the authentication check interval.
   168 		 * Filters the authentication check interval.
   141 		 *
   169 		 *
   142 		 * @since 3.6.0
   170 		 * @since 3.6.0
   143 		 *
   171 		 *
   144 		 * @param int $interval The interval in which to check a user's authentication.
   172 		 * @param int $interval The interval in which to check a user's authentication.
   145 		 *                      Default 3 minutes in seconds, or 180.
   173 		 *                      Default 3 minutes in seconds, or 180.
   148 	) );
   176 	) );
   149 
   177 
   150 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
   178 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
   151 
   179 
   152 	// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
   180 	// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
   153 	$scripts->add( 'prototype', '//ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
   181 	$scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
   154 	$scripts->add( 'scriptaculous-root', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
   182 	$scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
   155 	$scripts->add( 'scriptaculous-builder', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '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');
   156 	$scripts->add( 'scriptaculous-dragdrop', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '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');
   157 	$scripts->add( 'scriptaculous-effects', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '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');
   158 	$scripts->add( 'scriptaculous-slider', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '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');
   159 	$scripts->add( 'scriptaculous-sound', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
   187 	$scripts->add( 'scriptaculous-sound', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
   160 	$scripts->add( 'scriptaculous-controls', '//ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.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');
   161 	$scripts->add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') );
   189 	$scripts->add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') );
   162 
   190 
   163 	// not used in core, replaced by Jcrop.js
   191 	// not used in core, replaced by Jcrop.js
   164 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') );
   192 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') );
   165 
   193 
   166 	// jQuery
   194 	// jQuery
   167 	$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.11.2' );
   195 	$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4' );
   168 	$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.11.2' );
   196 	$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4' );
   169 	$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.2.1' );
   197 	$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
   170 
   198 
   171 	// full jQuery UI
   199 	// full jQuery UI
   172 	$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array('jquery'), '1.11.4', 1 );
   200 	$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array('jquery'), '1.11.4', 1 );
   173 	$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$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 );
   174 
   202 
   187 	$scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$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 );
   188 	$scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$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 );
   189 	$scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$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 );
   190 
   218 
   191 	$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 );
   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 );
   192 	$scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array('jquery-ui-menu'), '1.11.4', 1 );
   220 	$scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 );
   193 	$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 );
   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 );
   194 	$scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array('jquery-ui-core'), '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 );
   195 	$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 );
   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 );
   196 	$scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array('jquery-ui-mouse'), '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 );
   197 	$scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array('jquery-ui-draggable'), '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 );
   207 	$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 );
   235 	$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 );
   208 	$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 );
   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 );
   209 	$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 );
   237 	$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 );
   210 	$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '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 );
   211 
   239 
       
   240 	// 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 	) );
       
   249 
   212 	// deprecated, not used in core, most functionality is included in jQuery 1.3
   250 	// deprecated, not used in core, most functionality is included in jQuery 1.3
   213 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '3.37.0', 1 );
   251 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '4.2.1', 1 );
   214 
   252 
   215 	// jQuery plugins
   253 	// jQuery plugins
   216 	$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 );
   254 	$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 );
   217 	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
       
   218 	$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
   255 	$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
   219 	$scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
   256 	$scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
   220 	$scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2', 1 );
   257 	$scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2', 1 );
   221 	$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m', 1 );
   258 	$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m', 1 );
   222 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 );
   259 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 );
   223 	$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 );
   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 );
   224 
   261 
       
   262 	// 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 );
       
   264 
   225 	// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
   265 	// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
   226 	// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
   266 	// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
   227 	$scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array(), '3.1.2', 1 );
   267 	$scripts->add( 'imagesloaded', "/wp-includes/js/imagesloaded.min.js", array(), '3.2.0', 1 );
   228 	$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2', 1 );
   268 	$scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array( 'imagesloaded' ), '3.3.2', 1 );
       
   269 	$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 );
   229 
   270 
   230 	$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
   271 	$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
   231 	did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
   272 	did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
   232 			'next' => __('Next &gt;'),
   273 		'next' => __('Next &gt;'),
   233 			'prev' => __('&lt; Prev'),
   274 		'prev' => __('&lt; Prev'),
   234 			'image' => __('Image'),
   275 		'image' => __('Image'),
   235 			'of' => __('of'),
   276 		'of' => __('of'),
   236 			'close' => __('Close'),
   277 		'close' => __('Close'),
   237 			'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
   278 		'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
   238 			'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
   279 		'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
   239 	) );
   280 	) );
   240 
   281 
   241 	$scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12');
   282 	$scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12');
   242 
   283 
   243 	$scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417');
   284 	$scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417');
   244 
   285 
   245 	// error message for both plupload and swfupload
   286 	// Error messages for Plupload.
   246 	$uploader_l10n = array(
   287 	$uploader_l10n = array(
   247 		'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
   288 		'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
   248 		'file_exceeds_size_limit' => __('%s exceeds the maximum upload size for this site.'),
   289 		'file_exceeds_size_limit' => __('%s exceeds the maximum upload size for this site.'),
   249 		'zero_byte_file' => __('This file is empty. Please try another.'),
   290 		'zero_byte_file' => __('This file is empty. Please try another.'),
   250 		'invalid_filetype' => __('This file type is not allowed. Please try another.'),
   291 		'invalid_filetype' => __('Sorry, this file type is not permitted for security reasons.'),
   251 		'not_an_image' => __('This file is not an image. Please try another.'),
   292 		'not_an_image' => __('This file is not an image. Please try another.'),
   252 		'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
   293 		'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
   253 		'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),
   294 		'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),
   254 		'default_error' => __('An error occurred in the upload. Please try again later.'),
   295 		'default_error' => __('An error occurred in the upload. Please try again later.'),
   255 		'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
   296 		'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
   256 		'upload_limit_exceeded' => __('You may only upload 1 file.'),
   297 		'upload_limit_exceeded' => __('You may only upload 1 file.'),
   257 		'http_error' => __('HTTP error.'),
   298 		'http_error' => __('HTTP error.'),
   258 		'upload_failed' => __('Upload failed.'),
   299 		'upload_failed' => __('Upload failed.'),
       
   300 		/* translators: 1: Opening link tag, 2: Closing link tag */
   259 		'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.'),
   301 		'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.'),
   260 		'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.'),
   302 		'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.'),
   261 		'io_error' => __('IO error.'),
   303 		'io_error' => __('IO error.'),
   262 		'security_error' => __('Security error.'),
   304 		'security_error' => __('Security error.'),
   263 		'file_cancelled' => __('File canceled.'),
   305 		'file_cancelled' => __('File canceled.'),
   266 		'crunching' => __('Crunching&hellip;'),
   308 		'crunching' => __('Crunching&hellip;'),
   267 		'deleted' => __('moved to the trash.'),
   309 		'deleted' => __('moved to the trash.'),
   268 		'error_uploading' => __('&#8220;%s&#8221; has failed to upload.')
   310 		'error_uploading' => __('&#8220;%s&#8221; has failed to upload.')
   269 	);
   311 	);
   270 
   312 
   271 	$scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.1' );
   313 	$scripts->add( 'moxiejs', "/wp-includes/js/plupload/moxie$suffix.js", array(), '1.3.5' );
       
   314 	$scripts->add( 'plupload', "/wp-includes/js/plupload/plupload$suffix.js", array( 'moxiejs' ), '2.1.9' );
   272 	// Back compat handles:
   315 	// Back compat handles:
   273 	foreach ( array( 'all', 'html5', 'flash', 'silverlight', 'html4' ) as $handle ) {
   316 	foreach ( array( 'all', 'html5', 'flash', 'silverlight', 'html4' ) as $handle ) {
   274 		$scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' );
   317 		$scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' );
   275 	}
   318 	}
   276 
   319 
   280 	$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
   323 	$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
   281 	did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
   324 	did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
   282 
   325 
   283 	// keep 'swfupload' for back-compat.
   326 	// keep 'swfupload' for back-compat.
   284 	$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113');
   327 	$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113');
   285 	$scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201a');
   328 	$scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
   286 	$scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201');
       
   287 	$scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201');
       
   288 	$scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201');
       
   289 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524');
   329 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524');
   290 	did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
   330 	did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
   291 
   331 
   292 	$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
   332 	$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
   293 
   333 
   294 	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2011-02-23' );
   334 	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' );
   295 	did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
   335 	did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
   296 
   336 
   297 	$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.6.0', 1 );
   337 	$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 );
   298 	$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore','jquery' ), '1.1.2', 1 );
   338 	$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore','jquery' ), '1.2.3', 1 );
   299 
   339 
   300 	$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 );
   340 	$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 );
   301 	did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array(
   341 	did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array(
   302 		'ajax' => array(
   342 		'ajax' => array(
   303 			'url' => admin_url( 'admin-ajax.php', 'relative' ),
   343 			'url' => admin_url( 'admin-ajax.php', 'relative' ),
   304 		),
   344 		),
   305 	) );
   345 	) );
   306 
   346 
       
   347 	$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array('jquery'), false, 1 );
       
   348 
   307 	$scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 );
   349 	$scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 );
   308 
   350 
   309 	$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
   351 	$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
   310 
   352 
   311 	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), '0.9.10', 1 );
   353 	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1 );
   312 
   354 
   313 	$scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.16.2', 1 );
   355 	$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.6-78496d1' );
   314 	did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array(
   356 	$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.6-78496d1', 1 );
   315 		'language' => get_bloginfo( 'language' ),
   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(), '_-' ) ),
   316 		'strings'  => array(
   361 		'strings'  => array(
   317 			'Close'               => __( 'Close' ),
   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/' ),
   318 			'Fullscreen'          => __( 'Fullscreen' ),
   363 			'mejs.fullscreen-off'      => __( 'Turn off Fullscreen' ),
   319 			'Download File'       => __( 'Download File' ),
   364 			'mejs.fullscreen-on'       => __( 'Go Fullscreen' ),
   320 			'Download Video'      => __( 'Download Video' ),
   365 			'mejs.download-video'      => __( 'Download Video' ),
   321 			'Play/Pause'          => __( 'Play/Pause' ),
   366 			'mejs.fullscreen'          => __( 'Fullscreen' ),
   322 			'Mute Toggle'         => __( 'Mute Toggle' ),
   367 			'mejs.time-jump-forward'   => array( __( 'Jump forward 1 second' ), __( 'Jump forward %1 seconds' ) ),
   323 			'None'                => __( 'None' ),
   368 			'mejs.loop'                => __( 'Toggle Loop' ),
   324 			'Turn off Fullscreen' => __( 'Turn off Fullscreen' ),
   369 			'mejs.play'                => __( 'Play' ),
   325 			'Go Fullscreen'       => __( 'Go Fullscreen' ),
   370 			'mejs.pause'               => __( 'Pause' ),
   326 			'Unmute'              => __( 'Unmute' ),
   371 			'mejs.close'               => __( 'Close' ),
   327 			'Mute'                => __( 'Mute' ),
   372 			'mejs.time-slider'         => __( 'Time Slider' ),
   328 			'Captions/Subtitles'  => __( 'Captions/Subtitles' )
   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 );
       
   452 	$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',
       
   458 		/**
       
   459 		 * Filters the MediaElement configuration settings.
       
   460 		 *
       
   461 		 * @since 4.4.0
       
   462 		 *
       
   463 		 * @param array $mejs_settings MediaElement settings array.
       
   464 		 */
       
   465 		apply_filters( 'mejs_settings', $mejs_settings )
       
   466 	);
       
   467 
       
   468 	$scripts->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.js', array(), '5.29.1-alpha-ee20357' );
       
   469 	$scripts->add( 'csslint', '/wp-includes/js/codemirror/csslint.js', array(), '1.0.5' );
       
   470 	$scripts->add( 'jshint', '/wp-includes/js/codemirror/jshint.js', array(), '2.9.5.999' );
       
   471 	$scripts->add( 'jsonlint', '/wp-includes/js/codemirror/jsonlint.js', array(), '1.6.2' );
       
   472 	$scripts->add( 'htmlhint', '/wp-includes/js/codemirror/htmlhint.js', array(), '0.9.14-xwp' );
       
   473 	$scripts->add( 'htmlhint-kses', '/wp-includes/js/codemirror/htmlhint-kses.js', array( 'htmlhint' ) );
       
   474 	$scripts->add( 'code-editor', "/wp-admin/js/code-editor$suffix.js", array( 'jquery', 'wp-codemirror', 'underscore' ) );
       
   475 	$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.
   329 		),
   484 		),
   330 	) );
   485 	) ) ) );
   331 
   486 
   332 
   487 	$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
   333 	$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.js", array('mediaelement'), false, 1 );
       
   334 	did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings', array(
       
   335 		'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),
       
   336 	) );
       
   337 
       
   338 	$scripts->add( 'froogaloop',  "/wp-includes/js/mediaelement/froogaloop.min.js", array(), '2.0' );
       
   339 	$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
       
   340 
   488 
   341 	$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
   489 	$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
   342 	did_action( 'init' ) && $scripts->localize( 'zxcvbn-async', '_zxcvbnSettings', array(
   490 	did_action( 'init' ) && $scripts->localize( 'zxcvbn-async', '_zxcvbnSettings', array(
   343 		'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
   491 		'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
   344 	) );
   492 	) );
   345 
   493 
   346 	$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
   494 	$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
   347 	did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
   495 	did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
   348 		'empty' => __('Strength indicator'),
   496 		'unknown'  => _x( 'Password strength unknown', 'password strength' ),
   349 		'short' => __('Very weak'),
   497 		'short'    => _x( 'Very weak', 'password strength' ),
   350 		'bad' => __('Weak'),
   498 		'bad'      => _x( 'Weak', 'password strength' ),
   351 		/* translators: password strength */
   499 		'good'     => _x( 'Medium', 'password strength' ),
   352 		'good' => _x('Medium', 'password strength'),
   500 		'strong'   => _x( 'Strong', 'password strength' ),
   353 		'strong' => __('Strong'),
   501 		'mismatch' => _x( 'Mismatch', 'password mismatch' ),
   354 		'mismatch' => __('Mismatch')
       
   355 	) );
   502 	) );
   356 
   503 
   357 	$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
   504 	$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 	) );
       
   514 
   358 	$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
   515 	$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
   359 
   516 
   360 	$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
   517 	$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
   361 
   518 
   362 	$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
   519 	$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
   363 
   520 
   364 	$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery' ), false, 1 );
   521 	$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
   365 	did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array(
   522 	did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array(
   366 		'title' => __('Insert/edit link'),
   523 		'title' => __('Insert/edit link'),
   367 		'update' => __('Update'),
   524 		'update' => __('Update'),
   368 		'save' => __('Add Link'),
   525 		'save' => __('Add Link'),
   369 		'noTitle' => __('(no title)'),
   526 		'noTitle' => __('(no title)'),
   370 		'noMatchesFound' => __('No results found.')
   527 		'noMatchesFound' => __('No results found.'),
       
   528 		'linkSelected' => __( 'Link selected.' ),
       
   529 		'linkInserted' => __( 'Link inserted.' ),
   371 	) );
   530 	) );
   372 
   531 
   373 	$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
   532 	$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
   374 
   533 
   375 	$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array( 'jquery' ), false, 1 );
   534 	$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );
   376 	did_action( 'init' ) && $scripts->localize( 'word-count', 'wordCountL10n', array(
       
   377 		/* translators: If your word count is based on single characters (East Asian characters),
       
   378 		   enter 'characters'. Otherwise, enter 'words'. Do not translate into your own language. */
       
   379 		'type' => 'characters' == _x( 'words', 'word count: words or characters?' ) ? 'c' : 'w',
       
   380 	) );
       
   381 
   535 
   382 	$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
   536 	$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
   383 
   537 
   384 	$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '1.8.1', 1 );
   538 	$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '1.8.1', 1 );
   385 
   539 
   386 	$scripts->add( 'customize-base',     "/wp-includes/js/customize-base$suffix.js",     array( 'jquery', 'json2', 'underscore', 'wp-a11y' ), false, 1 );
   540 	$scripts->add( 'customize-base',     "/wp-includes/js/customize-base$suffix.js",     array( 'jquery', 'json2', 'underscore' ), false, 1 );
   387 	$scripts->add( 'customize-loader',   "/wp-includes/js/customize-loader$suffix.js",   array( 'customize-base' ), false, 1 );
   541 	$scripts->add( 'customize-loader',   "/wp-includes/js/customize-loader$suffix.js",   array( 'customize-base' ), false, 1 );
   388 	$scripts->add( 'customize-preview',  "/wp-includes/js/customize-preview$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 );
   389 	$scripts->add( 'customize-models',   "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 );
   543 	$scripts->add( 'customize-models',   "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 );
   390 	$scripts->add( 'customize-views',    "/wp-includes/js/customize-views.js",  array( 'jquery', 'underscore', 'imgareaselect', 'customize-models' ), 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 );
   391 	$scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base' ), false, 1 );
   545 	$scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util', 'jquery-ui-core' ), false, 1 );
   392 	did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
   546 	did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
   393 		'activate'           => __( 'Save &amp; Activate' ),
   547 		'activate'           => __( 'Activate &amp; Publish' ),
   394 		'save'               => __( 'Save &amp; Publish' ),
   548 		'save'               => __( 'Save &amp; 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.' ),
   395 		'saveAlert'          => __( 'The changes you made will be lost if you navigate away from this page.' ),
   559 		'saveAlert'          => __( 'The changes you made will be lost if you navigate away from this page.' ),
   396 		'saved'              => __( 'Saved' ),
   560 		'saved'              => __( 'Saved' ),
   397 		'cancel'             => __( 'Cancel' ),
   561 		'cancel'             => __( 'Cancel' ),
   398 		'close'              => __( 'Close' ),
   562 		'close'              => __( 'Close' ),
   399 		'cheatin'            => __( 'Cheatin&#8217; uh?' ),
   563 		'action'             => __( 'Action' ),
       
   564 		'discardChanges'     => __( 'Discard changes' ),
       
   565 		'cheatin'            => __( 'Something went wrong.' ),
       
   566 		'notAllowedHeading'  => __( 'You need a higher level of permission.' ),
       
   567 		'notAllowed'         => __( 'Sorry, you are not allowed to customize this site.' ),
   400 		'previewIframeTitle' => __( 'Site Preview' ),
   568 		'previewIframeTitle' => __( 'Site Preview' ),
   401 		'loginIframeTitle'   => __( 'Session expired' ),
   569 		'loginIframeTitle'   => __( 'Session expired' ),
   402 
   570 		'collapseSidebar'    => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),
       
   571 		'expandSidebar'      => _x( 'Show Controls', 'label for hide controls button without length constraints' ),
       
   572 		'untitledBlogName'   => __( '(Untitled)' ),
       
   573 		'unknownRequestFail' => __( 'Looks like something&#8217;s gone wrong. Wait a couple seconds, and then try again.' ),
       
   574 		'themeDownloading'   => __( 'Downloading your new theme&hellip;' ),
       
   575 		'themePreviewWait'   => __( 'Setting up your live preview. This may take a bit.' ),
       
   576 		'revertingChanges'   => __( 'Reverting unpublished changes&hellip;' ),
       
   577 		'trashConfirm'       => __( 'Are you sure you&#8217;d like to discard your unpublished changes?' ),
       
   578 		/* translators: %s: Display name of the user who has taken over the changeset in customizer. */
       
   579 		'takenOverMessage'   => __( '%s has taken over and is currently customizing.' ),
       
   580 		/* translators: %s: URL to the Customizer to load the autosaved version */
       
   581 		'autosaveNotice'     => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
       
   582 		'videoHeaderNotice'  => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
   403 		// Used for overriding the file types allowed in plupload.
   583 		// Used for overriding the file types allowed in plupload.
   404 		'allowedFiles' => __( 'Allowed Files' ),
   584 		'allowedFiles'       => __( 'Allowed Files' ),
   405 	) );
   585 		'customCssError'     => array(
       
   586 			/* translators: %d: error count */
       
   587 			'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 ),
       
   588 			/* translators: %d: error count */
       
   589 			'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.
       
   590 		),
       
   591 		'pageOnFrontError' => __( 'Homepage and posts page must be different.' ),
       
   592 		'saveBlockedError' => array(
       
   593 			/* translators: %s: number of invalid settings */
       
   594 			'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
       
   595 			/* translators: %s: number of invalid settings */
       
   596 			'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.
       
   597 		),
       
   598 		'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
       
   599 		'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.' ),
       
   600 		'themeInstallUnavailable' => sprintf(
       
   601 			/* translators: %s: URL to Add Themes admin screen */
       
   602 			__( '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>.' ),
       
   603 			esc_url( admin_url( 'theme-install.php' ) )
       
   604 		),
       
   605 		'publishSettings' => __( 'Publish Settings' ),
       
   606 		'invalidDate'     => __( 'Invalid date.' ),
       
   607 		'invalidValue'    => __( 'Invalid value.' ),
       
   608 	) );
       
   609 	$scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
   406 
   610 
   407 	$scripts->add( 'customize-widgets', "/wp-admin/js/customize-widgets$suffix.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-droppable', 'wp-backbone', 'customize-controls' ), false, 1 );
   611 	$scripts->add( 'customize-widgets', "/wp-admin/js/customize-widgets$suffix.js", array( 'jquery', 'jquery-ui-sortable', 'jquery-ui-droppable', 'wp-backbone', 'customize-controls' ), false, 1 );
   408 	$scripts->add( 'customize-preview-widgets', "/wp-includes/js/customize-preview-widgets$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
   612 	$scripts->add( 'customize-preview-widgets', "/wp-includes/js/customize-preview-widgets$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 );
       
   613 
       
   614 	$scripts->add( 'customize-nav-menus', "/wp-admin/js/customize-nav-menus$suffix.js", array( 'jquery', 'wp-backbone', 'customize-controls', 'accordion', 'nav-menu' ), false, 1 );
       
   615 	$scripts->add( 'customize-preview-nav-menus', "/wp-includes/js/customize-preview-nav-menus$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 );
       
   616 
       
   617 	$scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array( 'wp-a11y' ), false, 1 );
   409 
   618 
   410 	$scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 );
   619 	$scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 );
   411 
   620 
   412 	$scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
   621 	$scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
   413 	$scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
   622 	$scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
   416 			'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
   625 			'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
   417 			'post' => array( 'id' => 0 ),
   626 			'post' => array( 'id' => 0 ),
   418 		),
   627 		),
   419 	) );
   628 	) );
   420 
   629 
       
   630 	$scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" );
       
   631 
   421 	// To enqueue media-views or media-editor, call wp_enqueue_media().
   632 	// To enqueue media-views or media-editor, call wp_enqueue_media().
   422 	// Both rely on numerous settings, styles, and templates to operate correctly.
   633 	// Both rely on numerous settings, styles, and templates to operate correctly.
   423 	$scripts->add( 'media-views',  "/wp-includes/js/media-views$suffix.js",  array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement' ), false, 1 );
   634 	$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 );
   424 	$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
   635 	$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
   425 	$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
   636 	$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
   426 	$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'media-models', 'media-audiovideo', 'wp-playlist' ), false, 1 );
   637 	$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
       
   638 
       
   639 	$scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 );
   427 
   640 
   428 	if ( is_admin() ) {
   641 	if ( is_admin() ) {
   429 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
   642 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
   430 		did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
   643 		did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
   431 			'noPerm' => __('You do not have permission to do that.'),
   644 			'noPerm' => __('Sorry, you are not allowed to do that.'),
   432 			'broken' => __('An unidentified error has occurred.')
   645 			'broken' => __('Something went wrong.')
   433 		));
   646 		));
   434 
   647 
   435 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
   648 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
   436 		did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
   649 		did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
   437 			'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
   650 			'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
   438 			'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
   651 			'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
   439 			'replyApprove' => __( 'Approve and Reply' ),
   652 			'replyApprove' => __( 'Approve and Reply' ),
   440 			'reply' => __( 'Reply' )
   653 			'reply' => __( 'Reply' ),
       
   654 			'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
       
   655 			'warnCommentChanges' => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),
       
   656 			'docTitleComments' => __( 'Comments' ),
       
   657 			/* translators: %s: comments count */
       
   658 			'docTitleCommentsCount' => __( 'Comments (%s)' ),
   441 		) );
   659 		) );
   442 
   660 
   443 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );
   661 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );
       
   662 		did_action( 'init' ) && $scripts->localize(
       
   663 			'xfn', 'privacyToolsL10n', array(
       
   664 				'noDataFound'     => __( 'No personal data was found for this user.' ),
       
   665 				'foundAndRemoved' => __( 'All of the personal data found for this user was erased.' ),
       
   666 				'noneRemoved'     => __( 'Personal data was found for this user but was not erased.' ),
       
   667 				'someNotRemoved'  => __( 'Personal data was found for this user but some of the personal data found was not erased.' ),
       
   668 				'removalError'    => __( 'An error occurred while attempting to find and erase personal data.' ),
       
   669 				'noExportFile'    => __( 'No personal data export file was generated.' ),
       
   670 				'exportError'     => __( 'An error occurred while attempting to export personal data.' ),
       
   671 			)
       
   672 		);
   444 
   673 
   445 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
   674 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
   446 
   675 		did_action( 'init' ) && $scripts->localize( 'postbox', 'postBoxL10n', array(
   447 		$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
   676 			'postBoxEmptyString' => __( 'Drag boxes here' ),
   448 		did_action( 'init' ) && $scripts->localize( 'tags-box', 'tagsBoxL10n', array(
   677 		) );
       
   678 
       
   679 		$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
       
   680 
       
   681 		$scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
       
   682 		did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array(
   449 			'tagDelimiter' => _x( ',', 'tag delimiter' ),
   683 			'tagDelimiter' => _x( ',', 'tag delimiter' ),
       
   684 			'removeTerm'   => __( 'Remove term:' ),
       
   685 			'termSelected' => __( 'Term selected.' ),
       
   686 			'termAdded'    => __( 'Term added.' ),
       
   687 			'termRemoved'  => __( 'Term removed.' ),
   450 		) );
   688 		) );
   451 
   689 
   452 		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box' ), false, 1 );
   690 		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 );
   453 		did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
   691 		did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
   454 			'ok' => __('OK'),
   692 			'ok' => __('OK'),
   455 			'cancel' => __('Cancel'),
   693 			'cancel' => __('Cancel'),
   456 			'publishOn' => __('Publish on:'),
   694 			'publishOn' => __('Publish on:'),
   457 			'publishOnFuture' =>  __('Schedule for:'),
   695 			'publishOnFuture' =>  __('Schedule for:'),
   458 			'publishOnPast' => __('Published on:'),
   696 			'publishOnPast' => __('Published on:'),
   459 			/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
   697 			/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
   460 			'dateFormat' => __('%1$s %2$s, %3$s @ %4$s : %5$s'),
   698 			'dateFormat' => __('%1$s %2$s, %3$s @ %4$s:%5$s'),
   461 			'showcomm' => __('Show more comments'),
   699 			'showcomm' => __('Show more comments'),
   462 			'endcomm' => __('No more comments found.'),
   700 			'endcomm' => __('No more comments found.'),
   463 			'publish' => __('Publish'),
   701 			'publish' => __('Publish'),
   464 			'schedule' => __('Schedule'),
   702 			'schedule' => _x('Schedule', 'post action/button label'),
   465 			'update' => __('Update'),
   703 			'update' => __('Update'),
   466 			'savePending' => __('Save as Pending'),
   704 			'savePending' => __('Save as Pending'),
   467 			'saveDraft' => __('Save Draft'),
   705 			'saveDraft' => __('Save Draft'),
   468 			'private' => __('Private'),
   706 			'private' => __('Private'),
   469 			'public' => __('Public'),
   707 			'public' => __('Public'),
   471 			'password' => __('Password Protected'),
   709 			'password' => __('Password Protected'),
   472 			'privatelyPublished' => __('Privately Published'),
   710 			'privatelyPublished' => __('Privately Published'),
   473 			'published' => __('Published'),
   711 			'published' => __('Published'),
   474 			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
   712 			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
   475 			'savingText' => __('Saving Draft&#8230;'),
   713 			'savingText' => __('Saving Draft&#8230;'),
       
   714 			'permalinkSaved' => __( 'Permalink saved' ),
   476 		) );
   715 		) );
   477 
   716 
   478 		$scripts->add( 'press-this', "/wp-admin/js/press-this$suffix.js", array( 'jquery', 'tags-box' ), false, 1 );
   717 		$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
   479 		did_action( 'init' ) && $scripts->localize( 'press-this', 'pressThisL10n', array(
       
   480 			'newPost' => __( 'Title' ),
       
   481 			'serverError' => __( 'Connection lost or the server is busy. Please try again later.' ),
       
   482 			'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
   483 			/* translators: %d: nth embed found in a post */
       
   484 			'suggestedEmbedAlt' => __( 'Suggested embed #%d' ),
       
   485 			/* translators: %d: nth image found in a post */
       
   486 			'suggestedImgAlt' => __( 'Suggested image #%d' ),
       
   487 		) );
       
   488 
       
   489 		$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery' ), false, 1 );
       
   490 
   718 
   491 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
   719 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
   492 
   720 
   493 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
   721 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
   494 		$scripts->add_data( 'comment', 'group', 1 );
   722 		$scripts->add_data( 'comment', 'group', 1 );
   495 		did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
   723 		did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
   496 			'submittedOn' => __('Submitted on:')
   724 			'submittedOn' => __( 'Submitted on:' ),
       
   725 			/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
       
   726 			'dateFormat' => __( '%1$s %2$s, %3$s @ %4$s:%5$s' )
   497 		) );
   727 		) );
   498 
   728 
   499 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
   729 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
   500 
   730 
   501 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
   731 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
   502 
   732 		did_action( 'init' ) && $scripts->add_inline_script( 'admin-widgets', sprintf( 'wpWidgets.l10n = %s;', wp_json_encode( array(
   503 		$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 );
   733 			'save' => __( 'Save' ),
   504 
   734 			'saved' => __( 'Saved' ),
   505 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'suggest' ), false, 1 );
   735 			'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
   736 		) ) ) );
       
   737 
       
   738 		$scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
       
   739 		$scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' );
       
   740 
       
   741 		$scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
       
   742 		$scripts->add( 'media-image-widget', "/wp-admin/js/widgets/media-image-widget$suffix.js", array( 'media-widgets' ) );
       
   743 		$scripts->add( 'media-gallery-widget', "/wp-admin/js/widgets/media-gallery-widget$suffix.js", array( 'media-widgets' ) );
       
   744 		$scripts->add( 'media-video-widget', "/wp-admin/js/widgets/media-video-widget$suffix.js", array( 'media-widgets', 'media-audiovideo', 'wp-api-request' ) );
       
   745 		$scripts->add( 'text-widgets', "/wp-admin/js/widgets/text-widgets$suffix.js", array( 'jquery', 'backbone', 'editor', 'wp-util', 'wp-a11y' ) );
       
   746 		$scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) );
       
   747 
       
   748 		$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 );
       
   749 
       
   750 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
   506 		did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
   751 		did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
   507 			'error' => __('Error while saving the changes.'),
   752 			'error'      => __( 'Error while saving the changes.' ),
   508 			'ntdeltitle' => __('Remove From Bulk Edit'),
   753 			'ntdeltitle' => __( 'Remove From Bulk Edit' ),
   509 			'notitle' => __('(no title)'),
   754 			'notitle'    => __( '(no title)' ),
   510 			'comma' => trim( _x( ',', 'tag delimiter' ) ),
   755 			'comma'      => trim( _x( ',', 'tag delimiter' ) ),
       
   756 			'saved'      => __( 'Changes saved.' ),
   511 		) );
   757 		) );
   512 
   758 
   513 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery' ), false, 1 );
   759 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
   514 		did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
   760 		did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
   515 			'error' => __('Error while saving the changes.')
   761 			'error' => __( 'Error while saving the changes.' ),
       
   762 			'saved' => __( 'Changes saved.' ),
   516 		) );
   763 		) );
   517 
   764 
   518 		$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'thickbox' ), false, 1 );
   765 		$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
   519 		did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
   766 		did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
   520 			'plugin_information' => __('Plugin Information:'),
   767 			'plugin_information' => __( 'Plugin:' ),
       
   768 			'plugin_modal_label' => __( 'Plugin details' ),
   521 			'ays' => __('Are you sure you want to install this plugin?')
   769 			'ays' => __('Are you sure you want to install this plugin?')
   522 		) );
   770 		) );
   523 
   771 
   524 		$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ) );
   772 		$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
   525 		did_action( 'init' ) && $scripts->localize( 'updates', '_wpUpdatesSettings', array(
   773 		did_action( 'init' ) && $scripts->localize( 'updates', '_wpUpdatesSettings', array(
   526 			'ajax_nonce' => wp_create_nonce( 'updates' ),
   774 			'ajax_nonce' => wp_create_nonce( 'updates' ),
   527 			'l10n'       => array(
   775 			'l10n'       => array(
   528 				'updating'          => __( 'Updating...' ),
   776 				/* translators: %s: Search string */
   529 				'updated'           => __( 'Updated!' ),
   777 				'searchResults'              => __( 'Search results for &#8220;%s&#8221;' ),
   530 				'updateFailed'      => __( 'Update Failed' ),
   778 				'searchResultsLabel'         => __( 'Search Results' ),
   531 				/* translators: Plugin name and version */
   779 				'noPlugins'                  => __( 'You do not appear to have any plugins available at this time.' ),
   532 				'updatingLabel'     => __( 'Updating %s...' ),
   780 				'noItemsSelected'            => __( 'Please select at least one item to perform this action on.' ),
   533 				/* translators: Plugin name and version */
   781 				'updating'                   => __( 'Updating...' ), // No ellipsis.
   534 				'updatedLabel'      => __( '%s updated!' ),
   782 				'pluginUpdated'              => _x( 'Updated!', 'plugin' ),
   535 				/* translators: Plugin name and version */
   783 				'themeUpdated'               => _x( 'Updated!', 'theme' ),
   536 				'updateFailedLabel' => __( '%s update failed' ),
   784 				'update'                     => __( 'Update' ),
   537 				/* translators: JavaScript accessible string */
   785 				'updateNow'                  => __( 'Update Now' ),
   538 				'updatingMsg'       => __( 'Updating... please wait.' ),
   786 				/* translators: %s: Plugin name and version */
   539 				/* translators: JavaScript accessible string */
   787 				'pluginUpdateNowLabel'       => _x( 'Update %s now', 'plugin' ),
   540 				'updatedMsg'        => __( 'Update completed successfully.' ),
   788 				'updateFailedShort'          => __( 'Update Failed!' ),
   541 				/* translators: JavaScript accessible string */
   789 				/* translators: %s: Error string for a failed update */
   542 				'updateCancel'      => __( 'Update canceled.' ),
   790 				'updateFailed'               => __( 'Update Failed: %s' ),
   543 				'beforeunload'      => __( 'Plugin updates may not complete if you navigate away from this page.' ),
   791 				/* translators: %s: Plugin name and version */
   544 			)
   792 				'pluginUpdatingLabel'        => _x( 'Updating %s...', 'plugin' ), // No ellipsis.
       
   793 				/* translators: %s: Plugin name and version */
       
   794 				'pluginUpdatedLabel'         => _x( '%s updated!', 'plugin' ),
       
   795 				/* translators: %s: Plugin name and version */
       
   796 				'pluginUpdateFailedLabel'    => _x( '%s update failed', 'plugin' ),
       
   797 				/* translators: Accessibility text */
       
   798 				'updatingMsg'                => __( 'Updating... please wait.' ), // No ellipsis.
       
   799 				/* translators: Accessibility text */
       
   800 				'updatedMsg'                 => __( 'Update completed successfully.' ),
       
   801 				/* translators: Accessibility text */
       
   802 				'updateCancel'               => __( 'Update canceled.' ),
       
   803 				'beforeunload'               => __( 'Updates may not complete if you navigate away from this page.' ),
       
   804 				'installNow'                 => __( 'Install Now' ),
       
   805 				/* translators: %s: Plugin name */
       
   806 				'pluginInstallNowLabel'      => _x( 'Install %s now', 'plugin' ),
       
   807 				'installing'                 => __( 'Installing...' ),
       
   808 				'pluginInstalled'            => _x( 'Installed!', 'plugin' ),
       
   809 				'themeInstalled'             => _x( 'Installed!', 'theme' ),
       
   810 				'installFailedShort'         => __( 'Installation Failed!' ),
       
   811 				/* translators: %s: Error string for a failed installation */
       
   812 				'installFailed'              => __( 'Installation failed: %s' ),
       
   813 				/* translators: %s: Plugin name and version */
       
   814 				'pluginInstallingLabel'      => _x( 'Installing %s...', 'plugin' ), // no ellipsis
       
   815 				/* translators: %s: Theme name and version */
       
   816 				'themeInstallingLabel'       => _x( 'Installing %s...', 'theme' ), // no ellipsis
       
   817 				/* translators: %s: Plugin name and version */
       
   818 				'pluginInstalledLabel'       => _x( '%s installed!', 'plugin' ),
       
   819 				/* translators: %s: Theme name and version */
       
   820 				'themeInstalledLabel'        => _x( '%s installed!', 'theme' ),
       
   821 				/* translators: %s: Plugin name and version */
       
   822 				'pluginInstallFailedLabel'   => _x( '%s installation failed', 'plugin' ),
       
   823 				/* translators: %s: Theme name and version */
       
   824 				'themeInstallFailedLabel'    => _x( '%s installation failed', 'theme' ),
       
   825 				'installingMsg'              => __( 'Installing... please wait.' ),
       
   826 				'installedMsg'               => __( 'Installation completed successfully.' ),
       
   827 				/* translators: %s: Activation URL */
       
   828 				'importerInstalledMsg'       => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),
       
   829 				/* translators: %s: Theme name */
       
   830 				'aysDelete'                  => __( 'Are you sure you want to delete %s?' ),
       
   831 				/* translators: %s: Plugin name */
       
   832 				'aysDeleteUninstall'         => __( 'Are you sure you want to delete %s and its data?' ),
       
   833 				'aysBulkDelete'              => __( 'Are you sure you want to delete the selected plugins and their data?' ),
       
   834 				'aysBulkDeleteThemes'        => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),
       
   835 				'deleting'                   => __( 'Deleting...' ),
       
   836 				/* translators: %s: Error string for a failed deletion */
       
   837 				'deleteFailed'               => __( 'Deletion failed: %s' ),
       
   838 				'pluginDeleted'              => _x( 'Deleted!', 'plugin' ),
       
   839 				'themeDeleted'               => _x( 'Deleted!', 'theme' ),
       
   840 				'livePreview'                => __( 'Live Preview' ),
       
   841 				'activatePlugin'             => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),
       
   842 				'activateTheme'              => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),
       
   843 				/* translators: %s: Plugin name */
       
   844 				'activatePluginLabel'        => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),
       
   845 				/* translators: %s: Theme name */
       
   846 				'activateThemeLabel'         => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),
       
   847 				'activateImporter'           => __( 'Run Importer' ),
       
   848 				/* translators: %s: Importer name */
       
   849 				'activateImporterLabel'      => __( 'Run %s' ),
       
   850 				'unknownError'               => __( 'Something went wrong.' ),
       
   851 				'connectionError'            => __( 'Connection lost or the server is busy. Please try again later.' ),
       
   852 				'nonceError'                 => __( 'An error has occurred. Please reload the page and try again.' ),
       
   853 				'pluginsFound'               => __( 'Number of plugins found: %d' ),
       
   854 				'noPluginsFound'             => __( 'No plugins found. Try a different search.' ),
       
   855 			),
   545 		) );
   856 		) );
   546 
   857 
   547 		$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
   858 		$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
   548 
   859 
   549 		$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
   860 		$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
   550 		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
   861 		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
   551 		did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
   862 		did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
   552 			'clear' => __( 'Clear' ),
   863 			'clear'            => __( 'Clear' ),
   553 			'defaultString' => __( 'Default' ),
   864 			'clearAriaLabel'   => __( 'Clear color' ),
   554 			'pick' => __( 'Select Color' ),
   865 			'defaultString'    => __( 'Default' ),
   555 			'current' => __( 'Current Color' ),
   866 			'defaultAriaLabel' => __( 'Select default color' ),
       
   867 			'pick'             => __( 'Select Color' ),
       
   868 			'defaultLabel'     => __( 'Color value' ),
   556 		) );
   869 		) );
   557 
   870 
   558 		$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), false, 1 );
   871 		$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 );
   559 
   872 
   560 		$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
   873 		$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
   561 
   874 
   562 		$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
   875 		$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
   563 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
   876 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
   571 		));
   884 		));
   572 
   885 
   573 		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
   886 		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
   574 		did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
   887 		did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
   575 			'setThumbnail' => __( 'Use as featured image' ),
   888 			'setThumbnail' => __( 'Use as featured image' ),
   576 			'saving' => __( 'Saving...' ),
   889 			'saving' => __( 'Saving...' ), // no ellipsis
   577 			'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
   890 			'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
   578 			'done' => __( 'Done' )
   891 			'done' => __( 'Done' )
   579 		) );
   892 		) );
   580 
   893 
   581 		// Navigation Menus
   894 		// Navigation Menus
   582 		$scripts->add( 'nav-menu', "/wp-admin/js/nav-menu$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-lists', 'postbox' ) );
   895 		$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' ) );
   583 		did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
   896 		did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
   584 			'noResultsFound' => __( 'No results found.' ),
   897 			'noResultsFound' => __( 'No results found.' ),
   585 			'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
   898 			'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
   586 			'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
   899 			'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
   587 			'untitled' => _x( '(no label)', 'missing menu item navigation label' )
   900 			'untitled' => _x( '(no label)', 'missing menu item navigation label' )
   606  * Adding default styles is not the only task, it also assigns the base_url
   919  * Adding default styles is not the only task, it also assigns the base_url
   607  * property, the default version, and text direction for the object.
   920  * property, the default version, and text direction for the object.
   608  *
   921  *
   609  * @since 2.6.0
   922  * @since 2.6.0
   610  *
   923  *
   611  * @param object $styles
   924  * @param WP_Styles $styles
   612  */
   925  */
   613 function wp_default_styles( &$styles ) {
   926 function wp_default_styles( &$styles ) {
   614 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
   927 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
   615 
   928 
   616 	if ( ! defined( 'SCRIPT_DEBUG' ) )
   929 	if ( ! defined( 'SCRIPT_DEBUG' ) )
   623 	$styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
   936 	$styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
   624 	$styles->default_version = get_bloginfo( 'version' );
   937 	$styles->default_version = get_bloginfo( 'version' );
   625 	$styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
   938 	$styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
   626 	$styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
   939 	$styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
   627 
   940 
       
   941 	// Open Sans is no longer used by core, but may be relied upon by themes and plugins.
   628 	$open_sans_font_url = '';
   942 	$open_sans_font_url = '';
   629 
   943 
   630 	/* translators: If there are characters in your language that are not supported
   944 	/* translators: If there are characters in your language that are not supported
   631 	 * by Open Sans, translate this to 'off'. Do not translate into your own language.
   945 	 * by Open Sans, translate this to 'off'. Do not translate into your own language.
   632 	 */
   946 	 */
   645 		} elseif ( 'vietnamese' == $subset ) {
   959 		} elseif ( 'vietnamese' == $subset ) {
   646 			$subsets .= ',vietnamese';
   960 			$subsets .= ',vietnamese';
   647 		}
   961 		}
   648 
   962 
   649 		// Hotlink Open Sans, for now
   963 		// Hotlink Open Sans, for now
   650 		$open_sans_font_url = "//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
   964 		$open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
   651 	}
   965 	}
   652 
   966 
   653 	// Register a stylesheet for the selected admin color scheme.
   967 	// Register a stylesheet for the selected admin color scheme.
   654 	$styles->add( 'colors', true, array( 'wp-admin', 'buttons', 'open-sans', 'dashicons' ) );
   968 	$styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) );
   655 
   969 
   656 	$suffix = SCRIPT_DEBUG ? '' : '.min';
   970 	$suffix = SCRIPT_DEBUG ? '' : '.min';
   657 
   971 
   658 	// Admin CSS
   972 	// Admin CSS
   659 	$styles->add( 'wp-admin',           "/wp-admin/css/wp-admin$suffix.css", array( 'open-sans', 'dashicons' ) );
   973 	$styles->add( 'common',              "/wp-admin/css/common$suffix.css" );
   660 	$styles->add( 'login',              "/wp-admin/css/login$suffix.css", array( 'buttons', 'open-sans', 'dashicons' ) );
   974 	$styles->add( 'forms',               "/wp-admin/css/forms$suffix.css" );
   661 	$styles->add( 'install',            "/wp-admin/css/install$suffix.css", array( 'buttons', 'open-sans' ) );
   975 	$styles->add( 'admin-menu',          "/wp-admin/css/admin-menu$suffix.css" );
   662 	$styles->add( 'wp-color-picker',    "/wp-admin/css/color-picker$suffix.css" );
   976 	$styles->add( 'dashboard',           "/wp-admin/css/dashboard$suffix.css" );
   663 	$styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
   977 	$styles->add( 'list-tables',         "/wp-admin/css/list-tables$suffix.css" );
   664 	$styles->add( 'customize-widgets',  "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
   978 	$styles->add( 'edit',                "/wp-admin/css/edit$suffix.css" );
   665 	$styles->add( 'press-this',         "/wp-admin/css/press-this$suffix.css", array( 'open-sans', 'buttons' ) );
   979 	$styles->add( 'revisions',           "/wp-admin/css/revisions$suffix.css" );
   666 
   980 	$styles->add( 'media',               "/wp-admin/css/media$suffix.css" );
   667 	$styles->add( 'ie',                 "/wp-admin/css/ie$suffix.css" );
   981 	$styles->add( 'themes',              "/wp-admin/css/themes$suffix.css" );
       
   982 	$styles->add( 'about',               "/wp-admin/css/about$suffix.css" );
       
   983 	$styles->add( 'nav-menus',           "/wp-admin/css/nav-menus$suffix.css" );
       
   984 	$styles->add( 'widgets',             "/wp-admin/css/widgets$suffix.css", array( 'wp-pointer' ) );
       
   985 	$styles->add( 'site-icon',           "/wp-admin/css/site-icon$suffix.css" );
       
   986 	$styles->add( 'l10n',                "/wp-admin/css/l10n$suffix.css" );
       
   987 	$styles->add( 'code-editor',         "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) );
       
   988 
       
   989 	$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' ) );
       
   990 
       
   991 	$styles->add( 'login',               "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
       
   992 	$styles->add( 'install',             "/wp-admin/css/install$suffix.css", array( 'buttons' ) );
       
   993 	$styles->add( 'wp-color-picker',     "/wp-admin/css/color-picker$suffix.css" );
       
   994 	$styles->add( 'customize-controls',  "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
       
   995 	$styles->add( 'customize-widgets',   "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
       
   996 	$styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) );
       
   997 
       
   998 	$styles->add( 'ie', "/wp-admin/css/ie$suffix.css" );
   668 	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
   999 	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
   669 
  1000 
   670 	// Common dependencies
  1001 	// Common dependencies
   671 	$styles->add( 'buttons',   "/wp-includes/css/buttons$suffix.css" );
  1002 	$styles->add( 'buttons',   "/wp-includes/css/buttons$suffix.css" );
   672 	$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
  1003 	$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
   673 	$styles->add( 'open-sans', $open_sans_font_url );
       
   674 
  1004 
   675 	// Includes CSS
  1005 	// Includes CSS
   676 	$styles->add( 'admin-bar',      "/wp-includes/css/admin-bar$suffix.css", array( 'open-sans', 'dashicons' ) );
  1006 	$styles->add( 'admin-bar',            "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
   677 	$styles->add( 'wp-auth-check',  "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
  1007 	$styles->add( 'wp-auth-check',        "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
   678 	$styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
  1008 	$styles->add( 'editor-buttons',       "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
   679 	$styles->add( 'media-views',    "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
  1009 	$styles->add( 'media-views',          "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
   680 	$styles->add( 'wp-pointer',     "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
  1010 	$styles->add( 'wp-pointer',           "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
       
  1011 	$styles->add( 'customize-preview',    "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) );
       
  1012 	$styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" );
       
  1013 	$styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );
   681 
  1014 
   682 	// External libraries and friends
  1015 	// External libraries and friends
   683 	$styles->add( 'imgareaselect',       '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
  1016 	$styles->add( 'imgareaselect',       '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
   684 	$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
  1017 	$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
   685 	$styles->add( 'mediaelement',        "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.16.2' );
  1018 	$styles->add( 'mediaelement',        "/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css", array(), '4.2.6-78496d1' );
   686 	$styles->add( 'wp-mediaelement',     "/wp-includes/js/mediaelement/wp-mediaelement.css", array( 'mediaelement' ) );
  1019 	$styles->add( 'wp-mediaelement',     "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
   687 	$styles->add( 'thickbox',            '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
  1020 	$styles->add( 'thickbox',            '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
       
  1021 	$styles->add( 'wp-codemirror',       '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
   688 
  1022 
   689 	// Deprecated CSS
  1023 	// Deprecated CSS
   690 	$styles->add( 'media',      "/wp-admin/css/deprecated-media$suffix.css" );
  1024 	$styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
   691 	$styles->add( 'farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1' );
  1025 	$styles->add( 'farbtastic',       "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
   692 	$styles->add( 'jcrop',      "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12' );
  1026 	$styles->add( 'jcrop',            "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12' );
   693 	$styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
  1027 	$styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
       
  1028 	$styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
   694 
  1029 
   695 	// RTL CSS
  1030 	// RTL CSS
   696 	$rtl_styles = array(
  1031 	$rtl_styles = array(
   697 		// wp-admin
  1032 		// wp-admin
   698 		'wp-admin', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'ie', 'login', 'press-this',
  1033 		'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus',
       
  1034 		'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'customize-preview',
       
  1035 		'ie', 'login',
   699 		// wp-includes
  1036 		// wp-includes
   700 		'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
  1037 		'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
   701 		'wp-jquery-ui-dialog',
  1038 		'wp-jquery-ui-dialog',
   702 		// deprecated
  1039 		// deprecated
   703 		'media', 'farbtastic',
  1040 		'deprecated-media', 'farbtastic',
   704 	);
  1041 	);
   705 
  1042 
   706 	foreach ( $rtl_styles as $rtl_style ) {
  1043 	foreach ( $rtl_styles as $rtl_style ) {
   707 		$styles->add_data( $rtl_style, 'rtl', 'replace' );
  1044 		$styles->add_data( $rtl_style, 'rtl', 'replace' );
   708 		if ( $suffix ) {
  1045 		if ( $suffix ) {
   748 	wp_localize_script( 'autosave', 'autosaveL10n', array(
  1085 	wp_localize_script( 'autosave', 'autosaveL10n', array(
   749 		'autosaveInterval' => AUTOSAVE_INTERVAL,
  1086 		'autosaveInterval' => AUTOSAVE_INTERVAL,
   750 		'blog_id' => get_current_blog_id(),
  1087 		'blog_id' => get_current_blog_id(),
   751 	) );
  1088 	) );
   752 
  1089 
       
  1090 	wp_localize_script( 'mce-view', 'mceViewL10n', array(
       
  1091 		'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
       
  1092 	) );
       
  1093 
       
  1094 	wp_localize_script( 'word-count', 'wordCountL10n', array(
       
  1095 		/*
       
  1096 		 * translators: If your word count is based on single characters (e.g. East Asian characters),
       
  1097 		 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
       
  1098 		 * Do not translate into your own language.
       
  1099 		 */
       
  1100 		'type' => _x( 'words', 'Word count type. Do not translate!' ),
       
  1101 		'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
       
  1102 	) );
       
  1103 }
       
  1104 
       
  1105 /**
       
  1106  * Localizes the jQuery UI datepicker.
       
  1107  *
       
  1108  * @since 4.6.0
       
  1109  *
       
  1110  * @link https://api.jqueryui.com/datepicker/#options
       
  1111  *
       
  1112  * @global WP_Locale $wp_locale The WordPress date and time locale object.
       
  1113  */
       
  1114 function wp_localize_jquery_ui_datepicker() {
       
  1115 	global $wp_locale;
       
  1116 
       
  1117 	if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) {
       
  1118 		return;
       
  1119 	}
       
  1120 
       
  1121 	// Convert the PHP date format into jQuery UI's format.
       
  1122 	$datepicker_date_format = str_replace(
       
  1123 		array(
       
  1124 			'd', 'j', 'l', 'z', // Day.
       
  1125 			'F', 'M', 'n', 'm', // Month.
       
  1126 			'Y', 'y'            // Year.
       
  1127 		),
       
  1128 		array(
       
  1129 			'dd', 'd', 'DD', 'o',
       
  1130 			'MM', 'M', 'm', 'mm',
       
  1131 			'yy', 'y'
       
  1132 		),
       
  1133 		get_option( 'date_format' )
       
  1134 	);
       
  1135 
       
  1136 	$datepicker_defaults = wp_json_encode( array(
       
  1137 		'closeText'       => __( 'Close' ),
       
  1138 		'currentText'     => __( 'Today' ),
       
  1139 		'monthNames'      => array_values( $wp_locale->month ),
       
  1140 		'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
       
  1141 		'nextText'        => __( 'Next' ),
       
  1142 		'prevText'        => __( 'Previous' ),
       
  1143 		'dayNames'        => array_values( $wp_locale->weekday ),
       
  1144 		'dayNamesShort'   => array_values( $wp_locale->weekday_abbrev ),
       
  1145 		'dayNamesMin'     => array_values( $wp_locale->weekday_initial ),
       
  1146 		'dateFormat'      => $datepicker_date_format,
       
  1147 		'firstDay'        => absint( get_option( 'start_of_week' ) ),
       
  1148 		'isRTL'           => $wp_locale->is_rtl(),
       
  1149 	) );
       
  1150 
       
  1151 	wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
       
  1152 }
       
  1153 
       
  1154 /**
       
  1155  * Localizes community events data that needs to be passed to dashboard.js.
       
  1156  *
       
  1157  * @since 4.8.0
       
  1158  */
       
  1159 function wp_localize_community_events() {
       
  1160 	if ( ! wp_script_is( 'dashboard' ) ) {
       
  1161 		return;
       
  1162 	}
       
  1163 
       
  1164 	require_once( ABSPATH . 'wp-admin/includes/class-wp-community-events.php' );
       
  1165 
       
  1166 	$user_id            = get_current_user_id();
       
  1167 	$saved_location     = get_user_option( 'community-events-location', $user_id );
       
  1168 	$saved_ip_address   = isset( $saved_location['ip'] ) ? $saved_location['ip'] : false;
       
  1169 	$current_ip_address = WP_Community_Events::get_unsafe_client_ip();
       
  1170 
       
  1171 	/*
       
  1172 	 * If the user's location is based on their IP address, then update their
       
  1173 	 * location when their IP address changes. This allows them to see events
       
  1174 	 * in their current city when travelling. Otherwise, they would always be
       
  1175 	 * shown events in the city where they were when they first loaded the
       
  1176 	 * Dashboard, which could have been months or years ago.
       
  1177 	 */
       
  1178 	if ( $saved_ip_address && $current_ip_address && $current_ip_address !== $saved_ip_address ) {
       
  1179 		$saved_location['ip'] = $current_ip_address;
       
  1180 		update_user_option( $user_id, 'community-events-location', $saved_location, true );
       
  1181 	}
       
  1182 
       
  1183 	$events_client = new WP_Community_Events( $user_id, $saved_location );
       
  1184 
       
  1185 	wp_localize_script( 'dashboard', 'communityEventsData', array(
       
  1186 		'nonce' => wp_create_nonce( 'community_events' ),
       
  1187 		'cache' => $events_client->get_cached_events(),
       
  1188 
       
  1189 		'l10n' => array(
       
  1190 			'enter_closest_city' => __( 'Enter your closest city to find nearby events.' ),
       
  1191 			'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ),
       
  1192 			'attend_event_near_generic' => __( 'Attend an upcoming event near you.' ),
       
  1193 
       
  1194 			/*
       
  1195 			 * These specific examples were chosen to highlight the fact that a
       
  1196 			 * state is not needed, even for cities whose name is not unique.
       
  1197 			 * It would be too cumbersome to include that in the instructions
       
  1198 			 * to the user, so it's left as an implication.
       
  1199 			 */
       
  1200 			/* translators: %s is the name of the city we couldn't locate.
       
  1201 			 * Replace the examples with cities related to your locale. Test that
       
  1202 			 * they match the expected location and have upcoming events before
       
  1203 			 * including them. If no cities related to your locale have events,
       
  1204 			 * then use cities related to your locale that would be recognizable
       
  1205 			 * to most users. Use only the city name itself, without any region
       
  1206 			 * or country. Use the endonym (native locale name) instead of the
       
  1207 			 * English name if possible.
       
  1208 			 */
       
  1209 			'could_not_locate_city' => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
       
  1210 
       
  1211 			// This one is only used with wp.a11y.speak(), so it can/should be more brief.
       
  1212 			/* translators: %s: the name of a city */
       
  1213 			'city_updated' => __( 'City updated. Listing events near %s.' ),
       
  1214 		)
       
  1215 	) );
   753 }
  1216 }
   754 
  1217 
   755 /**
  1218 /**
   756  * Administration Screen CSS for changing the styles.
  1219  * Administration Screen CSS for changing the styles.
   757  *
  1220  *
   764  *
  1227  *
   765  * The query from $src parameter will be appended to the URL that is given from
  1228  * The query from $src parameter will be appended to the URL that is given from
   766  * the $_wp_admin_css_colors array value URL.
  1229  * the $_wp_admin_css_colors array value URL.
   767  *
  1230  *
   768  * @since 2.6.0
  1231  * @since 2.6.0
   769  * @uses $_wp_admin_css_colors
  1232  * @global array $_wp_admin_css_colors
   770  *
  1233  *
   771  * @param string $src Source URL.
  1234  * @param string $src    Source URL.
   772  * @param string $handle Either 'colors' or 'colors-rtl'.
  1235  * @param string $handle Either 'colors' or 'colors-rtl'.
   773  * @return string URL path to CSS stylesheet for Administration Screens.
  1236  * @return string|false URL path to CSS stylesheet for Administration Screens.
   774  */
  1237  */
   775 function wp_style_loader_src( $src, $handle ) {
  1238 function wp_style_loader_src( $src, $handle ) {
   776 	global $_wp_admin_css_colors;
  1239 	global $_wp_admin_css_colors;
   777 
  1240 
   778 	if ( defined('WP_INSTALLING') )
  1241 	if ( wp_installing() )
   779 		return preg_replace( '#^wp-admin/#', './', $src );
  1242 		return preg_replace( '#^wp-admin/#', './', $src );
   780 
  1243 
   781 	if ( 'colors' == $handle ) {
  1244 	if ( 'colors' == $handle ) {
   782 		$color = get_user_option('admin_color');
  1245 		$color = get_user_option('admin_color');
   783 
  1246 
   784 		if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
  1247 		if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
   785 			$color = 'fresh';
  1248 			$color = 'fresh';
   786 
  1249 
   787 		$color = $_wp_admin_css_colors[$color];
  1250 		$color = $_wp_admin_css_colors[$color];
   788 		$parsed = parse_url( $src );
       
   789 		$url = $color->url;
  1251 		$url = $color->url;
   790 
  1252 
   791 		if ( ! $url ) {
  1253 		if ( ! $url ) {
   792 			return false;
  1254 			return false;
   793 		}
  1255 		}
   794 
  1256 
       
  1257 		$parsed = parse_url( $src );
   795 		if ( isset($parsed['query']) && $parsed['query'] ) {
  1258 		if ( isset($parsed['query']) && $parsed['query'] ) {
   796 			wp_parse_str( $parsed['query'], $qv );
  1259 			wp_parse_str( $parsed['query'], $qv );
   797 			$url = add_query_arg( $qv, $url );
  1260 			$url = add_query_arg( $qv, $url );
   798 		}
  1261 		}
   799 
  1262 
   810  * print_footer_scripts() is called in the footer to print these scripts.
  1273  * print_footer_scripts() is called in the footer to print these scripts.
   811  *
  1274  *
   812  * @since 2.8.0
  1275  * @since 2.8.0
   813  *
  1276  *
   814  * @see wp_print_scripts()
  1277  * @see wp_print_scripts()
       
  1278  *
       
  1279  * @global bool $concatenate_scripts
       
  1280  *
       
  1281  * @return array
   815  */
  1282  */
   816 function print_head_scripts() {
  1283 function print_head_scripts() {
   817 	global $wp_scripts, $concatenate_scripts;
  1284 	global $concatenate_scripts;
   818 
  1285 
   819 	if ( ! did_action('wp_print_scripts') ) {
  1286 	if ( ! did_action('wp_print_scripts') ) {
   820 		/** This action is documented in wp-includes/functions.wp-scripts.php */
  1287 		/** This action is documented in wp-includes/functions.wp-scripts.php */
   821 		do_action( 'wp_print_scripts' );
  1288 		do_action( 'wp_print_scripts' );
   822 	}
  1289 	}
   823 
  1290 
   824 	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
  1291 	$wp_scripts = wp_scripts();
   825 		$wp_scripts = new WP_Scripts();
       
   826 	}
       
   827 
  1292 
   828 	script_concat_settings();
  1293 	script_concat_settings();
   829 	$wp_scripts->do_concat = $concatenate_scripts;
  1294 	$wp_scripts->do_concat = $concatenate_scripts;
   830 	$wp_scripts->do_head_items();
  1295 	$wp_scripts->do_head_items();
   831 
  1296 
   832 	/**
  1297 	/**
   833 	 * Filter whether to print the head scripts.
  1298 	 * Filters whether to print the head scripts.
   834 	 *
  1299 	 *
   835 	 * @since 2.8.0
  1300 	 * @since 2.8.0
   836 	 *
  1301 	 *
   837 	 * @param bool $print Whether to print the head scripts. Default true.
  1302 	 * @param bool $print Whether to print the head scripts. Default true.
   838 	 */
  1303 	 */
   846 
  1311 
   847 /**
  1312 /**
   848  * Prints the scripts that were queued for the footer or too late for the HTML head.
  1313  * Prints the scripts that were queued for the footer or too late for the HTML head.
   849  *
  1314  *
   850  * @since 2.8.0
  1315  * @since 2.8.0
       
  1316  *
       
  1317  * @global WP_Scripts $wp_scripts
       
  1318  * @global bool       $concatenate_scripts
       
  1319  *
       
  1320  * @return array
   851  */
  1321  */
   852 function print_footer_scripts() {
  1322 function print_footer_scripts() {
   853 	global $wp_scripts, $concatenate_scripts;
  1323 	global $wp_scripts, $concatenate_scripts;
   854 
  1324 
   855 	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
  1325 	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
   858 	script_concat_settings();
  1328 	script_concat_settings();
   859 	$wp_scripts->do_concat = $concatenate_scripts;
  1329 	$wp_scripts->do_concat = $concatenate_scripts;
   860 	$wp_scripts->do_footer_items();
  1330 	$wp_scripts->do_footer_items();
   861 
  1331 
   862 	/**
  1332 	/**
   863 	 * Filter whether to print the footer scripts.
  1333 	 * Filters whether to print the footer scripts.
   864 	 *
  1334 	 *
   865 	 * @since 2.8.0
  1335 	 * @since 2.8.0
   866 	 *
  1336 	 *
   867 	 * @param bool $print Whether to print the footer scripts. Default true.
  1337 	 * @param bool $print Whether to print the footer scripts. Default true.
   868 	 */
  1338 	 */
   876 
  1346 
   877 /**
  1347 /**
   878  * Print scripts (internal use only)
  1348  * Print scripts (internal use only)
   879  *
  1349  *
   880  * @ignore
  1350  * @ignore
       
  1351  *
       
  1352  * @global WP_Scripts $wp_scripts
       
  1353  * @global bool       $compress_scripts
   881  */
  1354  */
   882 function _print_scripts() {
  1355 function _print_scripts() {
   883 	global $wp_scripts, $compress_scripts;
  1356 	global $wp_scripts, $compress_scripts;
   884 
  1357 
   885 	$zip = $compress_scripts ? 1 : 0;
  1358 	$zip = $compress_scripts ? 1 : 0;
   912  *
  1385  *
   913  * Postpones the scripts that were queued for the footer.
  1386  * Postpones the scripts that were queued for the footer.
   914  * wp_print_footer_scripts() is called in the footer to print these scripts.
  1387  * wp_print_footer_scripts() is called in the footer to print these scripts.
   915  *
  1388  *
   916  * @since 2.8.0
  1389  * @since 2.8.0
       
  1390  *
       
  1391  * @global WP_Scripts $wp_scripts
       
  1392  *
       
  1393  * @return array
   917  */
  1394  */
   918 function wp_print_head_scripts() {
  1395 function wp_print_head_scripts() {
   919 	if ( ! did_action('wp_print_scripts') ) {
  1396 	if ( ! did_action('wp_print_scripts') ) {
   920 		/** This action is documented in wp-includes/functions.wp-scripts.php */
  1397 		/** This action is documented in wp-includes/functions.wp-scripts.php */
   921 		do_action( 'wp_print_scripts' );
  1398 		do_action( 'wp_print_scripts' );
   972 
  1449 
   973 /**
  1450 /**
   974  * Prints the styles queue in the HTML head on admin pages.
  1451  * Prints the styles queue in the HTML head on admin pages.
   975  *
  1452  *
   976  * @since 2.8.0
  1453  * @since 2.8.0
       
  1454  *
       
  1455  * @global bool $concatenate_scripts
       
  1456  *
       
  1457  * @return array
   977  */
  1458  */
   978 function print_admin_styles() {
  1459 function print_admin_styles() {
   979 	global $wp_styles, $concatenate_scripts;
  1460 	global $concatenate_scripts;
   980 
  1461 
   981 	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
  1462 	$wp_styles = wp_styles();
   982 		$wp_styles = new WP_Styles();
       
   983 	}
       
   984 
  1463 
   985 	script_concat_settings();
  1464 	script_concat_settings();
   986 	$wp_styles->do_concat = $concatenate_scripts;
  1465 	$wp_styles->do_concat = $concatenate_scripts;
   987 	$wp_styles->do_items(false);
  1466 	$wp_styles->do_items(false);
   988 
  1467 
   989 	/**
  1468 	/**
   990 	 * Filter whether to print the admin styles.
  1469 	 * Filters whether to print the admin styles.
   991 	 *
  1470 	 *
   992 	 * @since 2.8.0
  1471 	 * @since 2.8.0
   993 	 *
  1472 	 *
   994 	 * @param bool $print Whether to print the admin styles. Default true.
  1473 	 * @param bool $print Whether to print the admin styles. Default true.
   995 	 */
  1474 	 */
  1003 
  1482 
  1004 /**
  1483 /**
  1005  * Prints the styles that were queued too late for the HTML head.
  1484  * Prints the styles that were queued too late for the HTML head.
  1006  *
  1485  *
  1007  * @since 3.3.0
  1486  * @since 3.3.0
       
  1487  *
       
  1488  * @global WP_Styles $wp_styles
       
  1489  * @global bool      $concatenate_scripts
       
  1490  *
       
  1491  * @return array|void
  1008  */
  1492  */
  1009 function print_late_styles() {
  1493 function print_late_styles() {
  1010 	global $wp_styles, $concatenate_scripts;
  1494 	global $wp_styles, $concatenate_scripts;
  1011 
  1495 
  1012 	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
  1496 	if ( ! ( $wp_styles instanceof WP_Styles ) ) {
  1013 		return;
  1497 		return;
  1014 	}
  1498 	}
  1015 
  1499 
       
  1500 	script_concat_settings();
  1016 	$wp_styles->do_concat = $concatenate_scripts;
  1501 	$wp_styles->do_concat = $concatenate_scripts;
  1017 	$wp_styles->do_footer_items();
  1502 	$wp_styles->do_footer_items();
  1018 
  1503 
  1019 	/**
  1504 	/**
  1020 	 * Filter whether to print the styles queued too late for the HTML head.
  1505 	 * Filters whether to print the styles queued too late for the HTML head.
  1021 	 *
  1506 	 *
  1022 	 * @since 3.3.0
  1507 	 * @since 3.3.0
  1023 	 *
  1508 	 *
  1024 	 * @param bool $print Whether to print the 'late' styles. Default true.
  1509 	 * @param bool $print Whether to print the 'late' styles. Default true.
  1025 	 */
  1510 	 */
  1033 
  1518 
  1034 /**
  1519 /**
  1035  * Print styles (internal use only)
  1520  * Print styles (internal use only)
  1036  *
  1521  *
  1037  * @ignore
  1522  * @ignore
       
  1523  * @since 3.3.0
       
  1524  *
       
  1525  * @global bool $compress_css
  1038  */
  1526  */
  1039 function _print_styles() {
  1527 function _print_styles() {
  1040 	global $wp_styles, $compress_css;
  1528 	global $compress_css;
       
  1529 
       
  1530 	$wp_styles = wp_styles();
  1041 
  1531 
  1042 	$zip = $compress_css ? 1 : 0;
  1532 	$zip = $compress_css ? 1 : 0;
  1043 	if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
  1533 	if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
  1044 		$zip = 'gzip';
  1534 		$zip = 'gzip';
  1045 
  1535 
  1046 	if ( !empty($wp_styles->concat) ) {
  1536 	if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
  1047 		$dir = $wp_styles->text_direction;
  1537 		$dir = $wp_styles->text_direction;
  1048 		$ver = $wp_styles->default_version;
  1538 		$ver = $wp_styles->default_version;
  1049 		$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . '&ver=' . $ver;
  1539 
       
  1540 		$concat = str_split( $concat, 128 );
       
  1541 		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
       
  1542 
       
  1543 		$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver;
  1050 		echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
  1544 		echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
  1051 
  1545 
  1052 		if ( !empty($wp_styles->print_code) ) {
  1546 		if ( !empty($wp_styles->print_code) ) {
  1053 			echo "<style type='text/css'>\n";
  1547 			echo "<style type='text/css'>\n";
  1054 			echo $wp_styles->print_code;
  1548 			echo $wp_styles->print_code;
  1062 
  1556 
  1063 /**
  1557 /**
  1064  * Determine the concatenation and compression settings for scripts and styles.
  1558  * Determine the concatenation and compression settings for scripts and styles.
  1065  *
  1559  *
  1066  * @since 2.8.0
  1560  * @since 2.8.0
       
  1561  *
       
  1562  * @global bool $concatenate_scripts
       
  1563  * @global bool $compress_scripts
       
  1564  * @global bool $compress_css
  1067  */
  1565  */
  1068 function script_concat_settings() {
  1566 function script_concat_settings() {
  1069 	global $concatenate_scripts, $compress_scripts, $compress_css;
  1567 	global $concatenate_scripts, $compress_scripts, $compress_css;
  1070 
  1568 
  1071 	$compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') );
  1569 	$compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') );
  1072 
  1570 
  1073 	if ( ! isset($concatenate_scripts) ) {
  1571 	if ( ! isset($concatenate_scripts) ) {
  1074 		$concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
  1572 		$concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
  1075 		if ( ! is_admin() || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
  1573 		if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
  1076 			$concatenate_scripts = false;
  1574 			$concatenate_scripts = false;
  1077 	}
  1575 	}
  1078 
  1576 
  1079 	if ( ! isset($compress_scripts) ) {
  1577 	if ( ! isset($compress_scripts) ) {
  1080 		$compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
  1578 		$compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;