/wp-includes/script-loader.php

  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. if ( ! $guessurl = site_url() ) { 
  57. $guessed_url = true; 
  58. $guessurl = wp_guess_url(); 
  59.  
  60. $scripts->base_url = $guessurl; 
  61. $scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; 
  62. $scripts->default_version = get_bloginfo( 'version' ); 
  63. $scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/'); 
  64.  
  65. $suffix = SCRIPT_DEBUG ? '' : '.min'; 
  66. $dev_suffix = $develop_src ? '' : '.min'; 
  67.  
  68. $scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" ); 
  69. did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array( 
  70. 'url' => (string) SITECOOKIEPATH,  
  71. 'uid' => (string) get_current_user_id(),  
  72. 'time' => (string) time(),  
  73. 'secure' => (string) ( 'https' === parse_url( site_url(), PHP_URL_SCHEME ) ),  
  74. ) ); 
  75.  
  76. $scripts->add( 'common', "/wp-admin/js/common$suffix.js", array('jquery', 'hoverIntent', 'utils'), false, 1 ); 
  77. did_action( 'init' ) && $scripts->localize( 'common', 'commonL10n', array( 
  78. 'warnDelete' => __( "You are about to permanently delete these items.\n 'Cancel' to stop, 'OK' to delete." ),  
  79. 'dismiss' => __( 'Dismiss this notice.' ),  
  80. 'collapseMenu' => __( 'Collapse Main menu' ),  
  81. 'expandMenu' => __( 'Expand Main menu' ),  
  82. ) ); 
  83.  
  84. $scripts->add( 'wp-a11y', "/wp-includes/js/wp-a11y$suffix.js", array( 'jquery' ), false, 1 ); 
  85.  
  86. $scripts->add( 'sack', "/wp-includes/js/tw-sack$suffix.js", array(), '1.6.1', 1 ); 
  87.  
  88. $scripts->add( 'quicktags', "/wp-includes/js/quicktags$suffix.js", array(), false, 1 ); 
  89. did_action( 'init' ) && $scripts->localize( 'quicktags', 'quicktagsL10n', array( 
  90. 'closeAllOpenTags' => __( 'Close all open tags' ),  
  91. 'closeTags' => __( 'close tags' ),  
  92. 'enterURL' => __( 'Enter the URL' ),  
  93. 'enterImageURL' => __( 'Enter the URL of the image' ),  
  94. 'enterImageDescription' => __( 'Enter a description of the image' ),  
  95. 'textdirection' => __( 'text direction' ),  
  96. 'toggleTextdirection' => __( 'Toggle Editor Text Direction' ),  
  97. 'dfw' => __( 'Distraction-free writing mode' ),  
  98. 'strong' => __( 'Bold' ),  
  99. 'strongClose' => __( 'Close bold tag' ),  
  100. 'em' => __( 'Italic' ),  
  101. 'emClose' => __( 'Close italic tag' ),  
  102. 'link' => __( 'Insert link' ),  
  103. 'blockquote' => __( 'Blockquote' ),  
  104. 'blockquoteClose' => __( 'Close blockquote tag' ),  
  105. 'del' => __( 'Deleted text (strikethrough)' ),  
  106. 'delClose' => __( 'Close deleted text tag' ),  
  107. 'ins' => __( 'Inserted text' ),  
  108. 'insClose' => __( 'Close inserted text tag' ),  
  109. 'image' => __( 'Insert image' ),  
  110. 'ul' => __( 'Bulleted list' ),  
  111. 'ulClose' => __( 'Close bulleted list tag' ),  
  112. 'ol' => __( 'Numbered list' ),  
  113. 'olClose' => __( 'Close numbered list tag' ),  
  114. 'li' => __( 'List item' ),  
  115. 'liClose' => __( 'Close list item tag' ),  
  116. 'code' => __( 'Code' ),  
  117. 'codeClose' => __( 'Close code tag' ),  
  118. 'more' => __( 'Insert Read More tag' ),  
  119. ) ); 
  120.  
  121. $scripts->add( 'colorpicker', "/wp-includes/js/colorpicker$suffix.js", array('prototype'), '3517m' ); 
  122.  
  123. $scripts->add( 'editor', "/wp-admin/js/editor$suffix.js", array('utils', 'jquery'), false, 1 ); 
  124.  
  125. // Back-compat for old DFW. To-do: remove at the end of 2016. 
  126. $scripts->add( 'wp-fullscreen-stub', "/wp-admin/js/wp-fullscreen-stub$suffix.js", array(), false, 1 ); 
  127.  
  128. $scripts->add( 'wp-ajax-response', "/wp-includes/js/wp-ajax-response$suffix.js", array('jquery'), false, 1 ); 
  129. did_action( 'init' ) && $scripts->localize( 'wp-ajax-response', 'wpAjax', array( 
  130. 'noPerm' => __('Sorry, you are not allowed to do that.'),  
  131. 'broken' => __('An unidentified error has occurred.') 
  132. ) ); 
  133.  
  134. $scripts->add( 'wp-pointer', "/wp-includes/js/wp-pointer$suffix.js", array( 'jquery-ui-widget', 'jquery-ui-position' ), '20111129a', 1 ); 
  135. did_action( 'init' ) && $scripts->localize( 'wp-pointer', 'wpPointerL10n', array( 
  136. 'dismiss' => __('Dismiss'),  
  137. ) ); 
  138.  
  139. $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 ); 
  140.  
  141. $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 ); 
  142. did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings',  
  143. /** 
  144. * Filters the Heartbeat settings. 
  145. * 
  146. * @since 3.6.0 
  147. * 
  148. * @param array $settings Heartbeat settings array. 
  149. */ 
  150. apply_filters( 'heartbeat_settings', array() ) 
  151. ); 
  152.  
  153. $scripts->add( 'wp-auth-check', "/wp-includes/js/wp-auth-check$suffix.js", array('heartbeat'), false, 1 ); 
  154. did_action( 'init' ) && $scripts->localize( 'wp-auth-check', 'authcheckL10n', array( 
  155. 'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'),  
  156.  
  157. /** 
  158. * Filters the authentication check interval. 
  159. * 
  160. * @since 3.6.0 
  161. * 
  162. * @param int $interval The interval in which to check a user's authentication. 
  163. * Default 3 minutes in seconds, or 180. 
  164. */ 
  165. 'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),  
  166. ) ); 
  167.  
  168. $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 ); 
  169.  
  170. // WordPress no longer uses or bundles Prototype or script.aculo.us. These are now pulled from an external source. 
  171. $scripts->add( 'prototype', 'https://ajax.googleapis.com/ajax/libs/prototype/1.7.1.0/prototype.js', array(), '1.7.1'); 
  172. $scripts->add( 'scriptaculous-root', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/scriptaculous.js', array('prototype'), '1.9.0'); 
  173. $scripts->add( 'scriptaculous-builder', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/builder.js', array('scriptaculous-root'), '1.9.0'); 
  174. $scripts->add( 'scriptaculous-dragdrop', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/dragdrop.js', array('scriptaculous-builder', 'scriptaculous-effects'), '1.9.0'); 
  175. $scripts->add( 'scriptaculous-effects', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/effects.js', array('scriptaculous-root'), '1.9.0'); 
  176. $scripts->add( 'scriptaculous-slider', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/slider.js', array('scriptaculous-effects'), '1.9.0'); 
  177. $scripts->add( 'scriptaculous-sound', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/sound.js', array( 'scriptaculous-root' ), '1.9.0' ); 
  178. $scripts->add( 'scriptaculous-controls', 'https://ajax.googleapis.com/ajax/libs/scriptaculous/1.9.0/controls.js', array('scriptaculous-root'), '1.9.0'); 
  179. $scripts->add( 'scriptaculous', false, array('scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls') ); 
  180.  
  181. // not used in core, replaced by Jcrop.js 
  182. $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') ); 
  183.  
  184. // jQuery 
  185. $scripts->add( 'jquery', false, array( 'jquery-core', 'jquery-migrate' ), '1.12.4' ); 
  186. $scripts->add( 'jquery-core', '/wp-includes/js/jquery/jquery.js', array(), '1.12.4' ); 
  187. $scripts->add( 'jquery-migrate', "/wp-includes/js/jquery/jquery-migrate$suffix.js", array(), '1.4.1' ); 
  188.  
  189. // full jQuery UI 
  190. $scripts->add( 'jquery-ui-core', "/wp-includes/js/jquery/ui/core$dev_suffix.js", array('jquery'), '1.11.4', 1 ); 
  191. $scripts->add( 'jquery-effects-core', "/wp-includes/js/jquery/ui/effect$dev_suffix.js", array('jquery'), '1.11.4', 1 ); 
  192.  
  193. $scripts->add( 'jquery-effects-blind', "/wp-includes/js/jquery/ui/effect-blind$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  194. $scripts->add( 'jquery-effects-bounce', "/wp-includes/js/jquery/ui/effect-bounce$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  195. $scripts->add( 'jquery-effects-clip', "/wp-includes/js/jquery/ui/effect-clip$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  196. $scripts->add( 'jquery-effects-drop', "/wp-includes/js/jquery/ui/effect-drop$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  197. $scripts->add( 'jquery-effects-explode', "/wp-includes/js/jquery/ui/effect-explode$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  198. $scripts->add( 'jquery-effects-fade', "/wp-includes/js/jquery/ui/effect-fade$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  199. $scripts->add( 'jquery-effects-fold', "/wp-includes/js/jquery/ui/effect-fold$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  200. $scripts->add( 'jquery-effects-highlight', "/wp-includes/js/jquery/ui/effect-highlight$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  201. $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 ); 
  202. $scripts->add( 'jquery-effects-pulsate', "/wp-includes/js/jquery/ui/effect-pulsate$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  203. $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 ); 
  204. $scripts->add( 'jquery-effects-shake', "/wp-includes/js/jquery/ui/effect-shake$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  205. $scripts->add( 'jquery-effects-size', "/wp-includes/js/jquery/ui/effect-size$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  206. $scripts->add( 'jquery-effects-slide', "/wp-includes/js/jquery/ui/effect-slide$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  207. $scripts->add( 'jquery-effects-transfer', "/wp-includes/js/jquery/ui/effect-transfer$dev_suffix.js", array('jquery-effects-core'), '1.11.4', 1 ); 
  208.  
  209. $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 ); 
  210. $scripts->add( 'jquery-ui-autocomplete', "/wp-includes/js/jquery/ui/autocomplete$dev_suffix.js", array( 'jquery-ui-menu', 'wp-a11y' ), '1.11.4', 1 ); 
  211. $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 ); 
  212. $scripts->add( 'jquery-ui-datepicker', "/wp-includes/js/jquery/ui/datepicker$dev_suffix.js", array('jquery-ui-core'), '1.11.4', 1 ); 
  213. $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 ); 
  214. $scripts->add( 'jquery-ui-draggable', "/wp-includes/js/jquery/ui/draggable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 ); 
  215. $scripts->add( 'jquery-ui-droppable', "/wp-includes/js/jquery/ui/droppable$dev_suffix.js", array('jquery-ui-draggable'), '1.11.4', 1 ); 
  216. $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 ); 
  217. $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 ); 
  218. $scripts->add( 'jquery-ui-position', "/wp-includes/js/jquery/ui/position$dev_suffix.js", array('jquery'), '1.11.4', 1 ); 
  219. $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 ); 
  220. $scripts->add( 'jquery-ui-resizable', "/wp-includes/js/jquery/ui/resizable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 ); 
  221. $scripts->add( 'jquery-ui-selectable', "/wp-includes/js/jquery/ui/selectable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 ); 
  222. $scripts->add( 'jquery-ui-selectmenu', "/wp-includes/js/jquery/ui/selectmenu$dev_suffix.js", array('jquery-ui-menu'), '1.11.4', 1 ); 
  223. $scripts->add( 'jquery-ui-slider', "/wp-includes/js/jquery/ui/slider$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 ); 
  224. $scripts->add( 'jquery-ui-sortable', "/wp-includes/js/jquery/ui/sortable$dev_suffix.js", array('jquery-ui-mouse'), '1.11.4', 1 ); 
  225. $scripts->add( 'jquery-ui-spinner', "/wp-includes/js/jquery/ui/spinner$dev_suffix.js", array( 'jquery-ui-button' ), '1.11.4', 1 ); 
  226. $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 ); 
  227. $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 ); 
  228. $scripts->add( 'jquery-ui-widget', "/wp-includes/js/jquery/ui/widget$dev_suffix.js", array('jquery'), '1.11.4', 1 ); 
  229.  
  230. // Strings for 'jquery-ui-autocomplete' live region messages 
  231. did_action( 'init' ) && $scripts->localize( 'jquery-ui-autocomplete', 'uiAutocompleteL10n', array( 
  232. 'noResults' => __( 'No results found.' ),  
  233. /** translators: Number of results found when using jQuery UI Autocomplete */ 
  234. 'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ),  
  235. /** translators: %d: Number of results found when using jQuery UI Autocomplete */ 
  236. 'manyResults' => __( '%d results found. Use up and down arrow keys to navigate.' ),  
  237. 'itemSelected' => __( 'Item selected.' ),  
  238. ) ); 
  239.  
  240. // deprecated, not used in core, most functionality is included in jQuery 1.3 
  241. $scripts->add( 'jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '3.37.0', 1 ); 
  242.  
  243. // jQuery plugins 
  244. $scripts->add( 'jquery-color', "/wp-includes/js/jquery/jquery.color.min.js", array('jquery'), '2.1.1', 1 ); 
  245. $scripts->add( 'schedule', '/wp-includes/js/jquery/jquery.schedule.js', array('jquery'), '20m', 1 ); 
  246. $scripts->add( 'jquery-query', "/wp-includes/js/jquery/jquery.query.js", array('jquery'), '2.1.7', 1 ); 
  247. $scripts->add( 'jquery-serialize-object', "/wp-includes/js/jquery/jquery.serialize-object.js", array('jquery'), '0.2', 1 ); 
  248. $scripts->add( 'jquery-hotkeys', "/wp-includes/js/jquery/jquery.hotkeys$suffix.js", array('jquery'), '0.0.2m', 1 ); 
  249. $scripts->add( 'jquery-table-hotkeys', "/wp-includes/js/jquery/jquery.table-hotkeys$suffix.js", array('jquery', 'jquery-hotkeys'), false, 1 ); 
  250. $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 ); 
  251.  
  252. // Not used any more, registered for backwards compatibility. 
  253. $scripts->add( 'suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1 ); 
  254.  
  255. // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv. 
  256. // It sets jQuery as a dependency, as the theme may have been implicitly loading it this way. 
  257. $scripts->add( 'imagesloaded', "/wp-includes/js/imagesloaded.min.js", array(), '3.2.0', 1 ); 
  258. $scripts->add( 'masonry', "/wp-includes/js/masonry.min.js", array( 'imagesloaded' ), '3.3.2', 1 ); 
  259. $scripts->add( 'jquery-masonry', "/wp-includes/js/jquery/jquery.masonry$dev_suffix.js", array( 'jquery', 'masonry' ), '3.1.2b', 1 ); 
  260.  
  261. $scripts->add( 'thickbox', "/wp-includes/js/thickbox/thickbox.js", array('jquery'), '3.1-20121105', 1 ); 
  262. did_action( 'init' ) && $scripts->localize( 'thickbox', 'thickboxL10n', array( 
  263. 'next' => __('Next >'),  
  264. 'prev' => __('< Prev'),  
  265. 'image' => __('Image'),  
  266. 'of' => __('of'),  
  267. 'close' => __('Close'),  
  268. 'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'),  
  269. 'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'),  
  270. ) ); 
  271.  
  272. $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12'); 
  273.  
  274. $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417'); 
  275.  
  276. // error message for both plupload and swfupload 
  277. $uploader_l10n = array( 
  278. 'queue_limit_exceeded' => __('You have attempted to queue too many files.'),  
  279. 'file_exceeds_size_limit' => __('%s exceeds the maximum upload size for this site.'),  
  280. 'zero_byte_file' => __('This file is empty. Please try another.'),  
  281. 'invalid_filetype' => __('This file type is not allowed. Please try another.'),  
  282. 'not_an_image' => __('This file is not an image. Please try another.'),  
  283. 'image_memory_exceeded' => __('Memory exceeded. Please try another smaller file.'),  
  284. 'image_dimensions_exceeded' => __('This is larger than the maximum size. Please try another.'),  
  285. 'default_error' => __('An error occurred in the upload. Please try again later.'),  
  286. 'missing_upload_url' => __('There was a configuration error. Please contact the server administrator.'),  
  287. 'upload_limit_exceeded' => __('You may only upload 1 file.'),  
  288. 'http_error' => __('HTTP error.'),  
  289. 'upload_failed' => __('Upload failed.'),  
  290. /** translators: 1: Opening link tag, 2: Closing link tag */ 
  291. 'big_upload_failed' => __('Please try uploading this file with the %1$sbrowser uploader%2$s.'),  
  292. 'big_upload_queued' => __('%s exceeds the maximum upload size for the multi-file uploader when used in your browser.'),  
  293. 'io_error' => __('IO error.'),  
  294. 'security_error' => __('Security error.'),  
  295. 'file_cancelled' => __('File canceled.'),  
  296. 'upload_stopped' => __('Upload stopped.'),  
  297. 'dismiss' => __('Dismiss'),  
  298. 'crunching' => __('Crunching…'),  
  299. 'deleted' => __('moved to the trash.'),  
  300. 'error_uploading' => __('“%s” has failed to upload.') 
  301. ); 
  302.  
  303. $scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.8' ); 
  304. // Back compat handles: 
  305. foreach ( array( 'all', 'html5', 'flash', 'silverlight', 'html4' ) as $handle ) { 
  306. $scripts->add( "plupload-$handle", false, array( 'plupload' ), '2.1.1' ); 
  307.  
  308. $scripts->add( 'plupload-handlers', "/wp-includes/js/plupload/handlers$suffix.js", array( 'plupload', 'jquery' ) ); 
  309. did_action( 'init' ) && $scripts->localize( 'plupload-handlers', 'pluploadL10n', $uploader_l10n ); 
  310.  
  311. $scripts->add( 'wp-plupload', "/wp-includes/js/plupload/wp-plupload$suffix.js", array( 'plupload', 'jquery', 'json2', 'media-models' ), false, 1 ); 
  312. did_action( 'init' ) && $scripts->localize( 'wp-plupload', 'pluploadL10n', $uploader_l10n ); 
  313.  
  314. // keep 'swfupload' for back-compat. 
  315. $scripts->add( 'swfupload', '/wp-includes/js/swfupload/swfupload.js', array(), '2201-20110113'); 
  316. $scripts->add( 'swfupload-swfobject', '/wp-includes/js/swfupload/plugins/swfupload.swfobject.js', array('swfupload', 'swfobject'), '2201a'); 
  317. $scripts->add( 'swfupload-queue', '/wp-includes/js/swfupload/plugins/swfupload.queue.js', array('swfupload'), '2201'); 
  318. $scripts->add( 'swfupload-speed', '/wp-includes/js/swfupload/plugins/swfupload.speed.js', array('swfupload'), '2201'); 
  319. $scripts->add( 'swfupload-all', false, array('swfupload', 'swfupload-swfobject', 'swfupload-queue'), '2201'); 
  320. $scripts->add( 'swfupload-handlers', "/wp-includes/js/swfupload/handlers$suffix.js", array('swfupload-all', 'jquery'), '2201-20110524'); 
  321. did_action( 'init' ) && $scripts->localize( 'swfupload-handlers', 'swfuploadL10n', $uploader_l10n ); 
  322.  
  323. $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 ); 
  324.  
  325. $scripts->add( 'json2', "/wp-includes/js/json2$suffix.js", array(), '2015-05-03' ); 
  326. did_action( 'init' ) && $scripts->add_data( 'json2', 'conditional', 'lt IE 8' ); 
  327.  
  328. $scripts->add( 'underscore', "/wp-includes/js/underscore$dev_suffix.js", array(), '1.8.3', 1 ); 
  329. $scripts->add( 'backbone', "/wp-includes/js/backbone$dev_suffix.js", array( 'underscore', 'jquery' ), '1.2.3', 1 ); 
  330.  
  331. $scripts->add( 'wp-util', "/wp-includes/js/wp-util$suffix.js", array('underscore', 'jquery'), false, 1 ); 
  332. did_action( 'init' ) && $scripts->localize( 'wp-util', '_wpUtilSettings', array( 
  333. 'ajax' => array( 
  334. 'url' => admin_url( 'admin-ajax.php', 'relative' ),  
  335. ),  
  336. ) ); 
  337.  
  338. $scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 ); 
  339.  
  340. $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 ); 
  341.  
  342. $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1 ); 
  343.  
  344. $scripts->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelement-and-player.min.js", array('jquery'), '2.22.0', 1 ); 
  345. did_action( 'init' ) && $scripts->localize( 'mediaelement', 'mejsL10n', array( 
  346. 'language' => get_bloginfo( 'language' ),  
  347. 'strings' => array( 
  348. 'Close' => __( 'Close' ),  
  349. 'Fullscreen' => __( 'Fullscreen' ),  
  350. 'Turn off Fullscreen' => __( 'Turn off Fullscreen' ),  
  351. 'Go Fullscreen' => __( 'Go Fullscreen' ),  
  352. 'Download File' => __( 'Download File' ),  
  353. 'Download Video' => __( 'Download Video' ),  
  354. 'Play' => __( 'Play' ),  
  355. 'Pause' => __( 'Pause' ),  
  356. 'Captions/Subtitles' => __( 'Captions/Subtitles' ),  
  357. 'None' => __( 'None', 'no captions/subtitles' ),  
  358. 'Time Slider' => __( 'Time Slider' ),  
  359. /** translators: %1: number of seconds (30 by default) */ 
  360. 'Skip back %1 seconds' => __( 'Skip back %1 seconds' ),  
  361. 'Video Player' => __( 'Video Player' ),  
  362. 'Audio Player' => __( 'Audio Player' ),  
  363. 'Volume Slider' => __( 'Volume Slider' ),  
  364. 'Mute Toggle' => __( 'Mute Toggle' ),  
  365. 'Unmute' => __( 'Unmute' ),  
  366. 'Mute' => __( 'Mute' ),  
  367. 'Use Up/Down Arrow keys to increase or decrease volume.' => __( 'Use Up/Down Arrow keys to increase or decrease volume.' ),  
  368. 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' => __( 'Use Left/Right Arrow keys to advance one second, Up/Down arrows to advance ten seconds.' ),  
  369. ),  
  370. ) ); 
  371.  
  372.  
  373. $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array('mediaelement'), false, 1 ); 
  374. $mejs_settings = array( 
  375. 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ),  
  376. ); 
  377. did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings',  
  378. /** 
  379. * Filters the MediaElement configuration settings. 
  380. * 
  381. * @since 4.4.0 
  382. * 
  383. * @param array $mejs_settings MediaElement settings array. 
  384. */ 
  385. apply_filters( 'mejs_settings', $mejs_settings ) 
  386. ); 
  387.  
  388. $scripts->add( 'froogaloop', "/wp-includes/js/mediaelement/froogaloop.min.js", array(), '2.0' ); 
  389. $scripts->add( 'wp-playlist', "/wp-includes/js/mediaelement/wp-playlist$suffix.js", array( 'wp-util', 'backbone', 'mediaelement' ), false, 1 ); 
  390.  
  391. $scripts->add( 'zxcvbn-async', "/wp-includes/js/zxcvbn-async$suffix.js", array(), '1.0' ); 
  392. did_action( 'init' ) && $scripts->localize( 'zxcvbn-async', '_zxcvbnSettings', array( 
  393. 'src' => empty( $guessed_url ) ? includes_url( '/js/zxcvbn.min.js' ) : $scripts->base_url . '/wp-includes/js/zxcvbn.min.js',  
  394. ) ); 
  395.  
  396. $scripts->add( 'password-strength-meter', "/wp-admin/js/password-strength-meter$suffix.js", array( 'jquery', 'zxcvbn-async' ), false, 1 ); 
  397. did_action( 'init' ) && $scripts->localize( 'password-strength-meter', 'pwsL10n', array( 
  398. 'unknown' => _x( 'Password strength unknown', 'password strength' ),  
  399. 'short' => _x( 'Very weak', 'password strength' ),  
  400. 'bad' => _x( 'Weak', 'password strength' ),  
  401. 'good' => _x( 'Medium', 'password strength' ),  
  402. 'strong' => _x( 'Strong', 'password strength' ),  
  403. 'mismatch' => _x( 'Mismatch', 'password mismatch' ),  
  404. ) ); 
  405.  
  406. $scripts->add( 'user-profile', "/wp-admin/js/user-profile$suffix.js", array( 'jquery', 'password-strength-meter', 'wp-util' ), false, 1 ); 
  407. did_action( 'init' ) && $scripts->localize( 'user-profile', 'userProfileL10n', array( 
  408. 'warn' => __( 'Your new password has not been saved.' ),  
  409. 'warnWeak' => __( 'Confirm use of weak password' ),  
  410. 'show' => __( 'Show' ),  
  411. 'hide' => __( 'Hide' ),  
  412. 'cancel' => __( 'Cancel' ),  
  413. 'ariaShow' => esc_attr__( 'Show password' ),  
  414. 'ariaHide' => esc_attr__( 'Hide password' ),  
  415. ) ); 
  416.  
  417. $scripts->add( 'language-chooser', "/wp-admin/js/language-chooser$suffix.js", array( 'jquery' ), false, 1 ); 
  418.  
  419. $scripts->add( 'user-suggest', "/wp-admin/js/user-suggest$suffix.js", array( 'jquery-ui-autocomplete' ), false, 1 ); 
  420.  
  421. $scripts->add( 'admin-bar', "/wp-includes/js/admin-bar$suffix.js", array(), false, 1 ); 
  422.  
  423. $scripts->add( 'wplink', "/wp-includes/js/wplink$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); 
  424. did_action( 'init' ) && $scripts->localize( 'wplink', 'wpLinkL10n', array( 
  425. 'title' => __('Insert/edit link'),  
  426. 'update' => __('Update'),  
  427. 'save' => __('Add Link'),  
  428. 'noTitle' => __('(no title)'),  
  429. 'noMatchesFound' => __('No results found.'),  
  430. 'linkSelected' => __( 'Link selected.' ),  
  431. 'linkInserted' => __( 'Link inserted.' ),  
  432. ) ); 
  433.  
  434. $scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 ); 
  435.  
  436. $scripts->add( 'word-count', "/wp-admin/js/word-count$suffix.js", array(), false, 1 ); 
  437. did_action( 'init' ) && $scripts->localize( 'word-count', 'wordCountL10n', array( 
  438. /** 
  439. * translators: If your word count is based on single characters (e.g. East Asian characters),  
  440. * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. 
  441. * Do not translate into your own language. 
  442. */ 
  443. 'type' => _x( 'words', 'Word count type. Do not translate!' ),  
  444. 'shortcodes' => ! empty( $GLOBALS['shortcode_tags'] ) ? array_keys( $GLOBALS['shortcode_tags'] ) : array() 
  445. ) ); 
  446.  
  447. $scripts->add( 'media-upload', "/wp-admin/js/media-upload$suffix.js", array( 'thickbox', 'shortcode' ), false, 1 ); 
  448.  
  449. $scripts->add( 'hoverIntent', "/wp-includes/js/hoverIntent$suffix.js", array('jquery'), '1.8.1', 1 ); 
  450.  
  451. $scripts->add( 'customize-base', "/wp-includes/js/customize-base$suffix.js", array( 'jquery', 'json2', 'underscore' ), false, 1 ); 
  452. $scripts->add( 'customize-loader', "/wp-includes/js/customize-loader$suffix.js", array( 'customize-base' ), false, 1 ); 
  453. $scripts->add( 'customize-preview', "/wp-includes/js/customize-preview$suffix.js", array( 'wp-a11y', 'customize-base' ), false, 1 ); 
  454. $scripts->add( 'customize-models', "/wp-includes/js/customize-models.js", array( 'underscore', 'backbone' ), false, 1 ); 
  455. $scripts->add( 'customize-views', "/wp-includes/js/customize-views.js", array( 'jquery', 'underscore', 'imgareaselect', 'customize-models', 'media-editor', 'media-views' ), false, 1 ); 
  456. $scripts->add( 'customize-controls', "/wp-admin/js/customize-controls$suffix.js", array( 'customize-base', 'wp-a11y', 'wp-util' ), false, 1 ); 
  457. did_action( 'init' ) && $scripts->localize( 'customize-controls', '_wpCustomizeControlsL10n', array( 
  458. 'activate' => __( 'Save & Activate' ),  
  459. 'save' => __( 'Save & Publish' ),  
  460. 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),  
  461. 'saved' => __( 'Saved' ),  
  462. 'cancel' => __( 'Cancel' ),  
  463. 'close' => __( 'Close' ),  
  464. 'cheatin' => __( 'Cheatin’ uh?' ),  
  465. 'notAllowed' => __( 'Sorry, you are not allowed to customize this site.' ),  
  466. 'previewIframeTitle' => __( 'Site Preview' ),  
  467. 'loginIframeTitle' => __( 'Session expired' ),  
  468. 'collapseSidebar' => _x( 'Hide Controls', 'label for hide controls button without length constraints' ),  
  469. 'expandSidebar' => _x( 'Show Controls', 'label for hide controls button without length constraints' ),  
  470. 'untitledBlogName' => __( '(Untitled)' ),  
  471. // Used for overriding the file types allowed in plupload. 
  472. 'allowedFiles' => __( 'Allowed Files' ),  
  473. ) ); 
  474. $scripts->add( 'customize-selective-refresh', "/wp-includes/js/customize-selective-refresh$suffix.js", array( 'jquery', 'wp-util', 'customize-preview' ), false, 1 ); 
  475.  
  476. $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 ); 
  477. $scripts->add( 'customize-preview-widgets', "/wp-includes/js/customize-preview-widgets$suffix.js", array( 'jquery', 'wp-util', 'customize-preview', 'customize-selective-refresh' ), false, 1 ); 
  478.  
  479. $scripts->add( 'customize-nav-menus', "/wp-admin/js/customize-nav-menus$suffix.js", array( 'jquery', 'wp-backbone', 'customize-controls', 'accordion', 'nav-menu' ), false, 1 ); 
  480. $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 ); 
  481.  
  482. $scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array( 'wp-a11y' ), false, 1 ); 
  483.  
  484. $scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 ); 
  485.  
  486. $scripts->add( 'shortcode', "/wp-includes/js/shortcode$suffix.js", array( 'underscore' ), false, 1 ); 
  487. $scripts->add( 'media-models', "/wp-includes/js/media-models$suffix.js", array( 'wp-backbone' ), false, 1 ); 
  488. did_action( 'init' ) && $scripts->localize( 'media-models', '_wpMediaModelsL10n', array( 
  489. 'settings' => array( 
  490. 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ),  
  491. 'post' => array( 'id' => 0 ),  
  492. ),  
  493. ) ); 
  494.  
  495. $scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" ); 
  496.  
  497. // To enqueue media-views or media-editor, call wp_enqueue_media(). 
  498. // Both rely on numerous settings, styles, and templates to operate correctly. 
  499. $scripts->add( 'media-views', "/wp-includes/js/media-views$suffix.js", array( 'utils', 'media-models', 'wp-plupload', 'jquery-ui-sortable', 'wp-mediaelement' ), false, 1 ); 
  500. $scripts->add( 'media-editor', "/wp-includes/js/media-editor$suffix.js", array( 'shortcode', 'media-views' ), false, 1 ); 
  501. $scripts->add( 'media-audiovideo', "/wp-includes/js/media-audiovideo$suffix.js", array( 'media-editor' ), false, 1 ); 
  502. $scripts->add( 'mce-view', "/wp-includes/js/mce-view$suffix.js", array( 'shortcode', 'jquery', 'media-views', 'media-audiovideo' ), false, 1 ); 
  503.  
  504. $scripts->add( 'wp-api', "/wp-includes/js/wp-api$suffix.js", array( 'jquery', 'backbone', 'underscore' ), false, 1 ); 
  505. did_action( 'init' ) && $scripts->localize( 'wp-api', 'wpApiSettings', array( 
  506. 'root' => esc_url_raw( get_rest_url() ),  
  507. 'nonce' => ( wp_installing() && ! is_multisite() ) ? '' : wp_create_nonce( 'wp_rest' ),  
  508. 'versionString' => 'wp/v2/',  
  509. ) ); 
  510.  
  511. if ( is_admin() ) { 
  512. $scripts->add( 'admin-tags', "/wp-admin/js/tags$suffix.js", array( 'jquery', 'wp-ajax-response' ), false, 1 ); 
  513. did_action( 'init' ) && $scripts->localize( 'admin-tags', 'tagsl10n', array( 
  514. 'noPerm' => __('Sorry, you are not allowed to do that.'),  
  515. 'broken' => __('An unidentified error has occurred.') 
  516. )); 
  517.  
  518. $scripts->add( 'admin-comments', "/wp-admin/js/edit-comments$suffix.js", array('wp-lists', 'quicktags', 'jquery-query'), false, 1 ); 
  519. did_action( 'init' ) && $scripts->localize( 'admin-comments', 'adminCommentsL10n', array( 
  520. 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']),  
  521. 'hotkeys_highlight_last' => isset($_GET['hotkeys_highlight_last']),  
  522. 'replyApprove' => __( 'Approve and Reply' ),  
  523. 'reply' => __( 'Reply' ),  
  524. 'warnQuickEdit' => __( "Are you sure you want to edit this comment?\nThe changes you made will be lost." ),  
  525. 'warnCommentChanges' => __( "Are you sure you want to do this?\nThe comment changes you made will be lost." ),  
  526. 'docTitleComments' => __( 'Comments' ),  
  527. /** translators: %s: comments count */ 
  528. 'docTitleCommentsCount' => __( 'Comments (%s)' ),  
  529. ) ); 
  530.  
  531. $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 ); 
  532.  
  533. $scripts->add( 'postbox', "/wp-admin/js/postbox$suffix.js", array('jquery-ui-sortable'), false, 1 ); 
  534. did_action( 'init' ) && $scripts->localize( 'postbox', 'postBoxL10n', array( 
  535. 'postBoxEmptyString' => __( 'Drag boxes here' ),  
  536. ) ); 
  537.  
  538. $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 ); 
  539.  
  540. $scripts->add( 'tags-suggest', "/wp-admin/js/tags-suggest$suffix.js", array( 'jquery-ui-autocomplete', 'wp-a11y' ), false, 1 ); 
  541. did_action( 'init' ) && $scripts->localize( 'tags-suggest', 'tagsSuggestL10n', array( 
  542. 'tagDelimiter' => _x( ', ', 'tag delimiter' ),  
  543. 'removeTerm' => __( 'Remove term:' ),  
  544. 'termSelected' => __( 'Term selected.' ),  
  545. 'termAdded' => __( 'Term added.' ),  
  546. 'termRemoved' => __( 'Term removed.' ),  
  547. ) ); 
  548.  
  549. $scripts->add( 'post', "/wp-admin/js/post$suffix.js", array( 'suggest', 'wp-lists', 'postbox', 'tags-box', 'underscore', 'word-count', 'wp-a11y' ), false, 1 ); 
  550. did_action( 'init' ) && $scripts->localize( 'post', 'postL10n', array( 
  551. 'ok' => __('OK'),  
  552. 'cancel' => __('Cancel'),  
  553. 'publishOn' => __('Publish on:'),  
  554. 'publishOnFuture' => __('Schedule for:'),  
  555. 'publishOnPast' => __('Published on:'),  
  556. /** translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */ 
  557. 'dateFormat' => __('%1$s %2$s, %3$s @ %4$s:%5$s'),  
  558. 'showcomm' => __('Show more comments'),  
  559. 'endcomm' => __('No more comments found.'),  
  560. 'publish' => __('Publish'),  
  561. 'schedule' => __('Schedule'),  
  562. 'update' => __('Update'),  
  563. 'savePending' => __('Save as Pending'),  
  564. 'saveDraft' => __('Save Draft'),  
  565. 'private' => __('Private'),  
  566. 'public' => __('Public'),  
  567. 'publicSticky' => __('Public, Sticky'),  
  568. 'password' => __('Password Protected'),  
  569. 'privatelyPublished' => __('Privately Published'),  
  570. 'published' => __('Published'),  
  571. 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'),  
  572. 'savingText' => __('Saving Draft…'),  
  573. 'permalinkSaved' => __( 'Permalink saved' ),  
  574. ) ); 
  575.  
  576. $scripts->add( 'press-this', "/wp-admin/js/press-this$suffix.js", array( 'jquery', 'tags-box' ), false, 1 ); 
  577. did_action( 'init' ) && $scripts->localize( 'press-this', 'pressThisL10n', array( 
  578. 'newPost' => __( 'Title' ),  
  579. 'serverError' => __( 'Connection lost or the server is busy. Please try again later.' ),  
  580. 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),  
  581. /** translators: %d: nth embed found in a post */ 
  582. 'suggestedEmbedAlt' => __( 'Suggested embed #%d' ),  
  583. /** translators: %d: nth image found in a post */ 
  584. 'suggestedImgAlt' => __( 'Suggested image #%d' ),  
  585. ) ); 
  586.  
  587. $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 ); 
  588.  
  589. $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 ); 
  590.  
  591. $scripts->add( 'comment', "/wp-admin/js/comment$suffix.js", array( 'jquery', 'postbox' ) ); 
  592. $scripts->add_data( 'comment', 'group', 1 ); 
  593. did_action( 'init' ) && $scripts->localize( 'comment', 'commentL10n', array( 
  594. 'submittedOn' => __( 'Submitted on:' ),  
  595. /** translators: 1: month, 2: day, 3: year, 4: hour, 5: minute */ 
  596. 'dateFormat' => __( '%1$s %2$s, %3$s @ %4$s:%5$s' ) 
  597. ) ); 
  598.  
  599. $scripts->add( 'admin-gallery', "/wp-admin/js/gallery$suffix.js", array( 'jquery-ui-sortable' ) ); 
  600.  
  601. $scripts->add( 'admin-widgets', "/wp-admin/js/widgets$suffix.js", array( 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable' ), false, 1 ); 
  602.  
  603. $scripts->add( 'theme', "/wp-admin/js/theme$suffix.js", array( 'wp-backbone', 'wp-a11y' ), false, 1 ); 
  604.  
  605. $scripts->add( 'inline-edit-post', "/wp-admin/js/inline-edit-post$suffix.js", array( 'jquery', 'tags-suggest', 'wp-a11y' ), false, 1 ); 
  606. did_action( 'init' ) && $scripts->localize( 'inline-edit-post', 'inlineEditL10n', array( 
  607. 'error' => __( 'Error while saving the changes.' ),  
  608. 'ntdeltitle' => __( 'Remove From Bulk Edit' ),  
  609. 'notitle' => __( '(no title)' ),  
  610. 'comma' => trim( _x( ', ', 'tag delimiter' ) ),  
  611. 'saved' => __( 'Changes saved.' ),  
  612. ) ); 
  613.  
  614. $scripts->add( 'inline-edit-tax', "/wp-admin/js/inline-edit-tax$suffix.js", array( 'jquery', 'wp-a11y' ), false, 1 ); 
  615. did_action( 'init' ) && $scripts->localize( 'inline-edit-tax', 'inlineEditL10n', array( 
  616. 'error' => __( 'Error while saving the changes.' ),  
  617. 'saved' => __( 'Changes saved.' ),  
  618. ) ); 
  619.  
  620. $scripts->add( 'plugin-install', "/wp-admin/js/plugin-install$suffix.js", array( 'jquery', 'jquery-ui-core', 'thickbox' ), false, 1 ); 
  621. did_action( 'init' ) && $scripts->localize( 'plugin-install', 'plugininstallL10n', array( 
  622. 'plugin_information' => __( 'Plugin:' ),  
  623. 'plugin_modal_label' => __( 'Plugin details' ),  
  624. 'ays' => __('Are you sure you want to install this plugin?') 
  625. ) ); 
  626.  
  627. $scripts->add( 'updates', "/wp-admin/js/updates$suffix.js", array( 'jquery', 'wp-util', 'wp-a11y' ), false, 1 ); 
  628. did_action( 'init' ) && $scripts->localize( 'updates', '_wpUpdatesSettings', array( 
  629. 'ajax_nonce' => wp_create_nonce( 'updates' ),  
  630. 'l10n' => array( 
  631. /** translators: %s: Search string */ 
  632. 'searchResults' => __( 'Search results for “%s”' ),  
  633. 'searchResultsLabel' => __( 'Search Results' ),  
  634. 'noPlugins' => __( 'You do not appear to have any plugins available at this time.' ),  
  635. 'noItemsSelected' => __( 'Please select at least one item to perform this action on.' ),  
  636. 'updating' => __( 'Updating...' ), // No ellipsis. 
  637. 'updated' => __( 'Updated!' ),  
  638. 'update' => __( 'Update' ),  
  639. 'updateNow' => __( 'Update Now' ),  
  640. /** translators: %s: Plugin name and version */ 
  641. 'updateNowLabel' => __( 'Update %s now' ),  
  642. 'updateFailedShort' => __( 'Update Failed!' ),  
  643. /** translators: %s: Error string for a failed update */ 
  644. 'updateFailed' => __( 'Update Failed: %s' ),  
  645. /** translators: %s: Plugin name and version */ 
  646. 'updatingLabel' => __( 'Updating %s...' ), // No ellipsis. 
  647. /** translators: %s: Plugin name and version */ 
  648. 'updatedLabel' => __( '%s updated!' ),  
  649. /** translators: %s: Plugin name and version */ 
  650. 'updateFailedLabel' => __( '%s update failed' ),  
  651. /** translators: JavaScript accessible string */ 
  652. 'updatingMsg' => __( 'Updating... please wait.' ), // No ellipsis. 
  653. /** translators: JavaScript accessible string */ 
  654. 'updatedMsg' => __( 'Update completed successfully.' ),  
  655. /** translators: JavaScript accessible string */ 
  656. 'updateCancel' => __( 'Update canceled.' ),  
  657. 'beforeunload' => __( 'Updates may not complete if you navigate away from this page.' ),  
  658. 'installNow' => __( 'Install Now' ),  
  659. /** translators: %s: Plugin name */ 
  660. 'installNowLabel' => __( 'Install %s now' ),  
  661. 'installing' => __( 'Installing...' ),  
  662. 'installed' => __( 'Installed!' ),  
  663. 'installFailedShort' => __( 'Install Failed!' ),  
  664. /** translators: %s: Error string for a failed installation */ 
  665. 'installFailed' => __( 'Installation failed: %s' ),  
  666. /** translators: %s: Plugin name and version */ 
  667. 'pluginInstallingLabel' => _x( 'Installing %s...', 'plugin' ), // no ellipsis 
  668. /** translators: %s: Theme name and version */ 
  669. 'themeInstallingLabel' => _x( 'Installing %s...', 'theme' ), // no ellipsis 
  670. /** translators: %s: Plugin name and version */ 
  671. 'pluginInstalledLabel' => _x( '%s installed!', 'plugin' ),  
  672. /** translators: %s: Theme name and version */ 
  673. 'themeInstalledLabel' => _x( '%s installed!', 'theme' ),  
  674. /** translators: %s: Plugin name and version */ 
  675. 'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ),  
  676. /** translators: %s: Theme name and version */ 
  677. 'themeInstallFailedLabel' => _x( '%s installation failed', 'theme' ),  
  678. 'installingMsg' => __( 'Installing... please wait.' ),  
  679. 'installedMsg' => __( 'Installation completed successfully.' ),  
  680. /** translators: %s: Activation URL */ 
  681. 'importerInstalledMsg' => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ),  
  682. /** translators: %s: Theme name */ 
  683. 'aysDelete' => __( 'Are you sure you want to delete %s?' ),  
  684. /** translators: %s: Plugin name */ 
  685. 'aysDeleteUninstall' => __( 'Are you sure you want to delete %s and its data?' ),  
  686. 'aysBulkDelete' => __( 'Are you sure you want to delete the selected plugins and their data?' ),  
  687. 'aysBulkDeleteThemes' => __( 'Caution: These themes may be active on other sites in the network. Are you sure you want to proceed?' ),  
  688. 'deleting' => __( 'Deleting...' ),  
  689. /** translators: %s: Error string for a failed deletion */ 
  690. 'deleteFailed' => __( 'Deletion failed: %s' ),  
  691. 'deleted' => __( 'Deleted!' ),  
  692. 'livePreview' => __( 'Live Preview' ),  
  693. 'activatePlugin' => is_network_admin() ? __( 'Network Activate' ) : __( 'Activate' ),  
  694. 'activateTheme' => is_network_admin() ? __( 'Network Enable' ) : __( 'Activate' ),  
  695. /** translators: %s: Plugin name */ 
  696. 'activatePluginLabel' => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ),  
  697. /** translators: %s: Theme name */ 
  698. 'activateThemeLabel' => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ),  
  699. 'activateImporter' => __( 'Run Importer' ),  
  700. /** translators: %s: Importer name */ 
  701. 'activateImporterLabel' => __( 'Run %s' ),  
  702. 'unknownError' => __( 'An unknown error occurred' ),  
  703. 'connectionError' => __( 'Connection lost or the server is busy. Please try again later.' ),  
  704. 'nonceError' => __( 'An error has occurred. Please reload the page and try again.' ),  
  705. 'pluginsFound' => __( 'Number of plugins found: %d' ),  
  706. 'noPluginsFound' => __( 'No plugins found. Try a different search.' ),  
  707. ),  
  708. ) ); 
  709.  
  710. $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); 
  711.  
  712. $scripts->add( 'iris', '/wp-admin/js/iris.min.js', array( 'jquery-ui-draggable', 'jquery-ui-slider', 'jquery-touch-punch' ), '1.0.7', 1 ); 
  713. $scripts->add( 'wp-color-picker', "/wp-admin/js/color-picker$suffix.js", array( 'iris' ), false, 1 ); 
  714. did_action( 'init' ) && $scripts->localize( 'wp-color-picker', 'wpColorPickerL10n', array( 
  715. 'clear' => __( 'Clear' ),  
  716. 'defaultString' => __( 'Default' ),  
  717. 'pick' => __( 'Select Color' ),  
  718. 'current' => __( 'Current Color' ),  
  719. ) ); 
  720.  
  721. $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox' ), false, 1 ); 
  722.  
  723. $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" ); 
  724.  
  725. $scripts->add( 'media-grid', "/wp-includes/js/media-grid$suffix.js", array( 'media-editor' ), false, 1 ); 
  726. $scripts->add( 'media', "/wp-admin/js/media$suffix.js", array( 'jquery' ), false, 1 ); 
  727. did_action( 'init' ) && $scripts->localize( 'media', 'attachMediaBoxL10n', array( 
  728. 'error' => __( 'An error has occurred. Please reload the page and try again.' ),  
  729. )); 
  730.  
  731. $scripts->add( 'image-edit', "/wp-admin/js/image-edit$suffix.js", array('jquery', 'json2', 'imgareaselect'), false, 1 ); 
  732. did_action( 'init' ) && $scripts->localize( 'image-edit', 'imageEditL10n', array( 
  733. 'error' => __( 'Could not load the preview image. Please reload the page and try again.' ) 
  734. )); 
  735.  
  736. $scripts->add( 'set-post-thumbnail', "/wp-admin/js/set-post-thumbnail$suffix.js", array( 'jquery' ), false, 1 ); 
  737. did_action( 'init' ) && $scripts->localize( 'set-post-thumbnail', 'setPostThumbnailL10n', array( 
  738. 'setThumbnail' => __( 'Use as featured image' ),  
  739. 'saving' => __( 'Saving...' ), // no ellipsis 
  740. 'error' => __( 'Could not set that as the thumbnail image. Try a different attachment.' ),  
  741. 'done' => __( 'Done' ) 
  742. ) ); 
  743.  
  744. // Navigation Menus 
  745. $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' ) ); 
  746. did_action( 'init' ) && $scripts->localize( 'nav-menu', 'navMenuL10n', array( 
  747. 'noResultsFound' => __( 'No results found.' ),  
  748. 'warnDeleteMenu' => __( "You are about to permanently delete this menu. \n 'Cancel' to stop, 'OK' to delete." ),  
  749. 'saveAlert' => __( 'The changes you made will be lost if you navigate away from this page.' ),  
  750. 'untitled' => _x( '(no label)', 'missing menu item navigation label' ) 
  751. ) ); 
  752.  
  753. $scripts->add( 'custom-header', "/wp-admin/js/custom-header.js", array( 'jquery-masonry' ), false, 1 ); 
  754. $scripts->add( 'custom-background', "/wp-admin/js/custom-background$suffix.js", array( 'wp-color-picker', 'media-views' ), false, 1 ); 
  755. $scripts->add( 'media-gallery', "/wp-admin/js/media-gallery$suffix.js", array('jquery'), false, 1 ); 
  756.  
  757. $scripts->add( 'svg-painter', '/wp-admin/js/svg-painter.js', array( 'jquery' ), false, 1 ); 
  758.  
  759. /** 
  760. * Assign default styles to $styles object. 
  761. * 
  762. * Nothing is returned, because the $styles parameter is passed by reference. 
  763. * Meaning that whatever object is passed will be updated without having to 
  764. * reassign the variable that was passed back to the same value. This saves 
  765. * memory. 
  766. * 
  767. * Adding default styles is not the only task, it also assigns the base_url 
  768. * property, the default version, and text direction for the object. 
  769. * 
  770. * @since 2.6.0 
  771. * 
  772. * @param WP_Styles $styles 
  773. */ 
  774. function wp_default_styles( &$styles ) { 
  775. include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version 
  776.  
  777. if ( ! defined( 'SCRIPT_DEBUG' ) ) 
  778. define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) ); 
  779.  
  780. if ( ! $guessurl = site_url() ) 
  781. $guessurl = wp_guess_url(); 
  782.  
  783. $styles->base_url = $guessurl; 
  784. $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; 
  785. $styles->default_version = get_bloginfo( 'version' ); 
  786. $styles->text_direction = function_exists( 'is_rtl' ) && is_rtl() ? 'rtl' : 'ltr'; 
  787. $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/'); 
  788.  
  789. // Open Sans is no longer used by core, but may be relied upon by themes and plugins. 
  790. $open_sans_font_url = ''; 
  791.  
  792. /** translators: If there are characters in your language that are not supported 
  793. * by Open Sans, translate this to 'off'. Do not translate into your own language. 
  794. */ 
  795. if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) { 
  796. $subsets = 'latin, latin-ext'; 
  797.  
  798. /** translators: To add an additional Open Sans character subset specific to your language,  
  799. * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. 
  800. */ 
  801. $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' ); 
  802.  
  803. if ( 'cyrillic' == $subset ) { 
  804. $subsets .= ', cyrillic, cyrillic-ext'; 
  805. } elseif ( 'greek' == $subset ) { 
  806. $subsets .= ', greek, greek-ext'; 
  807. } elseif ( 'vietnamese' == $subset ) { 
  808. $subsets .= ', vietnamese'; 
  809.  
  810. // Hotlink Open Sans, for now 
  811. $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic, 400italic, 600italic, 300, 400, 600&subset=$subsets"; 
  812.  
  813. // Register a stylesheet for the selected admin color scheme. 
  814. $styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) ); 
  815.  
  816. $suffix = SCRIPT_DEBUG ? '' : '.min'; 
  817.  
  818. // Admin CSS 
  819. $styles->add( 'common', "/wp-admin/css/common$suffix.css" ); 
  820. $styles->add( 'forms', "/wp-admin/css/forms$suffix.css" ); 
  821. $styles->add( 'admin-menu', "/wp-admin/css/admin-menu$suffix.css" ); 
  822. $styles->add( 'dashboard', "/wp-admin/css/dashboard$suffix.css" ); 
  823. $styles->add( 'list-tables', "/wp-admin/css/list-tables$suffix.css" ); 
  824. $styles->add( 'edit', "/wp-admin/css/edit$suffix.css" ); 
  825. $styles->add( 'revisions', "/wp-admin/css/revisions$suffix.css" ); 
  826. $styles->add( 'media', "/wp-admin/css/media$suffix.css" ); 
  827. $styles->add( 'themes', "/wp-admin/css/themes$suffix.css" ); 
  828. $styles->add( 'about', "/wp-admin/css/about$suffix.css" ); 
  829. $styles->add( 'nav-menus', "/wp-admin/css/nav-menus$suffix.css" ); 
  830. $styles->add( 'widgets', "/wp-admin/css/widgets$suffix.css" ); 
  831. $styles->add( 'site-icon', "/wp-admin/css/site-icon$suffix.css" ); 
  832. $styles->add( 'l10n', "/wp-admin/css/l10n$suffix.css" ); 
  833.  
  834. $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' ) ); 
  835.  
  836. $styles->add( 'login', "/wp-admin/css/login$suffix.css", array( 'dashicons', 'buttons', 'forms', 'l10n' ) ); 
  837. $styles->add( 'install', "/wp-admin/css/install$suffix.css", array( 'buttons' ) ); 
  838. $styles->add( 'wp-color-picker', "/wp-admin/css/color-picker$suffix.css" ); 
  839. $styles->add( 'customize-controls', "/wp-admin/css/customize-controls$suffix.css", array( 'wp-admin', 'colors', 'ie', 'imgareaselect' ) ); 
  840. $styles->add( 'customize-widgets', "/wp-admin/css/customize-widgets$suffix.css", array( 'wp-admin', 'colors' ) ); 
  841. $styles->add( 'customize-nav-menus', "/wp-admin/css/customize-nav-menus$suffix.css", array( 'wp-admin', 'colors' ) ); 
  842. $styles->add( 'press-this', "/wp-admin/css/press-this$suffix.css", array( 'buttons' ) ); 
  843.  
  844. $styles->add( 'ie', "/wp-admin/css/ie$suffix.css" ); 
  845. $styles->add_data( 'ie', 'conditional', 'lte IE 7' ); 
  846.  
  847. // Common dependencies 
  848. $styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" ); 
  849. $styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" ); 
  850.  
  851. // Includes CSS 
  852. $styles->add( 'admin-bar', "/wp-includes/css/admin-bar$suffix.css", array( 'dashicons' ) ); 
  853. $styles->add( 'wp-auth-check', "/wp-includes/css/wp-auth-check$suffix.css", array( 'dashicons' ) ); 
  854. $styles->add( 'editor-buttons', "/wp-includes/css/editor$suffix.css", array( 'dashicons' ) ); 
  855. $styles->add( 'media-views', "/wp-includes/css/media-views$suffix.css", array( 'buttons', 'dashicons', 'wp-mediaelement' ) ); 
  856. $styles->add( 'wp-pointer', "/wp-includes/css/wp-pointer$suffix.css", array( 'dashicons' ) ); 
  857. $styles->add( 'customize-preview', "/wp-includes/css/customize-preview$suffix.css", array( 'dashicons' ) ); 
  858. $styles->add( 'wp-embed-template-ie', "/wp-includes/css/wp-embed-template-ie$suffix.css" ); 
  859. $styles->add_data( 'wp-embed-template-ie', 'conditional', 'lte IE 8' ); 
  860.  
  861. // External libraries and friends 
  862. $styles->add( 'imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8' ); 
  863. $styles->add( 'wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog$suffix.css", array( 'dashicons' ) ); 
  864. $styles->add( 'mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.22.0' ); 
  865. $styles->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.css", array( 'mediaelement' ) ); 
  866. $styles->add( 'thickbox', '/wp-includes/js/thickbox/thickbox.css', array( 'dashicons' ) ); 
  867.  
  868. // Deprecated CSS 
  869. $styles->add( 'deprecated-media', "/wp-admin/css/deprecated-media$suffix.css" ); 
  870. $styles->add( 'farbtastic', "/wp-admin/css/farbtastic$suffix.css", array(), '1.3u1' ); 
  871. $styles->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12' ); 
  872. $styles->add( 'colors-fresh', false, array( 'wp-admin', 'buttons' ) ); // Old handle. 
  873. $styles->add( 'open-sans', $open_sans_font_url ); // No longer used in core as of 4.6 
  874.  
  875. // RTL CSS 
  876. $rtl_styles = array( 
  877. // wp-admin 
  878. 'common', 'forms', 'admin-menu', 'dashboard', 'list-tables', 'edit', 'revisions', 'media', 'themes', 'about', 'nav-menus',  
  879. 'widgets', 'site-icon', 'l10n', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'customize-preview',  
  880. 'ie', 'login', 'press-this',  
  881. // wp-includes 
  882. 'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer',  
  883. 'wp-jquery-ui-dialog',  
  884. // deprecated 
  885. 'deprecated-media', 'farbtastic',  
  886. ); 
  887.  
  888. foreach ( $rtl_styles as $rtl_style ) { 
  889. $styles->add_data( $rtl_style, 'rtl', 'replace' ); 
  890. if ( $suffix ) { 
  891. $styles->add_data( $rtl_style, 'suffix', $suffix ); 
  892.  
  893. /** 
  894. * Reorder JavaScript scripts array to place prototype before jQuery. 
  895. * 
  896. * @since 2.3.1 
  897. * 
  898. * @param array $js_array JavaScript scripts array 
  899. * @return array Reordered array, if needed. 
  900. */ 
  901. function wp_prototype_before_jquery( $js_array ) { 
  902. if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) 
  903. return $js_array; 
  904.  
  905. if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) 
  906. return $js_array; 
  907.  
  908. if ( $prototype < $jquery ) 
  909. return $js_array; 
  910.  
  911. unset($js_array[$prototype]); 
  912.  
  913. array_splice( $js_array, $jquery, 0, 'prototype' ); 
  914.  
  915. return $js_array; 
  916.  
  917. /** 
  918. * Load localized data on print rather than initialization. 
  919. * 
  920. * These localizations require information that may not be loaded even by init. 
  921. * 
  922. * @since 2.5.0 
  923. */ 
  924. function wp_just_in_time_script_localization() { 
  925.  
  926. wp_localize_script( 'autosave', 'autosaveL10n', array( 
  927. 'autosaveInterval' => AUTOSAVE_INTERVAL,  
  928. 'blog_id' => get_current_blog_id(),  
  929. ) ); 
  930.  
  931. /** 
  932. * Localizes the jQuery UI datepicker. 
  933. * 
  934. * @since 4.6.0 
  935. * 
  936. * @link http://api.jqueryui.com/datepicker/#options 
  937. * 
  938. * @global WP_Locale $wp_locale The WordPress date and time locale object. 
  939. */ 
  940. function wp_localize_jquery_ui_datepicker() { 
  941. global $wp_locale; 
  942.  
  943. if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) { 
  944. return; 
  945.  
  946. // Convert the PHP date format into jQuery UI's format. 
  947. $datepicker_date_format = str_replace( 
  948. array( 
  949. 'd', 'j', 'l', 'z', // Day. 
  950. 'F', 'M', 'n', 'm', // Month. 
  951. 'Y', 'y' // Year. 
  952. ),  
  953. array( 
  954. 'dd', 'd', 'DD', 'o',  
  955. 'MM', 'M', 'm', 'mm',  
  956. 'yy', 'y' 
  957. ),  
  958. get_option( 'date_format' ) 
  959. ); 
  960.  
  961. $datepicker_defaults = wp_json_encode( array( 
  962. 'closeText' => __( 'Close' ),  
  963. 'currentText' => __( 'Today' ),  
  964. 'monthNames' => array_values( $wp_locale->month ),  
  965. 'monthNamesShort' => array_values( $wp_locale->month_abbrev ),  
  966. 'nextText' => __( 'Next' ),  
  967. 'prevText' => __( 'Previous' ),  
  968. 'dayNames' => array_values( $wp_locale->weekday ),  
  969. 'dayNamesShort' => array_values( $wp_locale->weekday_abbrev ),  
  970. 'dayNamesMin' => array_values( $wp_locale->weekday_initial ),  
  971. 'dateFormat' => $datepicker_date_format,  
  972. 'firstDay' => absint( get_option( 'start_of_week' ) ),  
  973. 'isRTL' => $wp_locale->is_rtl(),  
  974. ) ); 
  975.  
  976. wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery) {jQuery.datepicker.setDefaults({$datepicker_defaults});});" ); 
  977.  
  978. /** 
  979. * Administration Screen CSS for changing the styles. 
  980. * 
  981. * If installing the 'wp-admin/' directory will be replaced with './'. 
  982. * 
  983. * The $_wp_admin_css_colors global manages the Administration Screens CSS 
  984. * stylesheet that is loaded. The option that is set is 'admin_color' and is the 
  985. * color and key for the array. The value for the color key is an object with 
  986. * a 'url' parameter that has the URL path to the CSS file. 
  987. * 
  988. * The query from $src parameter will be appended to the URL that is given from 
  989. * the $_wp_admin_css_colors array value URL. 
  990. * 
  991. * @since 2.6.0 
  992. * @global array $_wp_admin_css_colors 
  993. * 
  994. * @param string $src Source URL. 
  995. * @param string $handle Either 'colors' or 'colors-rtl'. 
  996. * @return string|false URL path to CSS stylesheet for Administration Screens. 
  997. */ 
  998. function wp_style_loader_src( $src, $handle ) { 
  999. global $_wp_admin_css_colors; 
  1000.  
  1001. if ( wp_installing() ) 
  1002. return preg_replace( '#^wp-admin/#', './', $src ); 
  1003.  
  1004. if ( 'colors' == $handle ) { 
  1005. $color = get_user_option('admin_color'); 
  1006.  
  1007. if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) 
  1008. $color = 'fresh'; 
  1009.  
  1010. $color = $_wp_admin_css_colors[$color]; 
  1011. $url = $color->url; 
  1012.  
  1013. if ( ! $url ) { 
  1014. return false; 
  1015.  
  1016. $parsed = parse_url( $src ); 
  1017. if ( isset($parsed['query']) && $parsed['query'] ) { 
  1018. wp_parse_str( $parsed['query'], $qv ); 
  1019. $url = add_query_arg( $qv, $url ); 
  1020.  
  1021. return $url; 
  1022.  
  1023. return $src; 
  1024.  
  1025. /** 
  1026. * Prints the script queue in the HTML head on admin pages. 
  1027. * 
  1028. * Postpones the scripts that were queued for the footer. 
  1029. * print_footer_scripts() is called in the footer to print these scripts. 
  1030. * 
  1031. * @since 2.8.0 
  1032. * 
  1033. * @see wp_print_scripts() 
  1034. * 
  1035. * @global bool $concatenate_scripts 
  1036. * 
  1037. * @return array 
  1038. */ 
  1039. function print_head_scripts() { 
  1040. global $concatenate_scripts; 
  1041.  
  1042. if ( ! did_action('wp_print_scripts') ) { 
  1043. /** This action is documented in wp-includes/functions.wp-scripts.php */ 
  1044. do_action( 'wp_print_scripts' ); 
  1045.  
  1046. $wp_scripts = wp_scripts(); 
  1047.  
  1048. script_concat_settings(); 
  1049. $wp_scripts->do_concat = $concatenate_scripts; 
  1050. $wp_scripts->do_head_items(); 
  1051.  
  1052. /** 
  1053. * Filters whether to print the head scripts. 
  1054. * 
  1055. * @since 2.8.0 
  1056. * 
  1057. * @param bool $print Whether to print the head scripts. Default true. 
  1058. */ 
  1059. if ( apply_filters( 'print_head_scripts', true ) ) { 
  1060. _print_scripts(); 
  1061.  
  1062. $wp_scripts->reset(); 
  1063. return $wp_scripts->done; 
  1064.  
  1065. /** 
  1066. * Prints the scripts that were queued for the footer or too late for the HTML head. 
  1067. * 
  1068. * @since 2.8.0 
  1069. * 
  1070. * @global WP_Scripts $wp_scripts 
  1071. * @global bool $concatenate_scripts 
  1072. * 
  1073. * @return array 
  1074. */ 
  1075. function print_footer_scripts() { 
  1076. global $wp_scripts, $concatenate_scripts; 
  1077.  
  1078. if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { 
  1079. return array(); // No need to run if not instantiated. 
  1080. script_concat_settings(); 
  1081. $wp_scripts->do_concat = $concatenate_scripts; 
  1082. $wp_scripts->do_footer_items(); 
  1083.  
  1084. /** 
  1085. * Filters whether to print the footer scripts. 
  1086. * 
  1087. * @since 2.8.0 
  1088. * 
  1089. * @param bool $print Whether to print the footer scripts. Default true. 
  1090. */ 
  1091. if ( apply_filters( 'print_footer_scripts', true ) ) { 
  1092. _print_scripts(); 
  1093.  
  1094. $wp_scripts->reset(); 
  1095. return $wp_scripts->done; 
  1096.  
  1097. /** 
  1098. * Print scripts (internal use only) 
  1099. * 
  1100. * @ignore 
  1101. * 
  1102. * @global WP_Scripts $wp_scripts 
  1103. * @global bool $compress_scripts 
  1104. */ 
  1105. function _print_scripts() { 
  1106. global $wp_scripts, $compress_scripts; 
  1107.  
  1108. $zip = $compress_scripts ? 1 : 0; 
  1109. if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) 
  1110. $zip = 'gzip'; 
  1111.  
  1112. if ( $concat = trim( $wp_scripts->concat, ', ' ) ) { 
  1113.  
  1114. if ( !empty($wp_scripts->print_code) ) { 
  1115. echo "\n<script type='text/javascript'>\n"; 
  1116. echo "/* <![CDATA[ */\n"; // not needed in HTML 5 
  1117. echo $wp_scripts->print_code; 
  1118. echo "/* ]]> */\n"; 
  1119. echo "</script>\n"; 
  1120.  
  1121. $concat = str_split( $concat, 128 ); 
  1122. $concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat ); 
  1123.  
  1124. $src = $wp_scripts->base_url . "/wp-admin/load-scripts.php?c={$zip}&" . $concat . '&ver=' . $wp_scripts->default_version; 
  1125. echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n"; 
  1126.  
  1127. if ( !empty($wp_scripts->print_html) ) 
  1128. echo $wp_scripts->print_html; 
  1129.  
  1130. /** 
  1131. * Prints the script queue in the HTML head on the front end. 
  1132. * 
  1133. * Postpones the scripts that were queued for the footer. 
  1134. * wp_print_footer_scripts() is called in the footer to print these scripts. 
  1135. * 
  1136. * @since 2.8.0 
  1137. * 
  1138. * @global WP_Scripts $wp_scripts 
  1139. * 
  1140. * @return array 
  1141. */ 
  1142. function wp_print_head_scripts() { 
  1143. if ( ! did_action('wp_print_scripts') ) { 
  1144. /** This action is documented in wp-includes/functions.wp-scripts.php */ 
  1145. do_action( 'wp_print_scripts' ); 
  1146.  
  1147. global $wp_scripts; 
  1148.  
  1149. if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { 
  1150. return array(); // no need to run if nothing is queued 
  1151. return print_head_scripts(); 
  1152.  
  1153. /** 
  1154. * Private, for use in *_footer_scripts hooks 
  1155. * 
  1156. * @since 3.3.0 
  1157. */ 
  1158. function _wp_footer_scripts() { 
  1159. print_late_styles(); 
  1160. print_footer_scripts(); 
  1161.  
  1162. /** 
  1163. * Hooks to print the scripts and styles in the footer. 
  1164. * 
  1165. * @since 2.8.0 
  1166. */ 
  1167. function wp_print_footer_scripts() { 
  1168. /** 
  1169. * Fires when footer scripts are printed. 
  1170. * 
  1171. * @since 2.8.0 
  1172. */ 
  1173. do_action( 'wp_print_footer_scripts' ); 
  1174.  
  1175. /** 
  1176. * Wrapper for do_action('wp_enqueue_scripts') 
  1177. * 
  1178. * Allows plugins to queue scripts for the front end using wp_enqueue_script(). 
  1179. * Runs first in wp_head() where all is_home(), is_page(), etc. functions are available. 
  1180. * 
  1181. * @since 2.8.0 
  1182. */ 
  1183. function wp_enqueue_scripts() { 
  1184. /** 
  1185. * Fires when scripts and styles are enqueued. 
  1186. * 
  1187. * @since 2.8.0 
  1188. */ 
  1189. do_action( 'wp_enqueue_scripts' ); 
  1190.  
  1191. /** 
  1192. * Prints the styles queue in the HTML head on admin pages. 
  1193. * 
  1194. * @since 2.8.0 
  1195. * 
  1196. * @global bool $concatenate_scripts 
  1197. * 
  1198. * @return array 
  1199. */ 
  1200. function print_admin_styles() { 
  1201. global $concatenate_scripts; 
  1202.  
  1203. $wp_styles = wp_styles(); 
  1204.  
  1205. script_concat_settings(); 
  1206. $wp_styles->do_concat = $concatenate_scripts; 
  1207. $wp_styles->do_items(false); 
  1208.  
  1209. /** 
  1210. * Filters whether to print the admin styles. 
  1211. * 
  1212. * @since 2.8.0 
  1213. * 
  1214. * @param bool $print Whether to print the admin styles. Default true. 
  1215. */ 
  1216. if ( apply_filters( 'print_admin_styles', true ) ) { 
  1217. _print_styles(); 
  1218.  
  1219. $wp_styles->reset(); 
  1220. return $wp_styles->done; 
  1221.  
  1222. /** 
  1223. * Prints the styles that were queued too late for the HTML head. 
  1224. * 
  1225. * @since 3.3.0 
  1226. * 
  1227. * @global WP_Styles $wp_styles 
  1228. * @global bool $concatenate_scripts 
  1229. * 
  1230. * @return array|void 
  1231. */ 
  1232. function print_late_styles() { 
  1233. global $wp_styles, $concatenate_scripts; 
  1234.  
  1235. if ( ! ( $wp_styles instanceof WP_Styles ) ) { 
  1236. return; 
  1237.  
  1238. script_concat_settings(); 
  1239. $wp_styles->do_concat = $concatenate_scripts; 
  1240. $wp_styles->do_footer_items(); 
  1241.  
  1242. /** 
  1243. * Filters whether to print the styles queued too late for the HTML head. 
  1244. * 
  1245. * @since 3.3.0 
  1246. * 
  1247. * @param bool $print Whether to print the 'late' styles. Default true. 
  1248. */ 
  1249. if ( apply_filters( 'print_late_styles', true ) ) { 
  1250. _print_styles(); 
  1251.  
  1252. $wp_styles->reset(); 
  1253. return $wp_styles->done; 
  1254.  
  1255. /** 
  1256. * Print styles (internal use only) 
  1257. * 
  1258. * @ignore 
  1259. * @since 3.3.0 
  1260. * 
  1261. * @global bool $compress_css 
  1262. */ 
  1263. function _print_styles() { 
  1264. global $compress_css; 
  1265.  
  1266. $wp_styles = wp_styles(); 
  1267.  
  1268. $zip = $compress_css ? 1 : 0; 
  1269. if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) 
  1270. $zip = 'gzip'; 
  1271.  
  1272. if ( $concat = trim( $wp_styles->concat, ', ' ) ) { 
  1273. $dir = $wp_styles->text_direction; 
  1274. $ver = $wp_styles->default_version; 
  1275.  
  1276. $concat = str_split( $concat, 128 ); 
  1277. $concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat ); 
  1278.  
  1279. $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&" . $concat . '&ver=' . $ver; 
  1280. echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n"; 
  1281.  
  1282. if ( !empty($wp_styles->print_code) ) { 
  1283. echo "<style type='text/css'>\n"; 
  1284. echo $wp_styles->print_code; 
  1285. echo "\n</style>\n"; 
  1286.  
  1287. if ( !empty($wp_styles->print_html) ) 
  1288. echo $wp_styles->print_html; 
  1289.  
  1290. /** 
  1291. * Determine the concatenation and compression settings for scripts and styles. 
  1292. * 
  1293. * @since 2.8.0 
  1294. * 
  1295. * @global bool $concatenate_scripts 
  1296. * @global bool $compress_scripts 
  1297. * @global bool $compress_css 
  1298. */ 
  1299. function script_concat_settings() { 
  1300. global $concatenate_scripts, $compress_scripts, $compress_css; 
  1301.  
  1302. $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ); 
  1303.  
  1304. if ( ! isset($concatenate_scripts) ) { 
  1305. $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; 
  1306. if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ) 
  1307. $concatenate_scripts = false; 
  1308.  
  1309. if ( ! isset($compress_scripts) ) { 
  1310. $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; 
  1311. if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) 
  1312. $compress_scripts = false; 
  1313.  
  1314. if ( ! isset($compress_css) ) { 
  1315. $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true; 
  1316. if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) 
  1317. $compress_css = false; 
.