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