wp/wp-includes/script-loader.php
changeset 16 a86126ab1dd4
parent 13 d255fe9cd479
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
    15  *
    15  *
    16  * @package WordPress
    16  * @package WordPress
    17  */
    17  */
    18 
    18 
    19 /** WordPress Dependency Class */
    19 /** WordPress Dependency Class */
    20 require( ABSPATH . WPINC . '/class-wp-dependency.php' );
    20 require ABSPATH . WPINC . '/class-wp-dependency.php';
    21 
    21 
    22 /** WordPress Dependencies Class */
    22 /** WordPress Dependencies Class */
    23 require( ABSPATH . WPINC . '/class.wp-dependencies.php' );
    23 require ABSPATH . WPINC . '/class.wp-dependencies.php';
    24 
    24 
    25 /** WordPress Scripts Class */
    25 /** WordPress Scripts Class */
    26 require( ABSPATH . WPINC . '/class.wp-scripts.php' );
    26 require ABSPATH . WPINC . '/class.wp-scripts.php';
    27 
    27 
    28 /** WordPress Scripts Functions */
    28 /** WordPress Scripts Functions */
    29 require( ABSPATH . WPINC . '/functions.wp-scripts.php' );
    29 require ABSPATH . WPINC . '/functions.wp-scripts.php';
    30 
    30 
    31 /** WordPress Styles Class */
    31 /** WordPress Styles Class */
    32 require( ABSPATH . WPINC . '/class.wp-styles.php' );
    32 require ABSPATH . WPINC . '/class.wp-styles.php';
    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.
    38  * Registers TinyMCE scripts.
    39  *
    39  *
    40  * @since 5.0.0
    40  * @since 5.0.0
    41  *
    41  *
    42  * @param WP_Scripts $scripts WP_Scripts object.
    42  * @param WP_Scripts $scripts            WP_Scripts object.
    43  */
    43  * @param bool       $force_uncompressed Whether to forcibly prevent gzip compression. Default false.
    44 function wp_register_tinymce_scripts( &$scripts, $force_uncompressed = false ) {
    44  */
       
    45 function wp_register_tinymce_scripts( $scripts, $force_uncompressed = false ) {
    45 	global $tinymce_version, $concatenate_scripts, $compress_scripts;
    46 	global $tinymce_version, $concatenate_scripts, $compress_scripts;
    46 	$suffix     = wp_scripts_get_suffix();
    47 	$suffix     = wp_scripts_get_suffix();
    47 	$dev_suffix = wp_scripts_get_suffix( 'dev' );
    48 	$dev_suffix = wp_scripts_get_suffix( 'dev' );
    48 
    49 
    49 	script_concat_settings();
    50 	script_concat_settings();
    50 
    51 
    51 	$compressed = $compress_scripts && $concatenate_scripts && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )
    52 	$compressed = $compress_scripts && $concatenate_scripts && isset( $_SERVER['HTTP_ACCEPT_ENCODING'] )
    52 				  && false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $force_uncompressed;
    53 		&& false !== stripos( $_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip' ) && ! $force_uncompressed;
    53 
    54 
    54 	// Load tinymce.js when running from /src, otherwise load wp-tinymce.js.gz (in production) or
    55 	// Load tinymce.js when running from /src, otherwise load wp-tinymce.js.gz (in production)
    55 	// tinymce.min.js (when SCRIPT_DEBUG is true).
    56 	// or tinymce.min.js (when SCRIPT_DEBUG is true).
    56 	if ( $compressed ) {
    57 	if ( $compressed ) {
    57 		$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.js', array(), $tinymce_version );
    58 		$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . 'wp-tinymce.js', array(), $tinymce_version );
    58 	} else {
    59 	} else {
    59 		$scripts->add( 'wp-tinymce-root', includes_url( 'js/tinymce/' ) . "tinymce$dev_suffix.js", array(), $tinymce_version );
    60 		$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 		$scripts->add( 'wp-tinymce', includes_url( 'js/tinymce/' ) . "plugins/compat3x/plugin$dev_suffix.js", array( 'wp-tinymce-root' ), $tinymce_version );
    71  *
    72  *
    72  * @since 5.0.0
    73  * @since 5.0.0
    73  *
    74  *
    74  * @param WP_Scripts $scripts WP_Scripts object.
    75  * @param WP_Scripts $scripts WP_Scripts object.
    75  */
    76  */
    76 function wp_default_packages_vendor( &$scripts ) {
    77 function wp_default_packages_vendor( $scripts ) {
    77 	global $wp_locale;
    78 	global $wp_locale;
    78 
    79 
    79 	$suffix = wp_scripts_get_suffix();
    80 	$suffix = wp_scripts_get_suffix();
    80 
    81 
    81 	$vendor_scripts = array(
    82 	$vendor_scripts = array(
    84 		'moment',
    85 		'moment',
    85 		'lodash',
    86 		'lodash',
    86 		'wp-polyfill-fetch',
    87 		'wp-polyfill-fetch',
    87 		'wp-polyfill-formdata',
    88 		'wp-polyfill-formdata',
    88 		'wp-polyfill-node-contains',
    89 		'wp-polyfill-node-contains',
       
    90 		'wp-polyfill-url',
       
    91 		'wp-polyfill-dom-rect',
    89 		'wp-polyfill-element-closest',
    92 		'wp-polyfill-element-closest',
    90 		'wp-polyfill',
    93 		'wp-polyfill',
    91 	);
    94 	);
    92 
    95 
    93 	$vendor_scripts_versions = array(
    96 	$vendor_scripts_versions = array(
    94 		'react'                       => '16.8.4',
    97 		'react'                       => '16.9.0',
    95 		'react-dom'                   => '16.8.4',
    98 		'react-dom'                   => '16.9.0',
    96 		'moment'                      => '2.22.2',
    99 		'moment'                      => '2.26.0',
    97 		'lodash'                      => '4.17.11',
   100 		'lodash'                      => '4.17.15',
    98 		'wp-polyfill-fetch'           => '3.0.0',
   101 		'wp-polyfill-fetch'           => '3.0.0',
    99 		'wp-polyfill-formdata'        => '3.0.12',
   102 		'wp-polyfill-formdata'        => '3.0.12',
   100 		'wp-polyfill-node-contains'   => '3.26.0-0',
   103 		'wp-polyfill-node-contains'   => '3.42.0',
       
   104 		'wp-polyfill-url'             => '3.6.4',
       
   105 		'wp-polyfill-dom-rect'        => '3.42.0',
   101 		'wp-polyfill-element-closest' => '2.0.2',
   106 		'wp-polyfill-element-closest' => '2.0.2',
   102 		'wp-polyfill'                 => '7.0.0',
   107 		'wp-polyfill'                 => '7.4.4',
   103 	);
   108 	);
   104 
   109 
   105 	foreach ( $vendor_scripts as $handle => $dependencies ) {
   110 	foreach ( $vendor_scripts as $handle => $dependencies ) {
   106 		if ( is_string( $dependencies ) ) {
   111 		if ( is_string( $dependencies ) ) {
   107 			$handle       = $dependencies;
   112 			$handle       = $dependencies;
   120 		wp_get_script_polyfill(
   125 		wp_get_script_polyfill(
   121 			$scripts,
   126 			$scripts,
   122 			array(
   127 			array(
   123 				'\'fetch\' in window' => 'wp-polyfill-fetch',
   128 				'\'fetch\' in window' => 'wp-polyfill-fetch',
   124 				'document.contains'   => 'wp-polyfill-node-contains',
   129 				'document.contains'   => 'wp-polyfill-node-contains',
       
   130 				'window.DOMRect'      => 'wp-polyfill-dom-rect',
       
   131 				'window.URL && window.URL.prototype && window.URLSearchParams' => 'wp-polyfill-url',
   125 				'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
   132 				'window.FormData && window.FormData.prototype.keys' => 'wp-polyfill-formdata',
   126 				'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
   133 				'Element.prototype.matches && Element.prototype.closest' => 'wp-polyfill-element-closest',
   127 			)
   134 			)
   128 		)
   135 		)
   129 	);
   136 	);
   131 	did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
   138 	did_action( 'init' ) && $scripts->add_inline_script( 'lodash', 'window.lodash = _.noConflict();' );
   132 
   139 
   133 	did_action( 'init' ) && $scripts->add_inline_script(
   140 	did_action( 'init' ) && $scripts->add_inline_script(
   134 		'moment',
   141 		'moment',
   135 		sprintf(
   142 		sprintf(
   136 			"moment.locale( '%s', %s );",
   143 			"moment.updateLocale( '%s', %s );",
   137 			get_user_locale(),
   144 			get_user_locale(),
   138 			wp_json_encode(
   145 			wp_json_encode(
   139 				array(
   146 				array(
   140 					'months'         => array_values( $wp_locale->month ),
   147 					'months'         => array_values( $wp_locale->month ),
   141 					'monthsShort'    => array_values( $wp_locale->month_abbrev ),
   148 					'monthsShort'    => array_values( $wp_locale->month_abbrev ),
   168  *
   175  *
   169  * @param WP_Scripts $scripts WP_Scripts object.
   176  * @param WP_Scripts $scripts WP_Scripts object.
   170  * @param array      $tests   Features to detect.
   177  * @param array      $tests   Features to detect.
   171  * @return string Conditional polyfill inline script.
   178  * @return string Conditional polyfill inline script.
   172  */
   179  */
   173 function wp_get_script_polyfill( &$scripts, $tests ) {
   180 function wp_get_script_polyfill( $scripts, $tests ) {
   174 	$polyfill = '';
   181 	$polyfill = '';
   175 	foreach ( $tests as $test => $handle ) {
   182 	foreach ( $tests as $test => $handle ) {
   176 		if ( ! array_key_exists( $handle, $scripts->registered ) ) {
   183 		if ( ! array_key_exists( $handle, $scripts->registered ) ) {
   177 			continue;
   184 			continue;
   178 		}
   185 		}
   196 		}
   203 		}
   197 
   204 
   198 		$polyfill .= (
   205 		$polyfill .= (
   199 			// Test presence of feature...
   206 			// Test presence of feature...
   200 			'( ' . $test . ' ) || ' .
   207 			'( ' . $test . ' ) || ' .
   201 			// ...appending polyfill on any failures. Cautious viewers may balk
   208 			/*
   202 			// at the `document.write`. Its caveat of synchronous mid-stream
   209 			 * ...appending polyfill on any failures. Cautious viewers may balk
   203 			// blocking write is exactly the behavior we need though.
   210 			 * at the `document.write`. Its caveat of synchronous mid-stream
       
   211 			 * blocking write is exactly the behavior we need though.
       
   212 			 */
   204 			'document.write( \'<script src="' .
   213 			'document.write( \'<script src="' .
   205 			$src .
   214 			$src .
   206 			'"></scr\' + \'ipt>\' );'
   215 			'"></scr\' + \'ipt>\' );'
   207 		);
   216 		);
   208 	}
   217 	}
   218  *
   227  *
   219  * @since 5.0.0
   228  * @since 5.0.0
   220  *
   229  *
   221  * @param WP_Scripts $scripts WP_Scripts object.
   230  * @param WP_Scripts $scripts WP_Scripts object.
   222  */
   231  */
   223 function wp_default_packages_scripts( &$scripts ) {
   232 function wp_default_packages_scripts( $scripts ) {
   224 	$suffix = wp_scripts_get_suffix();
   233 	$suffix = wp_scripts_get_suffix();
   225 
   234 
   226 	$packages_versions = array(
   235 	// Expects multidimensional array like:
   227 		'a11y'                               => '2.2.0',
   236 	//	'a11y.js' => array('dependencies' => array(...), 'version' => '...'),
   228 		'annotations'                        => '1.2.3',
   237 	//	'annotations.js' => array('dependencies' => array(...), 'version' => '...'),
   229 		'api-fetch'                          => '3.1.2',
   238 	//	'api-fetch.js' => array(...
   230 		'autop'                              => '2.0.0',
   239 	$assets = include ABSPATH . WPINC . '/assets/script-loader-packages.php';
   231 		'blob'                               => '2.3.0',
   240 
   232 		'block-editor'                       => '2.0.3',
   241 	foreach ( $assets as $package_name => $package_data ) {
   233 		'block-library'                      => '2.4.6',
   242 		$basename = basename( $package_name, '.js' );
   234 		'block-serialization-default-parser' => '3.1.0',
   243 		$handle   = 'wp-' . $basename;
   235 		'blocks'                             => '6.2.5',
   244 		$path     = "/wp-includes/js/dist/{$basename}{$suffix}.js";
   236 		'components'                         => '7.3.2',
   245 
   237 		'compose'                            => '3.2.0',
   246 		if ( ! empty( $package_data['dependencies'] ) ) {
   238 		'core-data'                          => '2.2.2',
   247 			$dependencies = $package_data['dependencies'];
   239 		'data'                               => '4.4.0',
   248 		} else {
   240 		'date'                               => '3.2.0',
   249 			$dependencies = array();
   241 		'deprecated'                         => '2.2.0',
   250 		}
   242 		'dom'                                => '2.2.5',
   251 
   243 		'dom-ready'                          => '2.2.0',
   252 		// Add dependencies that cannot be detected and generated by build tools.
   244 		'edit-post'                          => '3.3.6',
   253 		switch ( $handle ) {
   245 		'editor'                             => '9.2.6',
   254 			case 'wp-block-library':
   246 		'element'                            => '2.3.0',
   255 				array_push( $dependencies, 'editor' );
   247 		'escape-html'                        => '1.2.0',
   256 				break;
   248 		'format-library'                     => '1.4.6',
   257 			case 'wp-edit-post':
   249 		'hooks'                              => '2.2.0',
   258 				array_push( $dependencies, 'media-models', 'media-views', 'postbox', 'wp-dom-ready' );
   250 		'html-entities'                      => '2.2.0',
   259 				break;
   251 		'i18n'                               => '3.3.0',
   260 		}
   252 		'is-shallow-equal'                   => '1.2.0',
   261 
   253 		'keycodes'                           => '2.2.0',
   262 		$scripts->add( $handle, $path, $dependencies, $package_data['version'], 1 );
   254 		'list-reusable-blocks'               => '1.3.5',
   263 
   255 		'notices'                            => '1.3.0',
   264 		if ( in_array( 'wp-i18n', $dependencies, true ) ) {
   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 );
   265 			$scripts->set_translations( $handle );
   519 		}
   266 		}
   520 	}
   267 	}
   521 }
   268 }
   522 
   269 
   525  *
   272  *
   526  * @since 5.0.0
   273  * @since 5.0.0
   527  *
   274  *
   528  * @param WP_Scripts $scripts WP_Scripts object.
   275  * @param WP_Scripts $scripts WP_Scripts object.
   529  */
   276  */
   530 function wp_default_packages_inline_scripts( &$scripts ) {
   277 function wp_default_packages_inline_scripts( $scripts ) {
   531 	global $wp_locale;
   278 	global $wp_locale;
   532 
   279 
   533 	if ( isset( $scripts->registered['wp-api-fetch'] ) ) {
   280 	if ( isset( $scripts->registered['wp-api-fetch'] ) ) {
   534 		$scripts->registered['wp-api-fetch']->deps[] = 'wp-hooks';
   281 		$scripts->registered['wp-api-fetch']->deps[] = 'wp-hooks';
   535 	}
   282 	}
   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(
   283 	$scripts->add_inline_script(
   562 		'wp-api-fetch',
   284 		'wp-api-fetch',
   563 		sprintf(
   285 		sprintf(
   564 			'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
   286 			'wp.apiFetch.use( wp.apiFetch.createRootURLMiddleware( "%s" ) );',
   565 			esc_url_raw( get_rest_url() )
   287 			esc_url_raw( get_rest_url() )
   566 		),
   288 		),
   567 		'after'
   289 		'after'
   568 	);
   290 	);
   569 
   291 	$scripts->add_inline_script(
       
   292 		'wp-api-fetch',
       
   293 		implode(
       
   294 			"\n",
       
   295 			array(
       
   296 				sprintf(
       
   297 					'wp.apiFetch.nonceMiddleware = wp.apiFetch.createNonceMiddleware( "%s" );',
       
   298 					( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' )
       
   299 				),
       
   300 				'wp.apiFetch.use( wp.apiFetch.nonceMiddleware );',
       
   301 				'wp.apiFetch.use( wp.apiFetch.mediaUploadMiddleware );',
       
   302 				sprintf(
       
   303 					'wp.apiFetch.nonceEndpoint = "%s";',
       
   304 					admin_url( 'admin-ajax.php?action=rest-nonce' )
       
   305 				),
       
   306 			)
       
   307 		),
       
   308 		'after'
       
   309 	);
   570 	$scripts->add_inline_script(
   310 	$scripts->add_inline_script(
   571 		'wp-data',
   311 		'wp-data',
   572 		implode(
   312 		implode(
   573 			"\n",
   313 			"\n",
   574 			array(
   314 			array(
   575 				'( function() {',
   315 				'( function() {',
   576 				'	var userId = ' . get_current_user_ID() . ';',
   316 				'	var userId = ' . get_current_user_ID() . ';',
   577 				'	var storageKey = "WP_DATA_USER_" + userId;',
   317 				'	var storageKey = "WP_DATA_USER_" + userId;',
   578 				'	wp.data',
   318 				'	wp.data',
   579 				'		.use( wp.data.plugins.persistence, { storageKey: storageKey } )',
   319 				'		.use( wp.data.plugins.persistence, { storageKey: storageKey } );',
   580 				'		.use( wp.data.plugins.controls );',
       
   581 				'	wp.data.plugins.persistence.__unstableMigrate( { storageKey: storageKey } );',
   320 				'	wp.data.plugins.persistence.__unstableMigrate( { storageKey: storageKey } );',
   582 				'} )();',
   321 				'} )();',
   583 			)
   322 			)
   584 		)
   323 		)
   585 	);
   324 	);
   596 						'monthsShort'   => array_values( $wp_locale->month_abbrev ),
   335 						'monthsShort'   => array_values( $wp_locale->month_abbrev ),
   597 						'weekdays'      => array_values( $wp_locale->weekday ),
   336 						'weekdays'      => array_values( $wp_locale->weekday ),
   598 						'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
   337 						'weekdaysShort' => array_values( $wp_locale->weekday_abbrev ),
   599 						'meridiem'      => (object) $wp_locale->meridiem,
   338 						'meridiem'      => (object) $wp_locale->meridiem,
   600 						'relative'      => array(
   339 						'relative'      => array(
   601 							/* translators: %s: duration */
   340 							/* translators: %s: Duration. */
   602 							'future' => __( '%s from now' ),
   341 							'future' => __( '%s from now' ),
   603 							/* translators: %s: duration */
   342 							/* translators: %s: Duration. */
   604 							'past'   => __( '%s ago' ),
   343 							'past'   => __( '%s ago' ),
   605 						),
   344 						),
   606 					),
   345 					),
   607 					'formats'  => array(
   346 					'formats'  => array(
   608 						/* translators: Time format, see https://secure.php.net/date */
   347 						/* translators: Time format, see https://www.php.net/date */
   609 						'time'                => get_option( 'time_format', __( 'g:i a' ) ),
   348 						'time'                => get_option( 'time_format', __( 'g:i a' ) ),
   610 						/* translators: Date format, see https://secure.php.net/date */
   349 						/* translators: Date format, see https://www.php.net/date */
   611 						'date'                => get_option( 'date_format', __( 'F j, Y' ) ),
   350 						'date'                => get_option( 'date_format', __( 'F j, Y' ) ),
   612 						/* translators: Date/Time format, see https://secure.php.net/date */
   351 						/* translators: Date/Time format, see https://www.php.net/date */
   613 						'datetime'            => __( 'F j, Y g:i a' ),
   352 						'datetime'            => __( 'F j, Y g:i a' ),
   614 						/* translators: Abbreviated date/time format, see https://secure.php.net/date */
   353 						/* translators: Abbreviated date/time format, see https://www.php.net/date */
   615 						'datetimeAbbreviated' => __( 'M j, Y g:i a' ),
   354 						'datetimeAbbreviated' => __( 'M j, Y g:i a' ),
   616 					),
   355 					),
   617 					'timezone' => array(
   356 					'timezone' => array(
   618 						'offset' => get_option( 'gmt_offset', 0 ),
   357 						'offset' => get_option( 'gmt_offset', 0 ),
   619 						'string' => get_option( 'timezone_string', 'UTC' ),
   358 						'string' => get_option( 'timezone_string', 'UTC' ),
   667 		'wpdialogs',
   406 		'wpdialogs',
   668 		'wptextpattern',
   407 		'wptextpattern',
   669 		'wpview',
   408 		'wpview',
   670 	);
   409 	);
   671 
   410 
   672 	/* This filter is documented in wp-includes/class-wp-editor.php */
   411 	/** This filter is documented in wp-includes/class-wp-editor.php */
   673 	$tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' );
   412 	$tinymce_plugins = apply_filters( 'tiny_mce_plugins', $tinymce_plugins, 'classic-block' );
   674 	$tinymce_plugins = array_unique( $tinymce_plugins );
   413 	$tinymce_plugins = array_unique( $tinymce_plugins );
   675 
   414 
   676 	$disable_captions = false;
   415 	$disable_captions = false;
   677 	// Runs after `tiny_mce_plugins` but before `mce_buttons`.
   416 	// Runs after `tiny_mce_plugins` but before `mce_buttons`.
   696 		'spellchecker',
   435 		'spellchecker',
   697 		'wp_add_media',
   436 		'wp_add_media',
   698 		'wp_adv',
   437 		'wp_adv',
   699 	);
   438 	);
   700 
   439 
   701 	/* This filter is documented in wp-includes/class-wp-editor.php */
   440 	/** This filter is documented in wp-includes/class-wp-editor.php */
   702 	$toolbar1 = apply_filters( 'mce_buttons', $toolbar1, 'classic-block' );
   441 	$toolbar1 = apply_filters( 'mce_buttons', $toolbar1, 'classic-block' );
   703 
   442 
   704 	$toolbar2 = array(
   443 	$toolbar2 = array(
   705 		'strikethrough',
   444 		'strikethrough',
   706 		'hr',
   445 		'hr',
   713 		'undo',
   452 		'undo',
   714 		'redo',
   453 		'redo',
   715 		'wp_help',
   454 		'wp_help',
   716 	);
   455 	);
   717 
   456 
   718 	/* This filter is documented in wp-includes/class-wp-editor.php */
   457 	/** This filter is documented in wp-includes/class-wp-editor.php */
   719 	$toolbar2 = apply_filters( 'mce_buttons_2', $toolbar2, 'classic-block' );
   458 	$toolbar2 = apply_filters( 'mce_buttons_2', $toolbar2, 'classic-block' );
   720 	/* This filter is documented in wp-includes/class-wp-editor.php */
   459 	/** This filter is documented in wp-includes/class-wp-editor.php */
   721 	$toolbar3 = apply_filters( 'mce_buttons_3', array(), 'classic-block' );
   460 	$toolbar3 = apply_filters( 'mce_buttons_3', array(), 'classic-block' );
   722 	/* This filter is documented in wp-includes/class-wp-editor.php */
   461 	/** This filter is documented in wp-includes/class-wp-editor.php */
   723 	$toolbar4 = apply_filters( 'mce_buttons_4', array(), 'classic-block' );
   462 	$toolbar4 = apply_filters( 'mce_buttons_4', array(), 'classic-block' );
   724 	/* This filter is documented in wp-includes/class-wp-editor.php */
   463 	/** This filter is documented in wp-includes/class-wp-editor.php */
   725 	$external_plugins = apply_filters( 'mce_external_plugins', array(), 'classic-block' );
   464 	$external_plugins = apply_filters( 'mce_external_plugins', array(), 'classic-block' );
   726 
   465 
   727 	$tinymce_settings = array(
   466 	$tinymce_settings = array(
   728 		'plugins'              => implode( ',', $tinymce_plugins ),
   467 		'plugins'              => implode( ',', $tinymce_plugins ),
   729 		'toolbar1'             => implode( ',', $toolbar1 ),
   468 		'toolbar1'             => implode( ',', $toolbar1 ),
   740 
   479 
   741 	if ( ! empty( $editor_settings['tinymce'] ) && is_array( $editor_settings['tinymce'] ) ) {
   480 	if ( ! empty( $editor_settings['tinymce'] ) && is_array( $editor_settings['tinymce'] ) ) {
   742 		array_merge( $tinymce_settings, $editor_settings['tinymce'] );
   481 		array_merge( $tinymce_settings, $editor_settings['tinymce'] );
   743 	}
   482 	}
   744 
   483 
   745 	/* This filter is documented in wp-includes/class-wp-editor.php */
   484 	/** This filter is documented in wp-includes/class-wp-editor.php */
   746 	$tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' );
   485 	$tinymce_settings = apply_filters( 'tiny_mce_before_init', $tinymce_settings, 'classic-block' );
   747 
   486 
   748 	// Do "by hand" translation from PHP array to js object.
   487 	// Do "by hand" translation from PHP array to js object.
   749 	// Prevents breakage in some custom settings.
   488 	// Prevents breakage in some custom settings.
   750 	$init_obj = '';
   489 	$init_obj = '';
   752 		if ( is_bool( $value ) ) {
   491 		if ( is_bool( $value ) ) {
   753 			$val       = $value ? 'true' : 'false';
   492 			$val       = $value ? 'true' : 'false';
   754 			$init_obj .= $key . ':' . $val . ',';
   493 			$init_obj .= $key . ':' . $val . ',';
   755 			continue;
   494 			continue;
   756 		} elseif ( ! empty( $value ) && is_string( $value ) && (
   495 		} elseif ( ! empty( $value ) && is_string( $value ) && (
   757 			( '{' == $value{0} && '}' == $value{strlen( $value ) - 1} ) ||
   496 			( '{' === $value[0] && '}' === $value[ strlen( $value ) - 1 ] ) ||
   758 			( '[' == $value{0} && ']' == $value{strlen( $value ) - 1} ) ||
   497 			( '[' === $value[0] && ']' === $value[ strlen( $value ) - 1 ] ) ||
   759 			preg_match( '/^\(?function ?\(/', $value ) ) ) {
   498 			preg_match( '/^\(?function ?\(/', $value ) ) ) {
   760 			$init_obj .= $key . ':' . $value . ',';
   499 			$init_obj .= $key . ':' . $value . ',';
   761 			continue;
   500 			continue;
   762 		}
   501 		}
   763 		$init_obj .= $key . ':"' . $value . '",';
   502 		$init_obj .= $key . ':"' . $value . '",';
   781  *
   520  *
   782  * @since 5.0.0
   521  * @since 5.0.0
   783  *
   522  *
   784  * @param WP_Scripts $scripts WP_Scripts object.
   523  * @param WP_Scripts $scripts WP_Scripts object.
   785  */
   524  */
   786 function wp_default_packages( &$scripts ) {
   525 function wp_default_packages( $scripts ) {
   787 	wp_default_packages_vendor( $scripts );
   526 	wp_default_packages_vendor( $scripts );
   788 	wp_register_tinymce_scripts( $scripts );
   527 	wp_register_tinymce_scripts( $scripts );
   789 	wp_default_packages_scripts( $scripts );
   528 	wp_default_packages_scripts( $scripts );
   790 
   529 
   791 	if ( did_action( 'init' ) ) {
   530 	if ( did_action( 'init' ) ) {
   804  * @return string The script suffix.
   543  * @return string The script suffix.
   805  */
   544  */
   806 function wp_scripts_get_suffix( $type = '' ) {
   545 function wp_scripts_get_suffix( $type = '' ) {
   807 	static $suffixes;
   546 	static $suffixes;
   808 
   547 
   809 	if ( $suffixes === null ) {
   548 	if ( null === $suffixes ) {
   810 		include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
   549 		// Include an unmodified $wp_version.
       
   550 		require ABSPATH . WPINC . '/version.php';
   811 
   551 
   812 		$develop_src = false !== strpos( $wp_version, '-src' );
   552 		$develop_src = false !== strpos( $wp_version, '-src' );
   813 
   553 
   814 		if ( ! defined( 'SCRIPT_DEBUG' ) ) {
   554 		if ( ! defined( 'SCRIPT_DEBUG' ) ) {
   815 			define( 'SCRIPT_DEBUG', $develop_src );
   555 			define( 'SCRIPT_DEBUG', $develop_src );
   821 			'suffix'     => $suffix,
   561 			'suffix'     => $suffix,
   822 			'dev_suffix' => $dev_suffix,
   562 			'dev_suffix' => $dev_suffix,
   823 		);
   563 		);
   824 	}
   564 	}
   825 
   565 
   826 	if ( $type === 'dev' ) {
   566 	if ( 'dev' === $type ) {
   827 		return $suffixes['dev_suffix'];
   567 		return $suffixes['dev_suffix'];
   828 	}
   568 	}
   829 
   569 
   830 	return $suffixes['suffix'];
   570 	return $suffixes['suffix'];
   831 }
   571 }
   839  *
   579  *
   840  * @since 2.6.0
   580  * @since 2.6.0
   841  *
   581  *
   842  * @param WP_Scripts $scripts WP_Scripts object.
   582  * @param WP_Scripts $scripts WP_Scripts object.
   843  */
   583  */
   844 function wp_default_scripts( &$scripts ) {
   584 function wp_default_scripts( $scripts ) {
   845 	$suffix     = wp_scripts_get_suffix();
   585 	$suffix     = wp_scripts_get_suffix();
   846 	$dev_suffix = wp_scripts_get_suffix( 'dev' );
   586 	$dev_suffix = wp_scripts_get_suffix( 'dev' );
   847 
   587 	$guessurl   = site_url();
   848 	if ( ! $guessurl = site_url() ) {
   588 
       
   589 	if ( ! $guessurl ) {
   849 		$guessed_url = true;
   590 		$guessed_url = true;
   850 		$guessurl    = wp_guess_url();
   591 		$guessurl    = wp_guess_url();
   851 	}
   592 	}
   852 
   593 
   853 	$scripts->base_url        = $guessurl;
   594 	$scripts->base_url        = $guessurl;
   866 			'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
   607 			'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),
   867 		)
   608 		)
   868 	);
   609 	);
   869 
   610 
   870 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils' ), false, 1 );
   611 	$scripts->add( 'common', "/wp-admin/js/common$suffix.js", array( 'jquery', 'hoverIntent', 'utils' ), false, 1 );
   871 	did_action( 'init' ) && $scripts->localize(
   612 	$scripts->set_translations( 'common' );
   872 		'common',
       
   873 		'commonL10n',
       
   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 
   613 
   882 	$scripts->add( 'wp-sanitize', "/wp-includes/js/wp-sanitize$suffix.js", array(), false, 1 );
   614 	$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 );
       
   885 
   615 
   886 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
   616 	$scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 );
   887 
   617 
   888 	$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
   618 	$scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 );
   889 	did_action( 'init' ) && $scripts->localize(
   619 	did_action( 'init' ) && $scripts->localize(
   926 
   656 
   927 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array( 'utils', 'jquery' ), false, 1 );
   657 	$scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array( 'utils', 'jquery' ), false, 1 );
   928 
   658 
   929 	$scripts->add( 'clipboard', "/wp-includes/js/clipboard$suffix.js", array(), false, 1 );
   659 	$scripts->add( 'clipboard', "/wp-includes/js/clipboard$suffix.js", array(), false, 1 );
   930 
   660 
   931 	// Back-compat for old DFW. To-do: remove at the end of 2016.
       
   932 	$scripts->add( 'wp-fullscreen-stub', "/wp-admin/js/wp-fullscreen-stub$suffix.js", array(), false, 1 );
       
   933 
       
   934 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array( 'jquery' ), false, 1 );
   661 	$scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array( 'jquery' ), false, 1 );
   935 	did_action( 'init' ) && $scripts->localize(
   662 	did_action( 'init' ) && $scripts->localize(
   936 		'wp-ajax-response',
   663 		'wp-ajax-response',
   937 		'wpAjax',
   664 		'wpAjax',
   938 		array(
   665 		array(
   951 			'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
   678 			'nonce'         => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),
   952 			'versionString' => 'wp/v2/',
   679 			'versionString' => 'wp/v2/',
   953 		)
   680 		)
   954 	);
   681 	);
   955 
   682 
   956 	$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 );
   683 	$scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), false, 1 );
   957 	did_action( 'init' ) && $scripts->localize(
   684 	$scripts->set_translations( 'wp-pointer' );
   958 		'wp-pointer',
       
   959 		'wpPointerL10n',
       
   960 		array(
       
   961 			'dismiss' => __( 'Dismiss' ),
       
   962 		)
       
   963 	);
       
   964 
   685 
   965 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
   686 	$scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array( 'heartbeat' ), false, 1 );
   966 
   687 
   967 	$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array( 'jquery', 'wp-hooks' ), false, 1 );
   688 	$scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array( 'jquery', 'wp-hooks' ), false, 1 );
   968 	did_action( 'init' ) && $scripts->localize(
   689 	did_action( 'init' ) && $scripts->localize(
   977 		 */
   698 		 */
   978 		apply_filters( 'heartbeat_settings', array() )
   699 		apply_filters( 'heartbeat_settings', array() )
   979 	);
   700 	);
   980 
   701 
   981 	$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array( 'heartbeat' ), false, 1 );
   702 	$scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array( 'heartbeat' ), false, 1 );
   982 	did_action( 'init' ) && $scripts->localize(
   703 	$scripts->set_translations( 'wp-auth-check' );
   983 		'wp-auth-check',
       
   984 		'authcheckL10n',
       
   985 		array(
       
   986 			'beforeunload' => __( 'Your session has expired. You can log in again from this page or go to the login page.' ),
       
   987 
       
   988 			/**
       
   989 			 * Filters the authentication check interval.
       
   990 			 *
       
   991 			 * @since 3.6.0
       
   992 			 *
       
   993 			 * @param int $interval The interval in which to check a user's authentication.
       
   994 			 *                      Default 3 minutes in seconds, or 180.
       
   995 			 */
       
   996 			'interval'     => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
       
   997 		)
       
   998 	);
       
   999 
   704 
  1000 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
   705 	$scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 );
  1001 
   706 
  1002 	// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
   707 	// WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source.
  1003 	$scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1' );
   708 	$scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1' );
  1008 	$scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array( 'scriptaculous-effects' ), '1.9.0' );
   713 	$scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array( 'scriptaculous-effects' ), '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' );
   714 	$scripts->add( 'scriptaculous-sound', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.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' );
   715 	$scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array( 'scriptaculous-root' ), '1.9.0' );
  1011 	$scripts->add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );
   716 	$scripts->add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );
  1012 
   717 
  1013 	// not used in core, replaced by Jcrop.js
   718 	// Not used in core, replaced by Jcrop.js.
  1014 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
   719 	$scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array( 'scriptaculous-dragdrop' ) );
  1015 
   720 
  1016 	// jQuery
   721 	// jQuery.
  1017 	$scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4-wp' );
   722 	$scripts->add( 'jquery', false, array( 'jquery-core' ), '1.12.4-wp' );
  1018 	$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4-wp' );
   723 	$scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4-wp' );
  1019 	$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
   724 	$scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' );
  1020 
   725 
  1021 	// full jQuery UI
   726 	// Full jQuery UI.
  1022 	$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
   727 	$scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$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 );
   728 	$scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
  1024 
   729 
  1025 	$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array( 'jquery-effects-core' ), '1.11.4', 1 );
   730 	$scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$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 );
   731 	$scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array( 'jquery-effects-core' ), '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 );
   762 	$scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '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 );
   763 	$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 );
  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 );
   764 	$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 );
  1060 	$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
   765 	$scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array( 'jquery' ), '1.11.4', 1 );
  1061 
   766 
  1062 	// Strings for 'jquery-ui-autocomplete' live region messages
   767 	// Strings for 'jquery-ui-autocomplete' live region messages.
  1063 	did_action( 'init' ) && $scripts->localize(
   768 	did_action( 'init' ) && $scripts->localize(
  1064 		'jquery-ui-autocomplete',
   769 		'jquery-ui-autocomplete',
  1065 		'uiAutocompleteL10n',
   770 		'uiAutocompleteL10n',
  1066 		array(
   771 		array(
  1067 			'noResults'    => __( 'No results found.' ),
   772 			'noResults'    => __( 'No results found.' ),
  1068 			/* translators: Number of results found when using jQuery UI Autocomplete */
   773 			/* translators: Number of results found when using jQuery UI Autocomplete. */
  1069 			'oneResult'    => __( '1 result found. Use up and down arrow keys to navigate.' ),
   774 			'oneResult'    => __( '1 result found. Use up and down arrow keys to navigate.' ),
  1070 			/* translators: %d: Number of results found when using jQuery UI Autocomplete */
   775 			/* translators: %d: Number of results found when using jQuery UI Autocomplete. */
  1071 			'manyResults'  => __( '%d results found. Use up and down arrow keys to navigate.' ),
   776 			'manyResults'  => __( '%d results found. Use up and down arrow keys to navigate.' ),
  1072 			'itemSelected' => __( 'Item selected.' ),
   777 			'itemSelected' => __( 'Item selected.' ),
  1073 		)
   778 		)
  1074 	);
   779 	);
  1075 
   780 
  1076 	// deprecated, not used in core, most functionality is included in jQuery 1.3
   781 	// Deprecated, not used in core, most functionality is included in jQuery 1.3.
  1077 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.2.1', 1 );
   782 	$scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array( 'jquery' ), '4.2.1', 1 );
  1078 
   783 
  1079 	// jQuery plugins
   784 	// jQuery plugins.
  1080 	$scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.min.js', array( 'jquery' ), '2.1.1', 1 );
   785 	$scripts->add( 'jquery-color', '/wp-includes/js/jquery/jquery.color.min.js', array( 'jquery' ), '2.1.2', 1 );
  1081 	$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array( 'jquery' ), '20m', 1 );
   786 	$scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array( 'jquery' ), '20m', 1 );
  1082 	$scripts->add( 'jquery-query', '/wp-includes/js/jquery/jquery.query.js', array( 'jquery' ), '2.1.7', 1 );
   787 	$scripts->add( 'jquery-query', '/wp-includes/js/jquery/jquery.query.js', array( 'jquery' ), '2.1.7', 1 );
  1083 	$scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2', 1 );
   788 	$scripts->add( 'jquery-serialize-object', '/wp-includes/js/jquery/jquery.serialize-object.js', array( 'jquery' ), '0.2', 1 );
  1084 	$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 );
   789 	$scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array( 'jquery' ), '0.0.2m', 1 );
  1085 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 );
   790 	$scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array( 'jquery', 'jquery-hotkeys' ), false, 1 );
  1088 	// Not used any more, registered for backward compatibility.
   793 	// Not used any more, registered for backward compatibility.
  1089 	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 );
   794 	$scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array( 'jquery' ), '1.1-20110113', 1 );
  1090 
   795 
  1091 	// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
   796 	// Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv.
  1092 	// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
   797 	// It sets jQuery as a dependency, as the theme may have been implicitly loading it this way.
  1093 	$scripts->add( 'imagesloaded', '/wp-includes/js/imagesloaded.min.js', array(), '3.2.0', 1 );
   798 	$scripts->add( 'imagesloaded', '/wp-includes/js/imagesloaded.min.js', array(), '4.1.4', 1 );
  1094 	$scripts->add( 'masonry', '/wp-includes/js/masonry.min.js', array( 'imagesloaded' ), '3.3.2', 1 );
   799 	$scripts->add( 'masonry', '/wp-includes/js/masonry.min.js', array( 'imagesloaded' ), '4.2.2', 1 );
  1095 	$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 );
   800 	$scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 );
  1096 
   801 
  1097 	$scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array( 'jquery' ), '3.1-20121105', 1 );
   802 	$scripts->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.js', array( 'jquery' ), '3.1-20121105', 1 );
  1098 	did_action( 'init' ) && $scripts->localize(
   803 	did_action( 'init' ) && $scripts->localize(
  1099 		'thickbox',
   804 		'thickbox',
  1114 	$scripts->add( 'swfobject', '/wp-includes/js/swfobject.js', array(), '2.2-20120417' );
   819 	$scripts->add( 'swfobject', '/wp-includes/js/swfobject.js', array(), '2.2-20120417' );
  1115 
   820 
  1116 	// Error messages for Plupload.
   821 	// Error messages for Plupload.
  1117 	$uploader_l10n = array(
   822 	$uploader_l10n = array(
  1118 		'queue_limit_exceeded'      => __( 'You have attempted to queue too many files.' ),
   823 		'queue_limit_exceeded'      => __( 'You have attempted to queue too many files.' ),
       
   824 		/* translators: %s: File name. */
  1119 		'file_exceeds_size_limit'   => __( '%s exceeds the maximum upload size for this site.' ),
   825 		'file_exceeds_size_limit'   => __( '%s exceeds the maximum upload size for this site.' ),
  1120 		'zero_byte_file'            => __( 'This file is empty. Please try another.' ),
   826 		'zero_byte_file'            => __( 'This file is empty. Please try another.' ),
  1121 		'invalid_filetype'          => __( 'Sorry, this file type is not permitted for security reasons.' ),
   827 		'invalid_filetype'          => __( 'Sorry, this file type is not permitted for security reasons.' ),
  1122 		'not_an_image'              => __( 'This file is not an image. Please try another.' ),
   828 		'not_an_image'              => __( 'This file is not an image. Please try another.' ),
  1123 		'image_memory_exceeded'     => __( 'Memory exceeded. Please try another smaller file.' ),
   829 		'image_memory_exceeded'     => __( 'Memory exceeded. Please try another smaller file.' ),
  1124 		'image_dimensions_exceeded' => __( 'This is larger than the maximum size. Please try another.' ),
   830 		'image_dimensions_exceeded' => __( 'This is larger than the maximum size. Please try another.' ),
  1125 		'default_error'             => __( 'An error occurred in the upload. Please try again later.' ),
   831 		'default_error'             => __( 'An error occurred in the upload. Please try again later.' ),
  1126 		'missing_upload_url'        => __( 'There was a configuration error. Please contact the server administrator.' ),
   832 		'missing_upload_url'        => __( 'There was a configuration error. Please contact the server administrator.' ),
  1127 		'upload_limit_exceeded'     => __( 'You may only upload 1 file.' ),
   833 		'upload_limit_exceeded'     => __( 'You may only upload 1 file.' ),
  1128 		'http_error'                => __( 'HTTP error.' ),
   834 		'http_error'                => __( 'Unexpected response from the server. The file may have been uploaded successfully. Check in the Media Library or reload the page.' ),
       
   835 		'http_error_image'          => __( 'Post-processing of the image failed likely because the server is busy or does not have enough resources. Uploading a smaller image may help. Suggested maximum size is 2500 pixels.' ),
  1129 		'upload_failed'             => __( 'Upload failed.' ),
   836 		'upload_failed'             => __( 'Upload failed.' ),
  1130 		/* translators: 1: Opening link tag, 2: Closing link tag */
   837 		/* translators: 1: Opening link tag, 2: Closing link tag. */
  1131 		'big_upload_failed'         => __( 'Please try uploading this file with the %1$sbrowser uploader%2$s.' ),
   838 		'big_upload_failed'         => __( 'Please try uploading this file with the %1$sbrowser uploader%2$s.' ),
       
   839 		/* translators: %s: File name. */
  1132 		'big_upload_queued'         => __( '%s exceeds the maximum upload size for the multi-file uploader when used in your browser.' ),
   840 		'big_upload_queued'         => __( '%s exceeds the maximum upload size for the multi-file uploader when used in your browser.' ),
  1133 		'io_error'                  => __( 'IO error.' ),
   841 		'io_error'                  => __( 'IO error.' ),
  1134 		'security_error'            => __( 'Security error.' ),
   842 		'security_error'            => __( 'Security error.' ),
  1135 		'file_cancelled'            => __( 'File canceled.' ),
   843 		'file_cancelled'            => __( 'File canceled.' ),
  1136 		'upload_stopped'            => __( 'Upload stopped.' ),
   844 		'upload_stopped'            => __( 'Upload stopped.' ),
  1137 		'dismiss'                   => __( 'Dismiss' ),
   845 		'dismiss'                   => __( 'Dismiss' ),
  1138 		'crunching'                 => __( 'Crunching&hellip;' ),
   846 		'crunching'                 => __( 'Crunching&hellip;' ),
  1139 		'deleted'                   => __( 'moved to the trash.' ),
   847 		'deleted'                   => __( 'moved to the Trash.' ),
       
   848 		/* translators: %s: File name. */
  1140 		'error_uploading'           => __( '&#8220;%s&#8221; has failed to upload.' ),
   849 		'error_uploading'           => __( '&#8220;%s&#8221; has failed to upload.' ),
       
   850 		'unsupported_image'         => __( 'This image cannot be displayed in a web browser. For best results convert it to JPEG before uploading.' ),
  1141 	);
   851 	);
  1142 
   852 
  1143 	$scripts->add( 'moxiejs', "/wp-includes/js/plupload/moxie$suffix.js", array(), '1.3.5' );
   853 	$scripts->add( 'moxiejs', "/wp-includes/js/plupload/moxie$suffix.js", array(), '1.3.5' );
  1144 	$scripts->add( 'plupload', "/wp-includes/js/plupload/plupload$suffix.js", array( 'moxiejs' ), '2.1.9' );
   854 	$scripts->add( 'plupload', "/wp-includes/js/plupload/plupload$suffix.js", array( 'moxiejs' ), '2.1.9' );
  1145 	// Back compat handles:
   855 	// Back compat handles:
  1151 	did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
   861 	did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n );
  1152 
   862 
  1153 	$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
   863 	$scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 );
  1154 	did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
   864 	did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n );
  1155 
   865 
  1156 	// keep 'swfupload' for back-compat.
   866 	// Keep 'swfupload' for back-compat.
  1157 	$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113' );
   867 	$scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113' );
  1158 	$scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
   868 	$scripts->add( 'swfupload-all', false, array( 'swfupload' ), '2201' );
  1159 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array( 'swfupload-all', 'jquery' ), '2201-20110524' );
   869 	$scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array( 'swfupload-all', 'jquery' ), '2201-20110524' );
  1160 	did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
   870 	did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n );
  1161 
   871 
  1163 
   873 
  1164 	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' );
   874 	$scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' );
  1165 	did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
   875 	did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' );
  1166 
   876 
  1167 	$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 );
   877 	$scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 );
  1168 	$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.2.3', 1 );
   878 	$scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.4.0', 1 );
  1169 
   879 
  1170 	$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array( 'underscore', 'jquery' ), false, 1 );
   880 	$scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array( 'underscore', 'jquery' ), false, 1 );
  1171 	did_action( 'init' ) && $scripts->localize(
   881 	did_action( 'init' ) && $scripts->localize(
  1172 		'wp-util',
   882 		'wp-util',
  1173 		'_wpUtilSettings',
   883 		'_wpUtilSettings',
  1182 
   892 
  1183 	$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
   893 	$scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 );
  1184 
   894 
  1185 	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array( 'jquery' ), false, 1 );
   895 	$scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array( 'jquery' ), false, 1 );
  1186 
   896 
  1187 	$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.6-78496d1' );
   897 	$scripts->add( 'mediaelement', false, array( 'jquery', 'mediaelement-core', 'mediaelement-migrate' ), '4.2.13-9993131', 1 );
  1188 	$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.6-78496d1', 1 );
   898 	$scripts->add( 'mediaelement-core', "/wp-includes/js/mediaelement/mediaelement-and-player$suffix.js", array(), '4.2.13-9993131', 1 );
  1189 	$scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 );
   899 	$scripts->add( 'mediaelement-migrate', "/wp-includes/js/mediaelement/mediaelement-migrate$suffix.js", array(), false, 1 );
  1190 
   900 
  1191 	did_action( 'init' ) && $scripts->add_inline_script(
   901 	did_action( 'init' ) && $scripts->add_inline_script(
  1192 		'mediaelement-core',
   902 		'mediaelement-core',
  1193 		sprintf(
   903 		sprintf(
  1194 			'var mejsL10n = %s;',
   904 			'var mejsL10n = %s;',
  1195 			wp_json_encode(
   905 			wp_json_encode(
  1196 				array(
   906 				array(
  1197 					'language' => strtolower( strtok( determine_locale(), '_-' ) ),
   907 					'language' => strtolower( strtok( determine_locale(), '_-' ) ),
  1198 					'strings'  => array(
   908 					'strings'  => array(
       
   909 						'mejs.download-file'       => __( 'Download File' ),
  1199 						'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/' ),
   910 						'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/' ),
  1200 						'mejs.fullscreen-off'      => __( 'Turn off Fullscreen' ),
       
  1201 						'mejs.fullscreen-on'       => __( 'Go Fullscreen' ),
       
  1202 						'mejs.download-video'      => __( 'Download Video' ),
       
  1203 						'mejs.fullscreen'          => __( 'Fullscreen' ),
   911 						'mejs.fullscreen'          => __( 'Fullscreen' ),
  1204 						'mejs.time-jump-forward'   => array( __( 'Jump forward 1 second' ), __( 'Jump forward %1 seconds' ) ),
       
  1205 						'mejs.loop'                => __( 'Toggle Loop' ),
       
  1206 						'mejs.play'                => __( 'Play' ),
   912 						'mejs.play'                => __( 'Play' ),
  1207 						'mejs.pause'               => __( 'Pause' ),
   913 						'mejs.pause'               => __( 'Pause' ),
  1208 						'mejs.close'               => __( 'Close' ),
       
  1209 						'mejs.time-slider'         => __( 'Time Slider' ),
   914 						'mejs.time-slider'         => __( 'Time Slider' ),
  1210 						'mejs.time-help-text'      => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
   915 						'mejs.time-help-text'      => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),
  1211 						'mejs.time-skip-back'      => array( __( 'Skip back 1 second' ), __( 'Skip back %1 seconds' ) ),
   916 						'mejs.live-broadcast'      => __( 'Live Broadcast' ),
  1212 						'mejs.captions-subtitles'  => __( 'Captions/Subtitles' ),
       
  1213 						'mejs.captions-chapters'   => __( 'Chapters' ),
       
  1214 						'mejs.none'                => __( 'None' ),
       
  1215 						'mejs.mute-toggle'         => __( 'Mute Toggle' ),
       
  1216 						'mejs.volume-help-text'    => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
   917 						'mejs.volume-help-text'    => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),
  1217 						'mejs.unmute'              => __( 'Unmute' ),
   918 						'mejs.unmute'              => __( 'Unmute' ),
  1218 						'mejs.mute'                => __( 'Mute' ),
   919 						'mejs.mute'                => __( 'Mute' ),
  1219 						'mejs.volume-slider'       => __( 'Volume Slider' ),
   920 						'mejs.volume-slider'       => __( 'Volume Slider' ),
  1220 						'mejs.video-player'        => __( 'Video Player' ),
   921 						'mejs.video-player'        => __( 'Video Player' ),
  1221 						'mejs.audio-player'        => __( 'Audio Player' ),
   922 						'mejs.audio-player'        => __( 'Audio Player' ),
  1222 						'mejs.ad-skip'             => __( 'Skip ad' ),
   923 						'mejs.captions-subtitles'  => __( 'Captions/Subtitles' ),
  1223 						'mejs.ad-skip-info'        => array( __( 'Skip in 1 second' ), __( 'Skip in %1 seconds' ) ),
   924 						'mejs.captions-chapters'   => __( 'Chapters' ),
  1224 						'mejs.source-chooser'      => __( 'Source Chooser' ),
   925 						'mejs.none'                => __( 'None' ),
  1225 						'mejs.stop'                => __( 'Stop' ),
       
  1226 						'mejs.speed-rate'          => __( 'Speed Rate' ),
       
  1227 						'mejs.live-broadcast'      => __( 'Live Broadcast' ),
       
  1228 						'mejs.afrikaans'           => __( 'Afrikaans' ),
   926 						'mejs.afrikaans'           => __( 'Afrikaans' ),
  1229 						'mejs.albanian'            => __( 'Albanian' ),
   927 						'mejs.albanian'            => __( 'Albanian' ),
  1230 						'mejs.arabic'              => __( 'Arabic' ),
   928 						'mejs.arabic'              => __( 'Arabic' ),
  1231 						'mejs.belarusian'          => __( 'Belarusian' ),
   929 						'mejs.belarusian'          => __( 'Belarusian' ),
  1232 						'mejs.bulgarian'           => __( 'Bulgarian' ),
   930 						'mejs.bulgarian'           => __( 'Bulgarian' ),
  1285 			)
   983 			)
  1286 		),
   984 		),
  1287 		'before'
   985 		'before'
  1288 	);
   986 	);
  1289 
   987 
  1290 	$scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.6-78496d1', 1 );
   988 	$scripts->add( 'mediaelement-vimeo', '/wp-includes/js/mediaelement/renderers/vimeo.min.js', array( 'mediaelement' ), '4.2.13-9993131', 1 );
  1291 	$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array( 'mediaelement' ), false, 1 );
   989 	$scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array( 'mediaelement' ), false, 1 );
  1292 	$mejs_settings = array(
   990 	$mejs_settings = array(
  1293 		'pluginPath'  => includes_url( 'js/mediaelement/', 'relative' ),
   991 		'pluginPath'  => includes_url( 'js/mediaelement/', 'relative' ),
  1294 		'classPrefix' => 'mejs-',
   992 		'classPrefix' => 'mejs-',
  1295 		'stretching'  => 'responsive',
   993 		'stretching'  => 'responsive',
  1313 	$scripts->add( 'jshint', '/wp-includes/js/codemirror/fakejshint.js', array( 'esprima' ), '2.9.5' );
  1011 	$scripts->add( 'jshint', '/wp-includes/js/codemirror/fakejshint.js', array( 'esprima' ), '2.9.5' );
  1314 	$scripts->add( 'jsonlint', '/wp-includes/js/codemirror/jsonlint.js', array(), '1.6.2' );
  1012 	$scripts->add( 'jsonlint', '/wp-includes/js/codemirror/jsonlint.js', array(), '1.6.2' );
  1315 	$scripts->add( 'htmlhint', '/wp-includes/js/codemirror/htmlhint.js', array(), '0.9.14-xwp' );
  1013 	$scripts->add( 'htmlhint', '/wp-includes/js/codemirror/htmlhint.js', array(), '0.9.14-xwp' );
  1316 	$scripts->add( 'htmlhint-kses', '/wp-includes/js/codemirror/htmlhint-kses.js', array( 'htmlhint' ) );
  1014 	$scripts->add( 'htmlhint-kses', '/wp-includes/js/codemirror/htmlhint-kses.js', array( 'htmlhint' ) );
  1317 	$scripts->add( 'code-editor', "/wp-admin/js/code-editor$suffix.js", array( 'jquery', 'wp-codemirror', 'underscore' ) );
  1015 	$scripts->add( 'code-editor', "/wp-admin/js/code-editor$suffix.js", array( 'jquery', 'wp-codemirror', 'underscore' ) );
  1318 	$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' ) );
  1016 	$scripts->add( 'wp-theme-plugin-editor', "/wp-admin/js/theme-plugin-editor$suffix.js", array( 'common', 'wp-util', 'wp-sanitize', 'jquery', 'jquery-ui-core', 'wp-a11y', 'underscore' ) );
  1319 	did_action( 'init' ) && $scripts->add_inline_script(
  1017 	$scripts->set_translations( 'wp-theme-plugin-editor' );
  1320 		'wp-theme-plugin-editor',
       
  1321 		sprintf(
       
  1322 			'wp.themePluginEditor.l10n = %s;',
       
  1323 			wp_json_encode(
       
  1324 				array(
       
  1325 					'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
  1326 					'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.' ),
       
  1327 					'lintError' => array(
       
  1328 						/* translators: %d: error count */
       
  1329 						'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 ),
       
  1330 						/* translators: %d: error count */
       
  1331 						'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.
       
  1332 					),
       
  1333 				)
       
  1334 			)
       
  1335 		)
       
  1336 	);
       
  1337 
  1018 
  1338 	$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
  1019 	$scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 );
  1339 
  1020 
  1340 	$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
  1021 	$scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' );
  1341 	did_action( 'init' ) && $scripts->localize(
  1022 	did_action( 'init' ) && $scripts->localize(
  1357 			'good'     => _x( 'Medium', 'password strength' ),
  1038 			'good'     => _x( 'Medium', 'password strength' ),
  1358 			'strong'   => _x( 'Strong', 'password strength' ),
  1039 			'strong'   => _x( 'Strong', 'password strength' ),
  1359 			'mismatch' => _x( 'Mismatch', 'password mismatch' ),
  1040 			'mismatch' => _x( 'Mismatch', 'password mismatch' ),
  1360 		)
  1041 		)
  1361 	);
  1042 	);
       
  1043 	$scripts->set_translations( 'password-strength-meter' );
  1362 
  1044 
  1363 	$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
  1045 	$scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 );
  1364 	did_action( 'init' ) && $scripts->localize(
  1046 	$scripts->set_translations( 'user-profile' );
  1365 		'user-profile',
       
  1366 		'userProfileL10n',
       
  1367 		array(
       
  1368 			'warn'     => __( 'Your new password has not been saved.' ),
       
  1369 			'warnWeak' => __( 'Confirm use of weak password' ),
       
  1370 			'show'     => __( 'Show' ),
       
  1371 			'hide'     => __( 'Hide' ),
       
  1372 			'cancel'   => __( 'Cancel' ),
       
  1373 			'ariaShow' => esc_attr__( 'Show password' ),
       
  1374 			'ariaHide' => esc_attr__( 'Hide password' ),
       
  1375 		)
       
  1376 	);
       
  1377 
  1047 
  1378 	$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
  1048 	$scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 );
  1379 
  1049 
  1380 	$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
  1050 	$scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 );
  1381 
  1051 
  1382 	$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 );
  1052 	$scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array( 'hoverintent-js' ), false, 1 );
  1383 
  1053 
  1384 	$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
  1054 	$scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
  1385 	did_action( 'init' ) && $scripts->localize(
  1055 	did_action( 'init' ) && $scripts->localize(
  1386 		'wplink',
  1056 		'wplink',
  1387 		'wpLinkL10n',
  1057 		'wpLinkL10n',
  1391 			'save'           => __( 'Add Link' ),
  1061 			'save'           => __( 'Add Link' ),
  1392 			'noTitle'        => __( '(no title)' ),
  1062 			'noTitle'        => __( '(no title)' ),
  1393 			'noMatchesFound' => __( 'No results found.' ),
  1063 			'noMatchesFound' => __( 'No results found.' ),
  1394 			'linkSelected'   => __( 'Link selected.' ),
  1064 			'linkSelected'   => __( 'Link selected.' ),
  1395 			'linkInserted'   => __( 'Link inserted.' ),
  1065 			'linkInserted'   => __( 'Link inserted.' ),
       
  1066 			/* translators: Minimum input length in characters to start searching posts in the "Insert/edit link" modal. */
       
  1067 			'minInputLength' => (int) _x( '3', 'minimum input length for searching post links' ),
  1396 		)
  1068 		)
  1397 	);
  1069 	);
  1398 
  1070 
  1399 	$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
  1071 	$scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 );
  1400 
  1072 
  1401 	$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );
  1073 	$scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 );
  1402 
  1074 
  1403 	$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
  1075 	$scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 );
  1404 
  1076 
  1405 	$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.8.1', 1 );
  1077 	$scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array( 'jquery' ), '1.8.1', 1 );
       
  1078 
       
  1079 	// JS-only version of hoverintent (no dependencies).
       
  1080 	$scripts->add( 'hoverintent-js', '/wp-includes/js/hoverintent-js.min.js', array(), '2.2.1', 1 );
  1406 
  1081 
  1407 	$scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );
  1082 	$scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 );
  1408 	$scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 );
  1083 	$scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 );
  1409 	$scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
  1084 	$scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 );
  1410 	$scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 );
  1085 	$scripts->add( 'customize-models', '/wp-includes/js/customize-models.js', array( 'underscore', 'backbone' ), false, 1 );
  1442 			'untitledBlogName'        => __( '(Untitled)' ),
  1117 			'untitledBlogName'        => __( '(Untitled)' ),
  1443 			'unknownRequestFail'      => __( 'Looks like something&#8217;s gone wrong. Wait a couple seconds, and then try again.' ),
  1118 			'unknownRequestFail'      => __( 'Looks like something&#8217;s gone wrong. Wait a couple seconds, and then try again.' ),
  1444 			'themeDownloading'        => __( 'Downloading your new theme&hellip;' ),
  1119 			'themeDownloading'        => __( 'Downloading your new theme&hellip;' ),
  1445 			'themePreviewWait'        => __( 'Setting up your live preview. This may take a bit.' ),
  1120 			'themePreviewWait'        => __( 'Setting up your live preview. This may take a bit.' ),
  1446 			'revertingChanges'        => __( 'Reverting unpublished changes&hellip;' ),
  1121 			'revertingChanges'        => __( 'Reverting unpublished changes&hellip;' ),
  1447 			'trashConfirm'            => __( 'Are you sure you&#8217;d like to discard your unpublished changes?' ),
  1122 			'trashConfirm'            => __( 'Are you sure you want to discard your unpublished changes?' ),
  1448 			/* translators: %s: Display name of the user who has taken over the changeset in customizer. */
  1123 			/* translators: %s: Display name of the user who has taken over the changeset in customizer. */
  1449 			'takenOverMessage'        => __( '%s has taken over and is currently customizing.' ),
  1124 			'takenOverMessage'        => __( '%s has taken over and is currently customizing.' ),
  1450 			/* translators: %s: URL to the Customizer to load the autosaved version */
  1125 			/* translators: %s: URL to the Customizer to load the autosaved version. */
  1451 			'autosaveNotice'          => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
  1126 			'autosaveNotice'          => __( 'There is a more recent autosave of your changes than the one you are previewing. <a href="%s">Restore the autosave</a>' ),
  1452 			'videoHeaderNotice'       => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
  1127 			'videoHeaderNotice'       => __( 'This theme doesn&#8217;t support video headers on this page. Navigate to the front page or another page that supports video headers.' ),
  1453 			// Used for overriding the file types allowed in plupload.
  1128 			// Used for overriding the file types allowed in Plupload.
  1454 			'allowedFiles'            => __( 'Allowed Files' ),
  1129 			'allowedFiles'            => __( 'Allowed Files' ),
  1455 			'customCssError'          => array(
  1130 			'customCssError'          => array(
  1456 				/* translators: %d: error count */
  1131 				/* translators: %d: Error count. */
  1457 				'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 ),
  1132 				'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 ),
  1458 				/* translators: %d: error count */
  1133 				/* translators: %d: Error count. */
  1459 				'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.
  1134 				'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 ),
       
  1135 				// @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
  1460 			),
  1136 			),
  1461 			'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
  1137 			'pageOnFrontError'        => __( 'Homepage and posts page must be different.' ),
  1462 			'saveBlockedError'        => array(
  1138 			'saveBlockedError'        => array(
  1463 				/* translators: %s: number of invalid settings */
  1139 				/* translators: %s: Number of invalid settings. */
  1464 				'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
  1140 				'singular' => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 1 ),
  1465 				/* translators: %s: number of invalid settings */
  1141 				/* translators: %s: Number of invalid settings. */
  1466 				'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.
  1142 				'plural'   => _n( 'Unable to save due to %s invalid setting.', 'Unable to save due to %s invalid settings.', 2 ),
       
  1143 				// @todo This is lacking, as some languages have a dedicated dual form. For proper handling of plurals in JS, see #20491.
  1467 			),
  1144 			),
  1468 			'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
  1145 			'scheduleDescription'     => __( 'Schedule your customization changes to publish ("go live") at a future date.' ),
  1469 			'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.' ),
  1146 			'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.' ),
  1470 			'themeInstallUnavailable' => sprintf(
  1147 			'themeInstallUnavailable' => sprintf(
  1471 				/* translators: %s: URL to Add Themes admin screen */
  1148 				/* translators: %s: URL to Add Themes admin screen. */
  1472 				   __( '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>.' ),
  1149 				__( '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>.' ),
  1473 				esc_url( admin_url( 'theme-install.php' ) )
  1150 				esc_url( admin_url( 'theme-install.php' ) )
  1474 			),
  1151 			),
  1475 			'publishSettings'         => __( 'Publish Settings' ),
  1152 			'publishSettings'         => __( 'Publish Settings' ),
  1476 			'invalidDate'             => __( 'Invalid date.' ),
  1153 			'invalidDate'             => __( 'Invalid date.' ),
  1477 			'invalidValue'            => __( 'Invalid value.' ),
  1154 			'invalidValue'            => __( 'Invalid value.' ),
  1504 
  1181 
  1505 	$scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" );
  1182 	$scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" );
  1506 
  1183 
  1507 	// To enqueue media-views or media-editor, call wp_enqueue_media().
  1184 	// To enqueue media-views or media-editor, call wp_enqueue_media().
  1508 	// Both rely on numerous settings, styles, and templates to operate correctly.
  1185 	// Both rely on numerous settings, styles, and templates to operate correctly.
  1509 	$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 );
  1186 	$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', 'wp-a11y', 'clipboard' ), false, 1 );
       
  1187 	$scripts->set_translations( 'media-views' );
       
  1188 
  1510 	$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
  1189 	$scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 );
       
  1190 	$scripts->set_translations( 'media-editor' );
  1511 	$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
  1191 	$scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 );
  1512 	$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
  1192 	$scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 );
  1513 
  1193 
  1514 	$scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 );
  1194 	$scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore', 'wp-api-request' ), false, 1 );
  1515 
  1195 
  1516 	if ( is_admin() ) {
  1196 	if ( is_admin() ) {
  1517 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
  1197 		$scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 );
  1518 		did_action( 'init' ) && $scripts->localize(
  1198 		$scripts->set_translations( 'admin-tags' );
  1519 			'admin-tags',
       
  1520 			'tagsl10n',
       
  1521 			array(
       
  1522 				'noPerm' => __( 'Sorry, you are not allowed to do that.' ),
       
  1523 				'broken' => __( 'Something went wrong.' ),
       
  1524 			)
       
  1525 		);
       
  1526 
  1199 
  1527 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 );
  1200 		$scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array( 'wp-lists', 'quicktags', 'jquery-query' ), false, 1 );
       
  1201 		$scripts->set_translations( 'admin-comments' );
  1528 		did_action( 'init' ) && $scripts->localize(
  1202 		did_action( 'init' ) && $scripts->localize(
  1529 			'admin-comments',
  1203 			'admin-comments',
  1530 			'adminCommentsL10n',
  1204 			'adminCommentsSettings',
  1531 			array(
  1205 			array(
  1532 				'hotkeys_highlight_first' => isset( $_GET['hotkeys_highlight_first'] ),
  1206 				'hotkeys_highlight_first' => isset( $_GET['hotkeys_highlight_first'] ),
  1533 				'hotkeys_highlight_last'  => isset( $_GET['hotkeys_highlight_last'] ),
  1207 				'hotkeys_highlight_last'  => isset( $_GET['hotkeys_highlight_last'] ),
  1534 				'replyApprove'            => __( 'Approve and Reply' ),
       
  1535 				'reply'                   => __( 'Reply' ),
       
  1536 				'warnQuickEdit'           => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),
       
  1537 				'warnCommentChanges'      => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),
       
  1538 				'docTitleComments'        => __( 'Comments' ),
       
  1539 				/* translators: %s: comments count */
       
  1540 				'docTitleCommentsCount'   => __( 'Comments (%s)' ),
       
  1541 			)
  1208 			)
  1542 		);
  1209 		);
  1543 
  1210 
  1544 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
  1211 		$scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array( 'jquery' ), false, 1 );
  1545 		did_action( 'init' ) && $scripts->localize(
  1212 
  1546 			'xfn',
  1213 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable', 'wp-a11y' ), false, 1 );
  1547 			'privacyToolsL10n',
  1214 		$scripts->set_translations( 'postbox' );
  1548 			array(
       
  1549 				'noDataFound'     => __( 'No personal data was found for this user.' ),
       
  1550 				'foundAndRemoved' => __( 'All of the personal data found for this user was erased.' ),
       
  1551 				'noneRemoved'     => __( 'Personal data was found for this user but was not erased.' ),
       
  1552 				'someNotRemoved'  => __( 'Personal data was found for this user but some of the personal data found was not erased.' ),
       
  1553 				'removalError'    => __( 'An error occurred while attempting to find and erase personal data.' ),
       
  1554 				'noExportFile'    => __( 'No personal data export file was generated.' ),
       
  1555 				'exportError'     => __( 'An error occurred while attempting to export personal data.' ),
       
  1556 			)
       
  1557 		);
       
  1558 
       
  1559 		$scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array( 'jquery-ui-sortable' ), false, 1 );
       
  1560 		did_action( 'init' ) && $scripts->localize(
       
  1561 			'postbox',
       
  1562 			'postBoxL10n',
       
  1563 			array(
       
  1564 				'postBoxEmptyString' => __( 'Drag boxes here' ),
       
  1565 			)
       
  1566 		);
       
  1567 
  1215 
  1568 		$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
  1216 		$scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 );
       
  1217 		$scripts->set_translations( 'tags-box' );
  1569 
  1218 
  1570 		$scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
  1219 		$scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 );
  1571 		did_action( 'init' ) && $scripts->localize(
  1220 		$scripts->set_translations( 'tags-suggest' );
  1572 			'tags-suggest',
  1221 
  1573 			'tagsSuggestL10n',
  1222 		$scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y', 'wp-sanitize', 'clipboard' ), false, 1 );
  1574 			array(
  1223 		$scripts->set_translations( 'post' );
  1575 				'tagDelimiter' => _x( ',', 'tag delimiter' ),
       
  1576 				'removeTerm'   => __( 'Remove term:' ),
       
  1577 				'termSelected' => __( 'Term selected.' ),
       
  1578 				'termAdded'    => __( 'Term added.' ),
       
  1579 				'termRemoved'  => __( 'Term removed.' ),
       
  1580 			)
       
  1581 		);
       
  1582 
       
  1583 		$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 );
       
  1584 		did_action( 'init' ) && $scripts->localize(
       
  1585 			'post',
       
  1586 			'postL10n',
       
  1587 			array(
       
  1588 				'ok'                 => __( 'OK' ),
       
  1589 				'cancel'             => __( 'Cancel' ),
       
  1590 				'publishOn'          => __( 'Publish on:' ),
       
  1591 				'publishOnFuture'    => __( 'Schedule for:' ),
       
  1592 				'publishOnPast'      => __( 'Published on:' ),
       
  1593 				/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
       
  1594 				'dateFormat'         => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ),
       
  1595 				'showcomm'           => __( 'Show more comments' ),
       
  1596 				'endcomm'            => __( 'No more comments found.' ),
       
  1597 				'publish'            => __( 'Publish' ),
       
  1598 				'schedule'           => _x( 'Schedule', 'post action/button label' ),
       
  1599 				'update'             => __( 'Update' ),
       
  1600 				'savePending'        => __( 'Save as Pending' ),
       
  1601 				'saveDraft'          => __( 'Save Draft' ),
       
  1602 				'private'            => __( 'Private' ),
       
  1603 				'public'             => __( 'Public' ),
       
  1604 				'publicSticky'       => __( 'Public, Sticky' ),
       
  1605 				'password'           => __( 'Password Protected' ),
       
  1606 				'privatelyPublished' => __( 'Privately Published' ),
       
  1607 				'published'          => __( 'Published' ),
       
  1608 				'saveAlert'          => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
  1609 				'savingText'         => __( 'Saving Draft&#8230;' ),
       
  1610 				'permalinkSaved'     => __( 'Permalink saved' ),
       
  1611 			)
       
  1612 		);
       
  1613 
  1224 
  1614 		$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
  1225 		$scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 );
  1615 
  1226 
  1616 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
  1227 		$scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 );
  1617 
  1228 
  1618 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) );
  1229 		$scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ), false, 1 );
  1619 		$scripts->add_data( 'comment', 'group', 1 );
  1230 		$scripts->set_translations( 'comment' );
  1620 		did_action( 'init' ) && $scripts->localize(
       
  1621 			'comment',
       
  1622 			'commentL10n',
       
  1623 			array(
       
  1624 				'submittedOn' => __( 'Submitted on:' ),
       
  1625 				/* translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */
       
  1626 				'dateFormat'  => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ),
       
  1627 			)
       
  1628 		);
       
  1629 
  1231 
  1630 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
  1232 		$scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) );
  1631 
  1233 
  1632 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 );
  1234 		$scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'wp-a11y' ), false, 1 );
  1633 		did_action( 'init' ) && $scripts->add_inline_script(
  1235 		$scripts->set_translations( 'admin-widgets' );
  1634 			'admin-widgets',
       
  1635 			sprintf(
       
  1636 				'wpWidgets.l10n = %s;',
       
  1637 				wp_json_encode(
       
  1638 					array(
       
  1639 						'save'      => __( 'Save' ),
       
  1640 						'saved'     => __( 'Saved' ),
       
  1641 						'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
  1642 					)
       
  1643 				)
       
  1644 			)
       
  1645 		);
       
  1646 
  1236 
  1647 		$scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
  1237 		$scripts->add( 'media-widgets', "/wp-admin/js/widgets/media-widgets$suffix.js", array( 'jquery', 'media-models', 'media-views', 'wp-api-request' ) );
  1648 		$scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' );
  1238 		$scripts->add_inline_script( 'media-widgets', 'wp.mediaWidgets.init();', 'after' );
  1649 
  1239 
  1650 		$scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
  1240 		$scripts->add( 'media-audio-widget', "/wp-admin/js/widgets/media-audio-widget$suffix.js", array( 'media-widgets', 'media-audiovideo' ) );
  1655 		$scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) );
  1245 		$scripts->add( 'custom-html-widgets', "/wp-admin/js/widgets/custom-html-widgets$suffix.js", array( 'jquery', 'backbone', 'wp-util', 'jquery-ui-core', 'wp-a11y' ) );
  1656 
  1246 
  1657 		$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 );
  1247 		$scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y', 'customize-base' ), false, 1 );
  1658 
  1248 
  1659 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
  1249 		$scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 );
  1660 		did_action( 'init' ) && $scripts->localize(
  1250 		$scripts->set_translations( 'inline-edit-post' );
  1661 			'inline-edit-post',
       
  1662 			'inlineEditL10n',
       
  1663 			array(
       
  1664 				'error'      => __( 'Error while saving the changes.' ),
       
  1665 				'ntdeltitle' => __( 'Remove From Bulk Edit' ),
       
  1666 				'notitle'    => __( '(no title)' ),
       
  1667 				'comma'      => trim( _x( ',', 'tag delimiter' ) ),
       
  1668 				'saved'      => __( 'Changes saved.' ),
       
  1669 			)
       
  1670 		);
       
  1671 
  1251 
  1672 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
  1252 		$scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
  1673 		did_action( 'init' ) && $scripts->localize(
  1253 		$scripts->set_translations( 'inline-edit-tax' );
  1674 			'inline-edit-tax',
       
  1675 			'inlineEditL10n',
       
  1676 			array(
       
  1677 				'error' => __( 'Error while saving the changes.' ),
       
  1678 				'saved' => __( 'Changes saved.' ),
       
  1679 			)
       
  1680 		);
       
  1681 
  1254 
  1682 		$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
  1255 		$scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 );
  1683 		did_action( 'init' ) && $scripts->localize(
  1256 		$scripts->set_translations( 'plugin-install' );
  1684 			'plugin-install',
  1257 
  1685 			'plugininstallL10n',
  1258 		$scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y' ), false, 1 );
  1686 			array(
       
  1687 				'plugin_information' => __( 'Plugin:' ),
       
  1688 				'plugin_modal_label' => __( 'Plugin details' ),
       
  1689 				'ays'                => __( 'Are you sure you want to install this plugin?' ),
       
  1690 			)
       
  1691 		);
       
  1692 
       
  1693 		$scripts->add( 'site-health', "/wp-admin/js/site-health$suffix.js", array( 'clipboard', 'jquery', 'wp-util', 'wp-a11y', 'wp-i18n' ), false, 1 );
       
  1694 		$scripts->set_translations( 'site-health' );
  1259 		$scripts->set_translations( 'site-health' );
  1695 
  1260 
  1696 		$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize' ), false, 1 );
  1261 		$scripts->add( 'privacy-tools', "/wp-admin/js/privacy-tools$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 );
       
  1262 		$scripts->set_translations( 'privacy-tools' );
       
  1263 
       
  1264 		$scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'common', 'jquery', 'wp-util', 'wp-a11y', 'wp-sanitize' ), false, 1 );
       
  1265 		$scripts->set_translations( 'updates' );
  1697 		did_action( 'init' ) && $scripts->localize(
  1266 		did_action( 'init' ) && $scripts->localize(
  1698 			'updates',
  1267 			'updates',
  1699 			'_wpUpdatesSettings',
  1268 			'_wpUpdatesSettings',
  1700 			array(
  1269 			array(
  1701 				'ajax_nonce' => wp_create_nonce( 'updates' ),
  1270 				'ajax_nonce' => wp_create_nonce( 'updates' ),
  1702 				'l10n'       => array(
       
  1703 					/* translators: %s: Search string */
       
  1704 					'searchResults'            => __( 'Search results for &#8220;%s&#8221;' ),
       
  1705 					'searchResultsLabel'       => __( 'Search Results' ),
       
  1706 					'noPlugins'                => __( 'You do not appear to have any plugins available at this time.' ),
       
  1707 					'noItemsSelected'          => __( 'Please select at least one item to perform this action on.' ),
       
  1708 					'updating'                 => __( 'Updating...' ), // No ellipsis.
       
  1709 					'pluginUpdated'            => _x( 'Updated!', 'plugin' ),
       
  1710 					'themeUpdated'             => _x( 'Updated!', 'theme' ),
       
  1711 					'update'                   => __( 'Update' ),
       
  1712 					'updateNow'                => __( 'Update Now' ),
       
  1713 					/* translators: %s: Plugin name and version */
       
  1714 					'pluginUpdateNowLabel'     => _x( 'Update %s now', 'plugin' ),
       
  1715 					'updateFailedShort'        => __( 'Update Failed!' ),
       
  1716 					/* translators: %s: Error string for a failed update */
       
  1717 					'updateFailed'             => __( 'Update Failed: %s' ),
       
  1718 					/* translators: %s: Plugin name and version */
       
  1719 					'pluginUpdatingLabel'      => _x( 'Updating %s...', 'plugin' ), // No ellipsis.
       
  1720 					/* translators: %s: Plugin name and version */
       
  1721 					'pluginUpdatedLabel'       => _x( '%s updated!', 'plugin' ),
       
  1722 					/* translators: %s: Plugin name and version */
       
  1723 					'pluginUpdateFailedLabel'  => _x( '%s update failed', 'plugin' ),
       
  1724 					/* translators: Accessibility text */
       
  1725 					'updatingMsg'              => __( 'Updating... please wait.' ), // No ellipsis.
       
  1726 					/* translators: Accessibility text */
       
  1727 					'updatedMsg'               => __( 'Update completed successfully.' ),
       
  1728 					/* translators: Accessibility text */
       
  1729 					'updateCancel'             => __( 'Update canceled.' ),
       
  1730 					'beforeunload'             => __( 'Updates may not complete if you navigate away from this page.' ),
       
  1731 					'installNow'               => __( 'Install Now' ),
       
  1732 					/* translators: %s: Plugin name */
       
  1733 					'pluginInstallNowLabel'    => _x( 'Install %s now', 'plugin' ),
       
  1734 					'installing'               => __( 'Installing...' ),
       
  1735 					'pluginInstalled'          => _x( 'Installed!', 'plugin' ),
       
  1736 					'themeInstalled'           => _x( 'Installed!', 'theme' ),
       
  1737 					'installFailedShort'       => __( 'Installation Failed!' ),
       
  1738 					/* translators: %s: Error string for a failed installation */
       
  1739 					'installFailed'            => __( 'Installation failed: %s' ),
       
  1740 					/* translators: %s: Plugin name and version */
       
  1741 					'pluginInstallingLabel'    => _x( 'Installing %s...', 'plugin' ), // no ellipsis
       
  1742 					/* translators: %s: Theme name and version */
       
  1743 					'themeInstallingLabel'     => _x( 'Installing %s...', 'theme' ), // no ellipsis
       
  1744 					/* translators: %s: Plugin name and version */
       
  1745 					'pluginInstalledLabel'     => _x( '%s installed!', 'plugin' ),
       
  1746 					/* translators: %s: Theme name and version */
       
  1747 					'themeInstalledLabel'      => _x( '%s installed!', 'theme' ),
       
  1748 					/* translators: %s: Plugin name and version */
       
  1749 					'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ),
       
  1750 					/* translators: %s: Theme name and version */
       
  1751 					'themeInstallFailedLabel'  => _x( '%s installation failed', 'theme' ),
       
  1752 					'installingMsg'            => __( 'Installing... please wait.' ),
       
  1753 					'installedMsg'             => __( 'Installation completed successfully.' ),
       
  1754 					/* translators: %s: Activation URL */
       
  1755 					'importerInstalledMsg'     => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),
       
  1756 					/* translators: %s: Theme name */
       
  1757 					'aysDelete'                => __( 'Are you sure you want to delete %s?' ),
       
  1758 					/* translators: %s: Plugin name */
       
  1759 					'aysDeleteUninstall'       => __( 'Are you sure you want to delete %s and its data?' ),
       
  1760 					'aysBulkDelete'            => __( 'Are you sure you want to delete the selected plugins and their data?' ),
       
  1761 					'aysBulkDeleteThemes'      => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),
       
  1762 					'deleting'                 => __( 'Deleting...' ),
       
  1763 					/* translators: %s: Error string for a failed deletion */
       
  1764 					'deleteFailed'             => __( 'Deletion failed: %s' ),
       
  1765 					'pluginDeleted'            => _x( 'Deleted!', 'plugin' ),
       
  1766 					'themeDeleted'             => _x( 'Deleted!', 'theme' ),
       
  1767 					'livePreview'              => __( 'Live Preview' ),
       
  1768 					'activatePlugin'           => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),
       
  1769 					'activateTheme'            => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),
       
  1770 					/* translators: %s: Plugin name */
       
  1771 					'activatePluginLabel'      => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),
       
  1772 					/* translators: %s: Theme name */
       
  1773 					'activateThemeLabel'       => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),
       
  1774 					'activateImporter'         => __( 'Run Importer' ),
       
  1775 					/* translators: %s: Importer name */
       
  1776 					'activateImporterLabel'    => __( 'Run %s' ),
       
  1777 					'unknownError'             => __( 'Something went wrong.' ),
       
  1778 					'connectionError'          => __( 'Connection lost or the server is busy. Please try again later.' ),
       
  1779 					'nonceError'               => __( 'An error has occurred. Please reload the page and try again.' ),
       
  1780 					'pluginsFound'             => __( 'Number of plugins found: %d' ),
       
  1781 					'noPluginsFound'           => __( 'No plugins found. Try a different search.' ),
       
  1782 				),
       
  1783 			)
  1271 			)
  1784 		);
  1272 		);
  1785 
  1273 
  1786 		$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array( 'jquery' ), '1.2' );
  1274 		$scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array( 'jquery' ), '1.2' );
  1787 
  1275 
  1788 		$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
  1276 		$scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 );
  1789 		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
  1277 		$scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 );
  1790 		did_action( 'init' ) && $scripts->localize(
  1278 		$scripts->set_translations( 'wp-color-picker' );
  1791 			'wp-color-picker',
       
  1792 			'wpColorPickerL10n',
       
  1793 			array(
       
  1794 				'clear'            => __( 'Clear' ),
       
  1795 				'clearAriaLabel'   => __( 'Clear color' ),
       
  1796 				'defaultString'    => __( 'Default' ),
       
  1797 				'defaultAriaLabel' => __( 'Select default color' ),
       
  1798 				'pick'             => __( 'Select Color' ),
       
  1799 				'defaultLabel'     => __( 'Color value' ),
       
  1800 			)
       
  1801 		);
       
  1802 
  1279 
  1803 		$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 );
  1280 		$scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 );
  1804 
  1281 
  1805 		$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
  1282 		$scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" );
  1806 
  1283 
  1807 		$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
  1284 		$scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 );
  1808 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
  1285 		$scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 );
  1809 		did_action( 'init' ) && $scripts->localize(
  1286 		$scripts->set_translations( 'media' );
  1810 			'media',
  1287 
  1811 			'attachMediaBoxL10n',
  1288 		$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'jquery-ui-core', 'json2', 'imgareaselect', 'wp-a11y' ), false, 1 );
  1812 			array(
  1289 		$scripts->set_translations( 'image-edit' );
  1813 				'error' => __( 'An error has occurred. Please reload the page and try again.' ),
       
  1814 			)
       
  1815 		);
       
  1816 
       
  1817 		$scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array( 'jquery', 'json2', 'imgareaselect' ), false, 1 );
       
  1818 		did_action( 'init' ) && $scripts->localize(
       
  1819 			'image-edit',
       
  1820 			'imageEditL10n',
       
  1821 			array(
       
  1822 				'error' => __( 'Could not load the preview image. Please reload the page and try again.' ),
       
  1823 			)
       
  1824 		);
       
  1825 
  1290 
  1826 		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
  1291 		$scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 );
  1827 		did_action( 'init' ) && $scripts->localize(
  1292 		$scripts->set_translations( 'set-post-thumbnail' );
  1828 			'set-post-thumbnail',
       
  1829 			'setPostThumbnailL10n',
       
  1830 			array(
       
  1831 				'setThumbnail' => __( 'Use as featured image' ),
       
  1832 				'saving'       => __( 'Saving...' ), // no ellipsis
       
  1833 				'error'        => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),
       
  1834 				'done'         => __( 'Done' ),
       
  1835 			)
       
  1836 		);
       
  1837 
  1293 
  1838 		/*
  1294 		/*
  1839 		 * Navigation Menus: Adding underscore as a dependency to utilize _.debounce
  1295 		 * Navigation Menus: Adding underscore as a dependency to utilize _.debounce
  1840 		 * see https://core.trac.wordpress.org/ticket/42321
  1296 		 * see https://core.trac.wordpress.org/ticket/42321
  1841 		 */
  1297 		 */
  1842 		$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' ) );
  1298 		$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' ) );
  1843 		did_action( 'init' ) && $scripts->localize(
  1299 		$scripts->set_translations( 'nav-menu' );
  1844 			'nav-menu',
       
  1845 			'navMenuL10n',
       
  1846 			array(
       
  1847 				'noResultsFound' => __( 'No results found.' ),
       
  1848 				'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),
       
  1849 				'saveAlert'      => __( 'The changes you made will be lost if you navigate away from this page.' ),
       
  1850 				'untitled'       => _x( '(no label)', 'missing menu item navigation label' ),
       
  1851 			)
       
  1852 		);
       
  1853 
  1300 
  1854 		$scripts->add( 'custom-header', '/wp-admin/js/custom-header.js', array( 'jquery-masonry' ), false, 1 );
  1301 		$scripts->add( 'custom-header', '/wp-admin/js/custom-header.js', array( 'jquery-masonry' ), false, 1 );
  1855 		$scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
  1302 		$scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 );
  1856 		$scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array( 'jquery' ), false, 1 );
  1303 		$scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array( 'jquery' ), false, 1 );
  1857 
  1304 
  1872  *
  1319  *
  1873  * @since 2.6.0
  1320  * @since 2.6.0
  1874  *
  1321  *
  1875  * @param WP_Styles $styles
  1322  * @param WP_Styles $styles
  1876  */
  1323  */
  1877 function wp_default_styles( &$styles ) {
  1324 function wp_default_styles( $styles ) {
  1878 	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
  1325 	// Include an unmodified $wp_version.
       
  1326 	require ABSPATH . WPINC . '/version.php';
  1879 
  1327 
  1880 	if ( ! defined( 'SCRIPT_DEBUG' ) ) {
  1328 	if ( ! defined( 'SCRIPT_DEBUG' ) ) {
  1881 		define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
  1329 		define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) );
  1882 	}
  1330 	}
  1883 
  1331 
  1884 	if ( ! $guessurl = site_url() ) {
  1332 	$guessurl = site_url();
       
  1333 
       
  1334 	if ( ! $guessurl ) {
  1885 		$guessurl = wp_guess_url();
  1335 		$guessurl = wp_guess_url();
  1886 	}
  1336 	}
  1887 
  1337 
  1888 	$styles->base_url        = $guessurl;
  1338 	$styles->base_url        = $guessurl;
  1889 	$styles->content_url     = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : '';
  1339 	$styles->content_url     = defined( 'WP_CONTENT_URL' ) ? WP_CONTENT_URL : '';
  1892 	$styles->default_dirs    = array( '/wp-admin/', '/wp-includes/css/' );
  1342 	$styles->default_dirs    = array( '/wp-admin/', '/wp-includes/css/' );
  1893 
  1343 
  1894 	// Open Sans is no longer used by core, but may be relied upon by themes and plugins.
  1344 	// Open Sans is no longer used by core, but may be relied upon by themes and plugins.
  1895 	$open_sans_font_url = '';
  1345 	$open_sans_font_url = '';
  1896 
  1346 
  1897 	/* translators: If there are characters in your language that are not supported
  1347 	/*
       
  1348 	 * translators: If there are characters in your language that are not supported
  1898 	 * by Open Sans, translate this to 'off'. Do not translate into your own language.
  1349 	 * by Open Sans, translate this to 'off'. Do not translate into your own language.
  1899 	 */
  1350 	 */
  1900 	if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) {
  1351 	if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) {
  1901 		$subsets = 'latin,latin-ext';
  1352 		$subsets = 'latin,latin-ext';
  1902 
  1353 
  1903 		/* translators: To add an additional Open Sans character subset specific to your language,
  1354 		/*
       
  1355 		 * translators: To add an additional Open Sans character subset specific to your language,
  1904 		 * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
  1356 		 * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
  1905 		 */
  1357 		 */
  1906 		$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' );
  1358 		$subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' );
  1907 
  1359 
  1908 		if ( 'cyrillic' == $subset ) {
  1360 		if ( 'cyrillic' === $subset ) {
  1909 			$subsets .= ',cyrillic,cyrillic-ext';
  1361 			$subsets .= ',cyrillic,cyrillic-ext';
  1910 		} elseif ( 'greek' == $subset ) {
  1362 		} elseif ( 'greek' === $subset ) {
  1911 			$subsets .= ',greek,greek-ext';
  1363 			$subsets .= ',greek,greek-ext';
  1912 		} elseif ( 'vietnamese' == $subset ) {
  1364 		} elseif ( 'vietnamese' === $subset ) {
  1913 			$subsets .= ',vietnamese';
  1365 			$subsets .= ',vietnamese';
  1914 		}
  1366 		}
  1915 
  1367 
  1916 		// Hotlink Open Sans, for now
  1368 		// Hotlink Open Sans, for now.
  1917 		$open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets";
  1369 		$open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset=$subsets&display=fallback";
  1918 	}
  1370 	}
  1919 
  1371 
  1920 	// Register a stylesheet for the selected admin color scheme.
  1372 	// Register a stylesheet for the selected admin color scheme.
  1921 	$styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) );
  1373 	$styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) );
  1922 
  1374 
  1923 	$suffix = SCRIPT_DEBUG ? '' : '.min';
  1375 	$suffix = SCRIPT_DEBUG ? '' : '.min';
  1924 
  1376 
  1925 	// Admin CSS
  1377 	// Admin CSS.
  1926 	$styles->add( 'common', "/wp-admin/css/common$suffix.css" );
  1378 	$styles->add( 'common', "/wp-admin/css/common$suffix.css" );
  1927 	$styles->add( 'forms', "/wp-admin/css/forms$suffix.css" );
  1379 	$styles->add( 'forms', "/wp-admin/css/forms$suffix.css" );
  1928 	$styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" );
  1380 	$styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" );
  1929 	$styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" );
  1381 	$styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" );
  1930 	$styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" );
  1382 	$styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" );
  1943 	$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' ) );
  1395 	$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' ) );
  1944 
  1396 
  1945 	$styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
  1397 	$styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
  1946 	$styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
  1398 	$styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) );
  1947 	$styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" );
  1399 	$styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" );
  1948 	$styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) );
  1400 	$styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'imgareaselect' ) );
  1949 	$styles->add( 'customize-widgets', "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
  1401 	$styles->add( 'customize-widgets', "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) );
  1950 	$styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) );
  1402 	$styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) );
  1951 
  1403 
  1952 	$styles->add( 'ie', "/wp-admin/css/ie$suffix.css" );
  1404 	// Common dependencies.
  1953 	$styles->add_data( 'ie', 'conditional', 'lte IE 7' );
       
  1954 
       
  1955 	// Common dependencies
       
  1956 	$styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" );
  1405 	$styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" );
  1957 	$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
  1406 	$styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" );
  1958 
  1407 
  1959 	// Includes CSS
  1408 	// Includes CSS.
  1960 	$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
  1409 	$styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) );
  1961 	$styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
  1410 	$styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) );
  1962 	$styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
  1411 	$styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) );
  1963 	$styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
  1412 	$styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) );
  1964 	$styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
  1413 	$styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) );
  1965 	$styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) );
  1414 	$styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) );
  1966 	$styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" );
  1415 	$styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" );
  1967 	$styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );
  1416 	$styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' );
  1968 
  1417 
  1969 	// External libraries and friends
  1418 	// External libraries and friends.
  1970 	$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
  1419 	$styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' );
  1971 	$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
  1420 	$styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) );
  1972 	$styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.6-78496d1' );
  1421 	$styles->add( 'mediaelement', '/wp-includes/js/mediaelement/mediaelementplayer-legacy.min.css', array(), '4.2.13-9993131' );
  1973 	$styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
  1422 	$styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) );
  1974 	$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
  1423 	$styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) );
  1975 	$styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
  1424 	$styles->add( 'wp-codemirror', '/wp-includes/js/codemirror/codemirror.min.css', array(), '5.29.1-alpha-ee20357' );
  1976 
  1425 
  1977 	// Deprecated CSS
  1426 	// Deprecated CSS.
  1978 	$styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
  1427 	$styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" );
  1979 	$styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
  1428 	$styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' );
  1980 	$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.css', array(), '0.9.12' );
  1429 	$styles->add( 'jcrop', '/wp-includes/js/jcrop/jquery.Jcrop.min.css', array(), '0.9.12' );
  1981 	$styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
  1430 	$styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle.
  1982 	$styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6
  1431 	$styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6.
  1983 
  1432 
  1984 	// Packages styles
  1433 	// Packages styles.
  1985 	$fonts_url = '';
  1434 	$fonts_url = '';
  1986 
  1435 
  1987 	/*
  1436 	/*
  1988 	 * Translators: Use this to specify the proper Google Font name and variants
  1437 	 * translators: Use this to specify the proper Google Font name and variants
  1989 	 * to load that is supported by your language. Do not translate.
  1438 	 * to load that is supported by your language. Do not translate.
  1990 	 * Set to 'off' to disable loading.
  1439 	 * Set to 'off' to disable loading.
  1991 	 */
  1440 	 */
  1992 	$font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
  1441 	$font_family = _x( 'Noto Serif:400,400i,700,700i', 'Google Font Name and Variants' );
  1993 	if ( 'off' !== $font_family ) {
  1442 	if ( 'off' !== $font_family ) {
  2013 		'block-editor'         => array(
  1462 		'block-editor'         => array(
  2014 			'wp-components',
  1463 			'wp-components',
  2015 			'wp-editor-font',
  1464 			'wp-editor-font',
  2016 		),
  1465 		),
  2017 		'block-library'        => array(),
  1466 		'block-library'        => array(),
       
  1467 		'block-directory'      => array(),
  2018 		'components'           => array(),
  1468 		'components'           => array(),
  2019 		'edit-post'            => array(
  1469 		'edit-post'            => array(
  2020 			'wp-components',
  1470 			'wp-components',
  2021 			'wp-block-editor',
  1471 			'wp-block-editor',
  2022 			'wp-editor',
  1472 			'wp-editor',
  2039 		$path   = "/wp-includes/css/dist/$package/style$suffix.css";
  1489 		$path   = "/wp-includes/css/dist/$package/style$suffix.css";
  2040 
  1490 
  2041 		$styles->add( $handle, $path, $dependencies );
  1491 		$styles->add( $handle, $path, $dependencies );
  2042 	}
  1492 	}
  2043 
  1493 
  2044 	// RTL CSS
  1494 	// RTL CSS.
  2045 	$rtl_styles = array(
  1495 	$rtl_styles = array(
  2046 		// Admin CSS
  1496 		// Admin CSS.
  2047 		'common',
  1497 		'common',
  2048 		'forms',
  1498 		'forms',
  2049 		'admin-menu',
  1499 		'admin-menu',
  2050 		'dashboard',
  1500 		'dashboard',
  2051 		'list-tables',
  1501 		'list-tables',
  2062 		'wp-color-picker',
  1512 		'wp-color-picker',
  2063 		'customize-controls',
  1513 		'customize-controls',
  2064 		'customize-widgets',
  1514 		'customize-widgets',
  2065 		'customize-nav-menus',
  1515 		'customize-nav-menus',
  2066 		'customize-preview',
  1516 		'customize-preview',
  2067 		'ie',
       
  2068 		'login',
  1517 		'login',
  2069 		'site-health',
  1518 		'site-health',
  2070 		// Includes CSS
  1519 		// Includes CSS.
  2071 		'buttons',
  1520 		'buttons',
  2072 		'admin-bar',
  1521 		'admin-bar',
  2073 		'wp-auth-check',
  1522 		'wp-auth-check',
  2074 		'editor-buttons',
  1523 		'editor-buttons',
  2075 		'media-views',
  1524 		'media-views',
  2076 		'wp-pointer',
  1525 		'wp-pointer',
  2077 		'wp-jquery-ui-dialog',
  1526 		'wp-jquery-ui-dialog',
  2078 		// Package styles
  1527 		// Package styles.
  2079 		'wp-block-library-theme',
  1528 		'wp-block-library-theme',
  2080 		'wp-edit-blocks',
  1529 		'wp-edit-blocks',
  2081 		'wp-block-editor',
  1530 		'wp-block-editor',
  2082 		'wp-block-library',
  1531 		'wp-block-library',
       
  1532 		'wp-block-directory',
  2083 		'wp-components',
  1533 		'wp-components',
  2084 		'wp-edit-post',
  1534 		'wp-edit-post',
  2085 		'wp-editor',
  1535 		'wp-editor',
  2086 		'wp-format-library',
  1536 		'wp-format-library',
  2087 		'wp-list-reusable-blocks',
  1537 		'wp-list-reusable-blocks',
  2088 		'wp-nux',
  1538 		'wp-nux',
  2089 		// Deprecated CSS
  1539 		// Deprecated CSS.
  2090 		'deprecated-media',
  1540 		'deprecated-media',
  2091 		'farbtastic',
  1541 		'farbtastic',
  2092 	);
  1542 	);
  2093 
  1543 
  2094 	foreach ( $rtl_styles as $rtl_style ) {
  1544 	foreach ( $rtl_styles as $rtl_style ) {
  2106  *
  1556  *
  2107  * @param array $js_array JavaScript scripts array
  1557  * @param array $js_array JavaScript scripts array
  2108  * @return array Reordered array, if needed.
  1558  * @return array Reordered array, if needed.
  2109  */
  1559  */
  2110 function wp_prototype_before_jquery( $js_array ) {
  1560 function wp_prototype_before_jquery( $js_array ) {
  2111 	if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) {
  1561 	$prototype = array_search( 'prototype', $js_array, true );
       
  1562 
       
  1563 	if ( false === $prototype ) {
  2112 		return $js_array;
  1564 		return $js_array;
  2113 	}
  1565 	}
  2114 
  1566 
  2115 	if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) {
  1567 	$jquery = array_search( 'jquery', $js_array, true );
       
  1568 
       
  1569 	if ( false === $jquery ) {
  2116 		return $js_array;
  1570 		return $js_array;
  2117 	}
  1571 	}
  2118 
  1572 
  2119 	if ( $prototype < $jquery ) {
  1573 	if ( $prototype < $jquery ) {
  2120 		return $js_array;
  1574 		return $js_array;
  2173  *
  1627  *
  2174  * @since 4.6.0
  1628  * @since 4.6.0
  2175  *
  1629  *
  2176  * @link https://api.jqueryui.com/datepicker/#options
  1630  * @link https://api.jqueryui.com/datepicker/#options
  2177  *
  1631  *
  2178  * @global WP_Locale $wp_locale The WordPress date and time locale object.
  1632  * @global WP_Locale $wp_locale WordPress date and time locale object.
  2179  */
  1633  */
  2180 function wp_localize_jquery_ui_datepicker() {
  1634 function wp_localize_jquery_ui_datepicker() {
  2181 	global $wp_locale;
  1635 	global $wp_locale;
  2182 
  1636 
  2183 	if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) {
  1637 	if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) {
  2194 			'F',
  1648 			'F',
  2195 			'M',
  1649 			'M',
  2196 			'n',
  1650 			'n',
  2197 			'm', // Month.
  1651 			'm', // Month.
  2198 			'Y',
  1652 			'Y',
  2199 			'y',            // Year.
  1653 			'y', // Year.
  2200 		),
  1654 		),
  2201 		array(
  1655 		array(
  2202 			'dd',
  1656 			'dd',
  2203 			'd',
  1657 			'd',
  2204 			'DD',
  1658 			'DD',
  2241 function wp_localize_community_events() {
  1695 function wp_localize_community_events() {
  2242 	if ( ! wp_script_is( 'dashboard' ) ) {
  1696 	if ( ! wp_script_is( 'dashboard' ) ) {
  2243 		return;
  1697 		return;
  2244 	}
  1698 	}
  2245 
  1699 
  2246 	require_once( ABSPATH . 'wp-admin/includes/class-wp-community-events.php' );
  1700 	require_once ABSPATH . 'wp-admin/includes/class-wp-community-events.php';
  2247 
  1701 
  2248 	$user_id            = get_current_user_id();
  1702 	$user_id            = get_current_user_id();
  2249 	$saved_location     = get_user_option( 'community-events-location', $user_id );
  1703 	$saved_location     = get_user_option( 'community-events-location', $user_id );
  2250 	$saved_ip_address   = isset( $saved_location['ip'] ) ? $saved_location['ip'] : false;
  1704 	$saved_ip_address   = isset( $saved_location['ip'] ) ? $saved_location['ip'] : false;
  2251 	$current_ip_address = WP_Community_Events::get_unsafe_client_ip();
  1705 	$current_ip_address = WP_Community_Events::get_unsafe_client_ip();
  2280 				 * These specific examples were chosen to highlight the fact that a
  1734 				 * These specific examples were chosen to highlight the fact that a
  2281 				 * state is not needed, even for cities whose name is not unique.
  1735 				 * state is not needed, even for cities whose name is not unique.
  2282 				 * It would be too cumbersome to include that in the instructions
  1736 				 * It would be too cumbersome to include that in the instructions
  2283 				 * to the user, so it's left as an implication.
  1737 				 * to the user, so it's left as an implication.
  2284 				 */
  1738 				 */
  2285 				/* translators: %s is the name of the city we couldn't locate.
  1739 				/*
       
  1740 				 * translators: %s is the name of the city we couldn't locate.
  2286 				 * Replace the examples with cities related to your locale. Test that
  1741 				 * Replace the examples with cities related to your locale. Test that
  2287 				 * they match the expected location and have upcoming events before
  1742 				 * they match the expected location and have upcoming events before
  2288 				 * including them. If no cities related to your locale have events,
  1743 				 * including them. If no cities related to your locale have events,
  2289 				 * then use cities related to your locale that would be recognizable
  1744 				 * then use cities related to your locale that would be recognizable
  2290 				 * to most users. Use only the city name itself, without any region
  1745 				 * to most users. Use only the city name itself, without any region
  2292 				 * English name if possible.
  1747 				 * English name if possible.
  2293 				 */
  1748 				 */
  2294 				'could_not_locate_city'           => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
  1749 				'could_not_locate_city'           => __( 'We couldn&#8217;t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ),
  2295 
  1750 
  2296 				// This one is only used with wp.a11y.speak(), so it can/should be more brief.
  1751 				// This one is only used with wp.a11y.speak(), so it can/should be more brief.
  2297 				/* translators: %s: the name of a city */
  1752 				/* translators: %s: The name of a city. */
  2298 				'city_updated'                    => __( 'City updated. Listing events near %s.' ),
  1753 				'city_updated'                    => __( 'City updated. Listing events near %s.' ),
  2299 			),
  1754 			),
  2300 		)
  1755 		)
  2301 	);
  1756 	);
  2302 }
  1757 }
  2313  *
  1768  *
  2314  * The query from $src parameter will be appended to the URL that is given from
  1769  * The query from $src parameter will be appended to the URL that is given from
  2315  * the $_wp_admin_css_colors array value URL.
  1770  * the $_wp_admin_css_colors array value URL.
  2316  *
  1771  *
  2317  * @since 2.6.0
  1772  * @since 2.6.0
       
  1773  *
  2318  * @global array $_wp_admin_css_colors
  1774  * @global array $_wp_admin_css_colors
  2319  *
  1775  *
  2320  * @param string $src    Source URL.
  1776  * @param string $src    Source URL.
  2321  * @param string $handle Either 'colors' or 'colors-rtl'.
  1777  * @param string $handle Either 'colors' or 'colors-rtl'.
  2322  * @return string|false URL path to CSS stylesheet for Administration Screens.
  1778  * @return string|false URL path to CSS stylesheet for Administration Screens.
  2326 
  1782 
  2327 	if ( wp_installing() ) {
  1783 	if ( wp_installing() ) {
  2328 		return preg_replace( '#^wp-admin/#', './', $src );
  1784 		return preg_replace( '#^wp-admin/#', './', $src );
  2329 	}
  1785 	}
  2330 
  1786 
  2331 	if ( 'colors' == $handle ) {
  1787 	if ( 'colors' === $handle ) {
  2332 		$color = get_user_option( 'admin_color' );
  1788 		$color = get_user_option( 'admin_color' );
  2333 
  1789 
  2334 		if ( empty( $color ) || ! isset( $_wp_admin_css_colors[ $color ] ) ) {
  1790 		if ( empty( $color ) || ! isset( $_wp_admin_css_colors[ $color ] ) ) {
  2335 			$color = 'fresh';
  1791 			$color = 'fresh';
  2336 		}
  1792 		}
  2446 	$zip = $compress_scripts ? 1 : 0;
  1902 	$zip = $compress_scripts ? 1 : 0;
  2447 	if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
  1903 	if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
  2448 		$zip = 'gzip';
  1904 		$zip = 'gzip';
  2449 	}
  1905 	}
  2450 
  1906 
  2451 	if ( $concat = trim( $wp_scripts->concat, ', ' ) ) {
  1907 	$concat    = trim( $wp_scripts->concat, ', ' );
  2452 
  1908 	$type_attr = current_theme_supports( 'html5', 'script' ) ? '' : " type='text/javascript'";
       
  1909 
       
  1910 	if ( $concat ) {
  2453 		if ( ! empty( $wp_scripts->print_code ) ) {
  1911 		if ( ! empty( $wp_scripts->print_code ) ) {
  2454 			echo "\n<script type='text/javascript'>\n";
  1912 			echo "\n<script{$type_attr}>\n";
  2455 			echo "/* <![CDATA[ */\n"; // not needed in HTML 5
  1913 			echo "/* <![CDATA[ */\n"; // Not needed in HTML 5.
  2456 			echo $wp_scripts->print_code;
  1914 			echo $wp_scripts->print_code;
  2457 			echo "/* ]]> */\n";
  1915 			echo "/* ]]> */\n";
  2458 			echo "</script>\n";
  1916 			echo "</script>\n";
  2459 		}
  1917 		}
  2460 
  1918 
  2461 		$concat = str_split( $concat, 128 );
  1919 		$concat       = str_split( $concat, 128 );
  2462 		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
  1920 		$concatenated = '';
  2463 
  1921 
  2464 		$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version;
  1922 		foreach ( $concat as $key => $chunk ) {
  2465 		echo "<script type='text/javascript' src='" . esc_attr( $src ) . "'></script>\n";
  1923 			$concatenated .= "&load%5Bchunk_{$key}%5D={$chunk}";
       
  1924 		}
       
  1925 
       
  1926 		$src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}" . $concatenated . '&ver=' . $wp_scripts->default_version;
       
  1927 		echo "<script{$type_attr} src='" . esc_attr( $src ) . "'></script>\n";
  2466 	}
  1928 	}
  2467 
  1929 
  2468 	if ( ! empty( $wp_scripts->print_html ) ) {
  1930 	if ( ! empty( $wp_scripts->print_html ) ) {
  2469 		echo $wp_scripts->print_html;
  1931 		echo $wp_scripts->print_html;
  2470 	}
  1932 	}
  2489 	}
  1951 	}
  2490 
  1952 
  2491 	global $wp_scripts;
  1953 	global $wp_scripts;
  2492 
  1954 
  2493 	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
  1955 	if ( ! ( $wp_scripts instanceof WP_Scripts ) ) {
  2494 		return array(); // no need to run if nothing is queued
  1956 		return array(); // No need to run if nothing is queued.
  2495 	}
  1957 	}
  2496 	return print_head_scripts();
  1958 	return print_head_scripts();
  2497 }
  1959 }
  2498 
  1960 
  2499 /**
  1961 /**
  2519 	 */
  1981 	 */
  2520 	do_action( 'wp_print_footer_scripts' );
  1982 	do_action( 'wp_print_footer_scripts' );
  2521 }
  1983 }
  2522 
  1984 
  2523 /**
  1985 /**
  2524  * Wrapper for do_action('wp_enqueue_scripts')
  1986  * Wrapper for do_action( 'wp_enqueue_scripts' ).
  2525  *
  1987  *
  2526  * Allows plugins to queue scripts for the front end using wp_enqueue_script().
  1988  * Allows plugins to queue scripts for the front end using wp_enqueue_script().
  2527  * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available.
  1989  * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available.
  2528  *
  1990  *
  2529  * @since 2.8.0
  1991  * @since 2.8.0
  2622 	$zip = $compress_css ? 1 : 0;
  2084 	$zip = $compress_css ? 1 : 0;
  2623 	if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
  2085 	if ( $zip && defined( 'ENFORCE_GZIP' ) && ENFORCE_GZIP ) {
  2624 		$zip = 'gzip';
  2086 		$zip = 'gzip';
  2625 	}
  2087 	}
  2626 
  2088 
  2627 	if ( $concat = trim( $wp_styles->concat, ', ' ) ) {
  2089 	$concat    = trim( $wp_styles->concat, ', ' );
       
  2090 	$type_attr = current_theme_supports( 'html5', 'style' ) ? '' : ' type="text/css"';
       
  2091 
       
  2092 	if ( $concat ) {
  2628 		$dir = $wp_styles->text_direction;
  2093 		$dir = $wp_styles->text_direction;
  2629 		$ver = $wp_styles->default_version;
  2094 		$ver = $wp_styles->default_version;
  2630 
  2095 
  2631 		$concat = str_split( $concat, 128 );
  2096 		$concat       = str_split( $concat, 128 );
  2632 		$concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat );
  2097 		$concatenated = '';
  2633 
  2098 
  2634 		$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver;
  2099 		foreach ( $concat as $key => $chunk ) {
  2635 		echo "<link rel='stylesheet' href='" . esc_attr( $href ) . "' type='text/css' media='all' />\n";
  2100 			$concatenated .= "&load%5Bchunk_{$key}%5D={$chunk}";
       
  2101 		}
       
  2102 
       
  2103 		$href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}" . $concatenated . '&ver=' . $ver;
       
  2104 		echo "<link rel='stylesheet' href='" . esc_attr( $href ) . "'{$type_attr} media='all' />\n";
  2636 
  2105 
  2637 		if ( ! empty( $wp_styles->print_code ) ) {
  2106 		if ( ! empty( $wp_styles->print_code ) ) {
  2638 			echo "<style type='text/css'>\n";
  2107 			echo "<style{$type_attr}>\n";
  2639 			echo $wp_styles->print_code;
  2108 			echo $wp_styles->print_code;
  2640 			echo "\n</style>\n";
  2109 			echo "\n</style>\n";
  2641 		}
  2110 		}
  2642 	}
  2111 	}
  2643 
  2112 
  2656  * @global bool $compress_css
  2125  * @global bool $compress_css
  2657  */
  2126  */
  2658 function script_concat_settings() {
  2127 function script_concat_settings() {
  2659 	global $concatenate_scripts, $compress_scripts, $compress_css;
  2128 	global $concatenate_scripts, $compress_scripts, $compress_css;
  2660 
  2129 
  2661 	$compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' == ini_get( 'output_handler' ) );
  2130 	$compressed_output = ( ini_get( 'zlib.output_compression' ) || 'ob_gzhandler' === ini_get( 'output_handler' ) );
  2662 
  2131 
  2663 	if ( ! isset( $concatenate_scripts ) ) {
  2132 	if ( ! isset( $concatenate_scripts ) ) {
  2664 		$concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true;
  2133 		$concatenate_scripts = defined( 'CONCATENATE_SCRIPTS' ) ? CONCATENATE_SCRIPTS : true;
  2665 		if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
  2134 		if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ) {
  2666 			$concatenate_scripts = false;
  2135 			$concatenate_scripts = false;
  2686  * Handles the enqueueing of block scripts and styles that are common to both
  2155  * Handles the enqueueing of block scripts and styles that are common to both
  2687  * the editor and the front-end.
  2156  * the editor and the front-end.
  2688  *
  2157  *
  2689  * @since 5.0.0
  2158  * @since 5.0.0
  2690  *
  2159  *
  2691  * @global WP_Screen $current_screen
  2160  * @global WP_Screen $current_screen WordPress current screen object.
  2692  */
  2161  */
  2693 function wp_common_block_scripts_and_styles() {
  2162 function wp_common_block_scripts_and_styles() {
  2694 	global $current_screen;
  2163 	global $current_screen;
  2695 
  2164 
  2696 	if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen->is_block_editor() ) {
  2165 	if ( is_admin() && ( $current_screen instanceof WP_Screen ) && ! $current_screen->is_block_editor() ) {
  2711 	 * In the function call you supply, simply use `wp_enqueue_script` and
  2180 	 * In the function call you supply, simply use `wp_enqueue_script` and
  2712 	 * `wp_enqueue_style` to add your functionality to the Gutenberg editor.
  2181 	 * `wp_enqueue_style` to add your functionality to the Gutenberg editor.
  2713 	 *
  2182 	 *
  2714 	 * @since 5.0.0
  2183 	 * @since 5.0.0
  2715 	 */
  2184 	 */
  2716 	  do_action( 'enqueue_block_assets' );
  2185 	do_action( 'enqueue_block_assets' );
  2717 }
  2186 }
  2718 
  2187 
  2719 /**
  2188 /**
  2720  * Enqueues registered block scripts and styles, depending on current rendered
  2189  * Enqueues registered block scripts and styles, depending on current rendered
  2721  * context (only enqueuing editor scripts while in context of the editor).
  2190  * context (only enqueuing editor scripts while in context of the editor).
  2722  *
  2191  *
  2723  * @since 5.0.0
  2192  * @since 5.0.0
  2724  *
  2193  *
  2725  * @global WP_Screen $current_screen
  2194  * @global WP_Screen $current_screen WordPress current screen object.
  2726  */
  2195  */
  2727 function wp_enqueue_registered_block_scripts_and_styles() {
  2196 function wp_enqueue_registered_block_scripts_and_styles() {
  2728 	global $current_screen;
  2197 	global $current_screen;
  2729 
  2198 
  2730 	$is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor() );
  2199 	$is_editor = ( ( $current_screen instanceof WP_Screen ) && $current_screen->is_block_editor() );
  2750 		if ( $is_editor && ! empty( $block_type->editor_script ) ) {
  2219 		if ( $is_editor && ! empty( $block_type->editor_script ) ) {
  2751 			wp_enqueue_script( $block_type->editor_script );
  2220 			wp_enqueue_script( $block_type->editor_script );
  2752 		}
  2221 		}
  2753 	}
  2222 	}
  2754 }
  2223 }
       
  2224 
       
  2225 /**
       
  2226  * Function responsible for enqueuing the styles required for block styles functionality on the editor and on the frontend.
       
  2227  *
       
  2228  * @since 5.3.0
       
  2229  */
       
  2230 function enqueue_block_styles_assets() {
       
  2231 	$block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered();
       
  2232 
       
  2233 	foreach ( $block_styles as $styles ) {
       
  2234 		foreach ( $styles as $style_properties ) {
       
  2235 			if ( isset( $style_properties['style_handle'] ) ) {
       
  2236 				wp_enqueue_style( $style_properties['style_handle'] );
       
  2237 			}
       
  2238 			if ( isset( $style_properties['inline_style'] ) ) {
       
  2239 				wp_add_inline_style( 'wp-block-library', $style_properties['inline_style'] );
       
  2240 			}
       
  2241 		}
       
  2242 	}
       
  2243 }
       
  2244 
       
  2245 /**
       
  2246  * Function responsible for enqueuing the assets required for block styles functionality on the editor.
       
  2247  *
       
  2248  * @since 5.3.0
       
  2249  */
       
  2250 function enqueue_editor_block_styles_assets() {
       
  2251 	$block_styles = WP_Block_Styles_Registry::get_instance()->get_all_registered();
       
  2252 
       
  2253 	$register_script_lines = array( '( function() {' );
       
  2254 	foreach ( $block_styles as $block_name => $styles ) {
       
  2255 		foreach ( $styles as $style_properties ) {
       
  2256 			$register_script_lines[] = sprintf(
       
  2257 				'	wp.blocks.registerBlockStyle( \'%s\', %s );',
       
  2258 				$block_name,
       
  2259 				wp_json_encode(
       
  2260 					array(
       
  2261 						'name'  => $style_properties['name'],
       
  2262 						'label' => $style_properties['label'],
       
  2263 					)
       
  2264 				)
       
  2265 			);
       
  2266 		}
       
  2267 	}
       
  2268 	$register_script_lines[] = '} )();';
       
  2269 	$inline_script           = implode( "\n", $register_script_lines );
       
  2270 
       
  2271 	wp_register_script( 'wp-block-styles', false, array( 'wp-blocks' ), true, true );
       
  2272 	wp_add_inline_script( 'wp-block-styles', $inline_script );
       
  2273 	wp_enqueue_script( 'wp-block-styles' );
       
  2274 }
       
  2275 
       
  2276 /**
       
  2277  * Enqueues the assets required for the block directory within the block editor.
       
  2278  *
       
  2279  * @since 5.5.0
       
  2280  */
       
  2281 function wp_enqueue_editor_block_directory_assets() {
       
  2282 	wp_enqueue_script( 'wp-block-directory' );
       
  2283 	wp_enqueue_style( 'wp-block-directory' );
       
  2284 }