wp/wp-includes/script-loader.php
changeset 9 177826044cd9
parent 7 cf61fcea0001
child 13 d255fe9cd479
equal deleted inserted replaced
8:c7c34916027a 9:177826044cd9
    33 
    33 
    34 /** WordPress Styles Functions */
    34 /** WordPress Styles Functions */
    35 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
    35 require( ABSPATH . WPINC . '/functions.wp-styles.php' );
    36 
    36 
    37 /**
    37 /**
       
    38  * Registers TinyMCE scripts.
       
    39  *
       
    40  * @since 5.0.0
       
    41  *
       
    42  * @param WP_Scripts $scripts WP_Scripts object.
       
    43  */
       
    44 function wp_register_tinymce_scripts( &$scripts, $force_uncompressed = false ) {
       
    45 	global $tinymce_version, $concatenate_scripts, $compress_scripts;
       
    46 	$suffix     = wp_scripts_get_suffix();
       
    47 	$dev_suffix = wp_scripts_get_suffix( 'dev' );
       
    48 
       
    49 	script_concat_settings();
       
    50 
       
    51 	$compressed = $compress_scripts && $concatenate_scripts && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )
       
    52 				  && false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $force_uncompressed;
       
    53 
       
    54 	// Load tinymce.js when running from /src, otherwise load wp-tinymce.js.gz (in production) or
       
    55 	// tinymce.min.js (when SCRIPT_DEBUG is true).
       
    56 	if ( $compressed ) {
       
    57 		$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.js', array(), $tinymce_version );
       
    58 	} else {
       
    59 		$scripts->add( 'wp-tinymce-root', includes_url( 'js/tinymce/' ) . "tinymce$dev_suffix.js", array(), $tinymce_version );
       
    60 		$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . "plugins/compat3x/plugin$dev_suffix.js", array( 'wp-tinymce-root' ), $tinymce_version );
       
    61 	}
       
    62 
       
    63 	$scripts->add( 'wp-tinymce-lists', includes_url( "js/tinymce/plugins/lists/plugin$suffix.js" ), array( 'wp-tinymce' ), $tinymce_version );
       
    64 }
       
    65 
       
    66 /**
       
    67  * Registers all the WordPress vendor scripts that are in the standardized
       
    68  * `js/dist/vendor/` location.
       
    69  *
       
    70  * For the order of `$scripts->add` see `wp_default_scripts`.
       
    71  *
       
    72  * @since 5.0.0
       
    73  *
       
    74  * @param WP_Scripts $scripts WP_Scripts object.
       
    75  */
       
    76 function wp_default_packages_vendor( &$scripts ) {
       
    77 	global $wp_locale;
       
    78 
       
    79 	$suffix = wp_scripts_get_suffix();
       
    80 
       
    81 	$vendor_scripts = array(
       
    82 		'react'     => array( 'wp-polyfill' ),
       
    83 		'react-dom' => array( 'react' ),
       
    84 		'moment',
       
    85 		'lodash',
       
    86 		'wp-polyfill-fetch',
       
    87 		'wp-polyfill-formdata',
       
    88 		'wp-polyfill-node-contains',
       
    89 		'wp-polyfill-element-closest',
       
    90 		'wp-polyfill',
       
    91 	);
       
    92 
       
    93 	$vendor_scripts_versions = array(
       
    94 		'react'                       => '16.8.4',
       
    95 		'react-dom'                   => '16.8.4',
       
    96 		'moment'                      => '2.22.2',
       
    97 		'lodash'                      => '4.17.11',
       
    98 		'wp-polyfill-fetch'           => '3.0.0',
       
    99 		'wp-polyfill-formdata'        => '3.0.12',
       
   100 		'wp-polyfill-node-contains'   => '3.26.0-0',
       
   101 		'wp-polyfill-element-closest' => '2.0.2',
       
   102 		'wp-polyfill'                 => '7.0.0',
       
   103 	);
       
   104 
       
   105 	foreach ( $vendor_scripts as $handle => $dependencies ) {
       
   106 		if ( is_string( $dependencies ) ) {
       
   107 			$handle       = $dependencies;
       
   108 			$dependencies = array();
       
   109 		}
       
   110 
       
   111 		$path    = "/wp-includes/js/dist/vendor/$handle$suffix.js";
       
   112 		$version = $vendor_scripts_versions[ $handle ];
       
   113 
       
   114 		$scripts->add( $handle, $path, $dependencies, $version, 1 );
       
   115 	}
       
   116 
       
   117 	$scripts->add( 'wp-polyfill', null, array( 'wp-polyfill' ) );
       
   118 	did_action( 'init' ) && $scripts->add_inline_script(
       
   119 		'wp-polyfill',
       
   120 		wp_get_script_polyfill(
       
   121 			$scripts,
       
   122 			array(
       
   123 				'\'fetch\' in window' => 'wp-polyfill-fetch',
       
   124 				'document.contains'   => 'wp-polyfill-node-contains',
       
   125 				'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
       
   126 				'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
       
   127 			)
       
   128 		)
       
   129 	);
       
   130 
       
   131 	did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
       
   132 
       
   133 	did_action( 'init' ) && $scripts->add_inline_script(
       
   134 		'moment',
       
   135 		sprintf(
       
   136 			"moment.locale( '%s', %s );",
       
   137 			get_user_locale(),
       
   138 			wp_json_encode(
       
   139 				array(
       
   140 					'months'         => array_values( $wp_locale->month ),
       
   141 					'monthsShort'    => array_values( $wp_locale->month_abbrev ),
       
   142 					'weekdays'       => array_values( $wp_locale->weekday ),
       
   143 					'weekdaysShort'  => array_values( $wp_locale->weekday_abbrev ),
       
   144 					'week'           => array(
       
   145 						'dow' => (int) get_option( 'start_of_week', 0 ),
       
   146 					),
       
   147 					'longDateFormat' => array(
       
   148 						'LT'   => get_option( 'time_format', __( 'g:i a', 'default' ) ),
       
   149 						'LTS'  => null,
       
   150 						'L'    => null,
       
   151 						'LL'   => get_option( 'date_format', __( 'F j, Y', 'default' ) ),
       
   152 						'LLL'  => __( 'F j, Y g:i a', 'default' ),
       
   153 						'LLLL' => null,
       
   154 					),
       
   155 				)
       
   156 			)
       
   157 		),
       
   158 		'after'
       
   159 	);
       
   160 }
       
   161 
       
   162 /**
       
   163  * Returns contents of an inline script used in appending polyfill scripts for
       
   164  * browsers which fail the provided tests. The provided array is a mapping from
       
   165  * a condition to verify feature support to its polyfill script handle.
       
   166  *
       
   167  * @since 5.0.0
       
   168  *
       
   169  * @param WP_Scripts $scripts WP_Scripts object.
       
   170  * @param array      $tests   Features to detect.
       
   171  * @return string Conditional polyfill inline script.
       
   172  */
       
   173 function wp_get_script_polyfill( &$scripts, $tests ) {
       
   174 	$polyfill = '';
       
   175 	foreach ( $tests as $test => $handle ) {
       
   176 		if ( ! array_key_exists( $handle, $scripts->registered ) ) {
       
   177 			continue;
       
   178 		}
       
   179 
       
   180 		$src = $scripts->registered[ $handle ]->src;
       
   181 		$ver = $scripts->registered[ $handle ]->ver;
       
   182 
       
   183 		if ( ! preg_match( '|^(https?:)?//|', $src ) && ! ( $scripts->content_url && 0 === strpos( $src, $scripts->content_url ) ) ) {
       
   184 			$src = $scripts->base_url . $src;
       
   185 		}
       
   186 
       
   187 		if ( ! empty( $ver ) ) {
       
   188 			$src = add_query_arg( 'ver', $ver, $src );
       
   189 		}
       
   190 
       
   191 		/** This filter is documented in wp-includes/class.wp-scripts.php */
       
   192 		$src = esc_url( apply_filters( 'script_loader_src', $src, $handle ) );
       
   193 
       
   194 		if ( ! $src ) {
       
   195 			continue;
       
   196 		}
       
   197 
       
   198 		$polyfill .= (
       
   199 			// Test presence of feature...
       
   200 			'( ' . $test . ' ) || ' .
       
   201 			// ...appending polyfill on any failures. Cautious viewers may balk
       
   202 			// at the `document.write`. Its caveat of synchronous mid-stream
       
   203 			// blocking write is exactly the behavior we need though.
       
   204 			'document.write( \'<script src="' .
       
   205 			$src .
       
   206 			'"></scr\' + \'ipt>\' );'
       
   207 		);
       
   208 	}
       
   209 
       
   210 	return $polyfill;
       
   211 }
       
   212 
       
   213 /**
       
   214  * Registers all the WordPress packages scripts that are in the standardized
       
   215  * `js/dist/` location.
       
   216  *
       
   217  * For the order of `$scripts->add` see `wp_default_scripts`.
       
   218  *
       
   219  * @since 5.0.0
       
   220  *
       
   221  * @param WP_Scripts $scripts WP_Scripts object.
       
   222  */
       
   223 function wp_default_packages_scripts( &$scripts ) {
       
   224 	$suffix = wp_scripts_get_suffix();
       
   225 
       
   226 	$packages_versions = array(
       
   227 		'a11y'                               => '2.2.0',
       
   228 		'annotations'                        => '1.2.3',
       
   229 		'api-fetch'                          => '3.1.2',
       
   230 		'autop'                              => '2.0.0',
       
   231 		'blob'                               => '2.3.0',
       
   232 		'block-editor'                       => '2.0.3',
       
   233 		'block-library'                      => '2.4.6',
       
   234 		'block-serialization-default-parser' => '3.1.0',
       
   235 		'blocks'                             => '6.2.5',
       
   236 		'components'                         => '7.3.2',
       
   237 		'compose'                            => '3.2.0',
       
   238 		'core-data'                          => '2.2.2',
       
   239 		'data'                               => '4.4.0',
       
   240 		'date'                               => '3.2.0',
       
   241 		'deprecated'                         => '2.2.0',
       
   242 		'dom'                                => '2.2.5',
       
   243 		'dom-ready'                          => '2.2.0',
       
   244 		'edit-post'                          => '3.3.6',
       
   245 		'editor'                             => '9.2.6',
       
   246 		'element'                            => '2.3.0',
       
   247 		'escape-html'                        => '1.2.0',
       
   248 		'format-library'                     => '1.4.6',
       
   249 		'hooks'                              => '2.2.0',
       
   250 		'html-entities'                      => '2.2.0',
       
   251 		'i18n'                               => '3.3.0',
       
   252 		'is-shallow-equal'                   => '1.2.0',
       
   253 		'keycodes'                           => '2.2.0',
       
   254 		'list-reusable-blocks'               => '1.3.5',
       
   255 		'notices'                            => '1.3.0',
       
   256 		'nux'                                => '3.2.5',
       
   257 		'plugins'                            => '2.2.0',
       
   258 		'priority-queue'                     => '1.1.0',
       
   259 		'redux-routine'                      => '3.2.0',
       
   260 		'rich-text'                          => '3.2.3',
       
   261 		'shortcode'                          => '2.2.0',
       
   262 		'token-list'                         => '1.2.0',
       
   263 		'url'                                => '2.5.0',
       
   264 		'viewport'                           => '2.3.0',
       
   265 		'wordcount'                          => '2.2.0',
       
   266 	);
       
   267 
       
   268 	$packages_dependencies = array(
       
   269 		'api-fetch'                          => array( 'wp-polyfill', 'wp-i18n', 'wp-url' ),
       
   270 		'a11y'                               => array( 'wp-dom-ready', 'wp-polyfill' ),
       
   271 		'annotations'                        => array(
       
   272 			'wp-data',
       
   273 			'wp-hooks',
       
   274 			'wp-i18n',
       
   275 			'wp-polyfill',
       
   276 			'wp-rich-text',
       
   277 		),
       
   278 		'autop'                              => array( 'wp-polyfill' ),
       
   279 		'blob'                               => array( 'wp-polyfill' ),
       
   280 		'blocks'                             => array(
       
   281 			'wp-autop',
       
   282 			'wp-blob',
       
   283 			'wp-block-serialization-default-parser',
       
   284 			'wp-data',
       
   285 			'wp-dom',
       
   286 			'wp-element',
       
   287 			'wp-hooks',
       
   288 			'wp-html-entities',
       
   289 			'wp-i18n',
       
   290 			'wp-is-shallow-equal',
       
   291 			'wp-polyfill',
       
   292 			'wp-shortcode',
       
   293 			'lodash',
       
   294 		),
       
   295 		'block-library'                      => array(
       
   296 			'editor',
       
   297 			'lodash',
       
   298 			'wp-api-fetch',
       
   299 			'wp-autop',
       
   300 			'wp-blob',
       
   301 			'wp-block-editor',
       
   302 			'wp-blocks',
       
   303 			'wp-components',
       
   304 			'wp-compose',
       
   305 			'wp-core-data',
       
   306 			'wp-data',
       
   307 			'wp-date',
       
   308 			'wp-editor',
       
   309 			'wp-element',
       
   310 			'wp-html-entities',
       
   311 			'wp-i18n',
       
   312 			'wp-keycodes',
       
   313 			'wp-polyfill',
       
   314 			'wp-url',
       
   315 			'wp-viewport',
       
   316 			'wp-rich-text',
       
   317 		),
       
   318 		'block-serialization-default-parser' => array(),
       
   319 		'block-editor'                       => array(
       
   320 			'lodash',
       
   321 			'wp-a11y',
       
   322 			'wp-blob',
       
   323 			'wp-blocks',
       
   324 			'wp-components',
       
   325 			'wp-compose',
       
   326 			'wp-core-data',
       
   327 			'wp-data',
       
   328 			'wp-dom',
       
   329 			'wp-element',
       
   330 			'wp-hooks',
       
   331 			'wp-html-entities',
       
   332 			'wp-i18n',
       
   333 			'wp-is-shallow-equal',
       
   334 			'wp-keycodes',
       
   335 			'wp-rich-text',
       
   336 			'wp-token-list',
       
   337 			'wp-url',
       
   338 			'wp-viewport',
       
   339 			'wp-wordcount',
       
   340 		),
       
   341 		'components'                         => array(
       
   342 			'lodash',
       
   343 			'moment',
       
   344 			'wp-a11y',
       
   345 			'wp-api-fetch',
       
   346 			'wp-compose',
       
   347 			'wp-dom',
       
   348 			'wp-element',
       
   349 			'wp-hooks',
       
   350 			'wp-html-entities',
       
   351 			'wp-i18n',
       
   352 			'wp-is-shallow-equal',
       
   353 			'wp-keycodes',
       
   354 			'wp-polyfill',
       
   355 			'wp-rich-text',
       
   356 			'wp-url',
       
   357 		),
       
   358 		'compose'                            => array(
       
   359 			'lodash',
       
   360 			'wp-element',
       
   361 			'wp-is-shallow-equal',
       
   362 			'wp-polyfill',
       
   363 		),
       
   364 		'core-data'                          => array(
       
   365 			'lodash',
       
   366 			'wp-api-fetch',
       
   367 			'wp-data',
       
   368 			'wp-deprecated',
       
   369 			'wp-polyfill',
       
   370 			'wp-url',
       
   371 		),
       
   372 		'data'                               => array(
       
   373 			'lodash',
       
   374 			'wp-compose',
       
   375 			'wp-element',
       
   376 			'wp-is-shallow-equal',
       
   377 			'wp-polyfill',
       
   378 			'wp-priority-queue',
       
   379 			'wp-redux-routine',
       
   380 		),
       
   381 		'date'                               => array( 'moment', 'wp-polyfill' ),
       
   382 		'deprecated'                         => array( 'wp-polyfill', 'wp-hooks' ),
       
   383 		'dom'                                => array( 'lodash', 'wp-polyfill' ),
       
   384 		'dom-ready'                          => array( 'wp-polyfill' ),
       
   385 		'edit-post'                          => array(
       
   386 			'jquery',
       
   387 			'lodash',
       
   388 			'postbox',
       
   389 			'media-models',
       
   390 			'media-views',
       
   391 			'wp-a11y',
       
   392 			'wp-api-fetch',
       
   393 			'wp-block-editor',
       
   394 			'wp-block-library',
       
   395 			'wp-blocks',
       
   396 			'wp-components',
       
   397 			'wp-compose',
       
   398 			'wp-core-data',
       
   399 			'wp-data',
       
   400 			'wp-dom-ready',
       
   401 			'wp-editor',
       
   402 			'wp-element',
       
   403 			'wp-embed',
       
   404 			'wp-i18n',
       
   405 			'wp-keycodes',
       
   406 			'wp-notices',
       
   407 			'wp-nux',
       
   408 			'wp-plugins',
       
   409 			'wp-polyfill',
       
   410 			'wp-url',
       
   411 			'wp-viewport',
       
   412 		),
       
   413 		'editor'                             => array(
       
   414 			'lodash',
       
   415 			'wp-api-fetch',
       
   416 			'wp-blob',
       
   417 			'wp-block-editor',
       
   418 			'wp-blocks',
       
   419 			'wp-components',
       
   420 			'wp-compose',
       
   421 			'wp-core-data',
       
   422 			'wp-data',
       
   423 			'wp-date',
       
   424 			'wp-deprecated',
       
   425 			'wp-element',
       
   426 			'wp-hooks',
       
   427 			'wp-html-entities',
       
   428 			'wp-i18n',
       
   429 			'wp-keycodes',
       
   430 			'wp-notices',
       
   431 			'wp-nux',
       
   432 			'wp-polyfill',
       
   433 			'wp-url',
       
   434 			'wp-viewport',
       
   435 			'wp-wordcount',
       
   436 		),
       
   437 		'element'                            => array( 'wp-polyfill', 'react', 'react-dom', 'lodash', 'wp-escape-html' ),
       
   438 		'escape-html'                        => array( 'wp-polyfill' ),
       
   439 		'format-library'                     => array(
       
   440 			'wp-block-editor',
       
   441 			'wp-components',
       
   442 			'wp-editor',
       
   443 			'wp-element',
       
   444 			'wp-i18n',
       
   445 			'wp-keycodes',
       
   446 			'wp-polyfill',
       
   447 			'wp-rich-text',
       
   448 			'wp-url',
       
   449 		),
       
   450 		'hooks'                              => array( 'wp-polyfill' ),
       
   451 		'html-entities'                      => array( 'wp-polyfill' ),
       
   452 		'i18n'                               => array( 'wp-polyfill' ),
       
   453 		'is-shallow-equal'                   => array( 'wp-polyfill' ),
       
   454 		'keycodes'                           => array( 'lodash', 'wp-polyfill', 'wp-i18n' ),
       
   455 		'list-reusable-blocks'               => array(
       
   456 			'lodash',
       
   457 			'wp-api-fetch',
       
   458 			'wp-components',
       
   459 			'wp-compose',
       
   460 			'wp-element',
       
   461 			'wp-i18n',
       
   462 			'wp-polyfill',
       
   463 		),
       
   464 		'notices'                            => array(
       
   465 			'lodash',
       
   466 			'wp-a11y',
       
   467 			'wp-data',
       
   468 			'wp-polyfill',
       
   469 		),
       
   470 		'nux'                                => array(
       
   471 			'wp-element',
       
   472 			'lodash',
       
   473 			'wp-components',
       
   474 			'wp-compose',
       
   475 			'wp-data',
       
   476 			'wp-i18n',
       
   477 			'wp-polyfill',
       
   478 			'lodash',
       
   479 		),
       
   480 		'plugins'                            => array( 'lodash', 'wp-compose', 'wp-element', 'wp-hooks', 'wp-polyfill' ),
       
   481 		'priority-queue'                     => array(),
       
   482 		'redux-routine'                      => array( 'wp-polyfill' ),
       
   483 		'rich-text'                          => array(
       
   484 			'lodash',
       
   485 			'wp-data',
       
   486 			'wp-escape-html',
       
   487 			'wp-polyfill',
       
   488 		),
       
   489 		'shortcode'                          => array( 'wp-polyfill', 'lodash' ),
       
   490 		'token-list'                         => array( 'lodash', 'wp-polyfill' ),
       
   491 		'url'                                => array( 'wp-polyfill' ),
       
   492 		'viewport'                           => array( 'wp-polyfill', 'wp-element', 'wp-data', 'wp-compose', 'lodash' ),
       
   493 		'wordcount'                          => array( 'wp-polyfill' ),
       
   494 	);
       
   495 
       
   496 	$package_translations = array(
       
   497 		'api-fetch',
       
   498 		'blocks',
       
   499 		'block-editor',
       
   500 		'block-library',
       
   501 		'components',
       
   502 		'edit-post',
       
   503 		'editor',
       
   504 		'format-library',
       
   505 		'keycodes',
       
   506 		'list-reusable-blocks',
       
   507 		'nux',
       
   508 	);
       
   509 
       
   510 	foreach ( $packages_dependencies as $package => $dependencies ) {
       
   511 		$handle  = 'wp-' . $package;
       
   512 		$path    = "/wp-includes/js/dist/$package$suffix.js";
       
   513 		$version = $packages_versions[ $package ];
       
   514 
       
   515 		$scripts->add( $handle, $path, $dependencies, $version, 1 );
       
   516 
       
   517 		if ( in_array( $package, $package_translations, true ) ) {
       
   518 			$scripts->set_translations( $handle );
       
   519 		}
       
   520 	}
       
   521 }
       
   522 
       
   523 /**
       
   524  * Adds inline scripts required for the WordPress JavaScript packages.
       
   525  *
       
   526  * @since 5.0.0
       
   527  *
       
   528  * @param WP_Scripts $scripts WP_Scripts object.
       
   529  */
       
   530 function wp_default_packages_inline_scripts( &$scripts ) {
       
   531 	global $wp_locale;
       
   532 
       
   533 	if ( isset( $scripts->registered['wp-api-fetch'] ) ) {
       
   534 		$scripts->registered['wp-api-fetch']->deps[] = 'wp-hooks';
       
   535 	}
       
   536 	$scripts->add_inline_script(
       
   537 		'wp-api-fetch',
       
   538 		sprintf(
       
   539 			implode(
       
   540 				"\n",
       
   541 				array(
       
   542 					'( function() {',
       
   543 					'	var nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );',
       
   544 					'	wp.apiFetch.use( nonceMiddleware );',
       
   545 					'	wp.hooks.addAction(',
       
   546 					'		"heartbeat.tick",',
       
   547 					'		"core/api-fetch/create-nonce-middleware",',
       
   548 					'		function( response ) {',
       
   549 					'			if ( response[ "rest_nonce" ] ) {',
       
   550 					'				nonceMiddleware.nonce = response[ "rest_nonce" ];',
       
   551 					'			}',
       
   552 					'		}',
       
   553 					'	);',
       
   554 					'} )();',
       
   555 				)
       
   556 			),
       
   557 			( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' )
       
   558 		),
       
   559 		'after'
       
   560 	);
       
   561 	$scripts->add_inline_script(
       
   562 		'wp-api-fetch',
       
   563 		sprintf(
       
   564 			'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
       
   565 			esc_url_raw( get_rest_url() )
       
   566 		),
       
   567 		'after'
       
   568 	);
       
   569 
       
   570 	$scripts->add_inline_script(
       
   571 		'wp-data',
       
   572 		implode(
       
   573 			"\n",
       
   574 			array(
       
   575 				'( function() {',
       
   576 				'	var userId = ' . get_current_user_ID() . ';',
       
   577 				'	var storageKey = "WP_DATA_USER_" + userId;',
       
   578 				'	wp.data',
       
   579 				'		.use( wp.data.plugins.persistence, { storageKey: storageKey } )',
       
   580 				'		.use( wp.data.plugins.controls );',
       
   581 				'	wp.data.plugins.persistence.__unstableMigrate( { storageKey: storageKey } );',
       
   582 				'} )();',
       
   583 			)
       
   584 		)
       
   585 	);
       
   586 
       
   587 	$scripts->add_inline_script(
       
   588 		'wp-date',
       
   589 		sprintf(
       
   590 			'wp.date.setSettings( %s );',
       
   591 			wp_json_encode(
       
   592 				array(
       
   593 					'l10n'     => array(
       
   594 						'locale'        => get_user_locale(),
       
   595 						'months'        => array_values( $wp_locale->month ),
       
   596 						'monthsShort'   => array_values( $wp_locale->month_abbrev ),
       
   597 						'weekdays'      => array_values( $wp_locale->weekday ),
       
   598 						'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
       
   599 						'meridiem'      => (object) $wp_locale->meridiem,
       
   600 						'relative'      => array(
       
   601 							/* translators: %s: duration */
       
   602 							'future' => __( '%s from now' ),
       
   603 							/* translators: %s: duration */
       
   604 							'past'   => __( '%s ago' ),
       
   605 						),
       
   606 					),
       
   607 					'formats'  => array(
       
   608 						/* translators: Time format, see https://secure.php.net/date */
       
   609 						'time'                => get_option( 'time_format', __( 'g:i a' ) ),
       
   610 						/* translators: Date format, see https://secure.php.net/date */
       
   611 						'date'                => get_option( 'date_format', __( 'F j, Y' ) ),
       
   612 						/* translators: Date/Time format, see https://secure.php.net/date */
       
   613 						'datetime'            => __( 'F j, Y g:i a' ),
       
   614 						/* translators: Abbreviated date/time format, see https://secure.php.net/date */
       
   615 						'datetimeAbbreviated' => __( 'M j, Y g:i a' ),
       
   616 					),
       
   617 					'timezone' => array(
       
   618 						'offset' => get_option( 'gmt_offset', 0 ),
       
   619 						'string' => get_option( 'timezone_string', 'UTC' ),
       
   620 					),
       
   621 				)
       
   622 			)
       
   623 		),
       
   624 		'after'
       
   625 	);
       
   626 
       
   627 	// Loading the old editor and its config to ensure the classic block works as expected.
       
   628 	$scripts->add_inline_script(
       
   629 		'editor',
       
   630 		'window.wp.oldEditor = window.wp.editor;',
       
   631 		'after'
       
   632 	);
       
   633 }
       
   634 
       
   635 /**
       
   636  * Adds inline scripts required for the TinyMCE in the block editor.
       
   637  *
       
   638  * These TinyMCE init settings are used to extend and override the default settings
       
   639  * from `_WP_Editors::default_settings()` for the Classic block.
       
   640  *
       
   641  * @since 5.0.0
       
   642  *
       
   643  * @global WP_Scripts $wp_scripts
       
   644  */
       
   645 function wp_tinymce_inline_scripts() {
       
   646 	global $wp_scripts;
       
   647 
       
   648 	/** This filter is documented in wp-includes/class-wp-editor.php */
       
   649 	$editor_settings = apply_filters( 'wp_editor_settings', array( 'tinymce' => true ), 'classic-block' );
       
   650 
       
   651 	$tinymce_plugins = array(
       
   652 		'charmap',
       
   653 		'colorpicker',
       
   654 		'hr',
       
   655 		'lists',
       
   656 		'media',
       
   657 		'paste',
       
   658 		'tabfocus',
       
   659 		'textcolor',
       
   660 		'fullscreen',
       
   661 		'wordpress',
       
   662 		'wpautoresize',
       
   663 		'wpeditimage',
       
   664 		'wpemoji',
       
   665 		'wpgallery',
       
   666 		'wplink',
       
   667 		'wpdialogs',
       
   668 		'wptextpattern',
       
   669 		'wpview',
       
   670 	);
       
   671 
       
   672 	/* This filter is documented in wp-includes/class-wp-editor.php */
       
   673 	$tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' );
       
   674 	$tinymce_plugins = array_unique( $tinymce_plugins );
       
   675 
       
   676 	$disable_captions = false;
       
   677 	// Runs after `tiny_mce_plugins` but before `mce_buttons`.
       
   678 	/** This filter is documented in wp-admin/includes/media.php */
       
   679 	if ( apply_filters( 'disable_captions', '' ) ) {
       
   680 		$disable_captions = true;
       
   681 	}
       
   682 
       
   683 	$toolbar1 = array(
       
   684 		'formatselect',
       
   685 		'bold',
       
   686 		'italic',
       
   687 		'bullist',
       
   688 		'numlist',
       
   689 		'blockquote',
       
   690 		'alignleft',
       
   691 		'aligncenter',
       
   692 		'alignright',
       
   693 		'link',
       
   694 		'unlink',
       
   695 		'wp_more',
       
   696 		'spellchecker',
       
   697 		'wp_add_media',
       
   698 		'wp_adv',
       
   699 	);
       
   700 
       
   701 	/* This filter is documented in wp-includes/class-wp-editor.php */
       
   702 	$toolbar1 = apply_filters( 'mce_buttons', $toolbar1, 'classic-block' );
       
   703 
       
   704 	$toolbar2 = array(
       
   705 		'strikethrough',
       
   706 		'hr',
       
   707 		'forecolor',
       
   708 		'pastetext',
       
   709 		'removeformat',
       
   710 		'charmap',
       
   711 		'outdent',
       
   712 		'indent',
       
   713 		'undo',
       
   714 		'redo',
       
   715 		'wp_help',
       
   716 	);
       
   717 
       
   718 	/* This filter is documented in wp-includes/class-wp-editor.php */
       
   719 	$toolbar2 = apply_filters( 'mce_buttons_2', $toolbar2, 'classic-block' );
       
   720 	/* This filter is documented in wp-includes/class-wp-editor.php */
       
   721 	$toolbar3 = apply_filters( 'mce_buttons_3', array(), 'classic-block' );
       
   722 	/* This filter is documented in wp-includes/class-wp-editor.php */
       
   723 	$toolbar4 = apply_filters( 'mce_buttons_4', array(), 'classic-block' );
       
   724 	/* This filter is documented in wp-includes/class-wp-editor.php */
       
   725 	$external_plugins = apply_filters( 'mce_external_plugins', array(), 'classic-block' );
       
   726 
       
   727 	$tinymce_settings = array(
       
   728 		'plugins'              => implode( ',', $tinymce_plugins ),
       
   729 		'toolbar1'             => implode( ',', $toolbar1 ),
       
   730 		'toolbar2'             => implode( ',', $toolbar2 ),
       
   731 		'toolbar3'             => implode( ',', $toolbar3 ),
       
   732 		'toolbar4'             => implode( ',', $toolbar4 ),
       
   733 		'external_plugins'     => wp_json_encode( $external_plugins ),
       
   734 		'classic_block_editor' => true,
       
   735 	);
       
   736 
       
   737 	if ( $disable_captions ) {
       
   738 		$tinymce_settings['wpeditimage_disable_captions'] = true;
       
   739 	}
       
   740 
       
   741 	if ( ! empty( $editor_settings['tinymce'] ) && is_array( $editor_settings['tinymce'] ) ) {
       
   742 		array_merge( $tinymce_settings, $editor_settings['tinymce'] );
       
   743 	}
       
   744 
       
   745 	/* This filter is documented in wp-includes/class-wp-editor.php */
       
   746 	$tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' );
       
   747 
       
   748 	// Do "by hand" translation from PHP array to js object.
       
   749 	// Prevents breakage in some custom settings.
       
   750 	$init_obj = '';
       
   751 	foreach ( $tinymce_settings as $key => $value ) {
       
   752 		if ( is_bool( $value ) ) {
       
   753 			$val       = $value ? 'true' : 'false';
       
   754 			$init_obj .= $key . ':' . $val . ',';
       
   755 			continue;
       
   756 		} elseif ( ! empty( $value ) && is_string( $value ) && (
       
   757 			( '{' == $value{0} && '}' == $value{strlen( $value ) - 1} ) ||
       
   758 			( '[' == $value{0} && ']' == $value{strlen( $value ) - 1} ) ||
       
   759 			preg_match( '/^\(?function ?\(/', $value ) ) ) {
       
   760 			$init_obj .= $key . ':' . $value . ',';
       
   761 			continue;
       
   762 		}
       
   763 		$init_obj .= $key . ':"' . $value . '",';
       
   764 	}
       
   765 
       
   766 	$init_obj = '{' . trim( $init_obj, ' ,' ) . '}';
       
   767 
       
   768 	$script = 'window.wpEditorL10n = {
       
   769 		tinymce: {
       
   770 			baseURL: ' . wp_json_encode( includes_url( 'js/tinymce' ) ) . ',
       
   771 			suffix: ' . ( SCRIPT_DEBUG ? '""' : '".min"' ) . ',
       
   772 			settings: ' . $init_obj . ',
       
   773 		}
       
   774 	}';
       
   775 
       
   776 	$wp_scripts->add_inline_script( 'wp-block-library', $script, 'before' );
       
   777 }
       
   778 
       
   779 /**
       
   780  * Registers all the WordPress packages scripts.
       
   781  *
       
   782  * @since 5.0.0
       
   783  *
       
   784  * @param WP_Scripts $scripts WP_Scripts object.
       
   785  */
       
   786 function wp_default_packages( &$scripts ) {
       
   787 	wp_default_packages_vendor( $scripts );
       
   788 	wp_register_tinymce_scripts( $scripts );
       
   789 	wp_default_packages_scripts( $scripts );
       
   790 
       
   791 	if ( did_action( 'init' ) ) {
       
   792 		wp_default_packages_inline_scripts( $scripts );
       
   793 	}
       
   794 }
       
   795 
       
   796 /**
       
   797  * Returns the suffix that can be used for the scripts.
       
   798  *
       
   799  * There are two suffix types, the normal one and the dev suffix.
       
   800  *
       
   801  * @since 5.0.0
       
   802  *
       
   803  * @param string $type The type of suffix to retrieve.
       
   804  * @return string The script suffix.
       
   805  */
       
   806 function wp_scripts_get_suffix( $type = '' ) {
       
   807 	static $suffixes;
       
   808 
       
   809 	if ( $suffixes === null ) {
       
   810 		include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
       
   811 
       
   812 		$develop_src = false !== strpos( $wp_version, '-src' );
       
   813 
       
   814 		if ( ! defined( 'SCRIPT_DEBUG' ) ) {
       
   815 			define( 'SCRIPT_DEBUG', $develop_src );
       
   816 		}
       
   817 		$suffix     = SCRIPT_DEBUG ? '' : '.min';
       
   818 		$dev_suffix = $develop_src ? '' : '.min';
       
   819 
       
   820 		$suffixes = array(
       
   821 			'suffix'     => $suffix,
       
   822 			'dev_suffix' => $dev_suffix,
       
   823 		);
       
   824 	}
       
   825 
       
   826 	if ( $type === 'dev' ) {
       
   827 		return $suffixes['dev_suffix'];
       
   828 	}
       
   829 
       
   830 	return $suffixes['suffix'];
       
   831 }
       
   832 
       
   833 /**
    38  * Register all WordPress scripts.
   834  * Register all WordPress scripts.
    39  *
   835  *
    40  * Localizes some of them.
   836  * Localizes some of them.
    41  * args order: `$scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );`
   837  * args order: `$scripts->add( 'handle', 'url', 'dependencies', 'query-string', 1 );`
    42  * when last arg === 1 queues the script for the footer
   838  * when last arg === 1 queues the script for the footer
    44  * @since 2.6.0
   840  * @since 2.6.0
    45  *
   841  *
    46  * @param WP_Scripts $scripts WP_Scripts object.
   842  * @param WP_Scripts $scripts WP_Scripts object.
    47  */
   843  */
    48 function wp_default_scripts( &$scripts ) {
   844 function wp_default_scripts( &$scripts ) {
    49 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
   845 	$suffix     = wp_scripts_get_suffix();
    50 
   846 	$dev_suffix = wp_scripts_get_suffix( 'dev' );
    51 	$develop_src = false !== strpos( $wp_version, '-src' );
       
    52 
       
    53 	if ( ! defined( 'SCRIPT_DEBUG' ) ) {
       
    54 		define( 'SCRIPT_DEBUG', $develop_src );
       
    55 	}
       
    56 
   847 
    57 	if ( ! $guessurl = site_url() ) {
   848 	if ( ! $guessurl = site_url() ) {
    58 		$guessed_url = true;
   849 		$guessed_url = true;
    59 		$guessurl = wp_guess_url();
   850 		$guessurl    = wp_guess_url();
    60 	}
   851 	}
    61 
   852 
    62 	$scripts->base_url = $guessurl;
   853 	$scripts->base_url        = $guessurl;
    63 	$scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
   854 	$scripts->content_url     = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : '';
    64 	$scripts->default_version = get_bloginfo( 'version' );
   855 	$scripts->default_version = get_bloginfo( 'version' );
    65 	$scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/');
   856 	$scripts->default_dirs    = array( '/wp-admin/js/', '/wp-includes/js/' );
    66 
       
    67 	$suffix = SCRIPT_DEBUG ? '' : '.min';
       
    68 	$dev_suffix = $develop_src ? '' : '.min';
       
    69 
   857 
    70 	$scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
   858 	$scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" );
    71 	did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array(
   859 	did_action( 'init' ) && $scripts->localize(
    72 		'url' => (string) SITECOOKIEPATH,
   860 		'utils',
    73 		'uid' => (string) get_current_user_id(),
   861 		'userSettings',
    74 		'time' => (string) time(),
   862 		array(
    75 		'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
   863 			'url'    => (string) SITECOOKIEPATH,
    76 	) );
   864 			'uid'    => (string) get_current_user_id(),
    77 
   865 			'time'   => (string) time(),
    78 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 );
   866 			'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
    79 	did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array(
   867 		)
    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." ),
   868 	);
    81 		'dismiss'      => __( 'Dismiss this notice.' ),
   869 
    82 		'collapseMenu' => __( 'Collapse Main menu' ),
   870 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils' ), false, 1 );
    83 		'expandMenu'   => __( 'Expand Main menu' ),
   871 	did_action( 'init' ) && $scripts->localize(
    84 	) );
   872 		'common',
    85 
   873 		'commonL10n',
    86 	$scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 );
   874 		array(
       
   875 			'warnDelete'   => __( "You are about to permanently delete these items from your site.\nThis action cannot be undone.\n 'Cancel' to stop, 'OK' to delete." ),
       
   876 			'dismiss'      => __( 'Dismiss this notice.' ),
       
   877 			'collapseMenu' => __( 'Collapse Main menu' ),
       
   878 			'expandMenu'   => __( 'Expand Main menu' ),
       
   879 		)
       
   880 	);
       
   881 
       
   882 	$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array(), false, 1 );
       
   883 
       
   884 	$scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery', 'wp-sanitize' ), false, 1 );
    87 
   885 
    88 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
   886 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
    89 
   887 
    90 	$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
   888 	$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
    91 	did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array(
   889 	did_action( 'init' ) && $scripts->localize(
    92 		'closeAllOpenTags'      => __( 'Close all open tags' ),
   890 		'quicktags',
    93 		'closeTags'             => __( 'close tags' ),
   891 		'quicktagsL10n',
    94 		'enterURL'              => __( 'Enter the URL' ),
   892 		array(
    95 		'enterImageURL'         => __( 'Enter the URL of the image' ),
   893 			'closeAllOpenTags'      => __( 'Close all open tags' ),
    96 		'enterImageDescription' => __( 'Enter a description of the image' ),
   894 			'closeTags'             => __( 'close tags' ),
    97 		'textdirection'         => __( 'text direction' ),
   895 			'enterURL'              => __( 'Enter the URL' ),
    98 		'toggleTextdirection'   => __( 'Toggle Editor Text Direction' ),
   896 			'enterImageURL'         => __( 'Enter the URL of the image' ),
    99 		'dfw'                   => __( 'Distraction-free writing mode' ),
   897 			'enterImageDescription' => __( 'Enter a description of the image' ),
   100 		'strong'          => __( 'Bold' ),
   898 			'textdirection'         => __( 'text direction' ),
   101 		'strongClose'     => __( 'Close bold tag' ),
   899 			'toggleTextdirection'   => __( 'Toggle Editor Text Direction' ),
   102 		'em'              => __( 'Italic' ),
   900 			'dfw'                   => __( 'Distraction-free writing mode' ),
   103 		'emClose'         => __( 'Close italic tag' ),
   901 			'strong'                => __( 'Bold' ),
   104 		'link'            => __( 'Insert link' ),
   902 			'strongClose'           => __( 'Close bold tag' ),
   105 		'blockquote'      => __( 'Blockquote' ),
   903 			'em'                    => __( 'Italic' ),
   106 		'blockquoteClose' => __( 'Close blockquote tag' ),
   904 			'emClose'               => __( 'Close italic tag' ),
   107 		'del'             => __( 'Deleted text (strikethrough)' ),
   905 			'link'                  => __( 'Insert link' ),
   108 		'delClose'        => __( 'Close deleted text tag' ),
   906 			'blockquote'            => __( 'Blockquote' ),
   109 		'ins'             => __( 'Inserted text' ),
   907 			'blockquoteClose'       => __( 'Close blockquote tag' ),
   110 		'insClose'        => __( 'Close inserted text tag' ),
   908 			'del'                   => __( 'Deleted text (strikethrough)' ),
   111 		'image'           => __( 'Insert image' ),
   909 			'delClose'              => __( 'Close deleted text tag' ),
   112 		'ul'              => __( 'Bulleted list' ),
   910 			'ins'                   => __( 'Inserted text' ),
   113 		'ulClose'         => __( 'Close bulleted list tag' ),
   911 			'insClose'              => __( 'Close inserted text tag' ),
   114 		'ol'              => __( 'Numbered list' ),
   912 			'image'                 => __( 'Insert image' ),
   115 		'olClose'         => __( 'Close numbered list tag' ),
   913 			'ul'                    => __( 'Bulleted list' ),
   116 		'li'              => __( 'List item' ),
   914 			'ulClose'               => __( 'Close bulleted list tag' ),
   117 		'liClose'         => __( 'Close list item tag' ),
   915 			'ol'                    => __( 'Numbered list' ),
   118 		'code'            => __( 'Code' ),
   916 			'olClose'               => __( 'Close numbered list tag' ),
   119 		'codeClose'       => __( 'Close code tag' ),
   917 			'li'                    => __( 'List item' ),
   120 		'more'            => __( 'Insert Read More tag' ),
   918 			'liClose'               => __( 'Close list item tag' ),
   121 	) );
   919 			'code'                  => __( 'Code' ),
   122 
   920 			'codeClose'             => __( 'Close code tag' ),
   123 	$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' );
   921 			'more'                  => __( 'Insert Read More tag' ),
   124 
   922 		)
   125 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils','jquery'), false, 1 );
   923 	);
       
   924 
       
   925 	$scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array( 'prototype' ), '3517m' );
       
   926 
       
   927 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array( 'utils', 'jquery' ), false, 1 );
       
   928 
       
   929 	$scripts->add( 'clipboard', "/wp-includes/js/clipboard$suffix.js", array(), false, 1 );
   126 
   930 
   127 	// Back-compat for old DFW. To-do: remove at the end of 2016.
   931 	// 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 );
   932 	$scripts->add( 'wp-fullscreen-stub', "/wp-admin/js/wp-fullscreen-stub$suffix.js", array(), false, 1 );
   129 
   933 
   130 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 );
   934 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array( 'jquery' ), false, 1 );
   131 	did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array(
   935 	did_action( 'init' ) && $scripts->localize(
   132 		'noPerm' => __('Sorry, you are not allowed to do that.'),
   936 		'wp-ajax-response',
   133 		'broken' => __('Something went wrong.')
   937 		'wpAjax',
   134 	) );
   938 		array(
       
   939 			'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
       
   940 			'broken' => __( 'Something went wrong.' ),
       
   941 		)
       
   942 	);
   135 
   943 
   136 	$scripts->add( 'wp-api-request', "/wp-includes/js/api-request$suffix.js", array( 'jquery' ), false, 1 );
   944 	$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.
   945 	// `wpApiSettings` is also used by `wp-api`, which depends on this script.
   138 	did_action( 'init' ) && $scripts->localize( 'wp-api-request', 'wpApiSettings', array(
   946 	did_action( 'init' ) && $scripts->localize(
   139 		'root'          => esc_url_raw( get_rest_url() ),
   947 		'wp-api-request',
   140 		'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
   948 		'wpApiSettings',
   141 		'versionString' => 'wp/v2/',
   949 		array(
   142 	) );
   950 			'root'          => esc_url_raw( get_rest_url() ),
       
   951 			'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
       
   952 			'versionString' => 'wp/v2/',
       
   953 		)
       
   954 	);
   143 
   955 
   144 	$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
   956 	$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
   145 	did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array(
   957 	did_action( 'init' ) && $scripts->localize(
   146 		'dismiss' => __('Dismiss'),
   958 		'wp-pointer',
   147 	) );
   959 		'wpPointerL10n',
   148 
   960 		array(
   149 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 );
   961 			'dismiss' => __( 'Dismiss' ),
   150 
   962 		)
   151 	$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 );
   963 	);
   152 	did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',
   964 
       
   965 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
       
   966 
       
   967 	$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array( 'jquery', 'wp-hooks' ), false, 1 );
       
   968 	did_action( 'init' ) && $scripts->localize(
       
   969 		'heartbeat',
       
   970 		'heartbeatSettings',
   153 		/**
   971 		/**
   154 		 * Filters the Heartbeat settings.
   972 		 * Filters the Heartbeat settings.
   155 		 *
   973 		 *
   156 		 * @since 3.6.0
   974 		 * @since 3.6.0
   157 		 *
   975 		 *
   158 		 * @param array $settings Heartbeat settings array.
   976 		 * @param array $settings Heartbeat settings array.
   159 		 */
   977 		 */
   160 		apply_filters( 'heartbeat_settings', array() )
   978 		apply_filters( 'heartbeat_settings', array() )
   161 	);
   979 	);
   162 
   980 
   163 	$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 );
   981 	$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array( 'heartbeat' ), false, 1 );
   164 	did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array(
   982 	did_action( 'init' ) && $scripts->localize(
   165 		'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),
   983 		'wp-auth-check',
   166 
   984 		'authcheckL10n',
   167 		/**
   985 		array(
   168 		 * Filters the authentication check interval.
   986 			'beforeunload' => __( 'Your session has expired. You can log in again from this page or go to the login page.' ),
   169 		 *
   987 
   170 		 * @since 3.6.0
   988 			/**
   171 		 *
   989 			 * Filters the authentication check interval.
   172 		 * @param int $interval The interval in which to check a user's authentication.
   990 			 *
   173 		 *                      Default 3 minutes in seconds, or 180.
   991 			 * @since 3.6.0
   174 		 */
   992 			 *
   175 		'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
   993 			 * @param int $interval The interval in which to check a user's authentication.
   176 	) );
   994 			 *                      Default 3 minutes in seconds, or 180.
       
   995 			 */
       
   996 			'interval'     => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
       
   997 		)
       
   998 	);
   177 
   999 
   178 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
  1000 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
   179 
  1001 
   180 	// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
  1002 	// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
   181 	$scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1');
  1003 	$scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1' );
   182 	$scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0');
  1004 	$scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array( 'prototype' ), '1.9.0' );
   183 	$scripts->add( 'scriptaculous-builder', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0');
  1005 	$scripts->add( 'scriptaculous-builder', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array( 'scriptaculous-root' ), '1.9.0' );
   184 	$scripts->add( 'scriptaculous-dragdrop', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0');
  1006 	$scripts->add( 'scriptaculous-dragdrop', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array( 'scriptaculous-builder', 'scriptaculous-effects' ), '1.9.0' );
   185 	$scripts->add( 'scriptaculous-effects', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0');
  1007 	$scripts->add( 'scriptaculous-effects', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array( 'scriptaculous-root' ), '1.9.0' );
   186 	$scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0');
  1008 	$scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array( 'scriptaculous-effects' ), '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' );
  1009 	$scripts->add( 'scriptaculous-sound', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' );
   188 	$scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0');
  1010 	$scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array( 'scriptaculous-root' ), '1.9.0' );
   189 	$scripts->add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') );
  1011 	$scripts->add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );
   190 
  1012 
   191 	// not used in core, replaced by Jcrop.js
  1013 	// not used in core, replaced by Jcrop.js
   192 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') );
  1014 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
   193 
  1015 
   194 	// jQuery
  1016 	// jQuery
   195 	$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4' );
  1017 	$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4-wp' );
   196 	$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4' );
  1018 	$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4-wp' );
   197 	$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
  1019 	$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
   198 
  1020 
   199 	// full jQuery UI
  1021 	// full jQuery UI
   200 	$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array('jquery'), '1.11.4', 1 );
  1022 	$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
   201 	$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array('jquery'), '1.11.4', 1 );
  1023 	$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
   202 
  1024 
   203 	$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1025 	$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   204 	$scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1026 	$scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   205 	$scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1027 	$scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   206 	$scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1028 	$scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   207 	$scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1029 	$scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   208 	$scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1030 	$scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   209 	$scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1031 	$scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   210 	$scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1032 	$scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   211 	$scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-scale'), '1.11.4', 1 );
  1033 	$scripts->add( 'jquery-effects-puff', "/wp-includes/js/jquery/ui/effect-puff$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-scale' ), '1.11.4', 1 );
   212 	$scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1034 	$scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   213 	$scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array('jquery-effects-core', 'jquery-effects-size'), '1.11.4', 1 );
  1035 	$scripts->add( 'jquery-effects-scale', "/wp-includes/js/jquery/ui/effect-scale$dev_suffix.js", array( 'jquery-effects-core', 'jquery-effects-size' ), '1.11.4', 1 );
   214 	$scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1036 	$scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   215 	$scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1037 	$scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   216 	$scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1038 	$scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   217 	$scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 );
  1039 	$scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   218 
  1040 
   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 );
  1041 	$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 );
   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 );
  1042 	$scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 );
   221 	$scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
  1043 	$scripts->add( 'jquery-ui-button', "/wp-includes/js/jquery/ui/button$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
   222 	$scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array('jquery-ui-core'), '1.11.4', 1 );
  1044 	$scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array( 'jquery-ui-core' ), '1.11.4', 1 );
   223 	$scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array('jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position'), '1.11.4', 1 );
  1045 	$scripts->add( 'jquery-ui-dialog', "/wp-includes/js/jquery/ui/dialog$dev_suffix.js", array( 'jquery-ui-resizable', 'jquery-ui-draggable', 'jquery-ui-button', 'jquery-ui-position' ), '1.11.4', 1 );
   224 	$scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
  1046 	$scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
   225 	$scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array('jquery-ui-draggable'), '1.11.4', 1 );
  1047 	$scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array( 'jquery-ui-draggable' ), '1.11.4', 1 );
   226 	$scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
  1048 	$scripts->add( 'jquery-ui-menu', "/wp-includes/js/jquery/ui/menu$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
   227 	$scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
  1049 	$scripts->add( 'jquery-ui-mouse', "/wp-includes/js/jquery/ui/mouse$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
   228 	$scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array('jquery'), '1.11.4', 1 );
  1050 	$scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
   229 	$scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
  1051 	$scripts->add( 'jquery-ui-progressbar', "/wp-includes/js/jquery/ui/progressbar$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget' ), '1.11.4', 1 );
   230 	$scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
  1052 	$scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
   231 	$scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
  1053 	$scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
   232 	$scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array('jquery-ui-menu'), '1.11.4', 1 );
  1054 	$scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array( 'jquery-ui-menu' ), '1.11.4', 1 );
   233 	$scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
  1055 	$scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array( 'jquery-ui-mouse' ), '1.11.4', 1 );
   234 	$scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 );
  1056 	$scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array( 'jquery-ui-mouse' ), '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 );
  1057 	$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 );
   236 	$scripts->add( 'jquery-ui-tabs', "/wp-includes/js/jquery/ui/tabs$dev_suffix.js", array('jquery-ui-core', 'jquery-ui-widget'), '1.11.4', 1 );
  1058 	$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 );
   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 );
  1059 	$scripts->add( 'jquery-ui-tooltip', "/wp-includes/js/jquery/ui/tooltip$dev_suffix.js", array( 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position' ), '1.11.4', 1 );
   238 	$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '1.11.4', 1 );
  1060 	$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
   239 
  1061 
   240 	// Strings for 'jquery-ui-autocomplete' live region messages
  1062 	// Strings for 'jquery-ui-autocomplete' live region messages
   241 	did_action( 'init' ) && $scripts->localize( 'jquery-ui-autocomplete', 'uiAutocompleteL10n', array(
  1063 	did_action( 'init' ) && $scripts->localize(
   242 		'noResults' => __( 'No results found.' ),
  1064 		'jquery-ui-autocomplete',
   243 		/* translators: Number of results found when using jQuery UI Autocomplete */
  1065 		'uiAutocompleteL10n',
   244 		'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),
  1066 		array(
   245 		/* translators: %d: Number of results found when using jQuery UI Autocomplete */
  1067 			'noResults'    => __( 'No results found.' ),
   246 		'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),
  1068 			/* translators: Number of results found when using jQuery UI Autocomplete */
   247 		'itemSelected' => __( 'Item selected.' ),
  1069 			'oneResult'    => __( '1 result found. Use up and down arrow keys to navigate.' ),
   248 	) );
  1070 			/* translators: %d: Number of results found when using jQuery UI Autocomplete */
       
  1071 			'manyResults'  => __( '%d results found. Use up and down arrow keys to navigate.' ),
       
  1072 			'itemSelected' => __( 'Item selected.' ),
       
  1073 		)
       
  1074 	);
   249 
  1075 
   250 	// deprecated, not used in core, most functionality is included in jQuery 1.3
  1076 	// deprecated, not used in core, most functionality is included in jQuery 1.3
   251 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '4.2.1', 1 );
  1077 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.2.1', 1 );
   252 
  1078 
   253 	// jQuery plugins
  1079 	// jQuery plugins
   254 	$scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 );
  1080 	$scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.min.js', array( 'jquery' ), '2.1.1', 1 );
   255 	$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 );
  1081 	$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array( 'jquery' ), '20m', 1 );
   256 	$scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 );
  1082 	$scripts->add( 'jquery-query', '/wp-includes/js/jquery/jquery.query.js', array( 'jquery' ), '2.1.7', 1 );
   257 	$scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2', 1 );
  1083 	$scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2', 1 );
   258 	$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m', 1 );
  1084 	$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 );
   259 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 );
  1085 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 );
   260 	$scripts->add( 'jquery-touch-punch', "/wp-includes/js/jquery/jquery.ui.touch-punch.js", array('jquery-ui-widget', 'jquery-ui-mouse'), '0.2.2', 1 );
  1086 	$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 );
   261 
  1087 
   262 	// Not used any more, registered for backwards compatibility.
  1088 	// Not used any more, registered for backward compatibility.
   263 	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 );
  1089 	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 );
   264 
  1090 
   265 	// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
  1091 	// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
   266 	// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
  1092 	// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
   267 	$scripts->add( 'imagesloaded', "/wp-includes/js/imagesloaded.min.js", array(), '3.2.0', 1 );
  1093 	$scripts->add( 'imagesloaded', '/wp-includes/js/imagesloaded.min.js', array(), '3.2.0', 1 );
   268 	$scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array( 'imagesloaded' ), '3.3.2', 1 );
  1094 	$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 );
  1095 	$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 );
   270 
  1096 
   271 	$scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 );
  1097 	$scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array( 'jquery' ), '3.1-20121105', 1 );
   272 	did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array(
  1098 	did_action( 'init' ) && $scripts->localize(
   273 		'next' => __('Next &gt;'),
  1099 		'thickbox',
   274 		'prev' => __('&lt; Prev'),
  1100 		'thickboxL10n',
   275 		'image' => __('Image'),
  1101 		array(
   276 		'of' => __('of'),
  1102 			'next'             => __( 'Next &gt;' ),
   277 		'close' => __('Close'),
  1103 			'prev'             => __( '&lt; Prev' ),
   278 		'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),
  1104 			'image'            => __( 'Image' ),
   279 		'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),
  1105 			'of'               => __( 'of' ),
   280 	) );
  1106 			'close'            => __( 'Close' ),
   281 
  1107 			'noiframes'        => __( 'This feature requires inline frames. You have iframes disabled or your browser does not support them.' ),
   282 	$scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12');
  1108 			'loadingAnimation' => includes_url( 'js/thickbox/loadingAnimation.gif' ),
   283 
  1109 		)
   284 	$scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417');
  1110 	);
       
  1111 
       
  1112 	$scripts->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.js', array( 'jquery' ), '0.9.12' );
       
  1113 
       
  1114 	$scripts->add( 'swfobject', '/wp-includes/js/swfobject.js', array(), '2.2-20120417' );
   285 
  1115 
   286 	// Error messages for Plupload.
  1116 	// Error messages for Plupload.
   287 	$uploader_l10n = array(
  1117 	$uploader_l10n = array(
   288 		'queue_limit_exceeded' => __('You have attempted to queue too many files.'),
  1118 		'queue_limit_exceeded'      => __( 'You have attempted to queue too many files.' ),
   289 		'file_exceeds_size_limit' => __('%s exceeds the maximum upload size for this site.'),
  1119 		'file_exceeds_size_limit'   => __( '%s exceeds the maximum upload size for this site.' ),
   290 		'zero_byte_file' => __('This file is empty. Please try another.'),
  1120 		'zero_byte_file'            => __( 'This file is empty. Please try another.' ),
   291 		'invalid_filetype' => __('Sorry, this file type is not permitted for security reasons.'),
  1121 		'invalid_filetype'          => __( 'Sorry, this file type is not permitted for security reasons.' ),
   292 		'not_an_image' => __('This file is not an image. Please try another.'),
  1122 		'not_an_image'              => __( 'This file is not an image. Please try another.' ),
   293 		'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),
  1123 		'image_memory_exceeded'     => __( 'Memory exceeded. Please try another smaller file.' ),
   294 		'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),
  1124 		'image_dimensions_exceeded' => __( 'This is larger than the maximum size. Please try another.' ),
   295 		'default_error' => __('An error occurred in the upload. Please try again later.'),
  1125 		'default_error'             => __( 'An error occurred in the upload. Please try again later.' ),
   296 		'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),
  1126 		'missing_upload_url'        => __( 'There was a configuration error. Please contact the server administrator.' ),
   297 		'upload_limit_exceeded' => __('You may only upload 1 file.'),
  1127 		'upload_limit_exceeded'     => __( 'You may only upload 1 file.' ),
   298 		'http_error' => __('HTTP error.'),
  1128 		'http_error'                => __( 'HTTP error.' ),
   299 		'upload_failed' => __('Upload failed.'),
  1129 		'upload_failed'             => __( 'Upload failed.' ),
   300 		/* translators: 1: Opening link tag, 2: Closing link tag */
  1130 		/* translators: 1: Opening link tag, 2: Closing link tag */
   301 		'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.'),
  1131 		'big_upload_failed'         => __( 'Please try uploading this file with the %1$sbrowser uploader%2$s.' ),
   302 		'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.'),
  1132 		'big_upload_queued'         => __( '%s exceeds the maximum upload size for the multi-file uploader when used in your browser.' ),
   303 		'io_error' => __('IO error.'),
  1133 		'io_error'                  => __( 'IO error.' ),
   304 		'security_error' => __('Security error.'),
  1134 		'security_error'            => __( 'Security error.' ),
   305 		'file_cancelled' => __('File canceled.'),
  1135 		'file_cancelled'            => __( 'File canceled.' ),
   306 		'upload_stopped' => __('Upload stopped.'),
  1136 		'upload_stopped'            => __( 'Upload stopped.' ),
   307 		'dismiss' => __('Dismiss'),
  1137 		'dismiss'                   => __( 'Dismiss' ),
   308 		'crunching' => __('Crunching&hellip;'),
  1138 		'crunching'                 => __( 'Crunching&hellip;' ),
   309 		'deleted' => __('moved to the trash.'),
  1139 		'deleted'                   => __( 'moved to the trash.' ),
   310 		'error_uploading' => __('&#8220;%s&#8221; has failed to upload.')
  1140 		'error_uploading'           => __( '&#8220;%s&#8221; has failed to upload.' ),
   311 	);
  1141 	);
   312 
  1142 
   313 	$scripts->add( 'moxiejs', "/wp-includes/js/plupload/moxie$suffix.js", array(), '1.3.5' );
  1143 	$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' );
  1144 	$scripts->add( 'plupload', "/wp-includes/js/plupload/plupload$suffix.js", array( 'moxiejs' ), '2.1.9' );
   315 	// Back compat handles:
  1145 	// Back compat handles:
   322 
  1152 
   323 	$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
  1153 	$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
   324 	did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
  1154 	did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
   325 
  1155 
   326 	// keep 'swfupload' for back-compat.
  1156 	// keep 'swfupload' for back-compat.
   327 	$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113');
  1157 	$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113' );
   328 	$scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
  1158 	$scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
   329 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524');
  1159 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array( 'swfupload-all', 'jquery' ), '2201-20110524' );
   330 	did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
  1160 	did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
   331 
  1161 
   332 	$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
  1162 	$scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 );
   333 
  1163 
   334 	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' );
  1164 	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' );
   335 	did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
  1165 	did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
   336 
  1166 
   337 	$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 );
  1167 	$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 );
   338 	$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore','jquery' ), '1.2.3', 1 );
  1168 	$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.2.3', 1 );
   339 
  1169 
   340 	$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 );
  1170 	$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array( 'underscore', 'jquery' ), false, 1 );
   341 	did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array(
  1171 	did_action( 'init' ) && $scripts->localize(
   342 		'ajax' => array(
  1172 		'wp-util',
   343 			'url' => admin_url( 'admin-ajax.php', 'relative' ),
  1173 		'_wpUtilSettings',
   344 		),
  1174 		array(
   345 	) );
  1175 			'ajax' => array(
   346 
  1176 				'url' => admin_url( 'admin-ajax.php', 'relative' ),
   347 	$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array('jquery'), false, 1 );
  1177 			),
   348 
  1178 		)
   349 	$scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 );
  1179 	);
       
  1180 
       
  1181 	$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array( 'jquery' ), false, 1 );
       
  1182 
       
  1183 	$scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array( 'backbone', 'wp-util' ), false, 1 );
   350 
  1184 
   351 	$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
  1185 	$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
   352 
  1186 
   353 	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1 );
  1187 	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array( 'jquery' ), false, 1 );
   354 
  1188 
   355 	$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.6-78496d1' );
  1189 	$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.6-78496d1' );
   356 	$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.6-78496d1', 1 );
  1190 	$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.6-78496d1', 1 );
   357 	$scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1);
  1191 	$scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 );
   358 
  1192 
   359 	did_action( 'init' ) && $scripts->add_inline_script( 'mediaelement-core', sprintf( 'var mejsL10n = %s;', wp_json_encode( array(
  1193 	did_action( 'init' ) && $scripts->add_inline_script(
   360 		'language' => strtolower( strtok( is_admin() ? get_user_locale() : get_locale(), '_-' ) ),
  1194 		'mediaelement-core',
   361 		'strings'  => array(
  1195 		sprintf(
   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/' ),
  1196 			'var mejsL10n = %s;',
   363 			'mejs.fullscreen-off'      => __( 'Turn off Fullscreen' ),
  1197 			wp_json_encode(
   364 			'mejs.fullscreen-on'       => __( 'Go Fullscreen' ),
  1198 				array(
   365 			'mejs.download-video'      => __( 'Download Video' ),
  1199 					'language' => strtolower( strtok( determine_locale(), '_-' ) ),
   366 			'mejs.fullscreen'          => __( 'Fullscreen' ),
  1200 					'strings'  => array(
   367 			'mejs.time-jump-forward'   => array( __( 'Jump forward 1 second' ), __( 'Jump forward %1 seconds' ) ),
  1201 						'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/' ),
   368 			'mejs.loop'                => __( 'Toggle Loop' ),
  1202 						'mejs.fullscreen-off'      => __( 'Turn off Fullscreen' ),
   369 			'mejs.play'                => __( 'Play' ),
  1203 						'mejs.fullscreen-on'       => __( 'Go Fullscreen' ),
   370 			'mejs.pause'               => __( 'Pause' ),
  1204 						'mejs.download-video'      => __( 'Download Video' ),
   371 			'mejs.close'               => __( 'Close' ),
  1205 						'mejs.fullscreen'          => __( 'Fullscreen' ),
   372 			'mejs.time-slider'         => __( 'Time Slider' ),
  1206 						'mejs.time-jump-forward'   => array( __( 'Jump forward 1 second' ), __( 'Jump forward %1 seconds' ) ),
   373 			'mejs.time-help-text'      => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
  1207 						'mejs.loop'                => __( 'Toggle Loop' ),
   374 			'mejs.time-skip-back'      => array( __( 'Skip back 1 second' ), __( 'Skip back %1 seconds' ) ),
  1208 						'mejs.play'                => __( 'Play' ),
   375 			'mejs.captions-subtitles'  => __( 'Captions/Subtitles' ),
  1209 						'mejs.pause'               => __( 'Pause' ),
   376 			'mejs.captions-chapters'   => __( 'Chapters' ),
  1210 						'mejs.close'               => __( 'Close' ),
   377 			'mejs.none'                => __( 'None' ),
  1211 						'mejs.time-slider'         => __( 'Time Slider' ),
   378 			'mejs.mute-toggle'         => __( 'Mute Toggle' ),
  1212 						'mejs.time-help-text'      => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
   379 			'mejs.volume-help-text'    => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
  1213 						'mejs.time-skip-back'      => array( __( 'Skip back 1 second' ), __( 'Skip back %1 seconds' ) ),
   380 			'mejs.unmute'              => __( 'Unmute' ),
  1214 						'mejs.captions-subtitles'  => __( 'Captions/Subtitles' ),
   381 			'mejs.mute'                => __( 'Mute' ),
  1215 						'mejs.captions-chapters'   => __( 'Chapters' ),
   382 			'mejs.volume-slider'       => __( 'Volume Slider' ),
  1216 						'mejs.none'                => __( 'None' ),
   383 			'mejs.video-player'        => __( 'Video Player' ),
  1217 						'mejs.mute-toggle'         => __( 'Mute Toggle' ),
   384 			'mejs.audio-player'        => __( 'Audio Player' ),
  1218 						'mejs.volume-help-text'    => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
   385 			'mejs.ad-skip'             => __( 'Skip ad' ),
  1219 						'mejs.unmute'              => __( 'Unmute' ),
   386 			'mejs.ad-skip-info'        => array( __( 'Skip in 1 second' ), __( 'Skip in %1 seconds' ) ),
  1220 						'mejs.mute'                => __( 'Mute' ),
   387 			'mejs.source-chooser'      => __( 'Source Chooser' ),
  1221 						'mejs.volume-slider'       => __( 'Volume Slider' ),
   388 			'mejs.stop'                => __( 'Stop' ),
  1222 						'mejs.video-player'        => __( 'Video Player' ),
   389 			'mejs.speed-rate'          => __( 'Speed Rate' ),
  1223 						'mejs.audio-player'        => __( 'Audio Player' ),
   390 			'mejs.live-broadcast'      => __( 'Live Broadcast' ),
  1224 						'mejs.ad-skip'             => __( 'Skip ad' ),
   391 			'mejs.afrikaans'           => __( 'Afrikaans' ),
  1225 						'mejs.ad-skip-info'        => array( __( 'Skip in 1 second' ), __( 'Skip in %1 seconds' ) ),
   392 			'mejs.albanian'            => __( 'Albanian' ),
  1226 						'mejs.source-chooser'      => __( 'Source Chooser' ),
   393 			'mejs.arabic'              => __( 'Arabic' ),
  1227 						'mejs.stop'                => __( 'Stop' ),
   394 			'mejs.belarusian'          => __( 'Belarusian' ),
  1228 						'mejs.speed-rate'          => __( 'Speed Rate' ),
   395 			'mejs.bulgarian'           => __( 'Bulgarian' ),
  1229 						'mejs.live-broadcast'      => __( 'Live Broadcast' ),
   396 			'mejs.catalan'             => __( 'Catalan' ),
  1230 						'mejs.afrikaans'           => __( 'Afrikaans' ),
   397 			'mejs.chinese'             => __( 'Chinese' ),
  1231 						'mejs.albanian'            => __( 'Albanian' ),
   398 			'mejs.chinese-simplified'  => __( 'Chinese (Simplified)' ),
  1232 						'mejs.arabic'              => __( 'Arabic' ),
   399 			'mejs.chinese-traditional' => __( 'Chinese (Traditional)' ),
  1233 						'mejs.belarusian'          => __( 'Belarusian' ),
   400 			'mejs.croatian'            => __( 'Croatian' ),
  1234 						'mejs.bulgarian'           => __( 'Bulgarian' ),
   401 			'mejs.czech'               => __( 'Czech' ),
  1235 						'mejs.catalan'             => __( 'Catalan' ),
   402 			'mejs.danish'              => __( 'Danish' ),
  1236 						'mejs.chinese'             => __( 'Chinese' ),
   403 			'mejs.dutch'               => __( 'Dutch' ),
  1237 						'mejs.chinese-simplified'  => __( 'Chinese (Simplified)' ),
   404 			'mejs.english'             => __( 'English' ),
  1238 						'mejs.chinese-traditional' => __( 'Chinese (Traditional)' ),
   405 			'mejs.estonian'            => __( 'Estonian' ),
  1239 						'mejs.croatian'            => __( 'Croatian' ),
   406 			'mejs.filipino'            => __( 'Filipino' ),
  1240 						'mejs.czech'               => __( 'Czech' ),
   407 			'mejs.finnish'             => __( 'Finnish' ),
  1241 						'mejs.danish'              => __( 'Danish' ),
   408 			'mejs.french'              => __( 'French' ),
  1242 						'mejs.dutch'               => __( 'Dutch' ),
   409 			'mejs.galician'            => __( 'Galician' ),
  1243 						'mejs.english'             => __( 'English' ),
   410 			'mejs.german'              => __( 'German' ),
  1244 						'mejs.estonian'            => __( 'Estonian' ),
   411 			'mejs.greek'               => __( 'Greek' ),
  1245 						'mejs.filipino'            => __( 'Filipino' ),
   412 			'mejs.haitian-creole'      => __( 'Haitian Creole' ),
  1246 						'mejs.finnish'             => __( 'Finnish' ),
   413 			'mejs.hebrew'              => __( 'Hebrew' ),
  1247 						'mejs.french'              => __( 'French' ),
   414 			'mejs.hindi'               => __( 'Hindi' ),
  1248 						'mejs.galician'            => __( 'Galician' ),
   415 			'mejs.hungarian'           => __( 'Hungarian' ),
  1249 						'mejs.german'              => __( 'German' ),
   416 			'mejs.icelandic'           => __( 'Icelandic' ),
  1250 						'mejs.greek'               => __( 'Greek' ),
   417 			'mejs.indonesian'          => __( 'Indonesian' ),
  1251 						'mejs.haitian-creole'      => __( 'Haitian Creole' ),
   418 			'mejs.irish'               => __( 'Irish' ),
  1252 						'mejs.hebrew'              => __( 'Hebrew' ),
   419 			'mejs.italian'             => __( 'Italian' ),
  1253 						'mejs.hindi'               => __( 'Hindi' ),
   420 			'mejs.japanese'            => __( 'Japanese' ),
  1254 						'mejs.hungarian'           => __( 'Hungarian' ),
   421 			'mejs.korean'              => __( 'Korean' ),
  1255 						'mejs.icelandic'           => __( 'Icelandic' ),
   422 			'mejs.latvian'             => __( 'Latvian' ),
  1256 						'mejs.indonesian'          => __( 'Indonesian' ),
   423 			'mejs.lithuanian'          => __( 'Lithuanian' ),
  1257 						'mejs.irish'               => __( 'Irish' ),
   424 			'mejs.macedonian'          => __( 'Macedonian' ),
  1258 						'mejs.italian'             => __( 'Italian' ),
   425 			'mejs.malay'               => __( 'Malay' ),
  1259 						'mejs.japanese'            => __( 'Japanese' ),
   426 			'mejs.maltese'             => __( 'Maltese' ),
  1260 						'mejs.korean'              => __( 'Korean' ),
   427 			'mejs.norwegian'           => __( 'Norwegian' ),
  1261 						'mejs.latvian'             => __( 'Latvian' ),
   428 			'mejs.persian'             => __( 'Persian' ),
  1262 						'mejs.lithuanian'          => __( 'Lithuanian' ),
   429 			'mejs.polish'              => __( 'Polish' ),
  1263 						'mejs.macedonian'          => __( 'Macedonian' ),
   430 			'mejs.portuguese'          => __( 'Portuguese' ),
  1264 						'mejs.malay'               => __( 'Malay' ),
   431 			'mejs.romanian'            => __( 'Romanian' ),
  1265 						'mejs.maltese'             => __( 'Maltese' ),
   432 			'mejs.russian'             => __( 'Russian' ),
  1266 						'mejs.norwegian'           => __( 'Norwegian' ),
   433 			'mejs.serbian'             => __( 'Serbian' ),
  1267 						'mejs.persian'             => __( 'Persian' ),
   434 			'mejs.slovak'              => __( 'Slovak' ),
  1268 						'mejs.polish'              => __( 'Polish' ),
   435 			'mejs.slovenian'           => __( 'Slovenian' ),
  1269 						'mejs.portuguese'          => __( 'Portuguese' ),
   436 			'mejs.spanish'             => __( 'Spanish' ),
  1270 						'mejs.romanian'            => __( 'Romanian' ),
   437 			'mejs.swahili'             => __( 'Swahili' ),
  1271 						'mejs.russian'             => __( 'Russian' ),
   438 			'mejs.swedish'             => __( 'Swedish' ),
  1272 						'mejs.serbian'             => __( 'Serbian' ),
   439 			'mejs.tagalog'             => __( 'Tagalog' ),
  1273 						'mejs.slovak'              => __( 'Slovak' ),
   440 			'mejs.thai'                => __( 'Thai' ),
  1274 						'mejs.slovenian'           => __( 'Slovenian' ),
   441 			'mejs.turkish'             => __( 'Turkish' ),
  1275 						'mejs.spanish'             => __( 'Spanish' ),
   442 			'mejs.ukrainian'           => __( 'Ukrainian' ),
  1276 						'mejs.swahili'             => __( 'Swahili' ),
   443 			'mejs.vietnamese'          => __( 'Vietnamese' ),
  1277 						'mejs.swedish'             => __( 'Swedish' ),
   444 			'mejs.welsh'               => __( 'Welsh' ),
  1278 						'mejs.tagalog'             => __( 'Tagalog' ),
   445 			'mejs.yiddish'             => __( 'Yiddish' ),
  1279 						'mejs.thai'                => __( 'Thai' ),
   446 			),
  1280 						'mejs.turkish'             => __( 'Turkish' ),
   447 		) ) ), 'before' );
  1281 						'mejs.ukrainian'           => __( 'Ukrainian' ),
   448 
  1282 						'mejs.vietnamese'          => __( 'Vietnamese' ),
   449 
  1283 						'mejs.welsh'               => __( 'Welsh' ),
   450 	$scripts->add( 'mediaelement-vimeo', "/wp-includes/js/mediaelement/renderers/vimeo.min.js", array('mediaelement'), '4.2.6-78496d1', 1 );
  1284 						'mejs.yiddish'             => __( 'Yiddish' ),
   451 	$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array('mediaelement'), false, 1 );
  1285 					),
       
  1286 				)
       
  1287 			)
       
  1288 		),
       
  1289 		'before'
       
  1290 	);
       
  1291 
       
  1292 	$scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.6-78496d1', 1 );
       
  1293 	$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array( 'mediaelement' ), false, 1 );
   452 	$mejs_settings = array(
  1294 	$mejs_settings = array(
   453 		'pluginPath'    => includes_url( 'js/mediaelement/', 'relative' ),
  1295 		'pluginPath'  => includes_url( 'js/mediaelement/', 'relative' ),
   454 		'classPrefix'   => 'mejs-',
  1296 		'classPrefix' => 'mejs-',
   455 		'stretching'    => 'responsive',
  1297 		'stretching'  => 'responsive',
   456 	);
  1298 	);
   457 	did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings',
  1299 	did_action( 'init' ) && $scripts->localize(
       
  1300 		'mediaelement',
       
  1301 		'_wpmejsSettings',
   458 		/**
  1302 		/**
   459 		 * Filters the MediaElement configuration settings.
  1303 		 * Filters the MediaElement configuration settings.
   460 		 *
  1304 		 *
   461 		 * @since 4.4.0
  1305 		 * @since 4.4.0
   462 		 *
  1306 		 *
   465 		apply_filters( 'mejs_settings', $mejs_settings )
  1309 		apply_filters( 'mejs_settings', $mejs_settings )
   466 	);
  1310 	);
   467 
  1311 
   468 	$scripts->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.js', array(), '5.29.1-alpha-ee20357' );
  1312 	$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' );
  1313 	$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' );
  1314 	$scripts->add( 'esprima', '/wp-includes/js/codemirror/esprima.js', array(), '4.0.0' );
       
  1315 	$scripts->add( 'jshint', '/wp-includes/js/codemirror/fakejshint.js', array( 'esprima' ), '2.9.5' );
   471 	$scripts->add( 'jsonlint', '/wp-includes/js/codemirror/jsonlint.js', array(), '1.6.2' );
  1316 	$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' );
  1317 	$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' ) );
  1318 	$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' ) );
  1319 	$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' ) );
  1320 	$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(
  1321 	did_action( 'init' ) && $scripts->add_inline_script(
   477 		'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
  1322 		'wp-theme-plugin-editor',
   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.' ),
  1323 		sprintf(
   479 		'lintError' => array(
  1324 			'wp.themePluginEditor.l10n = %s;',
   480 			/* translators: %d: error count */
  1325 			wp_json_encode(
   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 ),
  1326 				array(
   482 			/* translators: %d: error count */
  1327 					'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
   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.
  1328 					'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.' ),
   484 		),
  1329 					'lintError' => array(
   485 	) ) ) );
  1330 						/* translators: %d: error count */
       
  1331 						'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 ),
       
  1332 						/* translators: %d: error count */
       
  1333 						'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.
       
  1334 					),
       
  1335 				)
       
  1336 			)
       
  1337 		)
       
  1338 	);
   486 
  1339 
   487 	$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
  1340 	$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
   488 
  1341 
   489 	$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
  1342 	$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
   490 	did_action( 'init' ) && $scripts->localize( 'zxcvbn-async', '_zxcvbnSettings', array(
  1343 	did_action( 'init' ) && $scripts->localize(
   491 		'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
  1344 		'zxcvbn-async',
   492 	) );
  1345 		'_zxcvbnSettings',
       
  1346 		array(
       
  1347 			'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',
       
  1348 		)
       
  1349 	);
   493 
  1350 
   494 	$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
  1351 	$scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 );
   495 	did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array(
  1352 	did_action( 'init' ) && $scripts->localize(
   496 		'unknown'  => _x( 'Password strength unknown', 'password strength' ),
  1353 		'password-strength-meter',
   497 		'short'    => _x( 'Very weak', 'password strength' ),
  1354 		'pwsL10n',
   498 		'bad'      => _x( 'Weak', 'password strength' ),
  1355 		array(
   499 		'good'     => _x( 'Medium', 'password strength' ),
  1356 			'unknown'  => _x( 'Password strength unknown', 'password strength' ),
   500 		'strong'   => _x( 'Strong', 'password strength' ),
  1357 			'short'    => _x( 'Very weak', 'password strength' ),
   501 		'mismatch' => _x( 'Mismatch', 'password mismatch' ),
  1358 			'bad'      => _x( 'Weak', 'password strength' ),
   502 	) );
  1359 			'good'     => _x( 'Medium', 'password strength' ),
       
  1360 			'strong'   => _x( 'Strong', 'password strength' ),
       
  1361 			'mismatch' => _x( 'Mismatch', 'password mismatch' ),
       
  1362 		)
       
  1363 	);
   503 
  1364 
   504 	$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
  1365 	$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(
  1366 	did_action( 'init' ) && $scripts->localize(
   506 		'warn'     => __( 'Your new password has not been saved.' ),
  1367 		'user-profile',
   507 		'warnWeak' => __( 'Confirm use of weak password' ),
  1368 		'userProfileL10n',
   508 		'show'     => __( 'Show' ),
  1369 		array(
   509 		'hide'     => __( 'Hide' ),
  1370 			'warn'     => __( 'Your new password has not been saved.' ),
   510 		'cancel'   => __( 'Cancel' ),
  1371 			'warnWeak' => __( 'Confirm use of weak password' ),
   511 		'ariaShow' => esc_attr__( 'Show password' ),
  1372 			'show'     => __( 'Show' ),
   512 		'ariaHide' => esc_attr__( 'Hide password' ),
  1373 			'hide'     => __( 'Hide' ),
   513 	) );
  1374 			'cancel'   => __( 'Cancel' ),
       
  1375 			'ariaShow' => esc_attr__( 'Show password' ),
       
  1376 			'ariaHide' => esc_attr__( 'Hide password' ),
       
  1377 		)
       
  1378 	);
   514 
  1379 
   515 	$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
  1380 	$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
   516 
  1381 
   517 	$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
  1382 	$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
   518 
  1383 
   519 	$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
  1384 	$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
   520 
  1385 
   521 	$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
  1386 	$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
   522 	did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array(
  1387 	did_action( 'init' ) && $scripts->localize(
   523 		'title' => __('Insert/edit link'),
  1388 		'wplink',
   524 		'update' => __('Update'),
  1389 		'wpLinkL10n',
   525 		'save' => __('Add Link'),
  1390 		array(
   526 		'noTitle' => __('(no title)'),
  1391 			'title'          => __( 'Insert/edit link' ),
   527 		'noMatchesFound' => __('No results found.'),
  1392 			'update'         => __( 'Update' ),
   528 		'linkSelected' => __( 'Link selected.' ),
  1393 			'save'           => __( 'Add Link' ),
   529 		'linkInserted' => __( 'Link inserted.' ),
  1394 			'noTitle'        => __( '(no title)' ),
   530 	) );
  1395 			'noMatchesFound' => __( 'No results found.' ),
       
  1396 			'linkSelected'   => __( 'Link selected.' ),
       
  1397 			'linkInserted'   => __( 'Link inserted.' ),
       
  1398 		)
       
  1399 	);
   531 
  1400 
   532 	$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
  1401 	$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
   533 
  1402 
   534 	$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );
  1403 	$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );
   535 
  1404 
   536 	$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
  1405 	$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
   537 
  1406 
   538 	$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '1.8.1', 1 );
  1407 	$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.8.1', 1 );
   539 
  1408 
   540 	$scripts->add( 'customize-base',     "/wp-includes/js/customize-base$suffix.js",     array( 'jquery', 'json2', 'underscore' ), false, 1 );
  1409 	$scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );
   541 	$scripts->add( 'customize-loader',   "/wp-includes/js/customize-loader$suffix.js",   array( 'customize-base' ), false, 1 );
  1410 	$scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 );
   542 	$scripts->add( 'customize-preview',  "/wp-includes/js/customize-preview$suffix.js",  array( 'wp-a11y', 'customize-base' ), false, 1 );
  1411 	$scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
   543 	$scripts->add( 'customize-models',   "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 );
  1412 	$scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 );
   544 	$scripts->add( 'customize-views',    "/wp-includes/js/customize-views.js",  array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 );
  1413 	$scripts->add( 'customize-views', '/wp-includes/js/customize-views.js', array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), 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 );
  1414 	$scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util', 'jquery-ui-core' ), false, 1 );
   546 	did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array(
  1415 	did_action( 'init' ) && $scripts->localize(
   547 		'activate'           => __( 'Activate &amp; Publish' ),
  1416 		'customize-controls',
   548 		'save'               => __( 'Save &amp; Publish' ), // @todo Remove as not required.
  1417 		'_wpCustomizeControlsL10n',
   549 		'publish'            => __( 'Publish' ),
  1418 		array(
   550 		'published'          => __( 'Published' ),
  1419 			'activate'                => __( 'Activate &amp; Publish' ),
   551 		'saveDraft'          => __( 'Save Draft' ),
  1420 			'save'                    => __( 'Save &amp; Publish' ), // @todo Remove as not required.
   552 		'draftSaved'         => __( 'Draft Saved' ),
  1421 			'publish'                 => __( 'Publish' ),
   553 		'updating'           => __( 'Updating' ),
  1422 			'published'               => __( 'Published' ),
   554 		'schedule'           => _x( 'Schedule', 'customizer changeset action/button label' ),
  1423 			'saveDraft'               => __( 'Save Draft' ),
   555 		'scheduled'          => _x( 'Scheduled', 'customizer changeset status' ),
  1424 			'draftSaved'              => __( 'Draft Saved' ),
   556 		'invalid'            => __( 'Invalid' ),
  1425 			'updating'                => __( 'Updating' ),
   557 		'saveBeforeShare'    => __( 'Please save your changes in order to share the preview.' ),
  1426 			'schedule'                => _x( 'Schedule', 'customizer changeset action/button label' ),
   558 		'futureDateError'    => __( 'You must supply a future date to schedule.' ),
  1427 			'scheduled'               => _x( 'Scheduled', 'customizer changeset status' ),
   559 		'saveAlert'          => __( 'The changes you made will be lost if you navigate away from this page.' ),
  1428 			'invalid'                 => __( 'Invalid' ),
   560 		'saved'              => __( 'Saved' ),
  1429 			'saveBeforeShare'         => __( 'Please save your changes in order to share the preview.' ),
   561 		'cancel'             => __( 'Cancel' ),
  1430 			'futureDateError'         => __( 'You must supply a future date to schedule.' ),
   562 		'close'              => __( 'Close' ),
  1431 			'saveAlert'               => __( 'The changes you made will be lost if you navigate away from this page.' ),
   563 		'action'             => __( 'Action' ),
  1432 			'saved'                   => __( 'Saved' ),
   564 		'discardChanges'     => __( 'Discard changes' ),
  1433 			'cancel'                  => __( 'Cancel' ),
   565 		'cheatin'            => __( 'Something went wrong.' ),
  1434 			'close'                   => __( 'Close' ),
   566 		'notAllowedHeading'  => __( 'You need a higher level of permission.' ),
  1435 			'action'                  => __( 'Action' ),
   567 		'notAllowed'         => __( 'Sorry, you are not allowed to customize this site.' ),
  1436 			'discardChanges'          => __( 'Discard changes' ),
   568 		'previewIframeTitle' => __( 'Site Preview' ),
  1437 			'cheatin'                 => __( 'Something went wrong.' ),
   569 		'loginIframeTitle'   => __( 'Session expired' ),
  1438 			'notAllowedHeading'       => __( 'You need a higher level of permission.' ),
   570 		'collapseSidebar'    => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),
  1439 			'notAllowed'              => __( 'Sorry, you are not allowed to customize this site.' ),
   571 		'expandSidebar'      => _x( 'Show Controls', 'label for hide controls button without length constraints' ),
  1440 			'previewIframeTitle'      => __( 'Site Preview' ),
   572 		'untitledBlogName'   => __( '(Untitled)' ),
  1441 			'loginIframeTitle'        => __( 'Session expired' ),
   573 		'unknownRequestFail' => __( 'Looks like something&#8217;s gone wrong. Wait a couple seconds, and then try again.' ),
  1442 			'collapseSidebar'         => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),
   574 		'themeDownloading'   => __( 'Downloading your new theme&hellip;' ),
  1443 			'expandSidebar'           => _x( 'Show Controls', 'label for hide controls button without length constraints' ),
   575 		'themePreviewWait'   => __( 'Setting up your live preview. This may take a bit.' ),
  1444 			'untitledBlogName'        => __( '(Untitled)' ),
   576 		'revertingChanges'   => __( 'Reverting unpublished changes&hellip;' ),
  1445 			'unknownRequestFail'      => __( 'Looks like something&#8217;s gone wrong. Wait a couple seconds, and then try again.' ),
   577 		'trashConfirm'       => __( 'Are you sure you&#8217;d like to discard your unpublished changes?' ),
  1446 			'themeDownloading'        => __( 'Downloading your new theme&hellip;' ),
   578 		/* translators: %s: Display name of the user who has taken over the changeset in customizer. */
  1447 			'themePreviewWait'        => __( 'Setting up your live preview. This may take a bit.' ),
   579 		'takenOverMessage'   => __( '%s has taken over and is currently customizing.' ),
  1448 			'revertingChanges'        => __( 'Reverting unpublished changes&hellip;' ),
   580 		/* translators: %s: URL to the Customizer to load the autosaved version */
  1449 			'trashConfirm'            => __( 'Are you sure you&#8217;d like to discard your unpublished changes?' ),
   581 		'autosaveNotice'     => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
  1450 			/* translators: %s: Display name of the user who has taken over the changeset in customizer. */
   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.' ),
  1451 			'takenOverMessage'        => __( '%s has taken over and is currently customizing.' ),
   583 		// Used for overriding the file types allowed in plupload.
  1452 			/* translators: %s: URL to the Customizer to load the autosaved version */
   584 		'allowedFiles'       => __( 'Allowed Files' ),
  1453 			'autosaveNotice'          => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
   585 		'customCssError'     => array(
  1454 			'videoHeaderNotice'       => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
   586 			/* translators: %d: error count */
  1455 			// Used for overriding the file types allowed in plupload.
   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 ),
  1456 			'allowedFiles'            => __( 'Allowed Files' ),
   588 			/* translators: %d: error count */
  1457 			'customCssError'          => array(
   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.
  1458 				/* translators: %d: error count */
   590 		),
  1459 				'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 ),
   591 		'pageOnFrontError' => __( 'Homepage and posts page must be different.' ),
  1460 				/* translators: %d: error count */
   592 		'saveBlockedError' => array(
  1461 				'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.
   593 			/* translators: %s: number of invalid settings */
  1462 			),
   594 			'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
  1463 			'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
   595 			/* translators: %s: number of invalid settings */
  1464 			'saveBlockedError'        => array(
   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.
  1465 				/* translators: %s: number of invalid settings */
   597 		),
  1466 				'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
   598 		'scheduleDescription' => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
  1467 				/* translators: %s: number of invalid settings */
   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.' ),
  1468 				'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.
   600 		'themeInstallUnavailable' => sprintf(
  1469 			),
   601 			/* translators: %s: URL to Add Themes admin screen */
  1470 			'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
   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>.' ),
  1471 			'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.' ),
   603 			esc_url( admin_url( 'theme-install.php' ) )
  1472 			'themeInstallUnavailable' => sprintf(
   604 		),
  1473 				/* translators: %s: URL to Add Themes admin screen */
   605 		'publishSettings' => __( 'Publish Settings' ),
  1474 				   __( '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>.' ),
   606 		'invalidDate'     => __( 'Invalid date.' ),
  1475 				esc_url( admin_url( 'theme-install.php' ) )
   607 		'invalidValue'    => __( 'Invalid value.' ),
  1476 			),
   608 	) );
  1477 			'publishSettings'         => __( 'Publish Settings' ),
       
  1478 			'invalidDate'             => __( 'Invalid date.' ),
       
  1479 			'invalidValue'            => __( 'Invalid value.' ),
       
  1480 		)
       
  1481 	);
   609 	$scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
  1482 	$scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 );
   610 
  1483 
   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 );
  1484 	$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 );
   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 );
  1485 	$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 
  1486 
   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 );
  1487 	$scripts->add( 'customize-nav-menus', "/wp-admin/js/customize-nav-menus$suffix.js", array( 'jquery', 'wp-backbone', 'customize-controls', 'accordion', 'nav-menu', 'wp-sanitize' ), 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 );
  1488 	$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 
  1489 
   617 	$scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array( 'wp-a11y' ), false, 1 );
  1490 	$scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array( 'wp-a11y' ), false, 1 );
   618 
  1491 
   619 	$scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 );
  1492 	$scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 );
   620 
  1493 
   621 	$scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
  1494 	$scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 );
   622 	$scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
  1495 	$scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 );
   623 	did_action( 'init' ) && $scripts->localize( 'media-models', '_wpMediaModelsL10n', array(
  1496 	did_action( 'init' ) && $scripts->localize(
   624 		'settings' => array(
  1497 		'media-models',
   625 			'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
  1498 		'_wpMediaModelsL10n',
   626 			'post' => array( 'id' => 0 ),
  1499 		array(
   627 		),
  1500 			'settings' => array(
   628 	) );
  1501 				'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),
       
  1502 				'post'    => array( 'id' => 0 ),
       
  1503 			),
       
  1504 		)
       
  1505 	);
   629 
  1506 
   630 	$scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" );
  1507 	$scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" );
   631 
  1508 
   632 	// To enqueue media-views or media-editor, call wp_enqueue_media().
  1509 	// To enqueue media-views or media-editor, call wp_enqueue_media().
   633 	// Both rely on numerous settings, styles, and templates to operate correctly.
  1510 	// Both rely on numerous settings, styles, and templates to operate correctly.
   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 );
  1511 	$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 );
   635 	$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
  1512 	$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
   636 	$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
  1513 	$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
   637 	$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
  1514 	$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
   638 
  1515 
   639 	$scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 );
  1516 	$scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 );
   640 
  1517 
   641 	if ( is_admin() ) {
  1518 	if ( is_admin() ) {
   642 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
  1519 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
   643 		did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array(
       
   644 			'noPerm' => __('Sorry, you are not allowed to do that.'),
       
   645 			'broken' => __('Something went wrong.')
       
   646 		));
       
   647 
       
   648 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 );
       
   649 		did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array(
       
   650 			'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),
       
   651 			'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),
       
   652 			'replyApprove' => __( 'Approve and 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)' ),
       
   659 		) );
       
   660 
       
   661 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 );
       
   662 		did_action( 'init' ) && $scripts->localize(
  1520 		did_action( 'init' ) && $scripts->localize(
   663 			'xfn', 'privacyToolsL10n', array(
  1521 			'admin-tags',
       
  1522 			'tagsl10n',
       
  1523 			array(
       
  1524 				'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
       
  1525 				'broken' => __( 'Something went wrong.' ),
       
  1526 			)
       
  1527 		);
       
  1528 
       
  1529 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 );
       
  1530 		did_action( 'init' ) && $scripts->localize(
       
  1531 			'admin-comments',
       
  1532 			'adminCommentsL10n',
       
  1533 			array(
       
  1534 				'hotkeys_highlight_first' => isset( $_GET['hotkeys_highlight_first'] ),
       
  1535 				'hotkeys_highlight_last'  => isset( $_GET['hotkeys_highlight_last'] ),
       
  1536 				'replyApprove'            => __( 'Approve and Reply' ),
       
  1537 				'reply'                   => __( 'Reply' ),
       
  1538 				'warnQuickEdit'           => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
       
  1539 				'warnCommentChanges'      => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),
       
  1540 				'docTitleComments'        => __( 'Comments' ),
       
  1541 				/* translators: %s: comments count */
       
  1542 				'docTitleCommentsCount'   => __( 'Comments (%s)' ),
       
  1543 			)
       
  1544 		);
       
  1545 
       
  1546 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
       
  1547 		did_action( 'init' ) && $scripts->localize(
       
  1548 			'xfn',
       
  1549 			'privacyToolsL10n',
       
  1550 			array(
   664 				'noDataFound'     => __( 'No personal data was found for this user.' ),
  1551 				'noDataFound'     => __( 'No personal data was found for this user.' ),
   665 				'foundAndRemoved' => __( 'All of the personal data found for this user was erased.' ),
  1552 				'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.' ),
  1553 				'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.' ),
  1554 				'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.' ),
  1555 				'removalError'    => __( 'An error occurred while attempting to find and erase personal data.' ),
   669 				'noExportFile'    => __( 'No personal data export file was generated.' ),
  1556 				'noExportFile'    => __( 'No personal data export file was generated.' ),
   670 				'exportError'     => __( 'An error occurred while attempting to export personal data.' ),
  1557 				'exportError'     => __( 'An error occurred while attempting to export personal data.' ),
   671 			)
  1558 			)
   672 		);
  1559 		);
   673 
  1560 
   674 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 );
  1561 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable' ), false, 1 );
   675 		did_action( 'init' ) && $scripts->localize( 'postbox', 'postBoxL10n', array(
  1562 		did_action( 'init' ) && $scripts->localize(
   676 			'postBoxEmptyString' => __( 'Drag boxes here' ),
  1563 			'postbox',
   677 		) );
  1564 			'postBoxL10n',
       
  1565 			array(
       
  1566 				'postBoxEmptyString' => __( 'Drag boxes here' ),
       
  1567 			)
       
  1568 		);
   678 
  1569 
   679 		$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
  1570 		$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
   680 
  1571 
   681 		$scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
  1572 		$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(
  1573 		did_action( 'init' ) && $scripts->localize(
   683 			'tagDelimiter' => _x( ',', 'tag delimiter' ),
  1574 			'tags-suggest',
   684 			'removeTerm'   => __( 'Remove term:' ),
  1575 			'tagsSuggestL10n',
   685 			'termSelected' => __( 'Term selected.' ),
  1576 			array(
   686 			'termAdded'    => __( 'Term added.' ),
  1577 				'tagDelimiter' => _x( ',', 'tag delimiter' ),
   687 			'termRemoved'  => __( 'Term removed.' ),
  1578 				'removeTerm'   => __( 'Remove term:' ),
   688 		) );
  1579 				'termSelected' => __( 'Term selected.' ),
   689 
  1580 				'termAdded'    => __( 'Term added.' ),
   690 		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 );
  1581 				'termRemoved'  => __( 'Term removed.' ),
   691 		did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array(
  1582 			)
   692 			'ok' => __('OK'),
  1583 		);
   693 			'cancel' => __('Cancel'),
  1584 
   694 			'publishOn' => __('Publish on:'),
  1585 		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y', 'wp-sanitize' ), false, 1 );
   695 			'publishOnFuture' =>  __('Schedule for:'),
  1586 		did_action( 'init' ) && $scripts->localize(
   696 			'publishOnPast' => __('Published on:'),
  1587 			'post',
   697 			/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
  1588 			'postL10n',
   698 			'dateFormat' => __('%1$s %2$s, %3$s @ %4$s:%5$s'),
  1589 			array(
   699 			'showcomm' => __('Show more comments'),
  1590 				'ok'                 => __( 'OK' ),
   700 			'endcomm' => __('No more comments found.'),
  1591 				'cancel'             => __( 'Cancel' ),
   701 			'publish' => __('Publish'),
  1592 				'publishOn'          => __( 'Publish on:' ),
   702 			'schedule' => _x('Schedule', 'post action/button label'),
  1593 				'publishOnFuture'    => __( 'Schedule for:' ),
   703 			'update' => __('Update'),
  1594 				'publishOnPast'      => __( 'Published on:' ),
   704 			'savePending' => __('Save as Pending'),
  1595 				/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
   705 			'saveDraft' => __('Save Draft'),
  1596 				'dateFormat'         => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ),
   706 			'private' => __('Private'),
  1597 				'showcomm'           => __( 'Show more comments' ),
   707 			'public' => __('Public'),
  1598 				'endcomm'            => __( 'No more comments found.' ),
   708 			'publicSticky' => __('Public, Sticky'),
  1599 				'publish'            => __( 'Publish' ),
   709 			'password' => __('Password Protected'),
  1600 				'schedule'           => _x( 'Schedule', 'post action/button label' ),
   710 			'privatelyPublished' => __('Privately Published'),
  1601 				'update'             => __( 'Update' ),
   711 			'published' => __('Published'),
  1602 				'savePending'        => __( 'Save as Pending' ),
   712 			'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),
  1603 				'saveDraft'          => __( 'Save Draft' ),
   713 			'savingText' => __('Saving Draft&#8230;'),
  1604 				'private'            => __( 'Private' ),
   714 			'permalinkSaved' => __( 'Permalink saved' ),
  1605 				'public'             => __( 'Public' ),
   715 		) );
  1606 				'publicSticky'       => __( 'Public, Sticky' ),
       
  1607 				'password'           => __( 'Password Protected' ),
       
  1608 				'privatelyPublished' => __( 'Privately Published' ),
       
  1609 				'published'          => __( 'Published' ),
       
  1610 				'saveAlert'          => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
  1611 				'savingText'         => __( 'Saving Draft&#8230;' ),
       
  1612 				'permalinkSaved'     => __( 'Permalink saved' ),
       
  1613 			)
       
  1614 		);
   716 
  1615 
   717 		$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
  1616 		$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
   718 
  1617 
   719 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
  1618 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
   720 
  1619 
   721 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
  1620 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
   722 		$scripts->add_data( 'comment', 'group', 1 );
  1621 		$scripts->add_data( 'comment', 'group', 1 );
   723 		did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array(
  1622 		did_action( 'init' ) && $scripts->localize(
   724 			'submittedOn' => __( 'Submitted on:' ),
  1623 			'comment',
   725 			/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
  1624 			'commentL10n',
   726 			'dateFormat' => __( '%1$s %2$s, %3$s @ %4$s:%5$s' )
  1625 			array(
   727 		) );
  1626 				'submittedOn' => __( 'Submitted on:' ),
       
  1627 				/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
       
  1628 				'dateFormat'  => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ),
       
  1629 			)
       
  1630 		);
   728 
  1631 
   729 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
  1632 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
   730 
  1633 
   731 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
  1634 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
   732 		did_action( 'init' ) && $scripts->add_inline_script( 'admin-widgets', sprintf( 'wpWidgets.l10n = %s;', wp_json_encode( array(
  1635 		did_action( 'init' ) && $scripts->add_inline_script(
   733 			'save' => __( 'Save' ),
  1636 			'admin-widgets',
   734 			'saved' => __( 'Saved' ),
  1637 			sprintf(
   735 			'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
  1638 				'wpWidgets.l10n = %s;',
   736 		) ) ) );
  1639 				wp_json_encode(
       
  1640 					array(
       
  1641 						'save'      => __( 'Save' ),
       
  1642 						'saved'     => __( 'Saved' ),
       
  1643 						'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
  1644 					)
       
  1645 				)
       
  1646 			)
       
  1647 		);
   737 
  1648 
   738 		$scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
  1649 		$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' );
  1650 		$scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' );
   740 
  1651 
   741 		$scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
  1652 		$scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
   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' ) );
  1657 		$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 
  1658 
   748 		$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 );
  1659 		$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 );
   749 
  1660 
   750 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
  1661 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
   751 		did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array(
  1662 		did_action( 'init' ) && $scripts->localize(
   752 			'error'      => __( 'Error while saving the changes.' ),
  1663 			'inline-edit-post',
   753 			'ntdeltitle' => __( 'Remove From Bulk Edit' ),
  1664 			'inlineEditL10n',
   754 			'notitle'    => __( '(no title)' ),
  1665 			array(
   755 			'comma'      => trim( _x( ',', 'tag delimiter' ) ),
  1666 				'error'      => __( 'Error while saving the changes.' ),
   756 			'saved'      => __( 'Changes saved.' ),
  1667 				'ntdeltitle' => __( 'Remove From Bulk Edit' ),
   757 		) );
  1668 				'notitle'    => __( '(no title)' ),
       
  1669 				'comma'      => trim( _x( ',', 'tag delimiter' ) ),
       
  1670 				'saved'      => __( 'Changes saved.' ),
       
  1671 			)
       
  1672 		);
   758 
  1673 
   759 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
  1674 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
   760 		did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array(
  1675 		did_action( 'init' ) && $scripts->localize(
   761 			'error' => __( 'Error while saving the changes.' ),
  1676 			'inline-edit-tax',
   762 			'saved' => __( 'Changes saved.' ),
  1677 			'inlineEditL10n',
   763 		) );
  1678 			array(
       
  1679 				'error' => __( 'Error while saving the changes.' ),
       
  1680 				'saved' => __( 'Changes saved.' ),
       
  1681 			)
       
  1682 		);
   764 
  1683 
   765 		$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
  1684 		$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
   766 		did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array(
  1685 		did_action( 'init' ) && $scripts->localize(
   767 			'plugin_information' => __( 'Plugin:' ),
  1686 			'plugin-install',
   768 			'plugin_modal_label' => __( 'Plugin details' ),
  1687 			'plugininstallL10n',
   769 			'ays' => __('Are you sure you want to install this plugin?')
  1688 			array(
   770 		) );
  1689 				'plugin_information' => __( 'Plugin:' ),
   771 
  1690 				'plugin_modal_label' => __( 'Plugin details' ),
   772 		$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
  1691 				'ays'                => __( 'Are you sure you want to install this plugin?' ),
   773 		did_action( 'init' ) && $scripts->localize( 'updates', '_wpUpdatesSettings', array(
  1692 			)
   774 			'ajax_nonce' => wp_create_nonce( 'updates' ),
  1693 		);
   775 			'l10n'       => array(
  1694 
   776 				/* translators: %s: Search string */
  1695 		$scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 );
   777 				'searchResults'              => __( 'Search results for &#8220;%s&#8221;' ),
  1696 		$scripts->set_translations( 'site-health' );
   778 				'searchResultsLabel'         => __( 'Search Results' ),
  1697 
   779 				'noPlugins'                  => __( 'You do not appear to have any plugins available at this time.' ),
  1698 		$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize' ), false, 1 );
   780 				'noItemsSelected'            => __( 'Please select at least one item to perform this action on.' ),
  1699 		did_action( 'init' ) && $scripts->localize(
   781 				'updating'                   => __( 'Updating...' ), // No ellipsis.
  1700 			'updates',
   782 				'pluginUpdated'              => _x( 'Updated!', 'plugin' ),
  1701 			'_wpUpdatesSettings',
   783 				'themeUpdated'               => _x( 'Updated!', 'theme' ),
  1702 			array(
   784 				'update'                     => __( 'Update' ),
  1703 				'ajax_nonce' => wp_create_nonce( 'updates' ),
   785 				'updateNow'                  => __( 'Update Now' ),
  1704 				'l10n'       => array(
   786 				/* translators: %s: Plugin name and version */
  1705 					/* translators: %s: Search string */
   787 				'pluginUpdateNowLabel'       => _x( 'Update %s now', 'plugin' ),
  1706 					'searchResults'            => __( 'Search results for &#8220;%s&#8221;' ),
   788 				'updateFailedShort'          => __( 'Update Failed!' ),
  1707 					'searchResultsLabel'       => __( 'Search Results' ),
   789 				/* translators: %s: Error string for a failed update */
  1708 					'noPlugins'                => __( 'You do not appear to have any plugins available at this time.' ),
   790 				'updateFailed'               => __( 'Update Failed: %s' ),
  1709 					'noItemsSelected'          => __( 'Please select at least one item to perform this action on.' ),
   791 				/* translators: %s: Plugin name and version */
  1710 					'updating'                 => __( 'Updating...' ), // No ellipsis.
   792 				'pluginUpdatingLabel'        => _x( 'Updating %s...', 'plugin' ), // No ellipsis.
  1711 					'pluginUpdated'            => _x( 'Updated!', 'plugin' ),
   793 				/* translators: %s: Plugin name and version */
  1712 					'themeUpdated'             => _x( 'Updated!', 'theme' ),
   794 				'pluginUpdatedLabel'         => _x( '%s updated!', 'plugin' ),
  1713 					'update'                   => __( 'Update' ),
   795 				/* translators: %s: Plugin name and version */
  1714 					'updateNow'                => __( 'Update Now' ),
   796 				'pluginUpdateFailedLabel'    => _x( '%s update failed', 'plugin' ),
  1715 					/* translators: %s: Plugin name and version */
   797 				/* translators: Accessibility text */
  1716 					'pluginUpdateNowLabel'     => _x( 'Update %s now', 'plugin' ),
   798 				'updatingMsg'                => __( 'Updating... please wait.' ), // No ellipsis.
  1717 					'updateFailedShort'        => __( 'Update Failed!' ),
   799 				/* translators: Accessibility text */
  1718 					/* translators: %s: Error string for a failed update */
   800 				'updatedMsg'                 => __( 'Update completed successfully.' ),
  1719 					'updateFailed'             => __( 'Update Failed: %s' ),
   801 				/* translators: Accessibility text */
  1720 					/* translators: %s: Plugin name and version */
   802 				'updateCancel'               => __( 'Update canceled.' ),
  1721 					'pluginUpdatingLabel'      => _x( 'Updating %s...', 'plugin' ), // No ellipsis.
   803 				'beforeunload'               => __( 'Updates may not complete if you navigate away from this page.' ),
  1722 					/* translators: %s: Plugin name and version */
   804 				'installNow'                 => __( 'Install Now' ),
  1723 					'pluginUpdatedLabel'       => _x( '%s updated!', 'plugin' ),
   805 				/* translators: %s: Plugin name */
  1724 					/* translators: %s: Plugin name and version */
   806 				'pluginInstallNowLabel'      => _x( 'Install %s now', 'plugin' ),
  1725 					'pluginUpdateFailedLabel'  => _x( '%s update failed', 'plugin' ),
   807 				'installing'                 => __( 'Installing...' ),
  1726 					/* translators: Accessibility text */
   808 				'pluginInstalled'            => _x( 'Installed!', 'plugin' ),
  1727 					'updatingMsg'              => __( 'Updating... please wait.' ), // No ellipsis.
   809 				'themeInstalled'             => _x( 'Installed!', 'theme' ),
  1728 					/* translators: Accessibility text */
   810 				'installFailedShort'         => __( 'Installation Failed!' ),
  1729 					'updatedMsg'               => __( 'Update completed successfully.' ),
   811 				/* translators: %s: Error string for a failed installation */
  1730 					/* translators: Accessibility text */
   812 				'installFailed'              => __( 'Installation failed: %s' ),
  1731 					'updateCancel'             => __( 'Update canceled.' ),
   813 				/* translators: %s: Plugin name and version */
  1732 					'beforeunload'             => __( 'Updates may not complete if you navigate away from this page.' ),
   814 				'pluginInstallingLabel'      => _x( 'Installing %s...', 'plugin' ), // no ellipsis
  1733 					'installNow'               => __( 'Install Now' ),
   815 				/* translators: %s: Theme name and version */
  1734 					/* translators: %s: Plugin name */
   816 				'themeInstallingLabel'       => _x( 'Installing %s...', 'theme' ), // no ellipsis
  1735 					'pluginInstallNowLabel'    => _x( 'Install %s now', 'plugin' ),
   817 				/* translators: %s: Plugin name and version */
  1736 					'installing'               => __( 'Installing...' ),
   818 				'pluginInstalledLabel'       => _x( '%s installed!', 'plugin' ),
  1737 					'pluginInstalled'          => _x( 'Installed!', 'plugin' ),
   819 				/* translators: %s: Theme name and version */
  1738 					'themeInstalled'           => _x( 'Installed!', 'theme' ),
   820 				'themeInstalledLabel'        => _x( '%s installed!', 'theme' ),
  1739 					'installFailedShort'       => __( 'Installation Failed!' ),
   821 				/* translators: %s: Plugin name and version */
  1740 					/* translators: %s: Error string for a failed installation */
   822 				'pluginInstallFailedLabel'   => _x( '%s installation failed', 'plugin' ),
  1741 					'installFailed'            => __( 'Installation failed: %s' ),
   823 				/* translators: %s: Theme name and version */
  1742 					/* translators: %s: Plugin name and version */
   824 				'themeInstallFailedLabel'    => _x( '%s installation failed', 'theme' ),
  1743 					'pluginInstallingLabel'    => _x( 'Installing %s...', 'plugin' ), // no ellipsis
   825 				'installingMsg'              => __( 'Installing... please wait.' ),
  1744 					/* translators: %s: Theme name and version */
   826 				'installedMsg'               => __( 'Installation completed successfully.' ),
  1745 					'themeInstallingLabel'     => _x( 'Installing %s...', 'theme' ), // no ellipsis
   827 				/* translators: %s: Activation URL */
  1746 					/* translators: %s: Plugin name and version */
   828 				'importerInstalledMsg'       => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),
  1747 					'pluginInstalledLabel'     => _x( '%s installed!', 'plugin' ),
   829 				/* translators: %s: Theme name */
  1748 					/* translators: %s: Theme name and version */
   830 				'aysDelete'                  => __( 'Are you sure you want to delete %s?' ),
  1749 					'themeInstalledLabel'      => _x( '%s installed!', 'theme' ),
   831 				/* translators: %s: Plugin name */
  1750 					/* translators: %s: Plugin name and version */
   832 				'aysDeleteUninstall'         => __( 'Are you sure you want to delete %s and its data?' ),
  1751 					'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ),
   833 				'aysBulkDelete'              => __( 'Are you sure you want to delete the selected plugins and their data?' ),
  1752 					/* translators: %s: Theme name and version */
   834 				'aysBulkDeleteThemes'        => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),
  1753 					'themeInstallFailedLabel'  => _x( '%s installation failed', 'theme' ),
   835 				'deleting'                   => __( 'Deleting...' ),
  1754 					'installingMsg'            => __( 'Installing... please wait.' ),
   836 				/* translators: %s: Error string for a failed deletion */
  1755 					'installedMsg'             => __( 'Installation completed successfully.' ),
   837 				'deleteFailed'               => __( 'Deletion failed: %s' ),
  1756 					/* translators: %s: Activation URL */
   838 				'pluginDeleted'              => _x( 'Deleted!', 'plugin' ),
  1757 					'importerInstalledMsg'     => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),
   839 				'themeDeleted'               => _x( 'Deleted!', 'theme' ),
  1758 					/* translators: %s: Theme name */
   840 				'livePreview'                => __( 'Live Preview' ),
  1759 					'aysDelete'                => __( 'Are you sure you want to delete %s?' ),
   841 				'activatePlugin'             => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),
  1760 					/* translators: %s: Plugin name */
   842 				'activateTheme'              => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),
  1761 					'aysDeleteUninstall'       => __( 'Are you sure you want to delete %s and its data?' ),
   843 				/* translators: %s: Plugin name */
  1762 					'aysBulkDelete'            => __( 'Are you sure you want to delete the selected plugins and their data?' ),
   844 				'activatePluginLabel'        => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),
  1763 					'aysBulkDeleteThemes'      => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),
   845 				/* translators: %s: Theme name */
  1764 					'deleting'                 => __( 'Deleting...' ),
   846 				'activateThemeLabel'         => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),
  1765 					/* translators: %s: Error string for a failed deletion */
   847 				'activateImporter'           => __( 'Run Importer' ),
  1766 					'deleteFailed'             => __( 'Deletion failed: %s' ),
   848 				/* translators: %s: Importer name */
  1767 					'pluginDeleted'            => _x( 'Deleted!', 'plugin' ),
   849 				'activateImporterLabel'      => __( 'Run %s' ),
  1768 					'themeDeleted'             => _x( 'Deleted!', 'theme' ),
   850 				'unknownError'               => __( 'Something went wrong.' ),
  1769 					'livePreview'              => __( 'Live Preview' ),
   851 				'connectionError'            => __( 'Connection lost or the server is busy. Please try again later.' ),
  1770 					'activatePlugin'           => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),
   852 				'nonceError'                 => __( 'An error has occurred. Please reload the page and try again.' ),
  1771 					'activateTheme'            => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),
   853 				'pluginsFound'               => __( 'Number of plugins found: %d' ),
  1772 					/* translators: %s: Plugin name */
   854 				'noPluginsFound'             => __( 'No plugins found. Try a different search.' ),
  1773 					'activatePluginLabel'      => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),
   855 			),
  1774 					/* translators: %s: Theme name */
   856 		) );
  1775 					'activateThemeLabel'       => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),
   857 
  1776 					'activateImporter'         => __( 'Run Importer' ),
   858 		$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' );
  1777 					/* translators: %s: Importer name */
       
  1778 					'activateImporterLabel'    => __( 'Run %s' ),
       
  1779 					'unknownError'             => __( 'Something went wrong.' ),
       
  1780 					'connectionError'          => __( 'Connection lost or the server is busy. Please try again later.' ),
       
  1781 					'nonceError'               => __( 'An error has occurred. Please reload the page and try again.' ),
       
  1782 					'pluginsFound'             => __( 'Number of plugins found: %d' ),
       
  1783 					'noPluginsFound'           => __( 'No plugins found. Try a different search.' ),
       
  1784 				),
       
  1785 			)
       
  1786 		);
       
  1787 
       
  1788 		$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array( 'jquery' ), '1.2' );
   859 
  1789 
   860 		$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
  1790 		$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
   861 		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
  1791 		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
   862 		did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array(
  1792 		did_action( 'init' ) && $scripts->localize(
   863 			'clear'            => __( 'Clear' ),
  1793 			'wp-color-picker',
   864 			'clearAriaLabel'   => __( 'Clear color' ),
  1794 			'wpColorPickerL10n',
   865 			'defaultString'    => __( 'Default' ),
  1795 			array(
   866 			'defaultAriaLabel' => __( 'Select default color' ),
  1796 				'clear'            => __( 'Clear' ),
   867 			'pick'             => __( 'Select Color' ),
  1797 				'clearAriaLabel'   => __( 'Clear color' ),
   868 			'defaultLabel'     => __( 'Color value' ),
  1798 				'defaultString'    => __( 'Default' ),
   869 		) );
  1799 				'defaultAriaLabel' => __( 'Select default color' ),
       
  1800 				'pick'             => __( 'Select Color' ),
       
  1801 				'defaultLabel'     => __( 'Color value' ),
       
  1802 			)
       
  1803 		);
   870 
  1804 
   871 		$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 );
  1805 		$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 );
   872 
  1806 
   873 		$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
  1807 		$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
   874 
  1808 
   875 		$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
  1809 		$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
   876 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
  1810 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
   877 		did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array(
  1811 		did_action( 'init' ) && $scripts->localize(
   878 			'error' => __( 'An error has occurred. Please reload the page and try again.' ),
  1812 			'media',
   879 		));
  1813 			'attachMediaBoxL10n',
   880 
  1814 			array(
   881 		$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 );
  1815 				'error' => __( 'An error has occurred. Please reload the page and try again.' ),
   882 		did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array(
  1816 			)
   883 			'error' => __( 'Could not load the preview image. Please reload the page and try again.' )
  1817 		);
   884 		));
  1818 
       
  1819 		$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'json2', 'imgareaselect' ), false, 1 );
       
  1820 		did_action( 'init' ) && $scripts->localize(
       
  1821 			'image-edit',
       
  1822 			'imageEditL10n',
       
  1823 			array(
       
  1824 				'error' => __( 'Could not load the preview image. Please reload the page and try again.' ),
       
  1825 			)
       
  1826 		);
   885 
  1827 
   886 		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
  1828 		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
   887 		did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array(
  1829 		did_action( 'init' ) && $scripts->localize(
   888 			'setThumbnail' => __( 'Use as featured image' ),
  1830 			'set-post-thumbnail',
   889 			'saving' => __( 'Saving...' ), // no ellipsis
  1831 			'setPostThumbnailL10n',
   890 			'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
  1832 			array(
   891 			'done' => __( 'Done' )
  1833 				'setThumbnail' => __( 'Use as featured image' ),
   892 		) );
  1834 				'saving'       => __( 'Saving...' ), // no ellipsis
   893 
  1835 				'error'        => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
   894 		// Navigation Menus
  1836 				'done'         => __( 'Done' ),
   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' ) );
  1837 			)
   896 		did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array(
  1838 		);
   897 			'noResultsFound' => __( 'No results found.' ),
  1839 
   898 			'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
  1840 		/*
   899 			'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
  1841 		 * Navigation Menus: Adding underscore as a dependency to utilize _.debounce
   900 			'untitled' => _x( '(no label)', 'missing menu item navigation label' )
  1842 		 * see https://core.trac.wordpress.org/ticket/42321
   901 		) );
  1843 		 */
   902 
  1844 		$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', 'underscore' ) );
   903 		$scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 );
  1845 		did_action( 'init' ) && $scripts->localize(
       
  1846 			'nav-menu',
       
  1847 			'navMenuL10n',
       
  1848 			array(
       
  1849 				'noResultsFound' => __( 'No results found.' ),
       
  1850 				'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
       
  1851 				'saveAlert'      => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
  1852 				'untitled'       => _x( '(no label)', 'missing menu item navigation label' ),
       
  1853 			)
       
  1854 		);
       
  1855 
       
  1856 		$scripts->add( 'custom-header', '/wp-admin/js/custom-header.js', array( 'jquery-masonry' ), false, 1 );
   904 		$scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
  1857 		$scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
   905 		$scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array('jquery'), false, 1 );
  1858 		$scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array( 'jquery' ), false, 1 );
   906 
  1859 
   907 		$scripts->add( 'svg-painter', '/wp-admin/js/svg-painter.js', array( 'jquery' ), false, 1 );
  1860 		$scripts->add( 'svg-painter', '/wp-admin/js/svg-painter.js', array( 'jquery' ), false, 1 );
   908 	}
  1861 	}
   909 }
  1862 }
   910 
  1863 
   924  * @param WP_Styles $styles
  1877  * @param WP_Styles $styles
   925  */
  1878  */
   926 function wp_default_styles( &$styles ) {
  1879 function wp_default_styles( &$styles ) {
   927 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
  1880 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
   928 
  1881 
   929 	if ( ! defined( 'SCRIPT_DEBUG' ) )
  1882 	if ( ! defined( 'SCRIPT_DEBUG' ) ) {
   930 		define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
  1883 		define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
   931 
  1884 	}
   932 	if ( ! $guessurl = site_url() )
  1885 
       
  1886 	if ( ! $guessurl = site_url() ) {
   933 		$guessurl = wp_guess_url();
  1887 		$guessurl = wp_guess_url();
   934 
  1888 	}
   935 	$styles->base_url = $guessurl;
  1889 
   936 	$styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : '';
  1890 	$styles->base_url        = $guessurl;
       
  1891 	$styles->content_url     = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : '';
   937 	$styles->default_version = get_bloginfo( 'version' );
  1892 	$styles->default_version = get_bloginfo( 'version' );
   938 	$styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
  1893 	$styles->text_direction  = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr';
   939 	$styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
  1894 	$styles->default_dirs    = array( '/wp-admin/', '/wp-includes/css/' );
   940 
  1895 
   941 	// Open Sans is no longer used by core, but may be relied upon by themes and plugins.
  1896 	// Open Sans is no longer used by core, but may be relied upon by themes and plugins.
   942 	$open_sans_font_url = '';
  1897 	$open_sans_font_url = '';
   943 
  1898 
   944 	/* translators: If there are characters in your language that are not supported
  1899 	/* translators: If there are characters in your language that are not supported
   968 	$styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) );
  1923 	$styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) );
   969 
  1924 
   970 	$suffix = SCRIPT_DEBUG ? '' : '.min';
  1925 	$suffix = SCRIPT_DEBUG ? '' : '.min';
   971 
  1926 
   972 	// Admin CSS
  1927 	// Admin CSS
   973 	$styles->add( 'common',              "/wp-admin/css/common$suffix.css" );
  1928 	$styles->add( 'common', "/wp-admin/css/common$suffix.css" );
   974 	$styles->add( 'forms',               "/wp-admin/css/forms$suffix.css" );
  1929 	$styles->add( 'forms', "/wp-admin/css/forms$suffix.css" );
   975 	$styles->add( 'admin-menu',          "/wp-admin/css/admin-menu$suffix.css" );
  1930 	$styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" );
   976 	$styles->add( 'dashboard',           "/wp-admin/css/dashboard$suffix.css" );
  1931 	$styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" );
   977 	$styles->add( 'list-tables',         "/wp-admin/css/list-tables$suffix.css" );
  1932 	$styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" );
   978 	$styles->add( 'edit',                "/wp-admin/css/edit$suffix.css" );
  1933 	$styles->add( 'edit', "/wp-admin/css/edit$suffix.css" );
   979 	$styles->add( 'revisions',           "/wp-admin/css/revisions$suffix.css" );
  1934 	$styles->add( 'revisions', "/wp-admin/css/revisions$suffix.css" );
   980 	$styles->add( 'media',               "/wp-admin/css/media$suffix.css" );
  1935 	$styles->add( 'media', "/wp-admin/css/media$suffix.css" );
   981 	$styles->add( 'themes',              "/wp-admin/css/themes$suffix.css" );
  1936 	$styles->add( 'themes', "/wp-admin/css/themes$suffix.css" );
   982 	$styles->add( 'about',               "/wp-admin/css/about$suffix.css" );
  1937 	$styles->add( 'about', "/wp-admin/css/about$suffix.css" );
   983 	$styles->add( 'nav-menus',           "/wp-admin/css/nav-menus$suffix.css" );
  1938 	$styles->add( 'nav-menus', "/wp-admin/css/nav-menus$suffix.css" );
   984 	$styles->add( 'widgets',             "/wp-admin/css/widgets$suffix.css", array( 'wp-pointer' ) );
  1939 	$styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css", array( 'wp-pointer' ) );
   985 	$styles->add( 'site-icon',           "/wp-admin/css/site-icon$suffix.css" );
  1940 	$styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" );
   986 	$styles->add( 'l10n',                "/wp-admin/css/l10n$suffix.css" );
  1941 	$styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" );
   987 	$styles->add( 'code-editor',         "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) );
  1942 	$styles->add( 'code-editor', "/wp-admin/css/code-editor$suffix.css", array( 'wp-codemirror' ) );
       
  1943 	$styles->add( 'site-health', "/wp-admin/css/site-health$suffix.css" );
   988 
  1944 
   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' ) );
  1945 	$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 
  1946 
   991 	$styles->add( 'login',               "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
  1947 	$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' ) );
  1948 	$styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
   993 	$styles->add( 'wp-color-picker',     "/wp-admin/css/color-picker$suffix.css" );
  1949 	$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' ) );
  1950 	$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' ) );
  1951 	$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' ) );
  1952 	$styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) );
   997 
  1953 
   998 	$styles->add( 'ie', "/wp-admin/css/ie$suffix.css" );
  1954 	$styles->add( 'ie', "/wp-admin/css/ie$suffix.css" );
   999 	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
  1955 	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
  1000 
  1956 
  1001 	// Common dependencies
  1957 	// Common dependencies
  1002 	$styles->add( 'buttons',   "/wp-includes/css/buttons$suffix.css" );
  1958 	$styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" );
  1003 	$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
  1959 	$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
  1004 
  1960 
  1005 	// Includes CSS
  1961 	// Includes CSS
  1006 	$styles->add( 'admin-bar',            "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
  1962 	$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
  1007 	$styles->add( 'wp-auth-check',        "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
  1963 	$styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
  1008 	$styles->add( 'editor-buttons',       "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
  1964 	$styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
  1009 	$styles->add( 'media-views',          "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
  1965 	$styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
  1010 	$styles->add( 'wp-pointer',           "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
  1966 	$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' ) );
  1967 	$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" );
  1968 	$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' );
  1969 	$styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );
  1014 
  1970 
  1015 	// External libraries and friends
  1971 	// External libraries and friends
  1016 	$styles->add( 'imgareaselect',       '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
  1972 	$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
  1017 	$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
  1973 	$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
  1018 	$styles->add( 'mediaelement',        "/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css", array(), '4.2.6-78496d1' );
  1974 	$styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.6-78496d1' );
  1019 	$styles->add( 'wp-mediaelement',     "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
  1975 	$styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
  1020 	$styles->add( 'thickbox',            '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
  1976 	$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' );
  1977 	$styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
  1022 
  1978 
  1023 	// Deprecated CSS
  1979 	// Deprecated CSS
  1024 	$styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
  1980 	$styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
  1025 	$styles->add( 'farbtastic',       "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
  1981 	$styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
  1026 	$styles->add( 'jcrop',            "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12' );
  1982 	$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.css', array(), '0.9.12' );
  1027 	$styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
  1983 	$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
  1984 	$styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
  1029 
  1985 
       
  1986 	// Packages styles
       
  1987 	$fonts_url = '';
       
  1988 
       
  1989 	/*
       
  1990 	 * Translators: Use this to specify the proper Google Font name and variants
       
  1991 	 * to load that is supported by your language. Do not translate.
       
  1992 	 * Set to 'off' to disable loading.
       
  1993 	 */
       
  1994 	$font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
       
  1995 	if ( 'off' !== $font_family ) {
       
  1996 		$fonts_url = 'https://fonts.googleapis.com/css?family=' . urlencode( $font_family );
       
  1997 	}
       
  1998 	$styles->add( 'wp-editor-font', $fonts_url );
       
  1999 
       
  2000 	$styles->add( 'wp-block-library-theme', "/wp-includes/css/dist/block-library/theme$suffix.css" );
       
  2001 
       
  2002 	$styles->add(
       
  2003 		'wp-edit-blocks',
       
  2004 		"/wp-includes/css/dist/block-library/editor$suffix.css",
       
  2005 		array(
       
  2006 			'wp-components',
       
  2007 			'wp-editor',
       
  2008 			'wp-block-library',
       
  2009 			// Always include visual styles so the editor never appears broken.
       
  2010 			'wp-block-library-theme',
       
  2011 		)
       
  2012 	);
       
  2013 
       
  2014 	$package_styles = array(
       
  2015 		'block-editor'         => array(
       
  2016 			'wp-components',
       
  2017 			'wp-editor-font',
       
  2018 		),
       
  2019 		'block-library'        => array(),
       
  2020 		'components'           => array(),
       
  2021 		'edit-post'            => array(
       
  2022 			'wp-components',
       
  2023 			'wp-block-editor',
       
  2024 			'wp-editor',
       
  2025 			'wp-edit-blocks',
       
  2026 			'wp-block-library',
       
  2027 			'wp-nux',
       
  2028 		),
       
  2029 		'editor'               => array(
       
  2030 			'wp-components',
       
  2031 			'wp-block-editor',
       
  2032 			'wp-nux',
       
  2033 		),
       
  2034 		'format-library'       => array(),
       
  2035 		'list-reusable-blocks' => array( 'wp-components' ),
       
  2036 		'nux'                  => array( 'wp-components' ),
       
  2037 	);
       
  2038 
       
  2039 	foreach ( $package_styles as $package => $dependencies ) {
       
  2040 		$handle = 'wp-' . $package;
       
  2041 		$path   = "/wp-includes/css/dist/$package/style$suffix.css";
       
  2042 
       
  2043 		$styles->add( $handle, $path, $dependencies );
       
  2044 	}
       
  2045 
  1030 	// RTL CSS
  2046 	// RTL CSS
  1031 	$rtl_styles = array(
  2047 	$rtl_styles = array(
  1032 		// wp-admin
  2048 		// Admin CSS
  1033 		'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus',
  2049 		'common',
  1034 		'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'customize-preview',
  2050 		'forms',
  1035 		'ie', 'login',
  2051 		'admin-menu',
  1036 		// wp-includes
  2052 		'dashboard',
  1037 		'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',
  2053 		'list-tables',
       
  2054 		'edit',
       
  2055 		'revisions',
       
  2056 		'media',
       
  2057 		'themes',
       
  2058 		'about',
       
  2059 		'nav-menus',
       
  2060 		'widgets',
       
  2061 		'site-icon',
       
  2062 		'l10n',
       
  2063 		'install',
       
  2064 		'wp-color-picker',
       
  2065 		'customize-controls',
       
  2066 		'customize-widgets',
       
  2067 		'customize-nav-menus',
       
  2068 		'customize-preview',
       
  2069 		'ie',
       
  2070 		'login',
       
  2071 		'site-health',
       
  2072 		// Includes CSS
       
  2073 		'buttons',
       
  2074 		'admin-bar',
       
  2075 		'wp-auth-check',
       
  2076 		'editor-buttons',
       
  2077 		'media-views',
       
  2078 		'wp-pointer',
  1038 		'wp-jquery-ui-dialog',
  2079 		'wp-jquery-ui-dialog',
  1039 		// deprecated
  2080 		// Package styles
  1040 		'deprecated-media', 'farbtastic',
  2081 		'wp-block-library-theme',
       
  2082 		'wp-edit-blocks',
       
  2083 		'wp-block-editor',
       
  2084 		'wp-block-library',
       
  2085 		'wp-components',
       
  2086 		'wp-edit-post',
       
  2087 		'wp-editor',
       
  2088 		'wp-format-library',
       
  2089 		'wp-list-reusable-blocks',
       
  2090 		'wp-nux',
       
  2091 		// Deprecated CSS
       
  2092 		'deprecated-media',
       
  2093 		'farbtastic',
  1041 	);
  2094 	);
  1042 
  2095 
  1043 	foreach ( $rtl_styles as $rtl_style ) {
  2096 	foreach ( $rtl_styles as $rtl_style ) {
  1044 		$styles->add_data( $rtl_style, 'rtl', 'replace' );
  2097 		$styles->add_data( $rtl_style, 'rtl', 'replace' );
  1045 		if ( $suffix ) {
  2098 		if ( $suffix ) {
  1055  *
  2108  *
  1056  * @param array $js_array JavaScript scripts array
  2109  * @param array $js_array JavaScript scripts array
  1057  * @return array Reordered array, if needed.
  2110  * @return array Reordered array, if needed.
  1058  */
  2111  */
  1059 function wp_prototype_before_jquery( $js_array ) {
  2112 function wp_prototype_before_jquery( $js_array ) {
  1060 	if ( false === $prototype = array_search( 'prototype', $js_array, true ) )
  2113 	if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) {
  1061 		return $js_array;
  2114 		return $js_array;
  1062 
  2115 	}
  1063 	if ( false === $jquery = array_search( 'jquery', $js_array, true ) )
  2116 
       
  2117 	if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) {
  1064 		return $js_array;
  2118 		return $js_array;
  1065 
  2119 	}
  1066 	if ( $prototype < $jquery )
  2120 
       
  2121 	if ( $prototype < $jquery ) {
  1067 		return $js_array;
  2122 		return $js_array;
  1068 
  2123 	}
  1069 	unset($js_array[$prototype]);
  2124 
       
  2125 	unset( $js_array[ $prototype ] );
  1070 
  2126 
  1071 	array_splice( $js_array, $jquery, 0, 'prototype' );
  2127 	array_splice( $js_array, $jquery, 0, 'prototype' );
  1072 
  2128 
  1073 	return $js_array;
  2129 	return $js_array;
  1074 }
  2130 }
  1080  *
  2136  *
  1081  * @since 2.5.0
  2137  * @since 2.5.0
  1082  */
  2138  */
  1083 function wp_just_in_time_script_localization() {
  2139 function wp_just_in_time_script_localization() {
  1084 
  2140 
  1085 	wp_localize_script( 'autosave', 'autosaveL10n', array(
  2141 	wp_localize_script(
  1086 		'autosaveInterval' => AUTOSAVE_INTERVAL,
  2142 		'autosave',
  1087 		'blog_id' => get_current_blog_id(),
  2143 		'autosaveL10n',
  1088 	) );
  2144 		array(
  1089 
  2145 			'autosaveInterval' => AUTOSAVE_INTERVAL,
  1090 	wp_localize_script( 'mce-view', 'mceViewL10n', array(
  2146 			'blog_id'          => get_current_blog_id(),
  1091 		'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
  2147 		)
  1092 	) );
  2148 	);
  1093 
  2149 
  1094 	wp_localize_script( 'word-count', 'wordCountL10n', array(
  2150 	wp_localize_script(
  1095 		/*
  2151 		'mce-view',
  1096 		 * translators: If your word count is based on single characters (e.g. East Asian characters),
  2152 		'mceViewL10n',
  1097 		 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
  2153 		array(
  1098 		 * Do not translate into your own language.
  2154 			'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
  1099 		 */
  2155 		)
  1100 		'type' => _x( 'words', 'Word count type. Do not translate!' ),
  2156 	);
  1101 		'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array()
  2157 
  1102 	) );
  2158 	wp_localize_script(
       
  2159 		'word-count',
       
  2160 		'wordCountL10n',
       
  2161 		array(
       
  2162 			/*
       
  2163 			 * translators: If your word count is based on single characters (e.g. East Asian characters),
       
  2164 			 * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'.
       
  2165 			 * Do not translate into your own language.
       
  2166 			 */
       
  2167 			'type'       => _x( 'words', 'Word count type. Do not translate!' ),
       
  2168 			'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array(),
       
  2169 		)
       
  2170 	);
  1103 }
  2171 }
  1104 
  2172 
  1105 /**
  2173 /**
  1106  * Localizes the jQuery UI datepicker.
  2174  * Localizes the jQuery UI datepicker.
  1107  *
  2175  *
  1119 	}
  2187 	}
  1120 
  2188 
  1121 	// Convert the PHP date format into jQuery UI's format.
  2189 	// Convert the PHP date format into jQuery UI's format.
  1122 	$datepicker_date_format = str_replace(
  2190 	$datepicker_date_format = str_replace(
  1123 		array(
  2191 		array(
  1124 			'd', 'j', 'l', 'z', // Day.
  2192 			'd',
  1125 			'F', 'M', 'n', 'm', // Month.
  2193 			'j',
  1126 			'Y', 'y'            // Year.
  2194 			'l',
       
  2195 			'z', // Day.
       
  2196 			'F',
       
  2197 			'M',
       
  2198 			'n',
       
  2199 			'm', // Month.
       
  2200 			'Y',
       
  2201 			'y',            // Year.
  1127 		),
  2202 		),
  1128 		array(
  2203 		array(
  1129 			'dd', 'd', 'DD', 'o',
  2204 			'dd',
  1130 			'MM', 'M', 'm', 'mm',
  2205 			'd',
  1131 			'yy', 'y'
  2206 			'DD',
       
  2207 			'o',
       
  2208 			'MM',
       
  2209 			'M',
       
  2210 			'm',
       
  2211 			'mm',
       
  2212 			'yy',
       
  2213 			'y',
  1132 		),
  2214 		),
  1133 		get_option( 'date_format' )
  2215 		get_option( 'date_format' )
  1134 	);
  2216 	);
  1135 
  2217 
  1136 	$datepicker_defaults = wp_json_encode( array(
  2218 	$datepicker_defaults = wp_json_encode(
  1137 		'closeText'       => __( 'Close' ),
  2219 		array(
  1138 		'currentText'     => __( 'Today' ),
  2220 			'closeText'       => __( 'Close' ),
  1139 		'monthNames'      => array_values( $wp_locale->month ),
  2221 			'currentText'     => __( 'Today' ),
  1140 		'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
  2222 			'monthNames'      => array_values( $wp_locale->month ),
  1141 		'nextText'        => __( 'Next' ),
  2223 			'monthNamesShort' => array_values( $wp_locale->month_abbrev ),
  1142 		'prevText'        => __( 'Previous' ),
  2224 			'nextText'        => __( 'Next' ),
  1143 		'dayNames'        => array_values( $wp_locale->weekday ),
  2225 			'prevText'        => __( 'Previous' ),
  1144 		'dayNamesShort'   => array_values( $wp_locale->weekday_abbrev ),
  2226 			'dayNames'        => array_values( $wp_locale->weekday ),
  1145 		'dayNamesMin'     => array_values( $wp_locale->weekday_initial ),
  2227 			'dayNamesShort'   => array_values( $wp_locale->weekday_abbrev ),
  1146 		'dateFormat'      => $datepicker_date_format,
  2228 			'dayNamesMin'     => array_values( $wp_locale->weekday_initial ),
  1147 		'firstDay'        => absint( get_option( 'start_of_week' ) ),
  2229 			'dateFormat'      => $datepicker_date_format,
  1148 		'isRTL'           => $wp_locale->is_rtl(),
  2230 			'firstDay'        => absint( get_option( 'start_of_week' ) ),
  1149 	) );
  2231 			'isRTL'           => $wp_locale->is_rtl(),
       
  2232 		)
       
  2233 	);
  1150 
  2234 
  1151 	wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
  2235 	wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" );
  1152 }
  2236 }
  1153 
  2237 
  1154 /**
  2238 /**
  1180 		update_user_option( $user_id, 'community-events-location', $saved_location, true );
  2264 		update_user_option( $user_id, 'community-events-location', $saved_location, true );
  1181 	}
  2265 	}
  1182 
  2266 
  1183 	$events_client = new WP_Community_Events( $user_id, $saved_location );
  2267 	$events_client = new WP_Community_Events( $user_id, $saved_location );
  1184 
  2268 
  1185 	wp_localize_script( 'dashboard', 'communityEventsData', array(
  2269 	wp_localize_script(
  1186 		'nonce' => wp_create_nonce( 'community_events' ),
  2270 		'dashboard',
  1187 		'cache' => $events_client->get_cached_events(),
  2271 		'communityEventsData',
  1188 
  2272 		array(
  1189 		'l10n' => array(
  2273 			'nonce' => wp_create_nonce( 'community_events' ),
  1190 			'enter_closest_city' => __( 'Enter your closest city to find nearby events.' ),
  2274 			'cache' => $events_client->get_cached_events(),
  1191 			'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ),
  2275 
  1192 			'attend_event_near_generic' => __( 'Attend an upcoming event near you.' ),
  2276 			'l10n'  => array(
  1193 
  2277 				'enter_closest_city'              => __( 'Enter your closest city to find nearby events.' ),
  1194 			/*
  2278 				'error_occurred_please_try_again' => __( 'An error occurred. Please try again.' ),
  1195 			 * These specific examples were chosen to highlight the fact that a
  2279 				'attend_event_near_generic'       => __( 'Attend an upcoming event near you.' ),
  1196 			 * state is not needed, even for cities whose name is not unique.
  2280 
  1197 			 * It would be too cumbersome to include that in the instructions
  2281 				/*
  1198 			 * to the user, so it's left as an implication.
  2282 				 * These specific examples were chosen to highlight the fact that a
  1199 			 */
  2283 				 * state is not needed, even for cities whose name is not unique.
  1200 			/* translators: %s is the name of the city we couldn't locate.
  2284 				 * It would be too cumbersome to include that in the instructions
  1201 			 * Replace the examples with cities related to your locale. Test that
  2285 				 * to the user, so it's left as an implication.
  1202 			 * they match the expected location and have upcoming events before
  2286 				 */
  1203 			 * including them. If no cities related to your locale have events,
  2287 				/* translators: %s is the name of the city we couldn't locate.
  1204 			 * then use cities related to your locale that would be recognizable
  2288 				 * Replace the examples with cities related to your locale. Test that
  1205 			 * to most users. Use only the city name itself, without any region
  2289 				 * they match the expected location and have upcoming events before
  1206 			 * or country. Use the endonym (native locale name) instead of the
  2290 				 * including them. If no cities related to your locale have events,
  1207 			 * English name if possible.
  2291 				 * then use cities related to your locale that would be recognizable
  1208 			 */
  2292 				 * to most users. Use only the city name itself, without any region
  1209 			'could_not_locate_city' => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
  2293 				 * or country. Use the endonym (native locale name) instead of the
  1210 
  2294 				 * English name if possible.
  1211 			// This one is only used with wp.a11y.speak(), so it can/should be more brief.
  2295 				 */
  1212 			/* translators: %s: the name of a city */
  2296 				'could_not_locate_city'           => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
  1213 			'city_updated' => __( 'City updated. Listing events near %s.' ),
  2297 
       
  2298 				// This one is only used with wp.a11y.speak(), so it can/should be more brief.
       
  2299 				/* translators: %s: the name of a city */
       
  2300 				'city_updated'                    => __( 'City updated. Listing events near %s.' ),
       
  2301 			),
  1214 		)
  2302 		)
  1215 	) );
  2303 	);
  1216 }
  2304 }
  1217 
  2305 
  1218 /**
  2306 /**
  1219  * Administration Screen CSS for changing the styles.
  2307  * Administration Screen CSS for changing the styles.
  1220  *
  2308  *
  1236  * @return string|false URL path to CSS stylesheet for Administration Screens.
  2324  * @return string|false URL path to CSS stylesheet for Administration Screens.
  1237  */
  2325  */
  1238 function wp_style_loader_src( $src, $handle ) {
  2326 function wp_style_loader_src( $src, $handle ) {
  1239 	global $_wp_admin_css_colors;
  2327 	global $_wp_admin_css_colors;
  1240 
  2328 
  1241 	if ( wp_installing() )
  2329 	if ( wp_installing() ) {
  1242 		return preg_replace( '#^wp-admin/#', './', $src );
  2330 		return preg_replace( '#^wp-admin/#', './', $src );
       
  2331 	}
  1243 
  2332 
  1244 	if ( 'colors' == $handle ) {
  2333 	if ( 'colors' == $handle ) {
  1245 		$color = get_user_option('admin_color');
  2334 		$color = get_user_option( 'admin_color' );
  1246 
  2335 
  1247 		if ( empty($color) || !isset($_wp_admin_css_colors[$color]) )
  2336 		if ( empty( $color ) || ! isset( $_wp_admin_css_colors[ $color ] ) ) {
  1248 			$color = 'fresh';
  2337 			$color = 'fresh';
  1249 
  2338 		}
  1250 		$color = $_wp_admin_css_colors[$color];
  2339 
  1251 		$url = $color->url;
  2340 		$color = $_wp_admin_css_colors[ $color ];
       
  2341 		$url   = $color->url;
  1252 
  2342 
  1253 		if ( ! $url ) {
  2343 		if ( ! $url ) {
  1254 			return false;
  2344 			return false;
  1255 		}
  2345 		}
  1256 
  2346 
  1257 		$parsed = parse_url( $src );
  2347 		$parsed = parse_url( $src );
  1258 		if ( isset($parsed['query']) && $parsed['query'] ) {
  2348 		if ( isset( $parsed['query'] ) && $parsed['query'] ) {
  1259 			wp_parse_str( $parsed['query'], $qv );
  2349 			wp_parse_str( $parsed['query'], $qv );
  1260 			$url = add_query_arg( $qv, $url );
  2350 			$url = add_query_arg( $qv, $url );
  1261 		}
  2351 		}
  1262 
  2352 
  1263 		return $url;
  2353 		return $url;
  1281  * @return array
  2371  * @return array
  1282  */
  2372  */
  1283 function print_head_scripts() {
  2373 function print_head_scripts() {
  1284 	global $concatenate_scripts;
  2374 	global $concatenate_scripts;
  1285 
  2375 
  1286 	if ( ! did_action('wp_print_scripts') ) {
  2376 	if ( ! did_action( 'wp_print_scripts' ) ) {
  1287 		/** This action is documented in wp-includes/functions.wp-scripts.php */
  2377 		/** This action is documented in wp-includes/functions.wp-scripts.php */
  1288 		do_action( 'wp_print_scripts' );
  2378 		do_action( 'wp_print_scripts' );
  1289 	}
  2379 	}
  1290 
  2380 
  1291 	$wp_scripts = wp_scripts();
  2381 	$wp_scripts = wp_scripts();
  1354  */
  2444  */
  1355 function _print_scripts() {
  2445 function _print_scripts() {
  1356 	global $wp_scripts, $compress_scripts;
  2446 	global $wp_scripts, $compress_scripts;
  1357 
  2447 
  1358 	$zip = $compress_scripts ? 1 : 0;
  2448 	$zip = $compress_scripts ? 1 : 0;
  1359 	if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
  2449 	if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
  1360 		$zip = 'gzip';
  2450 		$zip = 'gzip';
       
  2451 	}
  1361 
  2452 
  1362 	if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
  2453 	if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
  1363 
  2454 
  1364 		if ( !empty($wp_scripts->print_code) ) {
  2455 		if ( ! empty( $wp_scripts->print_code ) ) {
  1365 			echo "\n<script type='text/javascript'>\n";
  2456 			echo "\n<script type='text/javascript'>\n";
  1366 			echo "/* <![CDATA[ */\n"; // not needed in HTML 5
  2457 			echo "/* <![CDATA[ */\n"; // not needed in HTML 5
  1367 			echo $wp_scripts->print_code;
  2458 			echo $wp_scripts->print_code;
  1368 			echo "/* ]]> */\n";
  2459 			echo "/* ]]> */\n";
  1369 			echo "</script>\n";
  2460 			echo "</script>\n";
  1371 
  2462 
  1372 		$concat = str_split( $concat, 128 );
  2463 		$concat = str_split( $concat, 128 );
  1373 		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
  2464 		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
  1374 
  2465 
  1375 		$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
  2466 		$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
  1376 		echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n";
  2467 		echo "<script type='text/javascript' src='" . esc_attr( $src ) . "'></script>\n";
  1377 	}
  2468 	}
  1378 
  2469 
  1379 	if ( !empty($wp_scripts->print_html) )
  2470 	if ( ! empty( $wp_scripts->print_html ) ) {
  1380 		echo $wp_scripts->print_html;
  2471 		echo $wp_scripts->print_html;
       
  2472 	}
  1381 }
  2473 }
  1382 
  2474 
  1383 /**
  2475 /**
  1384  * Prints the script queue in the HTML head on the front end.
  2476  * Prints the script queue in the HTML head on the front end.
  1385  *
  2477  *
  1391  * @global WP_Scripts $wp_scripts
  2483  * @global WP_Scripts $wp_scripts
  1392  *
  2484  *
  1393  * @return array
  2485  * @return array
  1394  */
  2486  */
  1395 function wp_print_head_scripts() {
  2487 function wp_print_head_scripts() {
  1396 	if ( ! did_action('wp_print_scripts') ) {
  2488 	if ( ! did_action( 'wp_print_scripts' ) ) {
  1397 		/** This action is documented in wp-includes/functions.wp-scripts.php */
  2489 		/** This action is documented in wp-includes/functions.wp-scripts.php */
  1398 		do_action( 'wp_print_scripts' );
  2490 		do_action( 'wp_print_scripts' );
  1399 	}
  2491 	}
  1400 
  2492 
  1401 	global $wp_scripts;
  2493 	global $wp_scripts;
  1461 
  2553 
  1462 	$wp_styles = wp_styles();
  2554 	$wp_styles = wp_styles();
  1463 
  2555 
  1464 	script_concat_settings();
  2556 	script_concat_settings();
  1465 	$wp_styles->do_concat = $concatenate_scripts;
  2557 	$wp_styles->do_concat = $concatenate_scripts;
  1466 	$wp_styles->do_items(false);
  2558 	$wp_styles->do_items( false );
  1467 
  2559 
  1468 	/**
  2560 	/**
  1469 	 * Filters whether to print the admin styles.
  2561 	 * Filters whether to print the admin styles.
  1470 	 *
  2562 	 *
  1471 	 * @since 2.8.0
  2563 	 * @since 2.8.0
  1528 	global $compress_css;
  2620 	global $compress_css;
  1529 
  2621 
  1530 	$wp_styles = wp_styles();
  2622 	$wp_styles = wp_styles();
  1531 
  2623 
  1532 	$zip = $compress_css ? 1 : 0;
  2624 	$zip = $compress_css ? 1 : 0;
  1533 	if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP )
  2625 	if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
  1534 		$zip = 'gzip';
  2626 		$zip = 'gzip';
       
  2627 	}
  1535 
  2628 
  1536 	if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
  2629 	if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
  1537 		$dir = $wp_styles->text_direction;
  2630 		$dir = $wp_styles->text_direction;
  1538 		$ver = $wp_styles->default_version;
  2631 		$ver = $wp_styles->default_version;
  1539 
  2632 
  1540 		$concat = str_split( $concat, 128 );
  2633 		$concat = str_split( $concat, 128 );
  1541 		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
  2634 		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
  1542 
  2635 
  1543 		$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver;
  2636 		$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver;
  1544 		echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
  2637 		echo "<link rel='stylesheet' href='" . esc_attr( $href ) . "' type='text/css' media='all' />\n";
  1545 
  2638 
  1546 		if ( !empty($wp_styles->print_code) ) {
  2639 		if ( ! empty( $wp_styles->print_code ) ) {
  1547 			echo "<style type='text/css'>\n";
  2640 			echo "<style type='text/css'>\n";
  1548 			echo $wp_styles->print_code;
  2641 			echo $wp_styles->print_code;
  1549 			echo "\n</style>\n";
  2642 			echo "\n</style>\n";
  1550 		}
  2643 		}
  1551 	}
  2644 	}
  1552 
  2645 
  1553 	if ( !empty($wp_styles->print_html) )
  2646 	if ( ! empty( $wp_styles->print_html ) ) {
  1554 		echo $wp_styles->print_html;
  2647 		echo $wp_styles->print_html;
       
  2648 	}
  1555 }
  2649 }
  1556 
  2650 
  1557 /**
  2651 /**
  1558  * Determine the concatenation and compression settings for scripts and styles.
  2652  * Determine the concatenation and compression settings for scripts and styles.
  1559  *
  2653  *
  1564  * @global bool $compress_css
  2658  * @global bool $compress_css
  1565  */
  2659  */
  1566 function script_concat_settings() {
  2660 function script_concat_settings() {
  1567 	global $concatenate_scripts, $compress_scripts, $compress_css;
  2661 	global $concatenate_scripts, $compress_scripts, $compress_css;
  1568 
  2662 
  1569 	$compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') );
  2663 	$compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' == ini_get( 'output_handler' ) );
  1570 
  2664 
  1571 	if ( ! isset($concatenate_scripts) ) {
  2665 	if ( ! isset( $concatenate_scripts ) ) {
  1572 		$concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true;
  2666 		$concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true;
  1573 		if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) )
  2667 		if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
  1574 			$concatenate_scripts = false;
  2668 			$concatenate_scripts = false;
  1575 	}
  2669 		}
  1576 
  2670 	}
  1577 	if ( ! isset($compress_scripts) ) {
  2671 
  1578 		$compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true;
  2672 	if ( ! isset( $compress_scripts ) ) {
  1579 		if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
  2673 		$compress_scripts = defined( 'COMPRESS_SCRIPTS' ) ? COMPRESS_SCRIPTS : true;
       
  2674 		if ( $compress_scripts && ( ! get_site_option( 'can_compress_scripts' ) || $compressed_output ) ) {
  1580 			$compress_scripts = false;
  2675 			$compress_scripts = false;
  1581 	}
  2676 		}
  1582 
  2677 	}
  1583 	if ( ! isset($compress_css) ) {
  2678 
  1584 		$compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true;
  2679 	if ( ! isset( $compress_css ) ) {
  1585 		if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) )
  2680 		$compress_css = defined( 'COMPRESS_CSS' ) ? COMPRESS_CSS : true;
       
  2681 		if ( $compress_css && ( ! get_site_option( 'can_compress_scripts' ) || $compressed_output ) ) {
  1586 			$compress_css = false;
  2682 			$compress_css = false;
       
  2683 		}
  1587 	}
  2684 	}
  1588 }
  2685 }
       
  2686 
       
  2687 /**
       
  2688  * Handles the enqueueing of block scripts and styles that are common to both
       
  2689  * the editor and the front-end.
       
  2690  *
       
  2691  * @since 5.0.0
       
  2692  *
       
  2693  * @global WP_Screen $current_screen
       
  2694  */
       
  2695 function wp_common_block_scripts_and_styles() {
       
  2696 	global $current_screen;
       
  2697 
       
  2698 	if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen->is_block_editor() ) {
       
  2699 		return;
       
  2700 	}
       
  2701 
       
  2702 	wp_enqueue_style( 'wp-block-library' );
       
  2703 
       
  2704 	if ( current_theme_supports( 'wp-block-styles' ) ) {
       
  2705 		wp_enqueue_style( 'wp-block-library-theme' );
       
  2706 	}
       
  2707 
       
  2708 	/**
       
  2709 	 * Fires after enqueuing block assets for both editor and front-end.
       
  2710 	 *
       
  2711 	 * Call `add_action` on any hook before 'wp_enqueue_scripts'.
       
  2712 	 *
       
  2713 	 * In the function call you supply, simply use `wp_enqueue_script` and
       
  2714 	 * `wp_enqueue_style` to add your functionality to the Gutenberg editor.
       
  2715 	 *
       
  2716 	 * @since 5.0.0
       
  2717 	 */
       
  2718 	  do_action( 'enqueue_block_assets' );
       
  2719 }
       
  2720 
       
  2721 /**
       
  2722  * Enqueues registered block scripts and styles, depending on current rendered
       
  2723  * context (only enqueuing editor scripts while in context of the editor).
       
  2724  *
       
  2725  * @since 5.0.0
       
  2726  *
       
  2727  * @global WP_Screen $current_screen
       
  2728  */
       
  2729 function wp_enqueue_registered_block_scripts_and_styles() {
       
  2730 	global $current_screen;
       
  2731 
       
  2732 	$is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor() );
       
  2733 
       
  2734 	$block_registry = WP_Block_Type_Registry::get_instance();
       
  2735 	foreach ( $block_registry->get_all_registered() as $block_name => $block_type ) {
       
  2736 		// Front-end styles.
       
  2737 		if ( ! empty( $block_type->style ) ) {
       
  2738 			wp_enqueue_style( $block_type->style );
       
  2739 		}
       
  2740 
       
  2741 		// Front-end script.
       
  2742 		if ( ! empty( $block_type->script ) ) {
       
  2743 			wp_enqueue_script( $block_type->script );
       
  2744 		}
       
  2745 
       
  2746 		// Editor styles.
       
  2747 		if ( $is_editor && ! empty( $block_type->editor_style ) ) {
       
  2748 			wp_enqueue_style( $block_type->editor_style );
       
  2749 		}
       
  2750 
       
  2751 		// Editor script.
       
  2752 		if ( $is_editor && ! empty( $block_type->editor_script ) ) {
       
  2753 			wp_enqueue_script( $block_type->editor_script );
       
  2754 		}
       
  2755 	}
       
  2756 }