home *** CD-ROM | disk | FTP | other *** search
/ HTML Examples / WP.iso / wordpress / wp-includes / script-loader.php < prev    next >
Encoding:
PHP Script  |  2018-01-22  |  77.5 KB  |  1,577 lines

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