@@ -139,8 +139,9 @@ discard block |
||
139 | 139 | function wp_print_media_templates() { |
140 | 140 | global $is_IE; |
141 | 141 | $class = 'media-modal wp-core-ui'; |
142 | - if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false ) |
|
143 | - $class .= ' ie7'; |
|
142 | + if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false ) { |
|
143 | + $class .= ' ie7'; |
|
144 | + } |
|
144 | 145 | ?> |
145 | 146 | <!--[if lte IE 8]> |
146 | 147 | <style> |
@@ -198,9 +199,12 @@ discard block |
||
198 | 199 | /** This action is documented in wp-admin/includes/media.php */ |
199 | 200 | do_action( 'upload_ui_over_quota' ); ?> |
200 | 201 | |
201 | - <?php else : ?> |
|
202 | + <?php else { |
|
203 | + : ?> |
|
202 | 204 | <div class="upload-ui"> |
203 | - <h2 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h2> |
|
205 | + <h2 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); |
|
206 | +} |
|
207 | +?></h2> |
|
204 | 208 | <p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p> |
205 | 209 | <button type="button" class="browser button button-hero"><?php _e( 'Select Files' ); ?></button> |
206 | 210 | </div> |
@@ -432,8 +436,11 @@ discard block |
||
432 | 436 | <# } else { #> |
433 | 437 | <button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button> |
434 | 438 | <# } #> |
435 | - <?php else: ?> |
|
436 | - <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button> |
|
439 | + <?php else { |
|
440 | + : ?> |
|
441 | + <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); |
|
442 | +} |
|
443 | +?></button> |
|
437 | 444 | <?php endif; ?> |
438 | 445 | <# } #> |
439 | 446 | </div> |
@@ -533,8 +540,11 @@ discard block |
||
533 | 540 | <# } else { #> |
534 | 541 | <button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button> |
535 | 542 | <# } #> |
536 | - <?php else: ?> |
|
537 | - <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button> |
|
543 | + <?php else { |
|
544 | + : ?> |
|
545 | + <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); |
|
546 | +} |
|
547 | +?></button> |
|
538 | 548 | <?php endif; ?> |
539 | 549 | <# } #> |
540 | 550 |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | width="{{ _.isUndefined( data.model.width ) ? 400 : data.model.width }}" |
23 | 23 | preload="{{ _.isUndefined( data.model.preload ) ? 'none' : data.model.preload }}" |
24 | 24 | <# |
25 | - <?php foreach ( array( 'autoplay', 'loop' ) as $attr ): |
|
25 | + <?php foreach (array('autoplay', 'loop') as $attr): |
|
26 | 26 | ?>if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) { |
27 | 27 | #> <?php echo $attr ?><# |
28 | 28 | } |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | <source src="{{ data.model.src }}" type="{{ wp.media.view.settings.embedMimes[ data.model.src.split('.').pop() ] }}" /> |
33 | 33 | <# } #> |
34 | 34 | |
35 | - <?php foreach ( $audio_types as $type ): |
|
35 | + <?php foreach ($audio_types as $type): |
|
36 | 36 | ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { #> |
37 | 37 | <source src="{{ data.model.<?php echo $type ?> }}" type="{{ wp.media.view.settings.embedMimes[ '<?php echo $type ?>' ] }}" /> |
38 | 38 | <# } #> |
@@ -90,9 +90,9 @@ discard block |
||
90 | 90 | <# if ( w ) { #>width="{{ w }}"<# } #> |
91 | 91 | <# if ( h ) { #>height="{{ h }}"<# } #> |
92 | 92 | <?php |
93 | - $props = array( 'poster' => '', 'preload' => 'metadata' ); |
|
94 | - foreach ( $props as $key => $value ): |
|
95 | - if ( empty( $value ) ) { |
|
93 | + $props = array('poster' => '', 'preload' => 'metadata'); |
|
94 | + foreach ($props as $key => $value): |
|
95 | + if (empty($value)) { |
|
96 | 96 | ?><# |
97 | 97 | if ( ! _.isUndefined( data.model.<?php echo $key ?> ) && data.model.<?php echo $key ?> ) { |
98 | 98 | #> <?php echo $key ?>="{{ data.model.<?php echo $key ?> }}"<# |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | } |
103 | 103 | endforeach; |
104 | 104 | ?><# |
105 | - <?php foreach ( array( 'autoplay', 'loop' ) as $attr ): |
|
105 | + <?php foreach (array('autoplay', 'loop') as $attr): |
|
106 | 106 | ?> if ( ! _.isUndefined( data.model.<?php echo $attr ?> ) && data.model.<?php echo $attr ?> ) { |
107 | 107 | #> <?php echo $attr ?><# |
108 | 108 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | <# } |
119 | 119 | } #> |
120 | 120 | |
121 | - <?php foreach ( $video_types as $type ): |
|
121 | + <?php foreach ($video_types as $type): |
|
122 | 122 | ?><# if ( data.model.<?php echo $type ?> ) { #> |
123 | 123 | <source src="{{ data.model.<?php echo $type ?> }}" type="{{ settings.embedMimes[ '<?php echo $type ?>' ] }}" /> |
124 | 124 | <# } #> |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | function wp_print_media_templates() { |
140 | 140 | global $is_IE; |
141 | 141 | $class = 'media-modal wp-core-ui'; |
142 | - if ( $is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false ) |
|
142 | + if ($is_IE && strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE 7') !== false) |
|
143 | 143 | $class .= ' ie7'; |
144 | 144 | ?> |
145 | 145 | <!--[if lte IE 8]> |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | <script type="text/html" id="tmpl-media-modal"> |
165 | 165 | <div class="<?php echo $class; ?>"> |
166 | - <button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e( 'Close media panel' ); ?></span></span></button> |
|
166 | + <button type="button" class="media-modal-close"><span class="media-modal-icon"><span class="screen-reader-text"><?php _e('Close media panel'); ?></span></span></button> |
|
167 | 167 | <div class="media-modal-content"></div> |
168 | 168 | </div> |
169 | 169 | <div class="media-modal-backdrop"></div> |
@@ -171,38 +171,38 @@ discard block |
||
171 | 171 | |
172 | 172 | <script type="text/html" id="tmpl-uploader-window"> |
173 | 173 | <div class="uploader-window-content"> |
174 | - <h1><?php _e( 'Drop files to upload' ); ?></h1> |
|
174 | + <h1><?php _e('Drop files to upload'); ?></h1> |
|
175 | 175 | </div> |
176 | 176 | </script> |
177 | 177 | |
178 | 178 | <script type="text/html" id="tmpl-uploader-editor"> |
179 | 179 | <div class="uploader-editor-content"> |
180 | - <div class="uploader-editor-title"><?php _e( 'Drop files to upload' ); ?></div> |
|
180 | + <div class="uploader-editor-title"><?php _e('Drop files to upload'); ?></div> |
|
181 | 181 | </div> |
182 | 182 | </script> |
183 | 183 | |
184 | 184 | <script type="text/html" id="tmpl-uploader-inline"> |
185 | 185 | <# var messageClass = data.message ? 'has-upload-message' : 'no-upload-message'; #> |
186 | 186 | <# if ( data.canClose ) { #> |
187 | - <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e( 'Close uploader' ); ?></span></button> |
|
187 | + <button class="close dashicons dashicons-no"><span class="screen-reader-text"><?php _e('Close uploader'); ?></span></button> |
|
188 | 188 | <# } #> |
189 | 189 | <div class="uploader-inline-content {{ messageClass }}"> |
190 | 190 | <# if ( data.message ) { #> |
191 | 191 | <h2 class="upload-message">{{ data.message }}</h2> |
192 | 192 | <# } #> |
193 | - <?php if ( ! _device_can_upload() ) : ?> |
|
194 | - <h2 class="upload-instructions"><?php printf( __( 'The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.' ), 'https://apps.wordpress.org/' ); ?></h2> |
|
195 | - <?php elseif ( is_multisite() && ! is_upload_space_available() ) : ?> |
|
196 | - <h2 class="upload-instructions"><?php _e( 'Upload Limit Exceeded' ); ?></h2> |
|
193 | + <?php if ( ! _device_can_upload()) : ?> |
|
194 | + <h2 class="upload-instructions"><?php printf(__('The web browser on your device cannot be used to upload files. You may be able to use the <a href="%s">native app for your device</a> instead.'), 'https://apps.wordpress.org/'); ?></h2> |
|
195 | + <?php elseif (is_multisite() && ! is_upload_space_available()) : ?> |
|
196 | + <h2 class="upload-instructions"><?php _e('Upload Limit Exceeded'); ?></h2> |
|
197 | 197 | <?php |
198 | 198 | /** This action is documented in wp-admin/includes/media.php */ |
199 | - do_action( 'upload_ui_over_quota' ); ?> |
|
199 | + do_action('upload_ui_over_quota'); ?> |
|
200 | 200 | |
201 | 201 | <?php else : ?> |
202 | 202 | <div class="upload-ui"> |
203 | - <h2 class="upload-instructions drop-instructions"><?php _e( 'Drop files anywhere to upload' ); ?></h2> |
|
204 | - <p class="upload-instructions drop-instructions"><?php _ex( 'or', 'Uploader: Drop files here - or - Select Files' ); ?></p> |
|
205 | - <button type="button" class="browser button button-hero"><?php _e( 'Select Files' ); ?></button> |
|
203 | + <h2 class="upload-instructions drop-instructions"><?php _e('Drop files anywhere to upload'); ?></h2> |
|
204 | + <p class="upload-instructions drop-instructions"><?php _ex('or', 'Uploader: Drop files here - or - Select Files'); ?></p> |
|
205 | + <button type="button" class="browser button button-hero"><?php _e('Select Files'); ?></button> |
|
206 | 206 | </div> |
207 | 207 | |
208 | 208 | <div class="upload-inline-status"></div> |
@@ -210,58 +210,58 @@ discard block |
||
210 | 210 | <div class="post-upload-ui"> |
211 | 211 | <?php |
212 | 212 | /** This action is documented in wp-admin/includes/media.php */ |
213 | - do_action( 'pre-upload-ui' ); |
|
213 | + do_action('pre-upload-ui'); |
|
214 | 214 | /** This action is documented in wp-admin/includes/media.php */ |
215 | - do_action( 'pre-plupload-upload-ui' ); |
|
215 | + do_action('pre-plupload-upload-ui'); |
|
216 | 216 | |
217 | - if ( 10 === remove_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ) ) { |
|
217 | + if (10 === remove_action('post-plupload-upload-ui', 'media_upload_flash_bypass')) { |
|
218 | 218 | /** This action is documented in wp-admin/includes/media.php */ |
219 | - do_action( 'post-plupload-upload-ui' ); |
|
220 | - add_action( 'post-plupload-upload-ui', 'media_upload_flash_bypass' ); |
|
219 | + do_action('post-plupload-upload-ui'); |
|
220 | + add_action('post-plupload-upload-ui', 'media_upload_flash_bypass'); |
|
221 | 221 | } else { |
222 | 222 | /** This action is documented in wp-admin/includes/media.php */ |
223 | - do_action( 'post-plupload-upload-ui' ); |
|
223 | + do_action('post-plupload-upload-ui'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | $max_upload_size = wp_max_upload_size(); |
227 | - if ( ! $max_upload_size ) { |
|
227 | + if ( ! $max_upload_size) { |
|
228 | 228 | $max_upload_size = 0; |
229 | 229 | } |
230 | 230 | ?> |
231 | 231 | |
232 | 232 | <p class="max-upload-size"><?php |
233 | - printf( __( 'Maximum upload file size: %s.' ), esc_html( size_format( $max_upload_size ) ) ); |
|
233 | + printf(__('Maximum upload file size: %s.'), esc_html(size_format($max_upload_size))); |
|
234 | 234 | ?></p> |
235 | 235 | |
236 | 236 | <# if ( data.suggestedWidth && data.suggestedHeight ) { #> |
237 | 237 | <p class="suggested-dimensions"> |
238 | 238 | <?php |
239 | 239 | /* translators: 1: suggested width number, 2: suggested height number. */ |
240 | - printf( __( 'Suggested image dimensions: %1$s by %2$s pixels.' ), '{{data.suggestedWidth}}', '{{data.suggestedHeight}}' ); |
|
240 | + printf(__('Suggested image dimensions: %1$s by %2$s pixels.'), '{{data.suggestedWidth}}', '{{data.suggestedHeight}}'); |
|
241 | 241 | ?> |
242 | 242 | </p> |
243 | 243 | <# } #> |
244 | 244 | |
245 | 245 | <?php |
246 | 246 | /** This action is documented in wp-admin/includes/media.php */ |
247 | - do_action( 'post-upload-ui' ); ?> |
|
247 | + do_action('post-upload-ui'); ?> |
|
248 | 248 | </div> |
249 | 249 | <?php endif; ?> |
250 | 250 | </div> |
251 | 251 | </script> |
252 | 252 | |
253 | 253 | <script type="text/html" id="tmpl-media-library-view-switcher"> |
254 | - <a href="<?php echo esc_url( add_query_arg( 'mode', 'list', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-list"> |
|
255 | - <span class="screen-reader-text"><?php _e( 'List View' ); ?></span> |
|
254 | + <a href="<?php echo esc_url(add_query_arg('mode', 'list', $_SERVER['REQUEST_URI'])) ?>" class="view-list"> |
|
255 | + <span class="screen-reader-text"><?php _e('List View'); ?></span> |
|
256 | 256 | </a> |
257 | - <a href="<?php echo esc_url( add_query_arg( 'mode', 'grid', $_SERVER['REQUEST_URI'] ) ) ?>" class="view-grid current"> |
|
258 | - <span class="screen-reader-text"><?php _e( 'Grid View' ); ?></span> |
|
257 | + <a href="<?php echo esc_url(add_query_arg('mode', 'grid', $_SERVER['REQUEST_URI'])) ?>" class="view-grid current"> |
|
258 | + <span class="screen-reader-text"><?php _e('Grid View'); ?></span> |
|
259 | 259 | </a> |
260 | 260 | </script> |
261 | 261 | |
262 | 262 | <script type="text/html" id="tmpl-uploader-status"> |
263 | - <h2><?php _e( 'Uploading' ); ?></h2> |
|
264 | - <button type="button" class="button-link upload-dismiss-errors"><span class="screen-reader-text"><?php _e( 'Dismiss Errors' ); ?></span></button> |
|
263 | + <h2><?php _e('Uploading'); ?></h2> |
|
264 | + <button type="button" class="button-link upload-dismiss-errors"><span class="screen-reader-text"><?php _e('Dismiss Errors'); ?></span></button> |
|
265 | 265 | |
266 | 266 | <div class="media-progress-bar"><div></div></div> |
267 | 267 | <div class="upload-details"> |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | |
282 | 282 | <script type="text/html" id="tmpl-edit-attachment-frame"> |
283 | 283 | <div class="edit-media-header"> |
284 | - <button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit previous media item' ); ?></span></button> |
|
285 | - <button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e( 'Edit next media item' ); ?></span></button> |
|
284 | + <button class="left dashicons <# if ( ! data.hasPrevious ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e('Edit previous media item'); ?></span></button> |
|
285 | + <button class="right dashicons <# if ( ! data.hasNext ) { #> disabled <# } #>"><span class="screen-reader-text"><?php _e('Edit next media item'); ?></span></button> |
|
286 | 286 | </div> |
287 | 287 | <div class="media-frame-title"></div> |
288 | 288 | <div class="media-frame-content"></div> |
@@ -327,9 +327,9 @@ discard block |
||
327 | 327 | |
328 | 328 | <div class="attachment-actions"> |
329 | 329 | <# if ( 'image' === data.type && ! data.uploading && data.sizes && data.can.save ) { #> |
330 | - <button type="button" class="button edit-attachment"><?php _e( 'Edit Image' ); ?></button> |
|
330 | + <button type="button" class="button edit-attachment"><?php _e('Edit Image'); ?></button> |
|
331 | 331 | <# } else if ( 'pdf' === data.subtype && data.sizes ) { #> |
332 | - <?php _e( 'Document Preview' ); ?> |
|
332 | + <?php _e('Document Preview'); ?> |
|
333 | 333 | <# } #> |
334 | 334 | </div> |
335 | 335 | </div> |
@@ -340,24 +340,24 @@ discard block |
||
340 | 340 | <span class="saved"><?php esc_html_e('Saved.'); ?></span> |
341 | 341 | </span> |
342 | 342 | <div class="details"> |
343 | - <div class="filename"><strong><?php _e( 'File name:' ); ?></strong> {{ data.filename }}</div> |
|
344 | - <div class="filename"><strong><?php _e( 'File type:' ); ?></strong> {{ data.mime }}</div> |
|
345 | - <div class="uploaded"><strong><?php _e( 'Uploaded on:' ); ?></strong> {{ data.dateFormatted }}</div> |
|
343 | + <div class="filename"><strong><?php _e('File name:'); ?></strong> {{ data.filename }}</div> |
|
344 | + <div class="filename"><strong><?php _e('File type:'); ?></strong> {{ data.mime }}</div> |
|
345 | + <div class="uploaded"><strong><?php _e('Uploaded on:'); ?></strong> {{ data.dateFormatted }}</div> |
|
346 | 346 | |
347 | - <div class="file-size"><strong><?php _e( 'File size:' ); ?></strong> {{ data.filesizeHumanReadable }}</div> |
|
347 | + <div class="file-size"><strong><?php _e('File size:'); ?></strong> {{ data.filesizeHumanReadable }}</div> |
|
348 | 348 | <# if ( 'image' === data.type && ! data.uploading ) { #> |
349 | 349 | <# if ( data.width && data.height ) { #> |
350 | - <div class="dimensions"><strong><?php _e( 'Dimensions:' ); ?></strong> {{ data.width }} × {{ data.height }}</div> |
|
350 | + <div class="dimensions"><strong><?php _e('Dimensions:'); ?></strong> {{ data.width }} × {{ data.height }}</div> |
|
351 | 351 | <# } #> |
352 | 352 | <# } #> |
353 | 353 | |
354 | 354 | <# if ( data.fileLength ) { #> |
355 | - <div class="file-length"><strong><?php _e( 'Length:' ); ?></strong> {{ data.fileLength }}</div> |
|
355 | + <div class="file-length"><strong><?php _e('Length:'); ?></strong> {{ data.fileLength }}</div> |
|
356 | 356 | <# } #> |
357 | 357 | |
358 | 358 | <# if ( 'audio' === data.type && data.meta.bitrate ) { #> |
359 | 359 | <div class="bitrate"> |
360 | - <strong><?php _e( 'Bitrate:' ); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s |
|
360 | + <strong><?php _e('Bitrate:'); ?></strong> {{ Math.round( data.meta.bitrate / 1000 ) }}kb/s |
|
361 | 361 | <# if ( data.meta.bitrate_mode ) { #> |
362 | 362 | {{ ' ' + data.meta.bitrate_mode.toUpperCase() }} |
363 | 363 | <# } #> |
@@ -377,30 +377,30 @@ discard block |
||
377 | 377 | <input type="text" value="{{ data.url }}" readonly /> |
378 | 378 | </label> |
379 | 379 | <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #> |
380 | - <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?> |
|
380 | + <?php if (post_type_supports('attachment', 'title')) : ?> |
|
381 | 381 | <label class="setting" data-setting="title"> |
382 | 382 | <span class="name"><?php _e('Title'); ?></span> |
383 | 383 | <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} /> |
384 | 384 | </label> |
385 | 385 | <?php endif; ?> |
386 | 386 | <# if ( 'audio' === data.type ) { #> |
387 | - <?php foreach ( array( |
|
388 | - 'artist' => __( 'Artist' ), |
|
389 | - 'album' => __( 'Album' ), |
|
390 | - ) as $key => $label ) : ?> |
|
391 | - <label class="setting" data-setting="<?php echo esc_attr( $key ) ?>"> |
|
387 | + <?php foreach (array( |
|
388 | + 'artist' => __('Artist'), |
|
389 | + 'album' => __('Album'), |
|
390 | + ) as $key => $label) : ?> |
|
391 | + <label class="setting" data-setting="<?php echo esc_attr($key) ?>"> |
|
392 | 392 | <span class="name"><?php echo $label ?></span> |
393 | 393 | <input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" /> |
394 | 394 | </label> |
395 | 395 | <?php endforeach; ?> |
396 | 396 | <# } #> |
397 | 397 | <label class="setting" data-setting="caption"> |
398 | - <span class="name"><?php _e( 'Caption' ); ?></span> |
|
398 | + <span class="name"><?php _e('Caption'); ?></span> |
|
399 | 399 | <textarea {{ maybeReadOnly }}>{{ data.caption }}</textarea> |
400 | 400 | </label> |
401 | 401 | <# if ( 'image' === data.type ) { #> |
402 | 402 | <label class="setting" data-setting="alt"> |
403 | - <span class="name"><?php _e( 'Alt Text' ); ?></span> |
|
403 | + <span class="name"><?php _e('Alt Text'); ?></span> |
|
404 | 404 | <input type="text" value="{{ data.alt }}" {{ maybeReadOnly }} /> |
405 | 405 | </label> |
406 | 406 | <# } #> |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | <textarea {{ maybeReadOnly }}>{{ data.description }}</textarea> |
410 | 410 | </label> |
411 | 411 | <label class="setting"> |
412 | - <span class="name"><?php _e( 'Uploaded By' ); ?></span> |
|
412 | + <span class="name"><?php _e('Uploaded By'); ?></span> |
|
413 | 413 | <span class="value">{{ data.authorName }}</span> |
414 | 414 | </label> |
415 | 415 | <# if ( data.uploadedToTitle ) { #> |
416 | 416 | <label class="setting"> |
417 | - <span class="name"><?php _e( 'Uploaded To' ); ?></span> |
|
417 | + <span class="name"><?php _e('Uploaded To'); ?></span> |
|
418 | 418 | <# if ( data.uploadedToLink ) { #> |
419 | 419 | <span class="value"><a href="{{ data.uploadedToLink }}">{{ data.uploadedToTitle }}</a></span> |
420 | 420 | <# } else { #> |
@@ -426,19 +426,19 @@ discard block |
||
426 | 426 | </div> |
427 | 427 | |
428 | 428 | <div class="actions"> |
429 | - <a class="view-attachment" href="{{ data.link }}"><?php _e( 'View attachment page' ); ?></a> |
|
429 | + <a class="view-attachment" href="{{ data.link }}"><?php _e('View attachment page'); ?></a> |
|
430 | 430 | <# if ( data.can.save ) { #> | |
431 | - <a href="post.php?post={{ data.id }}&action=edit"><?php _e( 'Edit more details' ); ?></a> |
|
431 | + <a href="post.php?post={{ data.id }}&action=edit"><?php _e('Edit more details'); ?></a> |
|
432 | 432 | <# } #> |
433 | 433 | <# if ( ! data.uploading && data.can.remove ) { #> | |
434 | - <?php if ( MEDIA_TRASH ): ?> |
|
434 | + <?php if (MEDIA_TRASH): ?> |
|
435 | 435 | <# if ( 'trash' === data.status ) { #> |
436 | - <button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button> |
|
436 | + <button type="button" class="button-link untrash-attachment"><?php _e('Untrash'); ?></button> |
|
437 | 437 | <# } else { #> |
438 | - <button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button> |
|
438 | + <button type="button" class="button-link trash-attachment"><?php _ex('Trash', 'verb'); ?></button> |
|
439 | 439 | <# } #> |
440 | 440 | <?php else: ?> |
441 | - <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button> |
|
441 | + <button type="button" class="button-link delete-attachment"><?php _e('Delete Permanently'); ?></button> |
|
442 | 442 | <?php endif; ?> |
443 | 443 | <# } #> |
444 | 444 | </div> |
@@ -471,11 +471,11 @@ discard block |
||
471 | 471 | <# } #> |
472 | 472 | </div> |
473 | 473 | <# if ( data.buttons.close ) { #> |
474 | - <button type="button" class="button-link attachment-close media-modal-icon"><span class="screen-reader-text"><?php _e( 'Remove' ); ?></span></button> |
|
474 | + <button type="button" class="button-link attachment-close media-modal-icon"><span class="screen-reader-text"><?php _e('Remove'); ?></span></button> |
|
475 | 475 | <# } #> |
476 | 476 | </div> |
477 | 477 | <# if ( data.buttons.check ) { #> |
478 | - <button type="button" class="check" tabindex="-1"><span class="media-modal-icon"></span><span class="screen-reader-text"><?php _e( 'Deselect' ); ?></span></button> |
|
478 | + <button type="button" class="check" tabindex="-1"><span class="media-modal-icon"></span><span class="screen-reader-text"><?php _e('Deselect'); ?></span></button> |
|
479 | 479 | <# } #> |
480 | 480 | <# |
481 | 481 | var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; |
@@ -498,7 +498,7 @@ discard block |
||
498 | 498 | |
499 | 499 | <script type="text/html" id="tmpl-attachment-details"> |
500 | 500 | <h2> |
501 | - <?php _e( 'Attachment Details' ); ?> |
|
501 | + <?php _e('Attachment Details'); ?> |
|
502 | 502 | <span class="settings-save-status"> |
503 | 503 | <span class="spinner"></span> |
504 | 504 | <span class="saved"><?php esc_html_e('Saved.'); ?></span> |
@@ -525,23 +525,23 @@ discard block |
||
525 | 525 | <# } #> |
526 | 526 | |
527 | 527 | <# if ( data.can.save && data.sizes ) { #> |
528 | - <a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e( 'Edit Image' ); ?></a> |
|
528 | + <a class="edit-attachment" href="{{ data.editLink }}&image-editor" target="_blank"><?php _e('Edit Image'); ?></a> |
|
529 | 529 | <# } #> |
530 | 530 | <# } #> |
531 | 531 | |
532 | 532 | <# if ( data.fileLength ) { #> |
533 | - <div class="file-length"><?php _e( 'Length:' ); ?> {{ data.fileLength }}</div> |
|
533 | + <div class="file-length"><?php _e('Length:'); ?> {{ data.fileLength }}</div> |
|
534 | 534 | <# } #> |
535 | 535 | |
536 | 536 | <# if ( ! data.uploading && data.can.remove ) { #> |
537 | - <?php if ( MEDIA_TRASH ): ?> |
|
537 | + <?php if (MEDIA_TRASH): ?> |
|
538 | 538 | <# if ( 'trash' === data.status ) { #> |
539 | - <button type="button" class="button-link untrash-attachment"><?php _e( 'Untrash' ); ?></button> |
|
539 | + <button type="button" class="button-link untrash-attachment"><?php _e('Untrash'); ?></button> |
|
540 | 540 | <# } else { #> |
541 | - <button type="button" class="button-link trash-attachment"><?php _ex( 'Trash', 'verb' ); ?></button> |
|
541 | + <button type="button" class="button-link trash-attachment"><?php _ex('Trash', 'verb'); ?></button> |
|
542 | 542 | <# } #> |
543 | 543 | <?php else: ?> |
544 | - <button type="button" class="button-link delete-attachment"><?php _e( 'Delete Permanently' ); ?></button> |
|
544 | + <button type="button" class="button-link delete-attachment"><?php _e('Delete Permanently'); ?></button> |
|
545 | 545 | <?php endif; ?> |
546 | 546 | <# } #> |
547 | 547 | |
@@ -558,18 +558,18 @@ discard block |
||
558 | 558 | <input type="text" value="{{ data.url }}" readonly /> |
559 | 559 | </label> |
560 | 560 | <# var maybeReadOnly = data.can.save || data.allowLocalEdits ? '' : 'readonly'; #> |
561 | - <?php if ( post_type_supports( 'attachment', 'title' ) ) : ?> |
|
561 | + <?php if (post_type_supports('attachment', 'title')) : ?> |
|
562 | 562 | <label class="setting" data-setting="title"> |
563 | 563 | <span class="name"><?php _e('Title'); ?></span> |
564 | 564 | <input type="text" value="{{ data.title }}" {{ maybeReadOnly }} /> |
565 | 565 | </label> |
566 | 566 | <?php endif; ?> |
567 | 567 | <# if ( 'audio' === data.type ) { #> |
568 | - <?php foreach ( array( |
|
569 | - 'artist' => __( 'Artist' ), |
|
570 | - 'album' => __( 'Album' ), |
|
571 | - ) as $key => $label ) : ?> |
|
572 | - <label class="setting" data-setting="<?php echo esc_attr( $key ) ?>"> |
|
568 | + <?php foreach (array( |
|
569 | + 'artist' => __('Artist'), |
|
570 | + 'album' => __('Album'), |
|
571 | + ) as $key => $label) : ?> |
|
572 | + <label class="setting" data-setting="<?php echo esc_attr($key) ?>"> |
|
573 | 573 | <span class="name"><?php echo $label ?></span> |
574 | 574 | <input type="text" value="{{ data.<?php echo $key ?> || data.meta.<?php echo $key ?> || '' }}" /> |
575 | 575 | </label> |
@@ -595,17 +595,17 @@ discard block |
||
595 | 595 | <div class="selection-info"> |
596 | 596 | <span class="count"></span> |
597 | 597 | <# if ( data.editable ) { #> |
598 | - <button type="button" class="button-link edit-selection"><?php _e( 'Edit Selection' ); ?></button> |
|
598 | + <button type="button" class="button-link edit-selection"><?php _e('Edit Selection'); ?></button> |
|
599 | 599 | <# } #> |
600 | 600 | <# if ( data.clearable ) { #> |
601 | - <button type="button" class="button-link clear-selection"><?php _e( 'Clear' ); ?></button> |
|
601 | + <button type="button" class="button-link clear-selection"><?php _e('Clear'); ?></button> |
|
602 | 602 | <# } #> |
603 | 603 | </div> |
604 | 604 | <div class="selection-view"></div> |
605 | 605 | </script> |
606 | 606 | |
607 | 607 | <script type="text/html" id="tmpl-attachment-display-settings"> |
608 | - <h2><?php _e( 'Attachment Display Settings' ); ?></h2> |
|
608 | + <h2><?php _e('Attachment Display Settings'); ?></h2> |
|
609 | 609 | |
610 | 610 | <# if ( 'image' === data.type ) { #> |
611 | 611 | <label class="setting align"> |
@@ -617,16 +617,16 @@ discard block |
||
617 | 617 | <# } #>> |
618 | 618 | |
619 | 619 | <option value="left"> |
620 | - <?php esc_html_e( 'Left' ); ?> |
|
620 | + <?php esc_html_e('Left'); ?> |
|
621 | 621 | </option> |
622 | 622 | <option value="center"> |
623 | - <?php esc_html_e( 'Center' ); ?> |
|
623 | + <?php esc_html_e('Center'); ?> |
|
624 | 624 | </option> |
625 | 625 | <option value="right"> |
626 | - <?php esc_html_e( 'Right' ); ?> |
|
626 | + <?php esc_html_e('Right'); ?> |
|
627 | 627 | </option> |
628 | 628 | <option value="none" selected> |
629 | - <?php esc_html_e( 'None' ); ?> |
|
629 | + <?php esc_html_e('None'); ?> |
|
630 | 630 | </option> |
631 | 631 | </select> |
632 | 632 | </label> |
@@ -648,31 +648,31 @@ discard block |
||
648 | 648 | |
649 | 649 | <# if ( data.model.canEmbed ) { #> |
650 | 650 | <option value="embed" selected> |
651 | - <?php esc_html_e( 'Embed Media Player' ); ?> |
|
651 | + <?php esc_html_e('Embed Media Player'); ?> |
|
652 | 652 | </option> |
653 | 653 | <option value="file"> |
654 | 654 | <# } else { #> |
655 | 655 | <option value="none" selected> |
656 | - <?php esc_html_e( 'None' ); ?> |
|
656 | + <?php esc_html_e('None'); ?> |
|
657 | 657 | </option> |
658 | 658 | <option value="file"> |
659 | 659 | <# } #> |
660 | 660 | <# if ( data.model.canEmbed ) { #> |
661 | - <?php esc_html_e( 'Link to Media File' ); ?> |
|
661 | + <?php esc_html_e('Link to Media File'); ?> |
|
662 | 662 | <# } else { #> |
663 | - <?php esc_html_e( 'Media File' ); ?> |
|
663 | + <?php esc_html_e('Media File'); ?> |
|
664 | 664 | <# } #> |
665 | 665 | </option> |
666 | 666 | <option value="post"> |
667 | 667 | <# if ( data.model.canEmbed ) { #> |
668 | - <?php esc_html_e( 'Link to Attachment Page' ); ?> |
|
668 | + <?php esc_html_e('Link to Attachment Page'); ?> |
|
669 | 669 | <# } else { #> |
670 | - <?php esc_html_e( 'Attachment Page' ); ?> |
|
670 | + <?php esc_html_e('Attachment Page'); ?> |
|
671 | 671 | <# } #> |
672 | 672 | </option> |
673 | 673 | <# if ( 'image' === data.type ) { #> |
674 | 674 | <option value="custom"> |
675 | - <?php esc_html_e( 'Custom URL' ); ?> |
|
675 | + <?php esc_html_e('Custom URL'); ?> |
|
676 | 676 | </option> |
677 | 677 | <# } #> |
678 | 678 | </select> |
@@ -690,19 +690,19 @@ discard block |
||
690 | 690 | <# } #>> |
691 | 691 | <?php |
692 | 692 | /** This filter is documented in wp-admin/includes/media.php */ |
693 | - $sizes = apply_filters( 'image_size_names_choose', array( |
|
693 | + $sizes = apply_filters('image_size_names_choose', array( |
|
694 | 694 | 'thumbnail' => __('Thumbnail'), |
695 | 695 | 'medium' => __('Medium'), |
696 | 696 | 'large' => __('Large'), |
697 | 697 | 'full' => __('Full Size'), |
698 | - ) ); |
|
698 | + )); |
|
699 | 699 | |
700 | - foreach ( $sizes as $value => $name ) : ?> |
|
700 | + foreach ($sizes as $value => $name) : ?> |
|
701 | 701 | <# |
702 | - var size = data.sizes['<?php echo esc_js( $value ); ?>']; |
|
702 | + var size = data.sizes['<?php echo esc_js($value); ?>']; |
|
703 | 703 | if ( size ) { #> |
704 | - <option value="<?php echo esc_attr( $value ); ?>" <?php selected( $value, 'full' ); ?>> |
|
705 | - <?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }} |
|
704 | + <option value="<?php echo esc_attr($value); ?>" <?php selected($value, 'full'); ?>> |
|
705 | + <?php echo esc_html($name); ?> – {{ size.width }} × {{ size.height }} |
|
706 | 706 | </option> |
707 | 707 | <# } #> |
708 | 708 | <?php endforeach; ?> |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | </script> |
713 | 713 | |
714 | 714 | <script type="text/html" id="tmpl-gallery-settings"> |
715 | - <h2><?php _e( 'Gallery Settings' ); ?></h2> |
|
715 | + <h2><?php _e('Gallery Settings'); ?></h2> |
|
716 | 716 | |
717 | 717 | <label class="setting"> |
718 | 718 | <span><?php _e('Link To'); ?></span> |
@@ -725,13 +725,13 @@ discard block |
||
725 | 725 | <option value="post" <# if ( ! wp.media.galleryDefaults.link || 'post' == wp.media.galleryDefaults.link ) { |
726 | 726 | #>selected="selected"<# } |
727 | 727 | #>> |
728 | - <?php esc_html_e( 'Attachment Page' ); ?> |
|
728 | + <?php esc_html_e('Attachment Page'); ?> |
|
729 | 729 | </option> |
730 | 730 | <option value="file" <# if ( 'file' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>> |
731 | - <?php esc_html_e( 'Media File' ); ?> |
|
731 | + <?php esc_html_e('Media File'); ?> |
|
732 | 732 | </option> |
733 | 733 | <option value="none" <# if ( 'none' == wp.media.galleryDefaults.link ) { #>selected="selected"<# } #>> |
734 | - <?php esc_html_e( 'None' ); ?> |
|
734 | + <?php esc_html_e('None'); ?> |
|
735 | 735 | </option> |
736 | 736 | </select> |
737 | 737 | </label> |
@@ -740,23 +740,23 @@ discard block |
||
740 | 740 | <span><?php _e('Columns'); ?></span> |
741 | 741 | <select class="columns" name="columns" |
742 | 742 | data-setting="columns"> |
743 | - <?php for ( $i = 1; $i <= 9; $i++ ) : ?> |
|
744 | - <option value="<?php echo esc_attr( $i ); ?>" <# |
|
743 | + <?php for ($i = 1; $i <= 9; $i++) : ?> |
|
744 | + <option value="<?php echo esc_attr($i); ?>" <# |
|
745 | 745 | if ( <?php echo $i ?> == wp.media.galleryDefaults.columns ) { #>selected="selected"<# } |
746 | 746 | #>> |
747 | - <?php echo esc_html( $i ); ?> |
|
747 | + <?php echo esc_html($i); ?> |
|
748 | 748 | </option> |
749 | 749 | <?php endfor; ?> |
750 | 750 | </select> |
751 | 751 | </label> |
752 | 752 | |
753 | 753 | <label class="setting"> |
754 | - <span><?php _e( 'Random Order' ); ?></span> |
|
754 | + <span><?php _e('Random Order'); ?></span> |
|
755 | 755 | <input type="checkbox" data-setting="_orderbyRandom" /> |
756 | 756 | </label> |
757 | 757 | |
758 | 758 | <label class="setting size"> |
759 | - <span><?php _e( 'Size' ); ?></span> |
|
759 | + <span><?php _e('Size'); ?></span> |
|
760 | 760 | <select class="size" name="size" |
761 | 761 | data-setting="size" |
762 | 762 | <# if ( data.userSettings ) { #> |
@@ -765,16 +765,16 @@ discard block |
||
765 | 765 | > |
766 | 766 | <?php |
767 | 767 | /** This filter is documented in wp-admin/includes/media.php */ |
768 | - $size_names = apply_filters( 'image_size_names_choose', array( |
|
769 | - 'thumbnail' => __( 'Thumbnail' ), |
|
770 | - 'medium' => __( 'Medium' ), |
|
771 | - 'large' => __( 'Large' ), |
|
772 | - 'full' => __( 'Full Size' ), |
|
773 | - ) ); |
|
774 | - |
|
775 | - foreach ( $size_names as $size => $label ) : ?> |
|
776 | - <option value="<?php echo esc_attr( $size ); ?>"> |
|
777 | - <?php echo esc_html( $label ); ?> |
|
768 | + $size_names = apply_filters('image_size_names_choose', array( |
|
769 | + 'thumbnail' => __('Thumbnail'), |
|
770 | + 'medium' => __('Medium'), |
|
771 | + 'large' => __('Large'), |
|
772 | + 'full' => __('Full Size'), |
|
773 | + )); |
|
774 | + |
|
775 | + foreach ($size_names as $size => $label) : ?> |
|
776 | + <option value="<?php echo esc_attr($size); ?>"> |
|
777 | + <?php echo esc_html($label); ?> |
|
778 | 778 | </option> |
779 | 779 | <?php endforeach; ?> |
780 | 780 | </select> |
@@ -782,7 +782,7 @@ discard block |
||
782 | 782 | </script> |
783 | 783 | |
784 | 784 | <script type="text/html" id="tmpl-playlist-settings"> |
785 | - <h2><?php _e( 'Playlist Settings' ); ?></h2> |
|
785 | + <h2><?php _e('Playlist Settings'); ?></h2> |
|
786 | 786 | |
787 | 787 | <# var emptyModel = _.isEmpty( data.model ), |
788 | 788 | isVideo = 'video' === data.controller.get('library').props.get('type'); #> |
@@ -792,9 +792,9 @@ discard block |
||
792 | 792 | checked="checked" |
793 | 793 | <# } #> /> |
794 | 794 | <# if ( isVideo ) { #> |
795 | - <span><?php _e( 'Show Video List' ); ?></span> |
|
795 | + <span><?php _e('Show Video List'); ?></span> |
|
796 | 796 | <# } else { #> |
797 | - <span><?php _e( 'Show Tracklist' ); ?></span> |
|
797 | + <span><?php _e('Show Tracklist'); ?></span> |
|
798 | 798 | <# } #> |
799 | 799 | </label> |
800 | 800 | |
@@ -803,7 +803,7 @@ discard block |
||
803 | 803 | <input type="checkbox" data-setting="artists" <# if ( emptyModel ) { #> |
804 | 804 | checked="checked" |
805 | 805 | <# } #> /> |
806 | - <span><?php _e( 'Show Artist Name in Tracklist' ); ?></span> |
|
806 | + <span><?php _e('Show Artist Name in Tracklist'); ?></span> |
|
807 | 807 | </label> |
808 | 808 | <# } #> |
809 | 809 | |
@@ -811,13 +811,13 @@ discard block |
||
811 | 811 | <input type="checkbox" data-setting="images" <# if ( emptyModel ) { #> |
812 | 812 | checked="checked" |
813 | 813 | <# } #> /> |
814 | - <span><?php _e( 'Show Images' ); ?></span> |
|
814 | + <span><?php _e('Show Images'); ?></span> |
|
815 | 815 | </label> |
816 | 816 | </script> |
817 | 817 | |
818 | 818 | <script type="text/html" id="tmpl-embed-link-settings"> |
819 | 819 | <label class="setting link-text"> |
820 | - <span><?php _e( 'Link Text' ); ?></span> |
|
820 | + <span><?php _e('Link Text'); ?></span> |
|
821 | 821 | <input type="text" class="alignment" data-setting="linkText" /> |
822 | 822 | </label> |
823 | 823 | <div class="embed-container" style="display: none;"> |
@@ -832,7 +832,7 @@ discard block |
||
832 | 832 | |
833 | 833 | <?php |
834 | 834 | /** This filter is documented in wp-admin/includes/media.php */ |
835 | - if ( ! apply_filters( 'disable_captions', '' ) ) : ?> |
|
835 | + if ( ! apply_filters('disable_captions', '')) : ?> |
|
836 | 836 | <label class="setting caption"> |
837 | 837 | <span><?php _e('Caption'); ?></span> |
838 | 838 | <textarea data-setting="caption" /> |
@@ -848,16 +848,16 @@ discard block |
||
848 | 848 | <span><?php _e('Align'); ?></span> |
849 | 849 | <div class="button-group button-large" data-setting="align"> |
850 | 850 | <button class="button" value="left"> |
851 | - <?php esc_html_e( 'Left' ); ?> |
|
851 | + <?php esc_html_e('Left'); ?> |
|
852 | 852 | </button> |
853 | 853 | <button class="button" value="center"> |
854 | - <?php esc_html_e( 'Center' ); ?> |
|
854 | + <?php esc_html_e('Center'); ?> |
|
855 | 855 | </button> |
856 | 856 | <button class="button" value="right"> |
857 | - <?php esc_html_e( 'Right' ); ?> |
|
857 | + <?php esc_html_e('Right'); ?> |
|
858 | 858 | </button> |
859 | 859 | <button class="button active" value="none"> |
860 | - <?php esc_html_e( 'None' ); ?> |
|
860 | + <?php esc_html_e('None'); ?> |
|
861 | 861 | </button> |
862 | 862 | </div> |
863 | 863 | </div> |
@@ -866,13 +866,13 @@ discard block |
||
866 | 866 | <span><?php _e('Link To'); ?></span> |
867 | 867 | <div class="button-group button-large" data-setting="link"> |
868 | 868 | <button class="button" value="file"> |
869 | - <?php esc_html_e( 'Image URL' ); ?> |
|
869 | + <?php esc_html_e('Image URL'); ?> |
|
870 | 870 | </button> |
871 | 871 | <button class="button" value="custom"> |
872 | - <?php esc_html_e( 'Custom URL' ); ?> |
|
872 | + <?php esc_html_e('Custom URL'); ?> |
|
873 | 873 | </button> |
874 | 874 | <button class="button active" value="none"> |
875 | - <?php esc_html_e( 'None' ); ?> |
|
875 | + <?php esc_html_e('None'); ?> |
|
876 | 876 | </button> |
877 | 877 | </div> |
878 | 878 | <input type="text" class="link-to-custom" data-setting="linkUrl" /> |
@@ -888,8 +888,8 @@ discard block |
||
888 | 888 | |
889 | 889 | <# if ( data.attachment && window.imageEdit ) { #> |
890 | 890 | <div class="actions"> |
891 | - <input type="button" class="edit-attachment button" value="<?php esc_attr_e( 'Edit Original' ); ?>" /> |
|
892 | - <input type="button" class="replace-attachment button" value="<?php esc_attr_e( 'Replace' ); ?>" /> |
|
891 | + <input type="button" class="edit-attachment button" value="<?php esc_attr_e('Edit Original'); ?>" /> |
|
892 | + <input type="button" class="replace-attachment button" value="<?php esc_attr_e('Replace'); ?>" /> |
|
893 | 893 | </div> |
894 | 894 | <# } #> |
895 | 895 | </div> |
@@ -897,7 +897,7 @@ discard block |
||
897 | 897 | <div class="column-settings"> |
898 | 898 | <?php |
899 | 899 | /** This filter is documented in wp-admin/includes/media.php */ |
900 | - if ( ! apply_filters( 'disable_captions', '' ) ) : ?> |
|
900 | + if ( ! apply_filters('disable_captions', '')) : ?> |
|
901 | 901 | <label class="setting caption"> |
902 | 902 | <span><?php _e('Caption'); ?></span> |
903 | 903 | <textarea data-setting="caption">{{ data.model.caption }}</textarea> |
@@ -909,21 +909,21 @@ discard block |
||
909 | 909 | <input type="text" data-setting="alt" value="{{ data.model.alt }}" /> |
910 | 910 | </label> |
911 | 911 | |
912 | - <h2><?php _e( 'Display Settings' ); ?></h2> |
|
912 | + <h2><?php _e('Display Settings'); ?></h2> |
|
913 | 913 | <div class="setting align"> |
914 | 914 | <span><?php _e('Align'); ?></span> |
915 | 915 | <div class="button-group button-large" data-setting="align"> |
916 | 916 | <button class="button" value="left"> |
917 | - <?php esc_html_e( 'Left' ); ?> |
|
917 | + <?php esc_html_e('Left'); ?> |
|
918 | 918 | </button> |
919 | 919 | <button class="button" value="center"> |
920 | - <?php esc_html_e( 'Center' ); ?> |
|
920 | + <?php esc_html_e('Center'); ?> |
|
921 | 921 | </button> |
922 | 922 | <button class="button" value="right"> |
923 | - <?php esc_html_e( 'Right' ); ?> |
|
923 | + <?php esc_html_e('Right'); ?> |
|
924 | 924 | </button> |
925 | 925 | <button class="button active" value="none"> |
926 | - <?php esc_html_e( 'None' ); ?> |
|
926 | + <?php esc_html_e('None'); ?> |
|
927 | 927 | </button> |
928 | 928 | </div> |
929 | 929 | </div> |
@@ -939,30 +939,30 @@ discard block |
||
939 | 939 | <# } #>> |
940 | 940 | <?php |
941 | 941 | /** This filter is documented in wp-admin/includes/media.php */ |
942 | - $sizes = apply_filters( 'image_size_names_choose', array( |
|
942 | + $sizes = apply_filters('image_size_names_choose', array( |
|
943 | 943 | 'thumbnail' => __('Thumbnail'), |
944 | 944 | 'medium' => __('Medium'), |
945 | 945 | 'large' => __('Large'), |
946 | 946 | 'full' => __('Full Size'), |
947 | - ) ); |
|
947 | + )); |
|
948 | 948 | |
949 | - foreach ( $sizes as $value => $name ) : ?> |
|
949 | + foreach ($sizes as $value => $name) : ?> |
|
950 | 950 | <# |
951 | - var size = data.sizes['<?php echo esc_js( $value ); ?>']; |
|
951 | + var size = data.sizes['<?php echo esc_js($value); ?>']; |
|
952 | 952 | if ( size ) { #> |
953 | - <option value="<?php echo esc_attr( $value ); ?>"> |
|
954 | - <?php echo esc_html( $name ); ?> – {{ size.width }} × {{ size.height }} |
|
953 | + <option value="<?php echo esc_attr($value); ?>"> |
|
954 | + <?php echo esc_html($name); ?> – {{ size.width }} × {{ size.height }} |
|
955 | 955 | </option> |
956 | 956 | <# } #> |
957 | 957 | <?php endforeach; ?> |
958 | - <option value="<?php echo esc_attr( 'custom' ); ?>"> |
|
959 | - <?php _e( 'Custom Size' ); ?> |
|
958 | + <option value="<?php echo esc_attr('custom'); ?>"> |
|
959 | + <?php _e('Custom Size'); ?> |
|
960 | 960 | </option> |
961 | 961 | </select> |
962 | 962 | </label> |
963 | 963 | <# } #> |
964 | 964 | <div class="custom-size<# if ( data.model.size !== 'custom' ) { #> hidden<# } #>"> |
965 | - <label><span><?php _e( 'Width' ); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">×</span><label><span><?php _e( 'Height' ); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label> |
|
965 | + <label><span><?php _e('Width'); ?> <small>(px)</small></span> <input data-setting="customWidth" type="number" step="1" value="{{ data.model.customWidth }}" /></label><span class="sep">×</span><label><span><?php _e('Height'); ?> <small>(px)</small></span><input data-setting="customHeight" type="number" step="1" value="{{ data.model.customHeight }}" /></label> |
|
966 | 966 | </div> |
967 | 967 | <# } #> |
968 | 968 | |
@@ -971,27 +971,27 @@ discard block |
||
971 | 971 | <select data-setting="link"> |
972 | 972 | <# if ( data.attachment ) { #> |
973 | 973 | <option value="file"> |
974 | - <?php esc_html_e( 'Media File' ); ?> |
|
974 | + <?php esc_html_e('Media File'); ?> |
|
975 | 975 | </option> |
976 | 976 | <option value="post"> |
977 | - <?php esc_html_e( 'Attachment Page' ); ?> |
|
977 | + <?php esc_html_e('Attachment Page'); ?> |
|
978 | 978 | </option> |
979 | 979 | <# } else { #> |
980 | 980 | <option value="file"> |
981 | - <?php esc_html_e( 'Image URL' ); ?> |
|
981 | + <?php esc_html_e('Image URL'); ?> |
|
982 | 982 | </option> |
983 | 983 | <# } #> |
984 | 984 | <option value="custom"> |
985 | - <?php esc_html_e( 'Custom URL' ); ?> |
|
985 | + <?php esc_html_e('Custom URL'); ?> |
|
986 | 986 | </option> |
987 | 987 | <option value="none"> |
988 | - <?php esc_html_e( 'None' ); ?> |
|
988 | + <?php esc_html_e('None'); ?> |
|
989 | 989 | </option> |
990 | 990 | </select> |
991 | 991 | <input type="text" class="link-to-custom" data-setting="linkUrl" /> |
992 | 992 | </div> |
993 | 993 | <div class="advanced-section"> |
994 | - <h2><button type="button" class="button-link advanced-toggle"><?php _e( 'Advanced Options' ); ?></button></h2> |
|
994 | + <h2><button type="button" class="button-link advanced-toggle"><?php _e('Advanced Options'); ?></button></h2> |
|
995 | 995 | <div class="advanced-settings hidden"> |
996 | 996 | <div class="advanced-image"> |
997 | 997 | <label class="setting title-text"> |
@@ -1005,7 +1005,7 @@ discard block |
||
1005 | 1005 | </div> |
1006 | 1006 | <div class="advanced-link"> |
1007 | 1007 | <div class="setting link-target"> |
1008 | - <label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e( 'Open link in a new tab' ); ?></label> |
|
1008 | + <label><input type="checkbox" data-setting="linkTargetBlank" value="_blank" <# if ( data.model.linkTargetBlank ) { #>checked="checked"<# } #>><?php _e('Open link in a new tab'); ?></label> |
|
1009 | 1009 | </div> |
1010 | 1010 | <label class="setting link-rel"> |
1011 | 1011 | <span><?php _e('Link Rel'); ?></span> |
@@ -1048,28 +1048,28 @@ discard block |
||
1048 | 1048 | <label class="setting"> |
1049 | 1049 | <span>SRC</span> |
1050 | 1050 | <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> |
1051 | - <button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button> |
|
1051 | + <button type="button" class="button-link remove-setting"><?php _e('Remove audio source'); ?></button> |
|
1052 | 1052 | </label> |
1053 | 1053 | <# } #> |
1054 | 1054 | <?php |
1055 | 1055 | |
1056 | - foreach ( $audio_types as $type ): |
|
1056 | + foreach ($audio_types as $type): |
|
1057 | 1057 | ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { |
1058 | 1058 | if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) { |
1059 | 1059 | delete html5types.<?php echo $type ?>; |
1060 | 1060 | } |
1061 | 1061 | #> |
1062 | 1062 | <label class="setting"> |
1063 | - <span><?php echo strtoupper( $type ) ?></span> |
|
1063 | + <span><?php echo strtoupper($type) ?></span> |
|
1064 | 1064 | <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" /> |
1065 | - <button type="button" class="button-link remove-setting"><?php _e( 'Remove audio source' ); ?></button> |
|
1065 | + <button type="button" class="button-link remove-setting"><?php _e('Remove audio source'); ?></button> |
|
1066 | 1066 | </label> |
1067 | 1067 | <# } #> |
1068 | 1068 | <?php endforeach ?> |
1069 | 1069 | |
1070 | 1070 | <# if ( ! _.isEmpty( html5types ) ) { #> |
1071 | 1071 | <div class="setting"> |
1072 | - <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ) ?></span> |
|
1072 | + <span><?php _e('Add alternate sources for maximum HTML5 playback:') ?></span> |
|
1073 | 1073 | <div class="button-large"> |
1074 | 1074 | <# _.each( html5types, function (mime, type) { #> |
1075 | 1075 | <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button> |
@@ -1079,22 +1079,22 @@ discard block |
||
1079 | 1079 | <# } #> |
1080 | 1080 | |
1081 | 1081 | <div class="setting preload"> |
1082 | - <span><?php _e( 'Preload' ); ?></span> |
|
1082 | + <span><?php _e('Preload'); ?></span> |
|
1083 | 1083 | <div class="button-group button-large" data-setting="preload"> |
1084 | - <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button> |
|
1085 | - <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button> |
|
1086 | - <button class="button active" value="none"><?php _e( 'None' ); ?></button> |
|
1084 | + <button class="button" value="auto"><?php _ex('Auto', 'auto preload'); ?></button> |
|
1085 | + <button class="button" value="metadata"><?php _e('Metadata'); ?></button> |
|
1086 | + <button class="button active" value="none"><?php _e('None'); ?></button> |
|
1087 | 1087 | </div> |
1088 | 1088 | </div> |
1089 | 1089 | |
1090 | 1090 | <label class="setting checkbox-setting autoplay"> |
1091 | 1091 | <input type="checkbox" data-setting="autoplay" /> |
1092 | - <span><?php _e( 'Autoplay' ); ?></span> |
|
1092 | + <span><?php _e('Autoplay'); ?></span> |
|
1093 | 1093 | </label> |
1094 | 1094 | |
1095 | 1095 | <label class="setting checkbox-setting"> |
1096 | 1096 | <input type="checkbox" data-setting="loop" /> |
1097 | - <span><?php _e( 'Loop' ); ?></span> |
|
1097 | + <span><?php _e('Loop'); ?></span> |
|
1098 | 1098 | </label> |
1099 | 1099 | </div> |
1100 | 1100 | </div> |
@@ -1131,19 +1131,19 @@ discard block |
||
1131 | 1131 | <label class="setting"> |
1132 | 1132 | <span>SRC</span> |
1133 | 1133 | <input type="text" disabled="disabled" data-setting="src" value="{{ data.model.src }}" /> |
1134 | - <button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button> |
|
1134 | + <button type="button" class="button-link remove-setting"><?php _e('Remove video source'); ?></button> |
|
1135 | 1135 | </label> |
1136 | 1136 | <# } #> |
1137 | - <?php foreach ( $video_types as $type ): |
|
1137 | + <?php foreach ($video_types as $type): |
|
1138 | 1138 | ?><# if ( ! _.isEmpty( data.model.<?php echo $type ?> ) ) { |
1139 | 1139 | if ( ! _.isUndefined( html5types.<?php echo $type ?> ) ) { |
1140 | 1140 | delete html5types.<?php echo $type ?>; |
1141 | 1141 | } |
1142 | 1142 | #> |
1143 | 1143 | <label class="setting"> |
1144 | - <span><?php echo strtoupper( $type ) ?></span> |
|
1144 | + <span><?php echo strtoupper($type) ?></span> |
|
1145 | 1145 | <input type="text" disabled="disabled" data-setting="<?php echo $type ?>" value="{{ data.model.<?php echo $type ?> }}" /> |
1146 | - <button type="button" class="button-link remove-setting"><?php _e( 'Remove video source' ); ?></button> |
|
1146 | + <button type="button" class="button-link remove-setting"><?php _e('Remove video source'); ?></button> |
|
1147 | 1147 | </label> |
1148 | 1148 | <# } #> |
1149 | 1149 | <?php endforeach ?> |
@@ -1151,7 +1151,7 @@ discard block |
||
1151 | 1151 | |
1152 | 1152 | <# if ( ! _.isEmpty( html5types ) ) { #> |
1153 | 1153 | <div class="setting"> |
1154 | - <span><?php _e( 'Add alternate sources for maximum HTML5 playback:' ); ?></span> |
|
1154 | + <span><?php _e('Add alternate sources for maximum HTML5 playback:'); ?></span> |
|
1155 | 1155 | <div class="button-large"> |
1156 | 1156 | <# _.each( html5types, function (mime, type) { #> |
1157 | 1157 | <button class="button add-media-source" data-mime="{{ mime }}">{{ type }}</button> |
@@ -1162,32 +1162,32 @@ discard block |
||
1162 | 1162 | |
1163 | 1163 | <# if ( ! _.isEmpty( data.model.poster ) ) { #> |
1164 | 1164 | <label class="setting"> |
1165 | - <span><?php _e( 'Poster Image' ); ?></span> |
|
1165 | + <span><?php _e('Poster Image'); ?></span> |
|
1166 | 1166 | <input type="text" disabled="disabled" data-setting="poster" value="{{ data.model.poster }}" /> |
1167 | - <button type="button" class="button-link remove-setting"><?php _e( 'Remove poster image' ); ?></button> |
|
1167 | + <button type="button" class="button-link remove-setting"><?php _e('Remove poster image'); ?></button> |
|
1168 | 1168 | </label> |
1169 | 1169 | <# } #> |
1170 | 1170 | <div class="setting preload"> |
1171 | - <span><?php _e( 'Preload' ); ?></span> |
|
1171 | + <span><?php _e('Preload'); ?></span> |
|
1172 | 1172 | <div class="button-group button-large" data-setting="preload"> |
1173 | - <button class="button" value="auto"><?php _ex( 'Auto', 'auto preload' ); ?></button> |
|
1174 | - <button class="button" value="metadata"><?php _e( 'Metadata' ); ?></button> |
|
1175 | - <button class="button active" value="none"><?php _e( 'None' ); ?></button> |
|
1173 | + <button class="button" value="auto"><?php _ex('Auto', 'auto preload'); ?></button> |
|
1174 | + <button class="button" value="metadata"><?php _e('Metadata'); ?></button> |
|
1175 | + <button class="button active" value="none"><?php _e('None'); ?></button> |
|
1176 | 1176 | </div> |
1177 | 1177 | </div> |
1178 | 1178 | |
1179 | 1179 | <label class="setting checkbox-setting autoplay"> |
1180 | 1180 | <input type="checkbox" data-setting="autoplay" /> |
1181 | - <span><?php _e( 'Autoplay' ); ?></span> |
|
1181 | + <span><?php _e('Autoplay'); ?></span> |
|
1182 | 1182 | </label> |
1183 | 1183 | |
1184 | 1184 | <label class="setting checkbox-setting"> |
1185 | 1185 | <input type="checkbox" data-setting="loop" /> |
1186 | - <span><?php _e( 'Loop' ); ?></span> |
|
1186 | + <span><?php _e('Loop'); ?></span> |
|
1187 | 1187 | </label> |
1188 | 1188 | |
1189 | 1189 | <label class="setting" data-setting="content"> |
1190 | - <span><?php _e( 'Tracks (subtitles, captions, descriptions, chapters, or metadata)' ); ?></span> |
|
1190 | + <span><?php _e('Tracks (subtitles, captions, descriptions, chapters, or metadata)'); ?></span> |
|
1191 | 1191 | <# |
1192 | 1192 | var content = ''; |
1193 | 1193 | if ( ! _.isEmpty( data.model.content ) ) { |
@@ -1196,11 +1196,11 @@ discard block |
||
1196 | 1196 | content += track.outerHTML; #> |
1197 | 1197 | <p> |
1198 | 1198 | <input class="content-track" type="text" value="{{ track.outerHTML }}" /> |
1199 | - <button type="button" class="button-link remove-setting remove-track"><?php _ex( 'Remove video track', 'media' ); ?></button> |
|
1199 | + <button type="button" class="button-link remove-setting remove-track"><?php _ex('Remove video track', 'media'); ?></button> |
|
1200 | 1200 | </p> |
1201 | 1201 | <# } ); #> |
1202 | 1202 | <# } else { #> |
1203 | - <em><?php _e( 'There are no associated subtitles.' ); ?></em> |
|
1203 | + <em><?php _e('There are no associated subtitles.'); ?></em> |
|
1204 | 1204 | <# } #> |
1205 | 1205 | <textarea class="hidden content-setting">{{ content }}</textarea> |
1206 | 1206 | </label> |
@@ -1233,31 +1233,31 @@ discard block |
||
1233 | 1233 | </div> |
1234 | 1234 | <# } else { #> |
1235 | 1235 | <div class="wpview-error"> |
1236 | - <div class="dashicons dashicons-format-gallery"></div><p><?php _e( 'No items found.' ); ?></p> |
|
1236 | + <div class="dashicons dashicons-format-gallery"></div><p><?php _e('No items found.'); ?></p> |
|
1237 | 1237 | </div> |
1238 | 1238 | <# } #> |
1239 | 1239 | </script> |
1240 | 1240 | |
1241 | 1241 | <script type="text/html" id="tmpl-crop-content"> |
1242 | - <img class="crop-image" src="{{ data.url }}" alt="<?php esc_attr_e( 'Image crop area preview. Requires mouse interaction.' ); ?>"> |
|
1242 | + <img class="crop-image" src="{{ data.url }}" alt="<?php esc_attr_e('Image crop area preview. Requires mouse interaction.'); ?>"> |
|
1243 | 1243 | <div class="upload-errors"></div> |
1244 | 1244 | </script> |
1245 | 1245 | |
1246 | 1246 | <script type="text/html" id="tmpl-site-icon-preview"> |
1247 | - <h2><?php _e( 'Preview' ); ?></h2> |
|
1248 | - <strong aria-hidden="true"><?php _e( 'As a browser icon' ); ?></strong> |
|
1247 | + <h2><?php _e('Preview'); ?></h2> |
|
1248 | + <strong aria-hidden="true"><?php _e('As a browser icon'); ?></strong> |
|
1249 | 1249 | <div class="favicon-preview"> |
1250 | - <img src="<?php echo esc_url( admin_url( 'images/' . ( is_rtl() ? 'browser-rtl.png' : 'browser.png' ) ) ); ?>" class="browser-preview" width="182" height="" alt="" /> |
|
1250 | + <img src="<?php echo esc_url(admin_url('images/'.(is_rtl() ? 'browser-rtl.png' : 'browser.png'))); ?>" class="browser-preview" width="182" height="" alt="" /> |
|
1251 | 1251 | |
1252 | 1252 | <div class="favicon"> |
1253 | - <img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as a browser icon' ); ?>"/> |
|
1253 | + <img id="preview-favicon" src="{{ data.url }}" alt="<?php esc_attr_e('Preview as a browser icon'); ?>"/> |
|
1254 | 1254 | </div> |
1255 | - <span class="browser-title" aria-hidden="true"><?php bloginfo( 'name' ); ?></span> |
|
1255 | + <span class="browser-title" aria-hidden="true"><?php bloginfo('name'); ?></span> |
|
1256 | 1256 | </div> |
1257 | 1257 | |
1258 | - <strong aria-hidden="true"><?php _e( 'As an app icon' ); ?></strong> |
|
1258 | + <strong aria-hidden="true"><?php _e('As an app icon'); ?></strong> |
|
1259 | 1259 | <div class="app-icon-preview"> |
1260 | - <img id="preview-app-icon" src="{{ data.url }}" alt="<?php esc_attr_e( 'Preview as an app icon' ); ?>"/> |
|
1260 | + <img id="preview-app-icon" src="{{ data.url }}" alt="<?php esc_attr_e('Preview as an app icon'); ?>"/> |
|
1261 | 1261 | </div> |
1262 | 1262 | </script> |
1263 | 1263 | |
@@ -1268,5 +1268,5 @@ discard block |
||
1268 | 1268 | * |
1269 | 1269 | * @since 3.5.0 |
1270 | 1270 | */ |
1271 | - do_action( 'print_media_templates' ); |
|
1271 | + do_action('print_media_templates'); |
|
1272 | 1272 | } |
@@ -106,10 +106,11 @@ |
||
106 | 106 | */ |
107 | 107 | $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name ); |
108 | 108 | |
109 | - if ( !empty( $capabilities[$cap] ) ) |
|
110 | - return $capabilities[$cap]; |
|
111 | - else |
|
112 | - return false; |
|
109 | + if ( !empty( $capabilities[$cap] ) ) { |
|
110 | + return $capabilities[$cap]; |
|
111 | + } else { |
|
112 | + return false; |
|
113 | + } |
|
113 | 114 | } |
114 | 115 | |
115 | 116 | } |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @param string $role Role name. |
44 | 44 | * @param array $capabilities List of capabilities. |
45 | 45 | */ |
46 | - public function __construct( $role, $capabilities ) { |
|
46 | + public function __construct($role, $capabilities) { |
|
47 | 47 | $this->name = $role; |
48 | 48 | $this->capabilities = $capabilities; |
49 | 49 | } |
@@ -57,9 +57,9 @@ discard block |
||
57 | 57 | * @param string $cap Capability name. |
58 | 58 | * @param bool $grant Whether role has capability privilege. |
59 | 59 | */ |
60 | - public function add_cap( $cap, $grant = true ) { |
|
60 | + public function add_cap($cap, $grant = true) { |
|
61 | 61 | $this->capabilities[$cap] = $grant; |
62 | - wp_roles()->add_cap( $this->name, $cap, $grant ); |
|
62 | + wp_roles()->add_cap($this->name, $cap, $grant); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -75,9 +75,9 @@ discard block |
||
75 | 75 | * |
76 | 76 | * @param string $cap Capability name. |
77 | 77 | */ |
78 | - public function remove_cap( $cap ) { |
|
79 | - unset( $this->capabilities[$cap] ); |
|
80 | - wp_roles()->remove_cap( $this->name, $cap ); |
|
78 | + public function remove_cap($cap) { |
|
79 | + unset($this->capabilities[$cap]); |
|
80 | + wp_roles()->remove_cap($this->name, $cap); |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | /** |
@@ -94,7 +94,7 @@ discard block |
||
94 | 94 | * @param string $cap Capability name. |
95 | 95 | * @return bool True if the role has the given capability. False otherwise. |
96 | 96 | */ |
97 | - public function has_cap( $cap ) { |
|
97 | + public function has_cap($cap) { |
|
98 | 98 | /** |
99 | 99 | * Filters which capabilities a role has. |
100 | 100 | * |
@@ -104,9 +104,9 @@ discard block |
||
104 | 104 | * @param string $cap Capability name. |
105 | 105 | * @param string $name Role name. |
106 | 106 | */ |
107 | - $capabilities = apply_filters( 'role_has_cap', $this->capabilities, $cap, $this->name ); |
|
107 | + $capabilities = apply_filters('role_has_cap', $this->capabilities, $cap, $this->name); |
|
108 | 108 | |
109 | - if ( !empty( $capabilities[$cap] ) ) |
|
109 | + if ( ! empty($capabilities[$cap])) |
|
110 | 110 | return $capabilities[$cap]; |
111 | 111 | else |
112 | 112 | return false; |
@@ -68,10 +68,11 @@ discard block |
||
68 | 68 | } |
69 | 69 | |
70 | 70 | if ( isset( $r['headers']['Host'] ) || isset( $r['headers']['host'] ) ) { |
71 | - if ( isset( $r['headers']['Host'] ) ) |
|
72 | - $arrURL['host'] = $r['headers']['Host']; |
|
73 | - else |
|
74 | - $arrURL['host'] = $r['headers']['host']; |
|
71 | + if ( isset( $r['headers']['Host'] ) ) { |
|
72 | + $arrURL['host'] = $r['headers']['Host']; |
|
73 | + } else { |
|
74 | + $arrURL['host'] = $r['headers']['host']; |
|
75 | + } |
|
75 | 76 | unset( $r['headers']['Host'], $r['headers']['host'] ); |
76 | 77 | } |
77 | 78 | |
@@ -80,8 +81,9 @@ discard block |
||
80 | 81 | * to ::1, which fails when the server is not set up for it. For compatibility, always |
81 | 82 | * connect to the IPv4 address. |
82 | 83 | */ |
83 | - if ( 'localhost' == strtolower( $connect_host ) ) |
|
84 | - $connect_host = '127.0.0.1'; |
|
84 | + if ( 'localhost' == strtolower( $connect_host ) ) { |
|
85 | + $connect_host = '127.0.0.1'; |
|
86 | + } |
|
85 | 87 | |
86 | 88 | $connect_host = $secure_transport ? 'ssl://' . $connect_host : 'tcp://' . $connect_host; |
87 | 89 | |
@@ -132,44 +134,52 @@ discard block |
||
132 | 134 | |
133 | 135 | if ( !WP_DEBUG ) { |
134 | 136 | // In the event that the SSL connection fails, silence the many PHP Warnings. |
135 | - if ( $secure_transport ) |
|
136 | - $error_reporting = error_reporting(0); |
|
137 | + if ( $secure_transport ) { |
|
138 | + $error_reporting = error_reporting(0); |
|
139 | + } |
|
137 | 140 | |
138 | - if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) |
|
139 | - $handle = @stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
140 | - else |
|
141 | - $handle = @stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
141 | + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { |
|
142 | + $handle = @stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
143 | + } else { |
|
144 | + $handle = @stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
145 | + } |
|
142 | 146 | |
143 | - if ( $secure_transport ) |
|
144 | - error_reporting( $error_reporting ); |
|
147 | + if ( $secure_transport ) { |
|
148 | + error_reporting( $error_reporting ); |
|
149 | + } |
|
145 | 150 | |
146 | 151 | } else { |
147 | - if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) |
|
148 | - $handle = stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
149 | - else |
|
150 | - $handle = stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
152 | + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { |
|
153 | + $handle = stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
154 | + } else { |
|
155 | + $handle = stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
156 | + } |
|
151 | 157 | } |
152 | 158 | |
153 | 159 | if ( false === $handle ) { |
154 | 160 | // SSL connection failed due to expired/invalid cert, or, OpenSSL configuration is broken. |
155 | - if ( $secure_transport && 0 === $connection_error && '' === $connection_error_str ) |
|
156 | - return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); |
|
161 | + if ( $secure_transport && 0 === $connection_error && '' === $connection_error_str ) { |
|
162 | + return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); |
|
163 | + } |
|
157 | 164 | |
158 | 165 | return new WP_Error('http_request_failed', $connection_error . ': ' . $connection_error_str ); |
159 | 166 | } |
160 | 167 | |
161 | 168 | // Verify that the SSL certificate is valid for this request. |
162 | 169 | if ( $secure_transport && $ssl_verify && ! $proxy->is_enabled() ) { |
163 | - if ( ! self::verify_ssl_certificate( $handle, $arrURL['host'] ) ) |
|
164 | - return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); |
|
170 | + if ( ! self::verify_ssl_certificate( $handle, $arrURL['host'] ) ) { |
|
171 | + return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); |
|
172 | + } |
|
165 | 173 | } |
166 | 174 | |
167 | 175 | stream_set_timeout( $handle, $timeout, $utimeout ); |
168 | 176 | |
169 | - if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) //Some proxies require full URL in this field. |
|
177 | + if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) { |
|
178 | + //Some proxies require full URL in this field. |
|
170 | 179 | $requestPath = $url; |
171 | - else |
|
172 | - $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' ); |
|
180 | + } else { |
|
181 | + $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' ); |
|
182 | + } |
|
173 | 183 | |
174 | 184 | $strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n"; |
175 | 185 | |
@@ -185,23 +195,27 @@ discard block |
||
185 | 195 | $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n"; |
186 | 196 | } |
187 | 197 | |
188 | - if ( isset($r['user-agent']) ) |
|
189 | - $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n"; |
|
198 | + if ( isset($r['user-agent']) ) { |
|
199 | + $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n"; |
|
200 | + } |
|
190 | 201 | |
191 | 202 | if ( is_array($r['headers']) ) { |
192 | - foreach ( (array) $r['headers'] as $header => $headerValue ) |
|
193 | - $strHeaders .= $header . ': ' . $headerValue . "\r\n"; |
|
203 | + foreach ( (array) $r['headers'] as $header => $headerValue ) { |
|
204 | + $strHeaders .= $header . ': ' . $headerValue . "\r\n"; |
|
205 | + } |
|
194 | 206 | } else { |
195 | 207 | $strHeaders .= $r['headers']; |
196 | 208 | } |
197 | 209 | |
198 | - if ( $proxy->use_authentication() ) |
|
199 | - $strHeaders .= $proxy->authentication_header() . "\r\n"; |
|
210 | + if ( $proxy->use_authentication() ) { |
|
211 | + $strHeaders .= $proxy->authentication_header() . "\r\n"; |
|
212 | + } |
|
200 | 213 | |
201 | 214 | $strHeaders .= "\r\n"; |
202 | 215 | |
203 | - if ( ! is_null($r['body']) ) |
|
204 | - $strHeaders .= $r['body']; |
|
216 | + if ( ! is_null($r['body']) ) { |
|
217 | + $strHeaders .= $r['body']; |
|
218 | + } |
|
205 | 219 | |
206 | 220 | fwrite($handle, $strHeaders); |
207 | 221 | |
@@ -215,17 +229,20 @@ discard block |
||
215 | 229 | $bodyStarted = false; |
216 | 230 | $keep_reading = true; |
217 | 231 | $block_size = 4096; |
218 | - if ( isset( $r['limit_response_size'] ) ) |
|
219 | - $block_size = min( $block_size, $r['limit_response_size'] ); |
|
232 | + if ( isset( $r['limit_response_size'] ) ) { |
|
233 | + $block_size = min( $block_size, $r['limit_response_size'] ); |
|
234 | + } |
|
220 | 235 | |
221 | 236 | // If streaming to a file setup the file handle. |
222 | 237 | if ( $r['stream'] ) { |
223 | - if ( ! WP_DEBUG ) |
|
224 | - $stream_handle = @fopen( $r['filename'], 'w+' ); |
|
225 | - else |
|
226 | - $stream_handle = fopen( $r['filename'], 'w+' ); |
|
227 | - if ( ! $stream_handle ) |
|
228 | - return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); |
|
238 | + if ( ! WP_DEBUG ) { |
|
239 | + $stream_handle = @fopen( $r['filename'], 'w+' ); |
|
240 | + } else { |
|
241 | + $stream_handle = fopen( $r['filename'], 'w+' ); |
|
242 | + } |
|
243 | + if ( ! $stream_handle ) { |
|
244 | + return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); |
|
245 | + } |
|
229 | 246 | |
230 | 247 | $bytes_written = 0; |
231 | 248 | while ( ! feof($handle) && $keep_reading ) { |
@@ -294,18 +311,22 @@ discard block |
||
294 | 311 | ); |
295 | 312 | |
296 | 313 | // Handle redirects. |
297 | - if ( false !== ( $redirect_response = WP_Http::handle_redirects( $url, $r, $response ) ) ) |
|
298 | - return $redirect_response; |
|
314 | + if ( false !== ( $redirect_response = WP_Http::handle_redirects( $url, $r, $response ) ) ) { |
|
315 | + return $redirect_response; |
|
316 | + } |
|
299 | 317 | |
300 | 318 | // If the body was chunk encoded, then decode it. |
301 | - if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] ) |
|
302 | - $process['body'] = WP_Http::chunkTransferDecode($process['body']); |
|
319 | + if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] ) { |
|
320 | + $process['body'] = WP_Http::chunkTransferDecode($process['body']); |
|
321 | + } |
|
303 | 322 | |
304 | - if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) ) |
|
305 | - $process['body'] = WP_Http_Encoding::decompress( $process['body'] ); |
|
323 | + if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) ) { |
|
324 | + $process['body'] = WP_Http_Encoding::decompress( $process['body'] ); |
|
325 | + } |
|
306 | 326 | |
307 | - if ( isset( $r['limit_response_size'] ) && strlen( $process['body'] ) > $r['limit_response_size'] ) |
|
308 | - $process['body'] = substr( $process['body'], 0, $r['limit_response_size'] ); |
|
327 | + if ( isset( $r['limit_response_size'] ) && strlen( $process['body'] ) > $r['limit_response_size'] ) { |
|
328 | + $process['body'] = substr( $process['body'], 0, $r['limit_response_size'] ); |
|
329 | + } |
|
309 | 330 | |
310 | 331 | $response['body'] = $process['body']; |
311 | 332 | |
@@ -332,12 +353,14 @@ discard block |
||
332 | 353 | public static function verify_ssl_certificate( $stream, $host ) { |
333 | 354 | $context_options = stream_context_get_options( $stream ); |
334 | 355 | |
335 | - if ( empty( $context_options['ssl']['peer_certificate'] ) ) |
|
336 | - return false; |
|
356 | + if ( empty( $context_options['ssl']['peer_certificate'] ) ) { |
|
357 | + return false; |
|
358 | + } |
|
337 | 359 | |
338 | 360 | $cert = openssl_x509_parse( $context_options['ssl']['peer_certificate'] ); |
339 | - if ( ! $cert ) |
|
340 | - return false; |
|
361 | + if ( ! $cert ) { |
|
362 | + return false; |
|
363 | + } |
|
341 | 364 | |
342 | 365 | /* |
343 | 366 | * If the request is being made to an IP address, we'll validate against IP fields |
@@ -350,8 +373,10 @@ discard block |
||
350 | 373 | $match_against = preg_split( '/,\s*/', $cert['extensions']['subjectAltName'] ); |
351 | 374 | foreach ( $match_against as $match ) { |
352 | 375 | list( $match_type, $match_host ) = explode( ':', $match ); |
353 | - if ( $host_type == strtolower( trim( $match_type ) ) ) // IP: or DNS: |
|
376 | + if ( $host_type == strtolower( trim( $match_type ) ) ) { |
|
377 | + // IP: or DNS: |
|
354 | 378 | $certificate_hostnames[] = strtolower( trim( $match_host ) ); |
379 | + } |
|
355 | 380 | } |
356 | 381 | } elseif ( !empty( $cert['subject']['CN'] ) ) { |
357 | 382 | // Only use the CN when the certificate includes no subjectAltName extension. |
@@ -359,16 +384,19 @@ discard block |
||
359 | 384 | } |
360 | 385 | |
361 | 386 | // Exact hostname/IP matches. |
362 | - if ( in_array( strtolower( $host ), $certificate_hostnames ) ) |
|
363 | - return true; |
|
387 | + if ( in_array( strtolower( $host ), $certificate_hostnames ) ) { |
|
388 | + return true; |
|
389 | + } |
|
364 | 390 | |
365 | 391 | // IP's can't be wildcards, Stop processing. |
366 | - if ( 'ip' == $host_type ) |
|
367 | - return false; |
|
392 | + if ( 'ip' == $host_type ) { |
|
393 | + return false; |
|
394 | + } |
|
368 | 395 | |
369 | 396 | // Test to see if the domain is at least 2 deep for wildcard support. |
370 | - if ( substr_count( $host, '.' ) < 2 ) |
|
371 | - return false; |
|
397 | + if ( substr_count( $host, '.' ) < 2 ) { |
|
398 | + return false; |
|
399 | + } |
|
372 | 400 | |
373 | 401 | // Wildcard subdomains certs (*.example.com) are valid for a.example.com but not a.b.example.com. |
374 | 402 | $wildcard_host = preg_replace( '/^[^.]+\./', '*.', $host ); |
@@ -388,16 +416,19 @@ discard block |
||
388 | 416 | * @return bool False means this class can not be used, true means it can. |
389 | 417 | */ |
390 | 418 | public static function test( $args = array() ) { |
391 | - if ( ! function_exists( 'stream_socket_client' ) ) |
|
392 | - return false; |
|
419 | + if ( ! function_exists( 'stream_socket_client' ) ) { |
|
420 | + return false; |
|
421 | + } |
|
393 | 422 | |
394 | 423 | $is_ssl = isset( $args['ssl'] ) && $args['ssl']; |
395 | 424 | |
396 | 425 | if ( $is_ssl ) { |
397 | - if ( ! extension_loaded( 'openssl' ) ) |
|
398 | - return false; |
|
399 | - if ( ! function_exists( 'openssl_x509_parse' ) ) |
|
400 | - return false; |
|
426 | + if ( ! extension_loaded( 'openssl' ) ) { |
|
427 | + return false; |
|
428 | + } |
|
429 | + if ( ! function_exists( 'openssl_x509_parse' ) ) { |
|
430 | + return false; |
|
431 | + } |
|
401 | 432 | } |
402 | 433 | |
403 | 434 | /** |
@@ -35,26 +35,26 @@ discard block |
||
35 | 35 | 'headers' => array(), 'body' => null, 'cookies' => array() |
36 | 36 | ); |
37 | 37 | |
38 | - $r = wp_parse_args( $args, $defaults ); |
|
38 | + $r = wp_parse_args($args, $defaults); |
|
39 | 39 | |
40 | - if ( isset( $r['headers']['User-Agent'] ) ) { |
|
40 | + if (isset($r['headers']['User-Agent'])) { |
|
41 | 41 | $r['user-agent'] = $r['headers']['User-Agent']; |
42 | - unset( $r['headers']['User-Agent'] ); |
|
43 | - } elseif ( isset( $r['headers']['user-agent'] ) ) { |
|
42 | + unset($r['headers']['User-Agent']); |
|
43 | + } elseif (isset($r['headers']['user-agent'])) { |
|
44 | 44 | $r['user-agent'] = $r['headers']['user-agent']; |
45 | - unset( $r['headers']['user-agent'] ); |
|
45 | + unset($r['headers']['user-agent']); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | // Construct Cookie: header if any cookies are set. |
49 | - WP_Http::buildCookieHeader( $r ); |
|
49 | + WP_Http::buildCookieHeader($r); |
|
50 | 50 | |
51 | 51 | $arrURL = parse_url($url); |
52 | 52 | |
53 | 53 | $connect_host = $arrURL['host']; |
54 | 54 | |
55 | - $secure_transport = ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ); |
|
56 | - if ( ! isset( $arrURL['port'] ) ) { |
|
57 | - if ( $arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https' ) { |
|
55 | + $secure_transport = ($arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https'); |
|
56 | + if ( ! isset($arrURL['port'])) { |
|
57 | + if ($arrURL['scheme'] == 'ssl' || $arrURL['scheme'] == 'https') { |
|
58 | 58 | $arrURL['port'] = 443; |
59 | 59 | $secure_transport = true; |
60 | 60 | } else { |
@@ -63,16 +63,16 @@ discard block |
||
63 | 63 | } |
64 | 64 | |
65 | 65 | // Always pass a Path, defaulting to the root in cases such as http://example.com |
66 | - if ( ! isset( $arrURL['path'] ) ) { |
|
66 | + if ( ! isset($arrURL['path'])) { |
|
67 | 67 | $arrURL['path'] = '/'; |
68 | 68 | } |
69 | 69 | |
70 | - if ( isset( $r['headers']['Host'] ) || isset( $r['headers']['host'] ) ) { |
|
71 | - if ( isset( $r['headers']['Host'] ) ) |
|
70 | + if (isset($r['headers']['Host']) || isset($r['headers']['host'])) { |
|
71 | + if (isset($r['headers']['Host'])) |
|
72 | 72 | $arrURL['host'] = $r['headers']['Host']; |
73 | 73 | else |
74 | 74 | $arrURL['host'] = $r['headers']['host']; |
75 | - unset( $r['headers']['Host'], $r['headers']['host'] ); |
|
75 | + unset($r['headers']['Host'], $r['headers']['host']); |
|
76 | 76 | } |
77 | 77 | |
78 | 78 | /* |
@@ -80,14 +80,14 @@ discard block |
||
80 | 80 | * to ::1, which fails when the server is not set up for it. For compatibility, always |
81 | 81 | * connect to the IPv4 address. |
82 | 82 | */ |
83 | - if ( 'localhost' == strtolower( $connect_host ) ) |
|
83 | + if ('localhost' == strtolower($connect_host)) |
|
84 | 84 | $connect_host = '127.0.0.1'; |
85 | 85 | |
86 | - $connect_host = $secure_transport ? 'ssl://' . $connect_host : 'tcp://' . $connect_host; |
|
86 | + $connect_host = $secure_transport ? 'ssl://'.$connect_host : 'tcp://'.$connect_host; |
|
87 | 87 | |
88 | - $is_local = isset( $r['local'] ) && $r['local']; |
|
89 | - $ssl_verify = isset( $r['sslverify'] ) && $r['sslverify']; |
|
90 | - if ( $is_local ) { |
|
88 | + $is_local = isset($r['local']) && $r['local']; |
|
89 | + $ssl_verify = isset($r['sslverify']) && $r['sslverify']; |
|
90 | + if ($is_local) { |
|
91 | 91 | /** |
92 | 92 | * Filters whether SSL should be verified for local requests. |
93 | 93 | * |
@@ -95,8 +95,8 @@ discard block |
||
95 | 95 | * |
96 | 96 | * @param bool $ssl_verify Whether to verify the SSL connection. Default true. |
97 | 97 | */ |
98 | - $ssl_verify = apply_filters( 'https_local_ssl_verify', $ssl_verify ); |
|
99 | - } elseif ( ! $is_local ) { |
|
98 | + $ssl_verify = apply_filters('https_local_ssl_verify', $ssl_verify); |
|
99 | + } elseif ( ! $is_local) { |
|
100 | 100 | /** |
101 | 101 | * Filters whether SSL should be verified for non-local requests. |
102 | 102 | * |
@@ -104,12 +104,12 @@ discard block |
||
104 | 104 | * |
105 | 105 | * @param bool $ssl_verify Whether to verify the SSL connection. Default true. |
106 | 106 | */ |
107 | - $ssl_verify = apply_filters( 'https_ssl_verify', $ssl_verify ); |
|
107 | + $ssl_verify = apply_filters('https_ssl_verify', $ssl_verify); |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | $proxy = new WP_HTTP_Proxy(); |
111 | 111 | |
112 | - $context = stream_context_create( array( |
|
112 | + $context = stream_context_create(array( |
|
113 | 113 | 'ssl' => array( |
114 | 114 | 'verify_peer' => $ssl_verify, |
115 | 115 | //'CN_match' => $arrURL['host'], // This is handled by self::verify_ssl_certificate() |
@@ -118,11 +118,11 @@ discard block |
||
118 | 118 | 'cafile' => $r['sslcertificates'], |
119 | 119 | 'allow_self_signed' => ! $ssl_verify, |
120 | 120 | ) |
121 | - ) ); |
|
121 | + )); |
|
122 | 122 | |
123 | - $timeout = (int) floor( $r['timeout'] ); |
|
123 | + $timeout = (int) floor($r['timeout']); |
|
124 | 124 | $utimeout = $timeout == $r['timeout'] ? 0 : 1000000 * $r['timeout'] % 1000000; |
125 | - $connect_timeout = max( $timeout, 1 ); |
|
125 | + $connect_timeout = max($timeout, 1); |
|
126 | 126 | |
127 | 127 | // Store error number. |
128 | 128 | $connection_error = null; |
@@ -130,159 +130,159 @@ discard block |
||
130 | 130 | // Store error string. |
131 | 131 | $connection_error_str = null; |
132 | 132 | |
133 | - if ( !WP_DEBUG ) { |
|
133 | + if ( ! WP_DEBUG) { |
|
134 | 134 | // In the event that the SSL connection fails, silence the many PHP Warnings. |
135 | - if ( $secure_transport ) |
|
135 | + if ($secure_transport) |
|
136 | 136 | $error_reporting = error_reporting(0); |
137 | 137 | |
138 | - if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) |
|
139 | - $handle = @stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
138 | + if ($proxy->is_enabled() && $proxy->send_through_proxy($url)) |
|
139 | + $handle = @stream_socket_client('tcp://'.$proxy->host().':'.$proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context); |
|
140 | 140 | else |
141 | - $handle = @stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
141 | + $handle = @stream_socket_client($connect_host.':'.$arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context); |
|
142 | 142 | |
143 | - if ( $secure_transport ) |
|
144 | - error_reporting( $error_reporting ); |
|
143 | + if ($secure_transport) |
|
144 | + error_reporting($error_reporting); |
|
145 | 145 | |
146 | 146 | } else { |
147 | - if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) |
|
148 | - $handle = stream_socket_client( 'tcp://' . $proxy->host() . ':' . $proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
147 | + if ($proxy->is_enabled() && $proxy->send_through_proxy($url)) |
|
148 | + $handle = stream_socket_client('tcp://'.$proxy->host().':'.$proxy->port(), $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context); |
|
149 | 149 | else |
150 | - $handle = stream_socket_client( $connect_host . ':' . $arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context ); |
|
150 | + $handle = stream_socket_client($connect_host.':'.$arrURL['port'], $connection_error, $connection_error_str, $connect_timeout, STREAM_CLIENT_CONNECT, $context); |
|
151 | 151 | } |
152 | 152 | |
153 | - if ( false === $handle ) { |
|
153 | + if (false === $handle) { |
|
154 | 154 | // SSL connection failed due to expired/invalid cert, or, OpenSSL configuration is broken. |
155 | - if ( $secure_transport && 0 === $connection_error && '' === $connection_error_str ) |
|
156 | - return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); |
|
155 | + if ($secure_transport && 0 === $connection_error && '' === $connection_error_str) |
|
156 | + return new WP_Error('http_request_failed', __('The SSL certificate for the host could not be verified.')); |
|
157 | 157 | |
158 | - return new WP_Error('http_request_failed', $connection_error . ': ' . $connection_error_str ); |
|
158 | + return new WP_Error('http_request_failed', $connection_error.': '.$connection_error_str); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | // Verify that the SSL certificate is valid for this request. |
162 | - if ( $secure_transport && $ssl_verify && ! $proxy->is_enabled() ) { |
|
163 | - if ( ! self::verify_ssl_certificate( $handle, $arrURL['host'] ) ) |
|
164 | - return new WP_Error( 'http_request_failed', __( 'The SSL certificate for the host could not be verified.' ) ); |
|
162 | + if ($secure_transport && $ssl_verify && ! $proxy->is_enabled()) { |
|
163 | + if ( ! self::verify_ssl_certificate($handle, $arrURL['host'])) |
|
164 | + return new WP_Error('http_request_failed', __('The SSL certificate for the host could not be verified.')); |
|
165 | 165 | } |
166 | 166 | |
167 | - stream_set_timeout( $handle, $timeout, $utimeout ); |
|
167 | + stream_set_timeout($handle, $timeout, $utimeout); |
|
168 | 168 | |
169 | - if ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) //Some proxies require full URL in this field. |
|
169 | + if ($proxy->is_enabled() && $proxy->send_through_proxy($url)) //Some proxies require full URL in this field. |
|
170 | 170 | $requestPath = $url; |
171 | 171 | else |
172 | - $requestPath = $arrURL['path'] . ( isset($arrURL['query']) ? '?' . $arrURL['query'] : '' ); |
|
172 | + $requestPath = $arrURL['path'].(isset($arrURL['query']) ? '?'.$arrURL['query'] : ''); |
|
173 | 173 | |
174 | - $strHeaders = strtoupper($r['method']) . ' ' . $requestPath . ' HTTP/' . $r['httpversion'] . "\r\n"; |
|
174 | + $strHeaders = strtoupper($r['method']).' '.$requestPath.' HTTP/'.$r['httpversion']."\r\n"; |
|
175 | 175 | |
176 | 176 | $include_port_in_host_header = ( |
177 | - ( $proxy->is_enabled() && $proxy->send_through_proxy( $url ) ) || |
|
178 | - ( 'http' == $arrURL['scheme'] && 80 != $arrURL['port'] ) || |
|
179 | - ( 'https' == $arrURL['scheme'] && 443 != $arrURL['port'] ) |
|
177 | + ($proxy->is_enabled() && $proxy->send_through_proxy($url)) || |
|
178 | + ('http' == $arrURL['scheme'] && 80 != $arrURL['port']) || |
|
179 | + ('https' == $arrURL['scheme'] && 443 != $arrURL['port']) |
|
180 | 180 | ); |
181 | 181 | |
182 | - if ( $include_port_in_host_header ) { |
|
183 | - $strHeaders .= 'Host: ' . $arrURL['host'] . ':' . $arrURL['port'] . "\r\n"; |
|
182 | + if ($include_port_in_host_header) { |
|
183 | + $strHeaders .= 'Host: '.$arrURL['host'].':'.$arrURL['port']."\r\n"; |
|
184 | 184 | } else { |
185 | - $strHeaders .= 'Host: ' . $arrURL['host'] . "\r\n"; |
|
185 | + $strHeaders .= 'Host: '.$arrURL['host']."\r\n"; |
|
186 | 186 | } |
187 | 187 | |
188 | - if ( isset($r['user-agent']) ) |
|
189 | - $strHeaders .= 'User-agent: ' . $r['user-agent'] . "\r\n"; |
|
188 | + if (isset($r['user-agent'])) |
|
189 | + $strHeaders .= 'User-agent: '.$r['user-agent']."\r\n"; |
|
190 | 190 | |
191 | - if ( is_array($r['headers']) ) { |
|
192 | - foreach ( (array) $r['headers'] as $header => $headerValue ) |
|
193 | - $strHeaders .= $header . ': ' . $headerValue . "\r\n"; |
|
191 | + if (is_array($r['headers'])) { |
|
192 | + foreach ((array) $r['headers'] as $header => $headerValue) |
|
193 | + $strHeaders .= $header.': '.$headerValue."\r\n"; |
|
194 | 194 | } else { |
195 | 195 | $strHeaders .= $r['headers']; |
196 | 196 | } |
197 | 197 | |
198 | - if ( $proxy->use_authentication() ) |
|
199 | - $strHeaders .= $proxy->authentication_header() . "\r\n"; |
|
198 | + if ($proxy->use_authentication()) |
|
199 | + $strHeaders .= $proxy->authentication_header()."\r\n"; |
|
200 | 200 | |
201 | 201 | $strHeaders .= "\r\n"; |
202 | 202 | |
203 | - if ( ! is_null($r['body']) ) |
|
203 | + if ( ! is_null($r['body'])) |
|
204 | 204 | $strHeaders .= $r['body']; |
205 | 205 | |
206 | 206 | fwrite($handle, $strHeaders); |
207 | 207 | |
208 | - if ( ! $r['blocking'] ) { |
|
209 | - stream_set_blocking( $handle, 0 ); |
|
210 | - fclose( $handle ); |
|
211 | - return array( 'headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array() ); |
|
208 | + if ( ! $r['blocking']) { |
|
209 | + stream_set_blocking($handle, 0); |
|
210 | + fclose($handle); |
|
211 | + return array('headers' => array(), 'body' => '', 'response' => array('code' => false, 'message' => false), 'cookies' => array()); |
|
212 | 212 | } |
213 | 213 | |
214 | 214 | $strResponse = ''; |
215 | 215 | $bodyStarted = false; |
216 | 216 | $keep_reading = true; |
217 | 217 | $block_size = 4096; |
218 | - if ( isset( $r['limit_response_size'] ) ) |
|
219 | - $block_size = min( $block_size, $r['limit_response_size'] ); |
|
218 | + if (isset($r['limit_response_size'])) |
|
219 | + $block_size = min($block_size, $r['limit_response_size']); |
|
220 | 220 | |
221 | 221 | // If streaming to a file setup the file handle. |
222 | - if ( $r['stream'] ) { |
|
223 | - if ( ! WP_DEBUG ) |
|
224 | - $stream_handle = @fopen( $r['filename'], 'w+' ); |
|
222 | + if ($r['stream']) { |
|
223 | + if ( ! WP_DEBUG) |
|
224 | + $stream_handle = @fopen($r['filename'], 'w+'); |
|
225 | 225 | else |
226 | - $stream_handle = fopen( $r['filename'], 'w+' ); |
|
227 | - if ( ! $stream_handle ) |
|
228 | - return new WP_Error( 'http_request_failed', sprintf( __( 'Could not open handle for fopen() to %s' ), $r['filename'] ) ); |
|
226 | + $stream_handle = fopen($r['filename'], 'w+'); |
|
227 | + if ( ! $stream_handle) |
|
228 | + return new WP_Error('http_request_failed', sprintf(__('Could not open handle for fopen() to %s'), $r['filename'])); |
|
229 | 229 | |
230 | 230 | $bytes_written = 0; |
231 | - while ( ! feof($handle) && $keep_reading ) { |
|
232 | - $block = fread( $handle, $block_size ); |
|
233 | - if ( ! $bodyStarted ) { |
|
231 | + while ( ! feof($handle) && $keep_reading) { |
|
232 | + $block = fread($handle, $block_size); |
|
233 | + if ( ! $bodyStarted) { |
|
234 | 234 | $strResponse .= $block; |
235 | - if ( strpos( $strResponse, "\r\n\r\n" ) ) { |
|
236 | - $process = WP_Http::processResponse( $strResponse ); |
|
235 | + if (strpos($strResponse, "\r\n\r\n")) { |
|
236 | + $process = WP_Http::processResponse($strResponse); |
|
237 | 237 | $bodyStarted = true; |
238 | 238 | $block = $process['body']; |
239 | - unset( $strResponse ); |
|
239 | + unset($strResponse); |
|
240 | 240 | $process['body'] = ''; |
241 | 241 | } |
242 | 242 | } |
243 | 243 | |
244 | - $this_block_size = strlen( $block ); |
|
244 | + $this_block_size = strlen($block); |
|
245 | 245 | |
246 | - if ( isset( $r['limit_response_size'] ) && ( $bytes_written + $this_block_size ) > $r['limit_response_size'] ) { |
|
247 | - $this_block_size = ( $r['limit_response_size'] - $bytes_written ); |
|
248 | - $block = substr( $block, 0, $this_block_size ); |
|
246 | + if (isset($r['limit_response_size']) && ($bytes_written + $this_block_size) > $r['limit_response_size']) { |
|
247 | + $this_block_size = ($r['limit_response_size'] - $bytes_written); |
|
248 | + $block = substr($block, 0, $this_block_size); |
|
249 | 249 | } |
250 | 250 | |
251 | - $bytes_written_to_file = fwrite( $stream_handle, $block ); |
|
251 | + $bytes_written_to_file = fwrite($stream_handle, $block); |
|
252 | 252 | |
253 | - if ( $bytes_written_to_file != $this_block_size ) { |
|
254 | - fclose( $handle ); |
|
255 | - fclose( $stream_handle ); |
|
256 | - return new WP_Error( 'http_request_failed', __( 'Failed to write request to temporary file.' ) ); |
|
253 | + if ($bytes_written_to_file != $this_block_size) { |
|
254 | + fclose($handle); |
|
255 | + fclose($stream_handle); |
|
256 | + return new WP_Error('http_request_failed', __('Failed to write request to temporary file.')); |
|
257 | 257 | } |
258 | 258 | |
259 | 259 | $bytes_written += $bytes_written_to_file; |
260 | 260 | |
261 | - $keep_reading = !isset( $r['limit_response_size'] ) || $bytes_written < $r['limit_response_size']; |
|
261 | + $keep_reading = ! isset($r['limit_response_size']) || $bytes_written < $r['limit_response_size']; |
|
262 | 262 | } |
263 | 263 | |
264 | - fclose( $stream_handle ); |
|
264 | + fclose($stream_handle); |
|
265 | 265 | |
266 | 266 | } else { |
267 | 267 | $header_length = 0; |
268 | - while ( ! feof( $handle ) && $keep_reading ) { |
|
269 | - $block = fread( $handle, $block_size ); |
|
268 | + while ( ! feof($handle) && $keep_reading) { |
|
269 | + $block = fread($handle, $block_size); |
|
270 | 270 | $strResponse .= $block; |
271 | - if ( ! $bodyStarted && strpos( $strResponse, "\r\n\r\n" ) ) { |
|
272 | - $header_length = strpos( $strResponse, "\r\n\r\n" ) + 4; |
|
271 | + if ( ! $bodyStarted && strpos($strResponse, "\r\n\r\n")) { |
|
272 | + $header_length = strpos($strResponse, "\r\n\r\n") + 4; |
|
273 | 273 | $bodyStarted = true; |
274 | 274 | } |
275 | - $keep_reading = ( ! $bodyStarted || !isset( $r['limit_response_size'] ) || strlen( $strResponse ) < ( $header_length + $r['limit_response_size'] ) ); |
|
275 | + $keep_reading = ( ! $bodyStarted || ! isset($r['limit_response_size']) || strlen($strResponse) < ($header_length + $r['limit_response_size'])); |
|
276 | 276 | } |
277 | 277 | |
278 | - $process = WP_Http::processResponse( $strResponse ); |
|
279 | - unset( $strResponse ); |
|
278 | + $process = WP_Http::processResponse($strResponse); |
|
279 | + unset($strResponse); |
|
280 | 280 | |
281 | 281 | } |
282 | 282 | |
283 | - fclose( $handle ); |
|
283 | + fclose($handle); |
|
284 | 284 | |
285 | - $arrHeaders = WP_Http::processHeaders( $process['headers'], $url ); |
|
285 | + $arrHeaders = WP_Http::processHeaders($process['headers'], $url); |
|
286 | 286 | |
287 | 287 | $response = array( |
288 | 288 | 'headers' => $arrHeaders['headers'], |
@@ -294,18 +294,18 @@ discard block |
||
294 | 294 | ); |
295 | 295 | |
296 | 296 | // Handle redirects. |
297 | - if ( false !== ( $redirect_response = WP_Http::handle_redirects( $url, $r, $response ) ) ) |
|
297 | + if (false !== ($redirect_response = WP_Http::handle_redirects($url, $r, $response))) |
|
298 | 298 | return $redirect_response; |
299 | 299 | |
300 | 300 | // If the body was chunk encoded, then decode it. |
301 | - if ( ! empty( $process['body'] ) && isset( $arrHeaders['headers']['transfer-encoding'] ) && 'chunked' == $arrHeaders['headers']['transfer-encoding'] ) |
|
301 | + if ( ! empty($process['body']) && isset($arrHeaders['headers']['transfer-encoding']) && 'chunked' == $arrHeaders['headers']['transfer-encoding']) |
|
302 | 302 | $process['body'] = WP_Http::chunkTransferDecode($process['body']); |
303 | 303 | |
304 | - if ( true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers']) ) |
|
305 | - $process['body'] = WP_Http_Encoding::decompress( $process['body'] ); |
|
304 | + if (true === $r['decompress'] && true === WP_Http_Encoding::should_decode($arrHeaders['headers'])) |
|
305 | + $process['body'] = WP_Http_Encoding::decompress($process['body']); |
|
306 | 306 | |
307 | - if ( isset( $r['limit_response_size'] ) && strlen( $process['body'] ) > $r['limit_response_size'] ) |
|
308 | - $process['body'] = substr( $process['body'], 0, $r['limit_response_size'] ); |
|
307 | + if (isset($r['limit_response_size']) && strlen($process['body']) > $r['limit_response_size']) |
|
308 | + $process['body'] = substr($process['body'], 0, $r['limit_response_size']); |
|
309 | 309 | |
310 | 310 | $response['body'] = $process['body']; |
311 | 311 | |
@@ -329,51 +329,51 @@ discard block |
||
329 | 329 | * @param string $host The hostname being requested |
330 | 330 | * @return bool If the cerficiate presented in $stream is valid for $host |
331 | 331 | */ |
332 | - public static function verify_ssl_certificate( $stream, $host ) { |
|
333 | - $context_options = stream_context_get_options( $stream ); |
|
332 | + public static function verify_ssl_certificate($stream, $host) { |
|
333 | + $context_options = stream_context_get_options($stream); |
|
334 | 334 | |
335 | - if ( empty( $context_options['ssl']['peer_certificate'] ) ) |
|
335 | + if (empty($context_options['ssl']['peer_certificate'])) |
|
336 | 336 | return false; |
337 | 337 | |
338 | - $cert = openssl_x509_parse( $context_options['ssl']['peer_certificate'] ); |
|
339 | - if ( ! $cert ) |
|
338 | + $cert = openssl_x509_parse($context_options['ssl']['peer_certificate']); |
|
339 | + if ( ! $cert) |
|
340 | 340 | return false; |
341 | 341 | |
342 | 342 | /* |
343 | 343 | * If the request is being made to an IP address, we'll validate against IP fields |
344 | 344 | * in the cert (if they exist) |
345 | 345 | */ |
346 | - $host_type = ( WP_Http::is_ip_address( $host ) ? 'ip' : 'dns' ); |
|
346 | + $host_type = (WP_Http::is_ip_address($host) ? 'ip' : 'dns'); |
|
347 | 347 | |
348 | 348 | $certificate_hostnames = array(); |
349 | - if ( ! empty( $cert['extensions']['subjectAltName'] ) ) { |
|
350 | - $match_against = preg_split( '/,\s*/', $cert['extensions']['subjectAltName'] ); |
|
351 | - foreach ( $match_against as $match ) { |
|
352 | - list( $match_type, $match_host ) = explode( ':', $match ); |
|
353 | - if ( $host_type == strtolower( trim( $match_type ) ) ) // IP: or DNS: |
|
354 | - $certificate_hostnames[] = strtolower( trim( $match_host ) ); |
|
349 | + if ( ! empty($cert['extensions']['subjectAltName'])) { |
|
350 | + $match_against = preg_split('/,\s*/', $cert['extensions']['subjectAltName']); |
|
351 | + foreach ($match_against as $match) { |
|
352 | + list($match_type, $match_host) = explode(':', $match); |
|
353 | + if ($host_type == strtolower(trim($match_type))) // IP: or DNS: |
|
354 | + $certificate_hostnames[] = strtolower(trim($match_host)); |
|
355 | 355 | } |
356 | - } elseif ( !empty( $cert['subject']['CN'] ) ) { |
|
356 | + } elseif ( ! empty($cert['subject']['CN'])) { |
|
357 | 357 | // Only use the CN when the certificate includes no subjectAltName extension. |
358 | - $certificate_hostnames[] = strtolower( $cert['subject']['CN'] ); |
|
358 | + $certificate_hostnames[] = strtolower($cert['subject']['CN']); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | // Exact hostname/IP matches. |
362 | - if ( in_array( strtolower( $host ), $certificate_hostnames ) ) |
|
362 | + if (in_array(strtolower($host), $certificate_hostnames)) |
|
363 | 363 | return true; |
364 | 364 | |
365 | 365 | // IP's can't be wildcards, Stop processing. |
366 | - if ( 'ip' == $host_type ) |
|
366 | + if ('ip' == $host_type) |
|
367 | 367 | return false; |
368 | 368 | |
369 | 369 | // Test to see if the domain is at least 2 deep for wildcard support. |
370 | - if ( substr_count( $host, '.' ) < 2 ) |
|
370 | + if (substr_count($host, '.') < 2) |
|
371 | 371 | return false; |
372 | 372 | |
373 | 373 | // Wildcard subdomains certs (*.example.com) are valid for a.example.com but not a.b.example.com. |
374 | - $wildcard_host = preg_replace( '/^[^.]+\./', '*.', $host ); |
|
374 | + $wildcard_host = preg_replace('/^[^.]+\./', '*.', $host); |
|
375 | 375 | |
376 | - return in_array( strtolower( $wildcard_host ), $certificate_hostnames ); |
|
376 | + return in_array(strtolower($wildcard_host), $certificate_hostnames); |
|
377 | 377 | } |
378 | 378 | |
379 | 379 | /** |
@@ -387,16 +387,16 @@ discard block |
||
387 | 387 | * @param array $args Optional. Array of request arguments. Default empty array. |
388 | 388 | * @return bool False means this class can not be used, true means it can. |
389 | 389 | */ |
390 | - public static function test( $args = array() ) { |
|
391 | - if ( ! function_exists( 'stream_socket_client' ) ) |
|
390 | + public static function test($args = array()) { |
|
391 | + if ( ! function_exists('stream_socket_client')) |
|
392 | 392 | return false; |
393 | 393 | |
394 | - $is_ssl = isset( $args['ssl'] ) && $args['ssl']; |
|
394 | + $is_ssl = isset($args['ssl']) && $args['ssl']; |
|
395 | 395 | |
396 | - if ( $is_ssl ) { |
|
397 | - if ( ! extension_loaded( 'openssl' ) ) |
|
396 | + if ($is_ssl) { |
|
397 | + if ( ! extension_loaded('openssl')) |
|
398 | 398 | return false; |
399 | - if ( ! function_exists( 'openssl_x509_parse' ) ) |
|
399 | + if ( ! function_exists('openssl_x509_parse')) |
|
400 | 400 | return false; |
401 | 401 | } |
402 | 402 | |
@@ -408,7 +408,7 @@ discard block |
||
408 | 408 | * @param bool $use_class Whether the class can be used. Default true. |
409 | 409 | * @param array $args Request arguments. |
410 | 410 | */ |
411 | - return apply_filters( 'use_streams_transport', true, $args ); |
|
411 | + return apply_filters('use_streams_transport', true, $args); |
|
412 | 412 | } |
413 | 413 | } |
414 | 414 |
@@ -361,8 +361,9 @@ discard block |
||
361 | 361 | * @uses WP_Customize_Control::render() |
362 | 362 | */ |
363 | 363 | final public function maybe_render() { |
364 | - if ( ! $this->check_capabilities() ) |
|
365 | - return; |
|
364 | + if ( ! $this->check_capabilities() ) { |
|
365 | + return; |
|
366 | + } |
|
366 | 367 | |
367 | 368 | /** |
368 | 369 | * Fires just before the current Customizer control is rendered. |
@@ -411,8 +412,9 @@ discard block |
||
411 | 412 | * @return string Data link parameter, if $setting_key is a valid setting, empty string otherwise. |
412 | 413 | */ |
413 | 414 | public function get_link( $setting_key = 'default' ) { |
414 | - if ( ! isset( $this->settings[ $setting_key ] ) ) |
|
415 | - return ''; |
|
415 | + if ( ! isset( $this->settings[ $setting_key ] ) ) { |
|
416 | + return ''; |
|
417 | + } |
|
416 | 418 | |
417 | 419 | return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; |
418 | 420 | } |
@@ -467,8 +469,9 @@ discard block |
||
467 | 469 | <?php |
468 | 470 | break; |
469 | 471 | case 'radio': |
470 | - if ( empty( $this->choices ) ) |
|
471 | - return; |
|
472 | + if ( empty( $this->choices ) ) { |
|
473 | + return; |
|
474 | + } |
|
472 | 475 | |
473 | 476 | $name = '_customize-radio-' . $this->id; |
474 | 477 | |
@@ -489,8 +492,9 @@ discard block |
||
489 | 492 | endforeach; |
490 | 493 | break; |
491 | 494 | case 'select': |
492 | - if ( empty( $this->choices ) ) |
|
493 | - return; |
|
495 | + if ( empty( $this->choices ) ) { |
|
496 | + return; |
|
497 | + } |
|
494 | 498 | |
495 | 499 | ?> |
496 | 500 | <label> |
@@ -503,8 +507,9 @@ discard block |
||
503 | 507 | |
504 | 508 | <select <?php $this->link(); ?>> |
505 | 509 | <?php |
506 | - foreach ( $this->choices as $value => $label ) |
|
507 | - echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
|
510 | + foreach ( $this->choices as $value => $label ) { |
|
511 | + echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
|
512 | + } |
|
508 | 513 | ?> |
509 | 514 | </select> |
510 | 515 | </label> |
@@ -293,7 +293,7 @@ |
||
293 | 293 | * |
294 | 294 | * @since 4.0.0 |
295 | 295 | * |
296 | - * @return true Always true. |
|
296 | + * @return boolean Always true. |
|
297 | 297 | */ |
298 | 298 | public function active_callback() { |
299 | 299 | return true; |
@@ -221,34 +221,34 @@ discard block |
||
221 | 221 | * 'date' are supported implicitly. Default 'text'. |
222 | 222 | * } |
223 | 223 | */ |
224 | - public function __construct( $manager, $id, $args = array() ) { |
|
225 | - $keys = array_keys( get_object_vars( $this ) ); |
|
226 | - foreach ( $keys as $key ) { |
|
227 | - if ( isset( $args[ $key ] ) ) { |
|
228 | - $this->$key = $args[ $key ]; |
|
224 | + public function __construct($manager, $id, $args = array()) { |
|
225 | + $keys = array_keys(get_object_vars($this)); |
|
226 | + foreach ($keys as $key) { |
|
227 | + if (isset($args[$key])) { |
|
228 | + $this->$key = $args[$key]; |
|
229 | 229 | } |
230 | 230 | } |
231 | 231 | |
232 | 232 | $this->manager = $manager; |
233 | 233 | $this->id = $id; |
234 | - if ( empty( $this->active_callback ) ) { |
|
235 | - $this->active_callback = array( $this, 'active_callback' ); |
|
234 | + if (empty($this->active_callback)) { |
|
235 | + $this->active_callback = array($this, 'active_callback'); |
|
236 | 236 | } |
237 | 237 | self::$instance_count += 1; |
238 | 238 | $this->instance_number = self::$instance_count; |
239 | 239 | |
240 | 240 | // Process settings. |
241 | - if ( ! isset( $this->settings ) ) { |
|
241 | + if ( ! isset($this->settings)) { |
|
242 | 242 | $this->settings = $id; |
243 | 243 | } |
244 | 244 | |
245 | 245 | $settings = array(); |
246 | - if ( is_array( $this->settings ) ) { |
|
247 | - foreach ( $this->settings as $key => $setting ) { |
|
248 | - $settings[ $key ] = $this->manager->get_setting( $setting ); |
|
246 | + if (is_array($this->settings)) { |
|
247 | + foreach ($this->settings as $key => $setting) { |
|
248 | + $settings[$key] = $this->manager->get_setting($setting); |
|
249 | 249 | } |
250 | - } else if ( is_string( $this->settings ) ) { |
|
251 | - $this->setting = $this->manager->get_setting( $this->settings ); |
|
250 | + } else if (is_string($this->settings)) { |
|
251 | + $this->setting = $this->manager->get_setting($this->settings); |
|
252 | 252 | $settings['default'] = $this->setting; |
253 | 253 | } |
254 | 254 | $this->settings = $settings; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | */ |
271 | 271 | final public function active() { |
272 | 272 | $control = $this; |
273 | - $active = call_user_func( $this->active_callback, $this ); |
|
273 | + $active = call_user_func($this->active_callback, $this); |
|
274 | 274 | |
275 | 275 | /** |
276 | 276 | * Filters response of WP_Customize_Control::active(). |
@@ -280,7 +280,7 @@ discard block |
||
280 | 280 | * @param bool $active Whether the Customizer control is active. |
281 | 281 | * @param WP_Customize_Control $control WP_Customize_Control instance. |
282 | 282 | */ |
283 | - $active = apply_filters( 'customize_control_active', $active, $control ); |
|
283 | + $active = apply_filters('customize_control_active', $active, $control); |
|
284 | 284 | |
285 | 285 | return $active; |
286 | 286 | } |
@@ -308,9 +308,9 @@ discard block |
||
308 | 308 | * @param string $setting_key |
309 | 309 | * @return mixed The requested setting's value, if the setting exists. |
310 | 310 | */ |
311 | - final public function value( $setting_key = 'default' ) { |
|
312 | - if ( isset( $this->settings[ $setting_key ] ) ) { |
|
313 | - return $this->settings[ $setting_key ]->value(); |
|
311 | + final public function value($setting_key = 'default') { |
|
312 | + if (isset($this->settings[$setting_key])) { |
|
313 | + return $this->settings[$setting_key]->value(); |
|
314 | 314 | } |
315 | 315 | } |
316 | 316 | |
@@ -321,8 +321,8 @@ discard block |
||
321 | 321 | */ |
322 | 322 | public function to_json() { |
323 | 323 | $this->json['settings'] = array(); |
324 | - foreach ( $this->settings as $key => $setting ) { |
|
325 | - $this->json['settings'][ $key ] = $setting->id; |
|
324 | + foreach ($this->settings as $key => $setting) { |
|
325 | + $this->json['settings'][$key] = $setting->id; |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | $this->json['type'] = $this->type; |
@@ -334,7 +334,7 @@ discard block |
||
334 | 334 | $this->json['description'] = $this->description; |
335 | 335 | $this->json['instanceNumber'] = $this->instance_number; |
336 | 336 | |
337 | - if ( 'dropdown-pages' === $this->type ) { |
|
337 | + if ('dropdown-pages' === $this->type) { |
|
338 | 338 | $this->json['allow_addition'] = $this->allow_addition; |
339 | 339 | } |
340 | 340 | } |
@@ -364,18 +364,18 @@ discard block |
||
364 | 364 | * @return bool False if theme doesn't support the control or user doesn't have the required permissions, otherwise true. |
365 | 365 | */ |
366 | 366 | final public function check_capabilities() { |
367 | - if ( ! empty( $this->capability ) && ! current_user_can( $this->capability ) ) { |
|
367 | + if ( ! empty($this->capability) && ! current_user_can($this->capability)) { |
|
368 | 368 | return false; |
369 | 369 | } |
370 | 370 | |
371 | - foreach ( $this->settings as $setting ) { |
|
372 | - if ( ! $setting || ! $setting->check_capabilities() ) { |
|
371 | + foreach ($this->settings as $setting) { |
|
372 | + if ( ! $setting || ! $setting->check_capabilities()) { |
|
373 | 373 | return false; |
374 | 374 | } |
375 | 375 | } |
376 | 376 | |
377 | - $section = $this->manager->get_section( $this->section ); |
|
378 | - if ( isset( $section ) && ! $section->check_capabilities() ) { |
|
377 | + $section = $this->manager->get_section($this->section); |
|
378 | + if (isset($section) && ! $section->check_capabilities()) { |
|
379 | 379 | return false; |
380 | 380 | } |
381 | 381 | |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | final public function get_content() { |
393 | 393 | ob_start(); |
394 | 394 | $this->maybe_render(); |
395 | - return trim( ob_get_clean() ); |
|
395 | + return trim(ob_get_clean()); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @uses WP_Customize_Control::render() |
403 | 403 | */ |
404 | 404 | final public function maybe_render() { |
405 | - if ( ! $this->check_capabilities() ) |
|
405 | + if ( ! $this->check_capabilities()) |
|
406 | 406 | return; |
407 | 407 | |
408 | 408 | /** |
@@ -412,7 +412,7 @@ discard block |
||
412 | 412 | * |
413 | 413 | * @param WP_Customize_Control $this WP_Customize_Control instance. |
414 | 414 | */ |
415 | - do_action( 'customize_render_control', $this ); |
|
415 | + do_action('customize_render_control', $this); |
|
416 | 416 | |
417 | 417 | /** |
418 | 418 | * Fires just before a specific Customizer control is rendered. |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * |
425 | 425 | * @param WP_Customize_Control $this WP_Customize_Control instance. |
426 | 426 | */ |
427 | - do_action( "customize_render_control_{$this->id}", $this ); |
|
427 | + do_action("customize_render_control_{$this->id}", $this); |
|
428 | 428 | |
429 | 429 | $this->render(); |
430 | 430 | } |
@@ -435,10 +435,10 @@ discard block |
||
435 | 435 | * @since 3.4.0 |
436 | 436 | */ |
437 | 437 | protected function render() { |
438 | - $id = 'customize-control-' . str_replace( array( '[', ']' ), array( '-', '' ), $this->id ); |
|
439 | - $class = 'customize-control customize-control-' . $this->type; |
|
438 | + $id = 'customize-control-'.str_replace(array('[', ']'), array('-', ''), $this->id); |
|
439 | + $class = 'customize-control customize-control-'.$this->type; |
|
440 | 440 | |
441 | - ?><li id="<?php echo esc_attr( $id ); ?>" class="<?php echo esc_attr( $class ); ?>"> |
|
441 | + ?><li id="<?php echo esc_attr($id); ?>" class="<?php echo esc_attr($class); ?>"> |
|
442 | 442 | <?php $this->render_content(); ?> |
443 | 443 | </li><?php |
444 | 444 | } |
@@ -451,11 +451,11 @@ discard block |
||
451 | 451 | * @param string $setting_key |
452 | 452 | * @return string Data link parameter, if $setting_key is a valid setting, empty string otherwise. |
453 | 453 | */ |
454 | - public function get_link( $setting_key = 'default' ) { |
|
455 | - if ( ! isset( $this->settings[ $setting_key ] ) ) |
|
454 | + public function get_link($setting_key = 'default') { |
|
455 | + if ( ! isset($this->settings[$setting_key])) |
|
456 | 456 | return ''; |
457 | 457 | |
458 | - return 'data-customize-setting-link="' . esc_attr( $this->settings[ $setting_key ]->id ) . '"'; |
|
458 | + return 'data-customize-setting-link="'.esc_attr($this->settings[$setting_key]->id).'"'; |
|
459 | 459 | } |
460 | 460 | |
461 | 461 | /** |
@@ -466,8 +466,8 @@ discard block |
||
466 | 466 | * |
467 | 467 | * @param string $setting_key |
468 | 468 | */ |
469 | - public function link( $setting_key = 'default' ) { |
|
470 | - echo $this->get_link( $setting_key ); |
|
469 | + public function link($setting_key = 'default') { |
|
470 | + echo $this->get_link($setting_key); |
|
471 | 471 | } |
472 | 472 | |
473 | 473 | /** |
@@ -476,8 +476,8 @@ discard block |
||
476 | 476 | * @since 4.0.0 |
477 | 477 | */ |
478 | 478 | public function input_attrs() { |
479 | - foreach ( $this->input_attrs as $attr => $value ) { |
|
480 | - echo $attr . '="' . esc_attr( $value ) . '" '; |
|
479 | + foreach ($this->input_attrs as $attr => $value) { |
|
480 | + echo $attr.'="'.esc_attr($value).'" '; |
|
481 | 481 | } |
482 | 482 | } |
483 | 483 | |
@@ -494,57 +494,57 @@ discard block |
||
494 | 494 | * @since 3.4.0 |
495 | 495 | */ |
496 | 496 | protected function render_content() { |
497 | - switch( $this->type ) { |
|
497 | + switch ($this->type) { |
|
498 | 498 | case 'checkbox': |
499 | 499 | ?> |
500 | 500 | <label> |
501 | - <input type="checkbox" value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); checked( $this->value() ); ?> /> |
|
502 | - <?php echo esc_html( $this->label ); ?> |
|
503 | - <?php if ( ! empty( $this->description ) ) : ?> |
|
501 | + <input type="checkbox" value="<?php echo esc_attr($this->value()); ?>" <?php $this->link(); checked($this->value()); ?> /> |
|
502 | + <?php echo esc_html($this->label); ?> |
|
503 | + <?php if ( ! empty($this->description)) : ?> |
|
504 | 504 | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
505 | 505 | <?php endif; ?> |
506 | 506 | </label> |
507 | 507 | <?php |
508 | 508 | break; |
509 | 509 | case 'radio': |
510 | - if ( empty( $this->choices ) ) |
|
510 | + if (empty($this->choices)) |
|
511 | 511 | return; |
512 | 512 | |
513 | - $name = '_customize-radio-' . $this->id; |
|
513 | + $name = '_customize-radio-'.$this->id; |
|
514 | 514 | |
515 | - if ( ! empty( $this->label ) ) : ?> |
|
516 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
515 | + if ( ! empty($this->label)) : ?> |
|
516 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
517 | 517 | <?php endif; |
518 | - if ( ! empty( $this->description ) ) : ?> |
|
519 | - <span class="description customize-control-description"><?php echo $this->description ; ?></span> |
|
518 | + if ( ! empty($this->description)) : ?> |
|
519 | + <span class="description customize-control-description"><?php echo $this->description; ?></span> |
|
520 | 520 | <?php endif; |
521 | 521 | |
522 | - foreach ( $this->choices as $value => $label ) : |
|
522 | + foreach ($this->choices as $value => $label) : |
|
523 | 523 | ?> |
524 | 524 | <label> |
525 | - <input type="radio" value="<?php echo esc_attr( $value ); ?>" name="<?php echo esc_attr( $name ); ?>" <?php $this->link(); checked( $this->value(), $value ); ?> /> |
|
526 | - <?php echo esc_html( $label ); ?><br/> |
|
525 | + <input type="radio" value="<?php echo esc_attr($value); ?>" name="<?php echo esc_attr($name); ?>" <?php $this->link(); checked($this->value(), $value); ?> /> |
|
526 | + <?php echo esc_html($label); ?><br/> |
|
527 | 527 | </label> |
528 | 528 | <?php |
529 | 529 | endforeach; |
530 | 530 | break; |
531 | 531 | case 'select': |
532 | - if ( empty( $this->choices ) ) |
|
532 | + if (empty($this->choices)) |
|
533 | 533 | return; |
534 | 534 | |
535 | 535 | ?> |
536 | 536 | <label> |
537 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
538 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
537 | + <?php if ( ! empty($this->label)) : ?> |
|
538 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
539 | 539 | <?php endif; |
540 | - if ( ! empty( $this->description ) ) : ?> |
|
540 | + if ( ! empty($this->description)) : ?> |
|
541 | 541 | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
542 | 542 | <?php endif; ?> |
543 | 543 | |
544 | 544 | <select <?php $this->link(); ?>> |
545 | 545 | <?php |
546 | - foreach ( $this->choices as $value => $label ) |
|
547 | - echo '<option value="' . esc_attr( $value ) . '"' . selected( $this->value(), $value, false ) . '>' . $label . '</option>'; |
|
546 | + foreach ($this->choices as $value => $label) |
|
547 | + echo '<option value="'.esc_attr($value).'"'.selected($this->value(), $value, false).'>'.$label.'</option>'; |
|
548 | 548 | ?> |
549 | 549 | </select> |
550 | 550 | </label> |
@@ -553,29 +553,29 @@ discard block |
||
553 | 553 | case 'textarea': |
554 | 554 | ?> |
555 | 555 | <label> |
556 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
557 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
556 | + <?php if ( ! empty($this->label)) : ?> |
|
557 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
558 | 558 | <?php endif; |
559 | - if ( ! empty( $this->description ) ) : ?> |
|
559 | + if ( ! empty($this->description)) : ?> |
|
560 | 560 | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
561 | 561 | <?php endif; ?> |
562 | - <textarea rows="5" <?php $this->input_attrs(); ?> <?php $this->link(); ?>><?php echo esc_textarea( $this->value() ); ?></textarea> |
|
562 | + <textarea rows="5" <?php $this->input_attrs(); ?> <?php $this->link(); ?>><?php echo esc_textarea($this->value()); ?></textarea> |
|
563 | 563 | </label> |
564 | 564 | <?php |
565 | 565 | break; |
566 | 566 | case 'dropdown-pages': |
567 | 567 | ?> |
568 | 568 | <label> |
569 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
570 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
569 | + <?php if ( ! empty($this->label)) : ?> |
|
570 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
571 | 571 | <?php endif; |
572 | - if ( ! empty( $this->description ) ) : ?> |
|
572 | + if ( ! empty($this->description)) : ?> |
|
573 | 573 | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
574 | 574 | <?php endif; ?> |
575 | 575 | |
576 | 576 | <?php |
577 | - $dropdown_name = '_customize-dropdown-pages-' . $this->id; |
|
578 | - $show_option_none = __( '— Select —' ); |
|
577 | + $dropdown_name = '_customize-dropdown-pages-'.$this->id; |
|
578 | + $show_option_none = __('— Select —'); |
|
579 | 579 | $option_none_value = '0'; |
580 | 580 | $dropdown = wp_dropdown_pages( |
581 | 581 | array( |
@@ -586,56 +586,56 @@ discard block |
||
586 | 586 | 'selected' => $this->value(), |
587 | 587 | ) |
588 | 588 | ); |
589 | - if ( empty( $dropdown ) ) { |
|
590 | - $dropdown = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $dropdown_name ) ); |
|
591 | - $dropdown .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $option_none_value ), esc_html( $show_option_none ) ); |
|
589 | + if (empty($dropdown)) { |
|
590 | + $dropdown = sprintf('<select id="%1$s" name="%1$s">', esc_attr($dropdown_name)); |
|
591 | + $dropdown .= sprintf('<option value="%1$s">%2$s</option>', esc_attr($option_none_value), esc_html($show_option_none)); |
|
592 | 592 | $dropdown .= '</select>'; |
593 | 593 | } |
594 | 594 | |
595 | 595 | // Hackily add in the data link parameter. |
596 | - $dropdown = str_replace( '<select', '<select ' . $this->get_link(), $dropdown ); |
|
596 | + $dropdown = str_replace('<select', '<select '.$this->get_link(), $dropdown); |
|
597 | 597 | |
598 | 598 | // Even more hacikly add auto-draft page stubs. |
599 | 599 | // @todo Eventually this should be removed in favor of the pages being injected into the underlying get_pages() call. See <https://github.com/xwp/wp-customize-posts/pull/250>. |
600 | - $nav_menus_created_posts_setting = $this->manager->get_setting( 'nav_menus_created_posts' ); |
|
601 | - if ( $nav_menus_created_posts_setting && current_user_can( 'publish_pages' ) ) { |
|
600 | + $nav_menus_created_posts_setting = $this->manager->get_setting('nav_menus_created_posts'); |
|
601 | + if ($nav_menus_created_posts_setting && current_user_can('publish_pages')) { |
|
602 | 602 | $auto_draft_page_options = ''; |
603 | - foreach ( $nav_menus_created_posts_setting->value() as $auto_draft_page_id ) { |
|
604 | - $post = get_post( $auto_draft_page_id ); |
|
605 | - if ( $post && 'page' === $post->post_type ) { |
|
606 | - $auto_draft_page_options .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $post->ID ), esc_html( $post->post_title ) ); |
|
603 | + foreach ($nav_menus_created_posts_setting->value() as $auto_draft_page_id) { |
|
604 | + $post = get_post($auto_draft_page_id); |
|
605 | + if ($post && 'page' === $post->post_type) { |
|
606 | + $auto_draft_page_options .= sprintf('<option value="%1$s">%2$s</option>', esc_attr($post->ID), esc_html($post->post_title)); |
|
607 | 607 | } |
608 | 608 | } |
609 | - if ( $auto_draft_page_options ) { |
|
610 | - $dropdown = str_replace( '</select>', $auto_draft_page_options . '</select>', $dropdown ); |
|
609 | + if ($auto_draft_page_options) { |
|
610 | + $dropdown = str_replace('</select>', $auto_draft_page_options.'</select>', $dropdown); |
|
611 | 611 | } |
612 | 612 | } |
613 | 613 | |
614 | 614 | echo $dropdown; |
615 | 615 | ?> |
616 | 616 | </label> |
617 | - <?php if ( $this->allow_addition && current_user_can( 'publish_pages' ) && current_user_can( 'edit_theme_options' ) ) : // Currently tied to menus functionality. ?> |
|
617 | + <?php if ($this->allow_addition && current_user_can('publish_pages') && current_user_can('edit_theme_options')) : // Currently tied to menus functionality. ?> |
|
618 | 618 | <button type="button" class="button-link add-new-toggle"><?php |
619 | 619 | /* translators: %s: add new page label */ |
620 | - printf( __( '+ %s' ), get_post_type_object( 'page' )->labels->add_new_item ); |
|
620 | + printf(__('+ %s'), get_post_type_object('page')->labels->add_new_item); |
|
621 | 621 | ?></button> |
622 | 622 | <div class="new-content-item"> |
623 | - <label for="create-input-<?php echo $this->id; ?>"><span class="screen-reader-text"><?php _e( 'New page title' ); ?></span></label> |
|
624 | - <input type="text" id="create-input-<?php echo $this->id; ?>" class="create-item-input" placeholder="<?php esc_attr_e( 'New page title…' ); ?>"> |
|
625 | - <button type="button" class="button add-content"><?php _e( 'Add' ); ?></button> |
|
623 | + <label for="create-input-<?php echo $this->id; ?>"><span class="screen-reader-text"><?php _e('New page title'); ?></span></label> |
|
624 | + <input type="text" id="create-input-<?php echo $this->id; ?>" class="create-item-input" placeholder="<?php esc_attr_e('New page title…'); ?>"> |
|
625 | + <button type="button" class="button add-content"><?php _e('Add'); ?></button> |
|
626 | 626 | </div> |
627 | 627 | <?php endif; |
628 | 628 | break; |
629 | 629 | default: |
630 | 630 | ?> |
631 | 631 | <label> |
632 | - <?php if ( ! empty( $this->label ) ) : ?> |
|
633 | - <span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span> |
|
632 | + <?php if ( ! empty($this->label)) : ?> |
|
633 | + <span class="customize-control-title"><?php echo esc_html($this->label); ?></span> |
|
634 | 634 | <?php endif; |
635 | - if ( ! empty( $this->description ) ) : ?> |
|
635 | + if ( ! empty($this->description)) : ?> |
|
636 | 636 | <span class="description customize-control-description"><?php echo $this->description; ?></span> |
637 | 637 | <?php endif; ?> |
638 | - <input type="<?php echo esc_attr( $this->type ); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr( $this->value() ); ?>" <?php $this->link(); ?> /> |
|
638 | + <input type="<?php echo esc_attr($this->type); ?>" <?php $this->input_attrs(); ?> value="<?php echo esc_attr($this->value()); ?>" <?php $this->link(); ?> /> |
|
639 | 639 | </label> |
640 | 640 | <?php |
641 | 641 | break; |
@@ -678,89 +678,89 @@ discard block |
||
678 | 678 | /** |
679 | 679 | * WP_Customize_Color_Control class. |
680 | 680 | */ |
681 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-color-control.php' ); |
|
681 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-color-control.php'); |
|
682 | 682 | |
683 | 683 | /** |
684 | 684 | * WP_Customize_Media_Control class. |
685 | 685 | */ |
686 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-media-control.php' ); |
|
686 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-media-control.php'); |
|
687 | 687 | |
688 | 688 | /** |
689 | 689 | * WP_Customize_Upload_Control class. |
690 | 690 | */ |
691 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-upload-control.php' ); |
|
691 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-upload-control.php'); |
|
692 | 692 | |
693 | 693 | /** |
694 | 694 | * WP_Customize_Image_Control class. |
695 | 695 | */ |
696 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-image-control.php' ); |
|
696 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-image-control.php'); |
|
697 | 697 | |
698 | 698 | /** |
699 | 699 | * WP_Customize_Background_Image_Control class. |
700 | 700 | */ |
701 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-image-control.php' ); |
|
701 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-image-control.php'); |
|
702 | 702 | |
703 | 703 | /** |
704 | 704 | * WP_Customize_Background_Position_Control class. |
705 | 705 | */ |
706 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-background-position-control.php' ); |
|
706 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-background-position-control.php'); |
|
707 | 707 | |
708 | 708 | /** |
709 | 709 | * WP_Customize_Cropped_Image_Control class. |
710 | 710 | */ |
711 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-cropped-image-control.php' ); |
|
711 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-cropped-image-control.php'); |
|
712 | 712 | |
713 | 713 | /** |
714 | 714 | * WP_Customize_Site_Icon_Control class. |
715 | 715 | */ |
716 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-site-icon-control.php' ); |
|
716 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-site-icon-control.php'); |
|
717 | 717 | |
718 | 718 | /** |
719 | 719 | * WP_Customize_Header_Image_Control class. |
720 | 720 | */ |
721 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-header-image-control.php' ); |
|
721 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-header-image-control.php'); |
|
722 | 722 | |
723 | 723 | /** |
724 | 724 | * WP_Customize_Theme_Control class. |
725 | 725 | */ |
726 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-theme-control.php' ); |
|
726 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-theme-control.php'); |
|
727 | 727 | |
728 | 728 | /** |
729 | 729 | * WP_Widget_Area_Customize_Control class. |
730 | 730 | */ |
731 | -require_once( ABSPATH . WPINC . '/customize/class-wp-widget-area-customize-control.php' ); |
|
731 | +require_once(ABSPATH.WPINC.'/customize/class-wp-widget-area-customize-control.php'); |
|
732 | 732 | |
733 | 733 | /** |
734 | 734 | * WP_Widget_Form_Customize_Control class. |
735 | 735 | */ |
736 | -require_once( ABSPATH . WPINC . '/customize/class-wp-widget-form-customize-control.php' ); |
|
736 | +require_once(ABSPATH.WPINC.'/customize/class-wp-widget-form-customize-control.php'); |
|
737 | 737 | |
738 | 738 | /** |
739 | 739 | * WP_Customize_Nav_Menu_Control class. |
740 | 740 | */ |
741 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-control.php' ); |
|
741 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-control.php'); |
|
742 | 742 | |
743 | 743 | /** |
744 | 744 | * WP_Customize_Nav_Menu_Item_Control class. |
745 | 745 | */ |
746 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-item-control.php' ); |
|
746 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-item-control.php'); |
|
747 | 747 | |
748 | 748 | /** |
749 | 749 | * WP_Customize_Nav_Menu_Location_Control class. |
750 | 750 | */ |
751 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-location-control.php' ); |
|
751 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-location-control.php'); |
|
752 | 752 | |
753 | 753 | /** |
754 | 754 | * WP_Customize_Nav_Menu_Name_Control class. |
755 | 755 | */ |
756 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-name-control.php' ); |
|
756 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-name-control.php'); |
|
757 | 757 | |
758 | 758 | /** |
759 | 759 | * WP_Customize_Nav_Menu_Auto_Add_Control class. |
760 | 760 | */ |
761 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-nav-menu-auto-add-control.php' ); |
|
761 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-nav-menu-auto-add-control.php'); |
|
762 | 762 | |
763 | 763 | /** |
764 | 764 | * WP_Customize_New_Menu_Control class. |
765 | 765 | */ |
766 | -require_once( ABSPATH . WPINC . '/customize/class-wp-customize-new-menu-control.php' ); |
|
766 | +require_once(ABSPATH.WPINC.'/customize/class-wp-customize-new-menu-control.php'); |
@@ -578,8 +578,9 @@ discard block |
||
578 | 578 | if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) { |
579 | 579 | $this->transform_query( $query, 'term_id' ); |
580 | 580 | |
581 | - if ( is_wp_error( $query ) ) |
|
582 | - return; |
|
581 | + if ( is_wp_error( $query ) ) { |
|
582 | + return; |
|
583 | + } |
|
583 | 584 | |
584 | 585 | $children = array(); |
585 | 586 | foreach ( $query['terms'] as $term ) { |
@@ -606,11 +607,13 @@ discard block |
||
606 | 607 | public function transform_query( &$query, $resulting_field ) { |
607 | 608 | global $wpdb; |
608 | 609 | |
609 | - if ( empty( $query['terms'] ) ) |
|
610 | - return; |
|
610 | + if ( empty( $query['terms'] ) ) { |
|
611 | + return; |
|
612 | + } |
|
611 | 613 | |
612 | - if ( $query['field'] == $resulting_field ) |
|
613 | - return; |
|
614 | + if ( $query['field'] == $resulting_field ) { |
|
615 | + return; |
|
616 | + } |
|
614 | 617 | |
615 | 618 | $resulting_field = sanitize_key( $resulting_field ); |
616 | 619 |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | * @access private |
51 | 51 | * @var string |
52 | 52 | */ |
53 | - private static $no_results = array( 'join' => array( '' ), 'where' => array( '0 = 1' ) ); |
|
53 | + private static $no_results = array('join' => array(''), 'where' => array('0 = 1')); |
|
54 | 54 | |
55 | 55 | /** |
56 | 56 | * A flat list of table aliases used in the JOIN clauses. |
@@ -118,14 +118,14 @@ discard block |
||
118 | 118 | * } |
119 | 119 | * } |
120 | 120 | */ |
121 | - public function __construct( $tax_query ) { |
|
122 | - if ( isset( $tax_query['relation'] ) ) { |
|
123 | - $this->relation = $this->sanitize_relation( $tax_query['relation'] ); |
|
121 | + public function __construct($tax_query) { |
|
122 | + if (isset($tax_query['relation'])) { |
|
123 | + $this->relation = $this->sanitize_relation($tax_query['relation']); |
|
124 | 124 | } else { |
125 | 125 | $this->relation = 'AND'; |
126 | 126 | } |
127 | 127 | |
128 | - $this->queries = $this->sanitize_query( $tax_query ); |
|
128 | + $this->queries = $this->sanitize_query($tax_query); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | /** |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | * @param array $queries Array of queries clauses. |
141 | 141 | * @return array Sanitized array of query clauses. |
142 | 142 | */ |
143 | - public function sanitize_query( $queries ) { |
|
143 | + public function sanitize_query($queries) { |
|
144 | 144 | $cleaned_query = array(); |
145 | 145 | |
146 | 146 | $defaults = array( |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | 'include_children' => true, |
152 | 152 | ); |
153 | 153 | |
154 | - foreach ( $queries as $key => $query ) { |
|
155 | - if ( 'relation' === $key ) { |
|
156 | - $cleaned_query['relation'] = $this->sanitize_relation( $query ); |
|
154 | + foreach ($queries as $key => $query) { |
|
155 | + if ('relation' === $key) { |
|
156 | + $cleaned_query['relation'] = $this->sanitize_relation($query); |
|
157 | 157 | |
158 | 158 | // First-order clause. |
159 | - } elseif ( self::is_first_order_clause( $query ) ) { |
|
159 | + } elseif (self::is_first_order_clause($query)) { |
|
160 | 160 | |
161 | - $cleaned_clause = array_merge( $defaults, $query ); |
|
161 | + $cleaned_clause = array_merge($defaults, $query); |
|
162 | 162 | $cleaned_clause['terms'] = (array) $cleaned_clause['terms']; |
163 | 163 | $cleaned_query[] = $cleaned_clause; |
164 | 164 | |
@@ -166,32 +166,32 @@ discard block |
||
166 | 166 | * Keep a copy of the clause in the flate |
167 | 167 | * $queried_terms array, for use in WP_Query. |
168 | 168 | */ |
169 | - if ( ! empty( $cleaned_clause['taxonomy'] ) && 'NOT IN' !== $cleaned_clause['operator'] ) { |
|
169 | + if ( ! empty($cleaned_clause['taxonomy']) && 'NOT IN' !== $cleaned_clause['operator']) { |
|
170 | 170 | $taxonomy = $cleaned_clause['taxonomy']; |
171 | - if ( ! isset( $this->queried_terms[ $taxonomy ] ) ) { |
|
172 | - $this->queried_terms[ $taxonomy ] = array(); |
|
171 | + if ( ! isset($this->queried_terms[$taxonomy])) { |
|
172 | + $this->queried_terms[$taxonomy] = array(); |
|
173 | 173 | } |
174 | 174 | |
175 | 175 | /* |
176 | 176 | * Backward compatibility: Only store the first |
177 | 177 | * 'terms' and 'field' found for a given taxonomy. |
178 | 178 | */ |
179 | - if ( ! empty( $cleaned_clause['terms'] ) && ! isset( $this->queried_terms[ $taxonomy ]['terms'] ) ) { |
|
180 | - $this->queried_terms[ $taxonomy ]['terms'] = $cleaned_clause['terms']; |
|
179 | + if ( ! empty($cleaned_clause['terms']) && ! isset($this->queried_terms[$taxonomy]['terms'])) { |
|
180 | + $this->queried_terms[$taxonomy]['terms'] = $cleaned_clause['terms']; |
|
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( $cleaned_clause['field'] ) && ! isset( $this->queried_terms[ $taxonomy ]['field'] ) ) { |
|
184 | - $this->queried_terms[ $taxonomy ]['field'] = $cleaned_clause['field']; |
|
183 | + if ( ! empty($cleaned_clause['field']) && ! isset($this->queried_terms[$taxonomy]['field'])) { |
|
184 | + $this->queried_terms[$taxonomy]['field'] = $cleaned_clause['field']; |
|
185 | 185 | } |
186 | 186 | } |
187 | 187 | |
188 | 188 | // Otherwise, it's a nested query, so we recurse. |
189 | - } elseif ( is_array( $query ) ) { |
|
190 | - $cleaned_subquery = $this->sanitize_query( $query ); |
|
189 | + } elseif (is_array($query)) { |
|
190 | + $cleaned_subquery = $this->sanitize_query($query); |
|
191 | 191 | |
192 | - if ( ! empty( $cleaned_subquery ) ) { |
|
192 | + if ( ! empty($cleaned_subquery)) { |
|
193 | 193 | // All queries with children must have a relation. |
194 | - if ( ! isset( $cleaned_subquery['relation'] ) ) { |
|
194 | + if ( ! isset($cleaned_subquery['relation'])) { |
|
195 | 195 | $cleaned_subquery['relation'] = 'AND'; |
196 | 196 | } |
197 | 197 | |
@@ -212,8 +212,8 @@ discard block |
||
212 | 212 | * @param string $relation Raw relation key from the query argument. |
213 | 213 | * @return string Sanitized relation ('AND' or 'OR'). |
214 | 214 | */ |
215 | - public function sanitize_relation( $relation ) { |
|
216 | - if ( 'OR' === strtoupper( $relation ) ) { |
|
215 | + public function sanitize_relation($relation) { |
|
216 | + if ('OR' === strtoupper($relation)) { |
|
217 | 217 | return 'OR'; |
218 | 218 | } else { |
219 | 219 | return 'AND'; |
@@ -237,8 +237,8 @@ discard block |
||
237 | 237 | * @param array $query Tax query arguments. |
238 | 238 | * @return bool Whether the query clause is a first-order clause. |
239 | 239 | */ |
240 | - protected static function is_first_order_clause( $query ) { |
|
241 | - return is_array( $query ) && ( empty( $query ) || array_key_exists( 'terms', $query ) || array_key_exists( 'taxonomy', $query ) || array_key_exists( 'include_children', $query ) || array_key_exists( 'field', $query ) || array_key_exists( 'operator', $query ) ); |
|
240 | + protected static function is_first_order_clause($query) { |
|
241 | + return is_array($query) && (empty($query) || array_key_exists('terms', $query) || array_key_exists('taxonomy', $query) || array_key_exists('include_children', $query) || array_key_exists('field', $query) || array_key_exists('operator', $query)); |
|
242 | 242 | } |
243 | 243 | |
244 | 244 | /** |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @type string $where SQL fragment to append to the main WHERE clause. |
259 | 259 | * } |
260 | 260 | */ |
261 | - public function get_sql( $primary_table, $primary_id_column ) { |
|
261 | + public function get_sql($primary_table, $primary_id_column) { |
|
262 | 262 | $this->primary_table = $primary_table; |
263 | 263 | $this->primary_id_column = $primary_id_column; |
264 | 264 | |
@@ -287,10 +287,10 @@ discard block |
||
287 | 287 | * To keep $this->queries unaltered, pass a copy. |
288 | 288 | */ |
289 | 289 | $queries = $this->queries; |
290 | - $sql = $this->get_sql_for_query( $queries ); |
|
290 | + $sql = $this->get_sql_for_query($queries); |
|
291 | 291 | |
292 | - if ( ! empty( $sql['where'] ) ) { |
|
293 | - $sql['where'] = ' AND ' . $sql['where']; |
|
292 | + if ( ! empty($sql['where'])) { |
|
293 | + $sql['where'] = ' AND '.$sql['where']; |
|
294 | 294 | } |
295 | 295 | |
296 | 296 | return $sql; |
@@ -315,7 +315,7 @@ discard block |
||
315 | 315 | * @type string $where SQL fragment to append to the main WHERE clause. |
316 | 316 | * } |
317 | 317 | */ |
318 | - protected function get_sql_for_query( &$query, $depth = 0 ) { |
|
318 | + protected function get_sql_for_query(&$query, $depth = 0) { |
|
319 | 319 | $sql_chunks = array( |
320 | 320 | 'join' => array(), |
321 | 321 | 'where' => array(), |
@@ -327,32 +327,32 @@ discard block |
||
327 | 327 | ); |
328 | 328 | |
329 | 329 | $indent = ''; |
330 | - for ( $i = 0; $i < $depth; $i++ ) { |
|
330 | + for ($i = 0; $i < $depth; $i++) { |
|
331 | 331 | $indent .= " "; |
332 | 332 | } |
333 | 333 | |
334 | - foreach ( $query as $key => &$clause ) { |
|
335 | - if ( 'relation' === $key ) { |
|
334 | + foreach ($query as $key => &$clause) { |
|
335 | + if ('relation' === $key) { |
|
336 | 336 | $relation = $query['relation']; |
337 | - } elseif ( is_array( $clause ) ) { |
|
337 | + } elseif (is_array($clause)) { |
|
338 | 338 | |
339 | 339 | // This is a first-order clause. |
340 | - if ( $this->is_first_order_clause( $clause ) ) { |
|
341 | - $clause_sql = $this->get_sql_for_clause( $clause, $query ); |
|
340 | + if ($this->is_first_order_clause($clause)) { |
|
341 | + $clause_sql = $this->get_sql_for_clause($clause, $query); |
|
342 | 342 | |
343 | - $where_count = count( $clause_sql['where'] ); |
|
344 | - if ( ! $where_count ) { |
|
343 | + $where_count = count($clause_sql['where']); |
|
344 | + if ( ! $where_count) { |
|
345 | 345 | $sql_chunks['where'][] = ''; |
346 | - } elseif ( 1 === $where_count ) { |
|
346 | + } elseif (1 === $where_count) { |
|
347 | 347 | $sql_chunks['where'][] = $clause_sql['where'][0]; |
348 | 348 | } else { |
349 | - $sql_chunks['where'][] = '( ' . implode( ' AND ', $clause_sql['where'] ) . ' )'; |
|
349 | + $sql_chunks['where'][] = '( '.implode(' AND ', $clause_sql['where']).' )'; |
|
350 | 350 | } |
351 | 351 | |
352 | - $sql_chunks['join'] = array_merge( $sql_chunks['join'], $clause_sql['join'] ); |
|
352 | + $sql_chunks['join'] = array_merge($sql_chunks['join'], $clause_sql['join']); |
|
353 | 353 | // This is a subquery, so we recurse. |
354 | 354 | } else { |
355 | - $clause_sql = $this->get_sql_for_query( $clause, $depth + 1 ); |
|
355 | + $clause_sql = $this->get_sql_for_query($clause, $depth + 1); |
|
356 | 356 | |
357 | 357 | $sql_chunks['where'][] = $clause_sql['where']; |
358 | 358 | $sql_chunks['join'][] = $clause_sql['join']; |
@@ -361,21 +361,21 @@ discard block |
||
361 | 361 | } |
362 | 362 | |
363 | 363 | // Filter to remove empties. |
364 | - $sql_chunks['join'] = array_filter( $sql_chunks['join'] ); |
|
365 | - $sql_chunks['where'] = array_filter( $sql_chunks['where'] ); |
|
364 | + $sql_chunks['join'] = array_filter($sql_chunks['join']); |
|
365 | + $sql_chunks['where'] = array_filter($sql_chunks['where']); |
|
366 | 366 | |
367 | - if ( empty( $relation ) ) { |
|
367 | + if (empty($relation)) { |
|
368 | 368 | $relation = 'AND'; |
369 | 369 | } |
370 | 370 | |
371 | 371 | // Filter duplicate JOIN clauses and combine into a single string. |
372 | - if ( ! empty( $sql_chunks['join'] ) ) { |
|
373 | - $sql['join'] = implode( ' ', array_unique( $sql_chunks['join'] ) ); |
|
372 | + if ( ! empty($sql_chunks['join'])) { |
|
373 | + $sql['join'] = implode(' ', array_unique($sql_chunks['join'])); |
|
374 | 374 | } |
375 | 375 | |
376 | 376 | // Generate a single WHERE clause with proper brackets and indentation. |
377 | - if ( ! empty( $sql_chunks['where'] ) ) { |
|
378 | - $sql['where'] = '( ' . "\n " . $indent . implode( ' ' . "\n " . $indent . $relation . ' ' . "\n " . $indent, $sql_chunks['where'] ) . "\n" . $indent . ')'; |
|
377 | + if ( ! empty($sql_chunks['where'])) { |
|
378 | + $sql['where'] = '( '."\n ".$indent.implode(' '."\n ".$indent.$relation.' '."\n ".$indent, $sql_chunks['where'])."\n".$indent.')'; |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | return $sql; |
@@ -398,7 +398,7 @@ discard block |
||
398 | 398 | * @type string $where SQL fragment to append to the main WHERE clause. |
399 | 399 | * } |
400 | 400 | */ |
401 | - public function get_sql_for_clause( &$clause, $parent_query ) { |
|
401 | + public function get_sql_for_clause(&$clause, $parent_query) { |
|
402 | 402 | global $wpdb; |
403 | 403 | |
404 | 404 | $sql = array( |
@@ -408,31 +408,31 @@ discard block |
||
408 | 408 | |
409 | 409 | $join = $where = ''; |
410 | 410 | |
411 | - $this->clean_query( $clause ); |
|
411 | + $this->clean_query($clause); |
|
412 | 412 | |
413 | - if ( is_wp_error( $clause ) ) { |
|
413 | + if (is_wp_error($clause)) { |
|
414 | 414 | return self::$no_results; |
415 | 415 | } |
416 | 416 | |
417 | 417 | $terms = $clause['terms']; |
418 | - $operator = strtoupper( $clause['operator'] ); |
|
418 | + $operator = strtoupper($clause['operator']); |
|
419 | 419 | |
420 | - if ( 'IN' == $operator ) { |
|
420 | + if ('IN' == $operator) { |
|
421 | 421 | |
422 | - if ( empty( $terms ) ) { |
|
422 | + if (empty($terms)) { |
|
423 | 423 | return self::$no_results; |
424 | 424 | } |
425 | 425 | |
426 | - $terms = implode( ',', $terms ); |
|
426 | + $terms = implode(',', $terms); |
|
427 | 427 | |
428 | 428 | /* |
429 | 429 | * Before creating another table join, see if this clause has a |
430 | 430 | * sibling with an existing join that can be shared. |
431 | 431 | */ |
432 | - $alias = $this->find_compatible_table_alias( $clause, $parent_query ); |
|
433 | - if ( false === $alias ) { |
|
434 | - $i = count( $this->table_aliases ); |
|
435 | - $alias = $i ? 'tt' . $i : $wpdb->term_relationships; |
|
432 | + $alias = $this->find_compatible_table_alias($clause, $parent_query); |
|
433 | + if (false === $alias) { |
|
434 | + $i = count($this->table_aliases); |
|
435 | + $alias = $i ? 'tt'.$i : $wpdb->term_relationships; |
|
436 | 436 | |
437 | 437 | // Store the alias as part of a flat array to build future iterators. |
438 | 438 | $this->table_aliases[] = $alias; |
@@ -448,13 +448,13 @@ discard block |
||
448 | 448 | |
449 | 449 | $where = "$alias.term_taxonomy_id $operator ($terms)"; |
450 | 450 | |
451 | - } elseif ( 'NOT IN' == $operator ) { |
|
451 | + } elseif ('NOT IN' == $operator) { |
|
452 | 452 | |
453 | - if ( empty( $terms ) ) { |
|
453 | + if (empty($terms)) { |
|
454 | 454 | return $sql; |
455 | 455 | } |
456 | 456 | |
457 | - $terms = implode( ',', $terms ); |
|
457 | + $terms = implode(',', $terms); |
|
458 | 458 | |
459 | 459 | $where = "$this->primary_table.$this->primary_id_column NOT IN ( |
460 | 460 | SELECT object_id |
@@ -462,15 +462,15 @@ discard block |
||
462 | 462 | WHERE term_taxonomy_id IN ($terms) |
463 | 463 | )"; |
464 | 464 | |
465 | - } elseif ( 'AND' == $operator ) { |
|
465 | + } elseif ('AND' == $operator) { |
|
466 | 466 | |
467 | - if ( empty( $terms ) ) { |
|
467 | + if (empty($terms)) { |
|
468 | 468 | return $sql; |
469 | 469 | } |
470 | 470 | |
471 | - $num_terms = count( $terms ); |
|
471 | + $num_terms = count($terms); |
|
472 | 472 | |
473 | - $terms = implode( ',', $terms ); |
|
473 | + $terms = implode(',', $terms); |
|
474 | 474 | |
475 | 475 | $where = "( |
476 | 476 | SELECT COUNT(1) |
@@ -479,16 +479,16 @@ discard block |
||
479 | 479 | AND object_id = $this->primary_table.$this->primary_id_column |
480 | 480 | ) = $num_terms"; |
481 | 481 | |
482 | - } elseif ( 'NOT EXISTS' === $operator || 'EXISTS' === $operator ) { |
|
482 | + } elseif ('NOT EXISTS' === $operator || 'EXISTS' === $operator) { |
|
483 | 483 | |
484 | - $where = $wpdb->prepare( "$operator ( |
|
484 | + $where = $wpdb->prepare("$operator ( |
|
485 | 485 | SELECT 1 |
486 | 486 | FROM $wpdb->term_relationships |
487 | 487 | INNER JOIN $wpdb->term_taxonomy |
488 | 488 | ON $wpdb->term_taxonomy.term_taxonomy_id = $wpdb->term_relationships.term_taxonomy_id |
489 | 489 | WHERE $wpdb->term_taxonomy.taxonomy = %s |
490 | 490 | AND $wpdb->term_relationships.object_id = $this->primary_table.$this->primary_id_column |
491 | - )", $clause['taxonomy'] ); |
|
491 | + )", $clause['taxonomy']); |
|
492 | 492 | |
493 | 493 | } |
494 | 494 | |
@@ -517,32 +517,32 @@ discard block |
||
517 | 517 | * @param array $parent_query Parent query of $clause. |
518 | 518 | * @return string|false Table alias if found, otherwise false. |
519 | 519 | */ |
520 | - protected function find_compatible_table_alias( $clause, $parent_query ) { |
|
520 | + protected function find_compatible_table_alias($clause, $parent_query) { |
|
521 | 521 | $alias = false; |
522 | 522 | |
523 | 523 | // Sanity check. Only IN queries use the JOIN syntax . |
524 | - if ( ! isset( $clause['operator'] ) || 'IN' !== $clause['operator'] ) { |
|
524 | + if ( ! isset($clause['operator']) || 'IN' !== $clause['operator']) { |
|
525 | 525 | return $alias; |
526 | 526 | } |
527 | 527 | |
528 | 528 | // Since we're only checking IN queries, we're only concerned with OR relations. |
529 | - if ( ! isset( $parent_query['relation'] ) || 'OR' !== $parent_query['relation'] ) { |
|
529 | + if ( ! isset($parent_query['relation']) || 'OR' !== $parent_query['relation']) { |
|
530 | 530 | return $alias; |
531 | 531 | } |
532 | 532 | |
533 | - $compatible_operators = array( 'IN' ); |
|
533 | + $compatible_operators = array('IN'); |
|
534 | 534 | |
535 | - foreach ( $parent_query as $sibling ) { |
|
536 | - if ( ! is_array( $sibling ) || ! $this->is_first_order_clause( $sibling ) ) { |
|
535 | + foreach ($parent_query as $sibling) { |
|
536 | + if ( ! is_array($sibling) || ! $this->is_first_order_clause($sibling)) { |
|
537 | 537 | continue; |
538 | 538 | } |
539 | 539 | |
540 | - if ( empty( $sibling['alias'] ) || empty( $sibling['operator'] ) ) { |
|
540 | + if (empty($sibling['alias']) || empty($sibling['operator'])) { |
|
541 | 541 | continue; |
542 | 542 | } |
543 | 543 | |
544 | 544 | // The sibling must both have compatible operator to share its alias. |
545 | - if ( in_array( strtoupper( $sibling['operator'] ), $compatible_operators ) ) { |
|
545 | + if (in_array(strtoupper($sibling['operator']), $compatible_operators)) { |
|
546 | 546 | $alias = $sibling['alias']; |
547 | 547 | break; |
548 | 548 | } |
@@ -559,37 +559,37 @@ discard block |
||
559 | 559 | * |
560 | 560 | * @param array $query The single query. Passed by reference. |
561 | 561 | */ |
562 | - private function clean_query( &$query ) { |
|
563 | - if ( empty( $query['taxonomy'] ) ) { |
|
564 | - if ( 'term_taxonomy_id' !== $query['field'] ) { |
|
565 | - $query = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); |
|
562 | + private function clean_query(&$query) { |
|
563 | + if (empty($query['taxonomy'])) { |
|
564 | + if ('term_taxonomy_id' !== $query['field']) { |
|
565 | + $query = new WP_Error('invalid_taxonomy', __('Invalid taxonomy.')); |
|
566 | 566 | return; |
567 | 567 | } |
568 | 568 | |
569 | 569 | // so long as there are shared terms, include_children requires that a taxonomy is set |
570 | 570 | $query['include_children'] = false; |
571 | - } elseif ( ! taxonomy_exists( $query['taxonomy'] ) ) { |
|
572 | - $query = new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) ); |
|
571 | + } elseif ( ! taxonomy_exists($query['taxonomy'])) { |
|
572 | + $query = new WP_Error('invalid_taxonomy', __('Invalid taxonomy.')); |
|
573 | 573 | return; |
574 | 574 | } |
575 | 575 | |
576 | - $query['terms'] = array_unique( (array) $query['terms'] ); |
|
576 | + $query['terms'] = array_unique((array) $query['terms']); |
|
577 | 577 | |
578 | - if ( is_taxonomy_hierarchical( $query['taxonomy'] ) && $query['include_children'] ) { |
|
579 | - $this->transform_query( $query, 'term_id' ); |
|
578 | + if (is_taxonomy_hierarchical($query['taxonomy']) && $query['include_children']) { |
|
579 | + $this->transform_query($query, 'term_id'); |
|
580 | 580 | |
581 | - if ( is_wp_error( $query ) ) |
|
581 | + if (is_wp_error($query)) |
|
582 | 582 | return; |
583 | 583 | |
584 | 584 | $children = array(); |
585 | - foreach ( $query['terms'] as $term ) { |
|
586 | - $children = array_merge( $children, get_term_children( $term, $query['taxonomy'] ) ); |
|
585 | + foreach ($query['terms'] as $term) { |
|
586 | + $children = array_merge($children, get_term_children($term, $query['taxonomy'])); |
|
587 | 587 | $children[] = $term; |
588 | 588 | } |
589 | 589 | $query['terms'] = $children; |
590 | 590 | } |
591 | 591 | |
592 | - $this->transform_query( $query, 'term_taxonomy_id' ); |
|
592 | + $this->transform_query($query, 'term_taxonomy_id'); |
|
593 | 593 | } |
594 | 594 | |
595 | 595 | /** |
@@ -603,64 +603,64 @@ discard block |
||
603 | 603 | * @param string $resulting_field The resulting field. Accepts 'slug', 'name', 'term_taxonomy_id', |
604 | 604 | * or 'term_id'. Default 'term_id'. |
605 | 605 | */ |
606 | - public function transform_query( &$query, $resulting_field ) { |
|
606 | + public function transform_query(&$query, $resulting_field) { |
|
607 | 607 | global $wpdb; |
608 | 608 | |
609 | - if ( empty( $query['terms'] ) ) |
|
609 | + if (empty($query['terms'])) |
|
610 | 610 | return; |
611 | 611 | |
612 | - if ( $query['field'] == $resulting_field ) |
|
612 | + if ($query['field'] == $resulting_field) |
|
613 | 613 | return; |
614 | 614 | |
615 | - $resulting_field = sanitize_key( $resulting_field ); |
|
615 | + $resulting_field = sanitize_key($resulting_field); |
|
616 | 616 | |
617 | - switch ( $query['field'] ) { |
|
617 | + switch ($query['field']) { |
|
618 | 618 | case 'slug': |
619 | 619 | case 'name': |
620 | - foreach ( $query['terms'] as &$term ) { |
|
620 | + foreach ($query['terms'] as &$term) { |
|
621 | 621 | /* |
622 | 622 | * 0 is the $term_id parameter. We don't have a term ID yet, but it doesn't |
623 | 623 | * matter because `sanitize_term_field()` ignores the $term_id param when the |
624 | 624 | * context is 'db'. |
625 | 625 | */ |
626 | - $clean_term = sanitize_term_field( $query['field'], $term, 0, $query['taxonomy'], 'db' ); |
|
626 | + $clean_term = sanitize_term_field($query['field'], $term, 0, $query['taxonomy'], 'db'); |
|
627 | 627 | |
628 | 628 | // Match sanitization in wp_insert_term(). |
629 | - $clean_term = wp_unslash( $clean_term ); |
|
629 | + $clean_term = wp_unslash($clean_term); |
|
630 | 630 | |
631 | - $term = "'" . esc_sql( $clean_term ) . "'"; |
|
631 | + $term = "'".esc_sql($clean_term)."'"; |
|
632 | 632 | } |
633 | 633 | |
634 | - $terms = implode( ",", $query['terms'] ); |
|
634 | + $terms = implode(",", $query['terms']); |
|
635 | 635 | |
636 | - $terms = $wpdb->get_col( " |
|
636 | + $terms = $wpdb->get_col(" |
|
637 | 637 | SELECT $wpdb->term_taxonomy.$resulting_field |
638 | 638 | FROM $wpdb->term_taxonomy |
639 | 639 | INNER JOIN $wpdb->terms USING (term_id) |
640 | 640 | WHERE taxonomy = '{$query['taxonomy']}' |
641 | 641 | AND $wpdb->terms.{$query['field']} IN ($terms) |
642 | - " ); |
|
642 | + "); |
|
643 | 643 | break; |
644 | 644 | case 'term_taxonomy_id': |
645 | - $terms = implode( ',', array_map( 'intval', $query['terms'] ) ); |
|
646 | - $terms = $wpdb->get_col( " |
|
645 | + $terms = implode(',', array_map('intval', $query['terms'])); |
|
646 | + $terms = $wpdb->get_col(" |
|
647 | 647 | SELECT $resulting_field |
648 | 648 | FROM $wpdb->term_taxonomy |
649 | 649 | WHERE term_taxonomy_id IN ($terms) |
650 | - " ); |
|
650 | + "); |
|
651 | 651 | break; |
652 | 652 | default: |
653 | - $terms = implode( ',', array_map( 'intval', $query['terms'] ) ); |
|
654 | - $terms = $wpdb->get_col( " |
|
653 | + $terms = implode(',', array_map('intval', $query['terms'])); |
|
654 | + $terms = $wpdb->get_col(" |
|
655 | 655 | SELECT $resulting_field |
656 | 656 | FROM $wpdb->term_taxonomy |
657 | 657 | WHERE taxonomy = '{$query['taxonomy']}' |
658 | 658 | AND term_id IN ($terms) |
659 | - " ); |
|
659 | + "); |
|
660 | 660 | } |
661 | 661 | |
662 | - if ( 'AND' == $query['operator'] && count( $terms ) < count( $query['terms'] ) ) { |
|
663 | - $query = new WP_Error( 'inexistent_terms', __( 'Inexistent terms.' ) ); |
|
662 | + if ('AND' == $query['operator'] && count($terms) < count($query['terms'])) { |
|
663 | + $query = new WP_Error('inexistent_terms', __('Inexistent terms.')); |
|
664 | 664 | return; |
665 | 665 | } |
666 | 666 |
@@ -258,16 +258,16 @@ |
||
258 | 258 | } |
259 | 259 | |
260 | 260 | /** |
261 | - * paged_walk() - produce a page of nested elements |
|
262 | - * |
|
263 | - * Given an array of hierarchical elements, the maximum depth, a specific page number, |
|
264 | - * and number of elements per page, this function first determines all top level root elements |
|
265 | - * belonging to that page, then lists them and all of their children in hierarchical order. |
|
266 | - * |
|
261 | + * paged_walk() - produce a page of nested elements |
|
262 | + * |
|
263 | + * Given an array of hierarchical elements, the maximum depth, a specific page number, |
|
264 | + * and number of elements per page, this function first determines all top level root elements |
|
265 | + * belonging to that page, then lists them and all of their children in hierarchical order. |
|
266 | + * |
|
267 | 267 | * $max_depth = 0 means display all levels. |
268 | 268 | * $max_depth > 0 specifies the number of display levels. |
269 | 269 | * |
270 | - * @since 2.7.0 |
|
270 | + * @since 2.7.0 |
|
271 | 271 | * |
272 | 272 | * @param array $elements |
273 | 273 | * @param int $max_depth The maximum hierarchical depth. |
@@ -201,8 +201,9 @@ discard block |
||
201 | 201 | // flat display |
202 | 202 | if ( -1 == $max_depth ) { |
203 | 203 | $empty_array = array(); |
204 | - foreach ( $elements as $e ) |
|
205 | - $this->display_element( $e, $empty_array, 1, 0, $args, $output ); |
|
204 | + foreach ( $elements as $e ) { |
|
205 | + $this->display_element( $e, $empty_array, 1, 0, $args, $output ); |
|
206 | + } |
|
206 | 207 | return $output; |
207 | 208 | } |
208 | 209 | |
@@ -215,10 +216,11 @@ discard block |
||
215 | 216 | $top_level_elements = array(); |
216 | 217 | $children_elements = array(); |
217 | 218 | foreach ( $elements as $e) { |
218 | - if ( empty( $e->$parent_field ) ) |
|
219 | - $top_level_elements[] = $e; |
|
220 | - else |
|
221 | - $children_elements[ $e->$parent_field ][] = $e; |
|
219 | + if ( empty( $e->$parent_field ) ) { |
|
220 | + $top_level_elements[] = $e; |
|
221 | + } else { |
|
222 | + $children_elements[ $e->$parent_field ][] = $e; |
|
223 | + } |
|
222 | 224 | } |
223 | 225 | |
224 | 226 | /* |
@@ -233,15 +235,17 @@ discard block |
||
233 | 235 | $top_level_elements = array(); |
234 | 236 | $children_elements = array(); |
235 | 237 | foreach ( $elements as $e) { |
236 | - if ( $root->$parent_field == $e->$parent_field ) |
|
237 | - $top_level_elements[] = $e; |
|
238 | - else |
|
239 | - $children_elements[ $e->$parent_field ][] = $e; |
|
238 | + if ( $root->$parent_field == $e->$parent_field ) { |
|
239 | + $top_level_elements[] = $e; |
|
240 | + } else { |
|
241 | + $children_elements[ $e->$parent_field ][] = $e; |
|
242 | + } |
|
240 | 243 | } |
241 | 244 | } |
242 | 245 | |
243 | - foreach ( $top_level_elements as $e ) |
|
244 | - $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); |
|
246 | + foreach ( $top_level_elements as $e ) { |
|
247 | + $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); |
|
248 | + } |
|
245 | 249 | |
246 | 250 | /* |
247 | 251 | * If we are displaying all levels, and remaining children_elements is not empty, |
@@ -249,9 +253,10 @@ discard block |
||
249 | 253 | */ |
250 | 254 | if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) { |
251 | 255 | $empty_array = array(); |
252 | - foreach ( $children_elements as $orphans ) |
|
253 | - foreach ( $orphans as $op ) |
|
256 | + foreach ( $children_elements as $orphans ) { |
|
257 | + foreach ( $orphans as $op ) |
|
254 | 258 | $this->display_element( $op, $empty_array, 1, 0, $args, $output ); |
259 | + } |
|
255 | 260 | } |
256 | 261 | |
257 | 262 | return $output; |
@@ -286,21 +291,24 @@ discard block |
||
286 | 291 | $parent_field = $this->db_fields['parent']; |
287 | 292 | |
288 | 293 | $count = -1; |
289 | - if ( -1 == $max_depth ) |
|
290 | - $total_top = count( $elements ); |
|
294 | + if ( -1 == $max_depth ) { |
|
295 | + $total_top = count( $elements ); |
|
296 | + } |
|
291 | 297 | if ( $page_num < 1 || $per_page < 0 ) { |
292 | 298 | // No paging |
293 | 299 | $paging = false; |
294 | 300 | $start = 0; |
295 | - if ( -1 == $max_depth ) |
|
296 | - $end = $total_top; |
|
301 | + if ( -1 == $max_depth ) { |
|
302 | + $end = $total_top; |
|
303 | + } |
|
297 | 304 | $this->max_pages = 1; |
298 | 305 | } else { |
299 | 306 | $paging = true; |
300 | 307 | $start = ( (int)$page_num - 1 ) * (int)$per_page; |
301 | 308 | $end = $start + $per_page; |
302 | - if ( -1 == $max_depth ) |
|
303 | - $this->max_pages = ceil($total_top / $per_page); |
|
309 | + if ( -1 == $max_depth ) { |
|
310 | + $this->max_pages = ceil($total_top / $per_page); |
|
311 | + } |
|
304 | 312 | } |
305 | 313 | |
306 | 314 | // flat display |
@@ -315,10 +323,12 @@ discard block |
||
315 | 323 | $empty_array = array(); |
316 | 324 | foreach ( $elements as $e ) { |
317 | 325 | $count++; |
318 | - if ( $count < $start ) |
|
319 | - continue; |
|
320 | - if ( $count >= $end ) |
|
321 | - break; |
|
326 | + if ( $count < $start ) { |
|
327 | + continue; |
|
328 | + } |
|
329 | + if ( $count >= $end ) { |
|
330 | + break; |
|
331 | + } |
|
322 | 332 | $this->display_element( $e, $empty_array, 1, 0, $args, $output ); |
323 | 333 | } |
324 | 334 | return $output; |
@@ -332,17 +342,19 @@ discard block |
||
332 | 342 | $top_level_elements = array(); |
333 | 343 | $children_elements = array(); |
334 | 344 | foreach ( $elements as $e) { |
335 | - if ( 0 == $e->$parent_field ) |
|
336 | - $top_level_elements[] = $e; |
|
337 | - else |
|
338 | - $children_elements[ $e->$parent_field ][] = $e; |
|
345 | + if ( 0 == $e->$parent_field ) { |
|
346 | + $top_level_elements[] = $e; |
|
347 | + } else { |
|
348 | + $children_elements[ $e->$parent_field ][] = $e; |
|
349 | + } |
|
339 | 350 | } |
340 | 351 | |
341 | 352 | $total_top = count( $top_level_elements ); |
342 | - if ( $paging ) |
|
343 | - $this->max_pages = ceil($total_top / $per_page); |
|
344 | - else |
|
345 | - $end = $total_top; |
|
353 | + if ( $paging ) { |
|
354 | + $this->max_pages = ceil($total_top / $per_page); |
|
355 | + } else { |
|
356 | + $end = $total_top; |
|
357 | + } |
|
346 | 358 | |
347 | 359 | if ( !empty($args[0]['reverse_top_level']) ) { |
348 | 360 | $top_level_elements = array_reverse( $top_level_elements ); |
@@ -351,31 +363,36 @@ discard block |
||
351 | 363 | $end = $total_top - $oldstart; |
352 | 364 | } |
353 | 365 | if ( !empty($args[0]['reverse_children']) ) { |
354 | - foreach ( $children_elements as $parent => $children ) |
|
355 | - $children_elements[$parent] = array_reverse( $children ); |
|
366 | + foreach ( $children_elements as $parent => $children ) { |
|
367 | + $children_elements[$parent] = array_reverse( $children ); |
|
368 | + } |
|
356 | 369 | } |
357 | 370 | |
358 | 371 | foreach ( $top_level_elements as $e ) { |
359 | 372 | $count++; |
360 | 373 | |
361 | 374 | // For the last page, need to unset earlier children in order to keep track of orphans. |
362 | - if ( $end >= $total_top && $count < $start ) |
|
363 | - $this->unset_children( $e, $children_elements ); |
|
375 | + if ( $end >= $total_top && $count < $start ) { |
|
376 | + $this->unset_children( $e, $children_elements ); |
|
377 | + } |
|
364 | 378 | |
365 | - if ( $count < $start ) |
|
366 | - continue; |
|
379 | + if ( $count < $start ) { |
|
380 | + continue; |
|
381 | + } |
|
367 | 382 | |
368 | - if ( $count >= $end ) |
|
369 | - break; |
|
383 | + if ( $count >= $end ) { |
|
384 | + break; |
|
385 | + } |
|
370 | 386 | |
371 | 387 | $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); |
372 | 388 | } |
373 | 389 | |
374 | 390 | if ( $end >= $total_top && count( $children_elements ) > 0 ) { |
375 | 391 | $empty_array = array(); |
376 | - foreach ( $children_elements as $orphans ) |
|
377 | - foreach ( $orphans as $op ) |
|
392 | + foreach ( $children_elements as $orphans ) { |
|
393 | + foreach ( $orphans as $op ) |
|
378 | 394 | $this->display_element( $op, $empty_array, 1, 0, $args, $output ); |
395 | + } |
|
379 | 396 | } |
380 | 397 | |
381 | 398 | return $output; |
@@ -395,8 +412,9 @@ discard block |
||
395 | 412 | $parent_field = $this->db_fields['parent']; |
396 | 413 | |
397 | 414 | foreach ( $elements as $e) { |
398 | - if ( 0 == $e->$parent_field ) |
|
399 | - $num++; |
|
415 | + if ( 0 == $e->$parent_field ) { |
|
416 | + $num++; |
|
417 | + } |
|
400 | 418 | } |
401 | 419 | return $num; |
402 | 420 | } |
@@ -415,9 +433,10 @@ discard block |
||
415 | 433 | $id_field = $this->db_fields['id']; |
416 | 434 | $id = $e->$id_field; |
417 | 435 | |
418 | - if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) ) |
|
419 | - foreach ( (array) $children_elements[$id] as $child ) |
|
436 | + if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) ) { |
|
437 | + foreach ( (array) $children_elements[$id] as $child ) |
|
420 | 438 | $this->unset_children( $child, $children_elements ); |
439 | + } |
|
421 | 440 | |
422 | 441 | unset( $children_elements[ $id ] ); |
423 | 442 | } |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * @param int $depth Depth of the item. |
61 | 61 | * @param array $args An array of additional arguments. |
62 | 62 | */ |
63 | - public function start_lvl( &$output, $depth = 0, $args = array() ) {} |
|
63 | + public function start_lvl(&$output, $depth = 0, $args = array()) {} |
|
64 | 64 | |
65 | 65 | /** |
66 | 66 | * Ends the list of after the elements are added. |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | * @param int $depth Depth of the item. |
76 | 76 | * @param array $args An array of additional arguments. |
77 | 77 | */ |
78 | - public function end_lvl( &$output, $depth = 0, $args = array() ) {} |
|
78 | + public function end_lvl(&$output, $depth = 0, $args = array()) {} |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Start the element output. |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | * @param array $args An array of additional arguments. |
93 | 93 | * @param int $current_object_id ID of the current item. |
94 | 94 | */ |
95 | - public function start_el( &$output, $object, $depth = 0, $args = array(), $current_object_id = 0 ) {} |
|
95 | + public function start_el(&$output, $object, $depth = 0, $args = array(), $current_object_id = 0) {} |
|
96 | 96 | |
97 | 97 | /** |
98 | 98 | * Ends the element output, if needed. |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | * @param int $depth Depth of the item. |
108 | 108 | * @param array $args An array of additional arguments. |
109 | 109 | */ |
110 | - public function end_el( &$output, $object, $depth = 0, $args = array() ) {} |
|
110 | + public function end_el(&$output, $object, $depth = 0, $args = array()) {} |
|
111 | 111 | |
112 | 112 | /** |
113 | 113 | * Traverse elements to create list from elements. |
@@ -128,8 +128,8 @@ discard block |
||
128 | 128 | * @param array $args An array of arguments. |
129 | 129 | * @param string $output Passed by reference. Used to append additional content. |
130 | 130 | */ |
131 | - public function display_element( $element, &$children_elements, $max_depth, $depth, $args, &$output ) { |
|
132 | - if ( ! $element ) { |
|
131 | + public function display_element($element, &$children_elements, $max_depth, $depth, $args, &$output) { |
|
132 | + if ( ! $element) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | |
@@ -137,38 +137,38 @@ discard block |
||
137 | 137 | $id = $element->$id_field; |
138 | 138 | |
139 | 139 | //display this element |
140 | - $this->has_children = ! empty( $children_elements[ $id ] ); |
|
141 | - if ( isset( $args[0] ) && is_array( $args[0] ) ) { |
|
140 | + $this->has_children = ! empty($children_elements[$id]); |
|
141 | + if (isset($args[0]) && is_array($args[0])) { |
|
142 | 142 | $args[0]['has_children'] = $this->has_children; // Back-compat. |
143 | 143 | } |
144 | 144 | |
145 | - $cb_args = array_merge( array(&$output, $element, $depth), $args); |
|
145 | + $cb_args = array_merge(array(&$output, $element, $depth), $args); |
|
146 | 146 | call_user_func_array(array($this, 'start_el'), $cb_args); |
147 | 147 | |
148 | 148 | // descend only when the depth is right and there are childrens for this element |
149 | - if ( ($max_depth == 0 || $max_depth > $depth+1 ) && isset( $children_elements[$id]) ) { |
|
149 | + if (($max_depth == 0 || $max_depth > $depth + 1) && isset($children_elements[$id])) { |
|
150 | 150 | |
151 | - foreach ( $children_elements[ $id ] as $child ){ |
|
151 | + foreach ($children_elements[$id] as $child) { |
|
152 | 152 | |
153 | - if ( !isset($newlevel) ) { |
|
153 | + if ( ! isset($newlevel)) { |
|
154 | 154 | $newlevel = true; |
155 | 155 | //start the child delimiter |
156 | - $cb_args = array_merge( array(&$output, $depth), $args); |
|
156 | + $cb_args = array_merge(array(&$output, $depth), $args); |
|
157 | 157 | call_user_func_array(array($this, 'start_lvl'), $cb_args); |
158 | 158 | } |
159 | - $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); |
|
159 | + $this->display_element($child, $children_elements, $max_depth, $depth + 1, $args, $output); |
|
160 | 160 | } |
161 | - unset( $children_elements[ $id ] ); |
|
161 | + unset($children_elements[$id]); |
|
162 | 162 | } |
163 | 163 | |
164 | - if ( isset($newlevel) && $newlevel ){ |
|
164 | + if (isset($newlevel) && $newlevel) { |
|
165 | 165 | //end the child delimiter |
166 | - $cb_args = array_merge( array(&$output, $depth), $args); |
|
166 | + $cb_args = array_merge(array(&$output, $depth), $args); |
|
167 | 167 | call_user_func_array(array($this, 'end_lvl'), $cb_args); |
168 | 168 | } |
169 | 169 | |
170 | 170 | //end this element |
171 | - $cb_args = array_merge( array(&$output, $element, $depth), $args); |
|
171 | + $cb_args = array_merge(array(&$output, $element, $depth), $args); |
|
172 | 172 | call_user_func_array(array($this, 'end_el'), $cb_args); |
173 | 173 | } |
174 | 174 | |
@@ -187,12 +187,12 @@ discard block |
||
187 | 187 | * @param int $max_depth The maximum hierarchical depth. |
188 | 188 | * @return string The hierarchical item output. |
189 | 189 | */ |
190 | - public function walk( $elements, $max_depth ) { |
|
190 | + public function walk($elements, $max_depth) { |
|
191 | 191 | $args = array_slice(func_get_args(), 2); |
192 | 192 | $output = ''; |
193 | 193 | |
194 | 194 | //invalid parameter or nothing to walk |
195 | - if ( $max_depth < -1 || empty( $elements ) ) { |
|
195 | + if ($max_depth < -1 || empty($elements)) { |
|
196 | 196 | return $output; |
197 | 197 | } |
198 | 198 | |
@@ -201,8 +201,8 @@ discard block |
||
201 | 201 | // flat display |
202 | 202 | if ( -1 == $max_depth ) { |
203 | 203 | $empty_array = array(); |
204 | - foreach ( $elements as $e ) |
|
205 | - $this->display_element( $e, $empty_array, 1, 0, $args, $output ); |
|
204 | + foreach ($elements as $e) |
|
205 | + $this->display_element($e, $empty_array, 1, 0, $args, $output); |
|
206 | 206 | return $output; |
207 | 207 | } |
208 | 208 | |
@@ -214,44 +214,44 @@ discard block |
||
214 | 214 | */ |
215 | 215 | $top_level_elements = array(); |
216 | 216 | $children_elements = array(); |
217 | - foreach ( $elements as $e) { |
|
218 | - if ( empty( $e->$parent_field ) ) |
|
217 | + foreach ($elements as $e) { |
|
218 | + if (empty($e->$parent_field)) |
|
219 | 219 | $top_level_elements[] = $e; |
220 | 220 | else |
221 | - $children_elements[ $e->$parent_field ][] = $e; |
|
221 | + $children_elements[$e->$parent_field][] = $e; |
|
222 | 222 | } |
223 | 223 | |
224 | 224 | /* |
225 | 225 | * When none of the elements is top level. |
226 | 226 | * Assume the first one must be root of the sub elements. |
227 | 227 | */ |
228 | - if ( empty($top_level_elements) ) { |
|
228 | + if (empty($top_level_elements)) { |
|
229 | 229 | |
230 | - $first = array_slice( $elements, 0, 1 ); |
|
230 | + $first = array_slice($elements, 0, 1); |
|
231 | 231 | $root = $first[0]; |
232 | 232 | |
233 | 233 | $top_level_elements = array(); |
234 | 234 | $children_elements = array(); |
235 | - foreach ( $elements as $e) { |
|
236 | - if ( $root->$parent_field == $e->$parent_field ) |
|
235 | + foreach ($elements as $e) { |
|
236 | + if ($root->$parent_field == $e->$parent_field) |
|
237 | 237 | $top_level_elements[] = $e; |
238 | 238 | else |
239 | - $children_elements[ $e->$parent_field ][] = $e; |
|
239 | + $children_elements[$e->$parent_field][] = $e; |
|
240 | 240 | } |
241 | 241 | } |
242 | 242 | |
243 | - foreach ( $top_level_elements as $e ) |
|
244 | - $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); |
|
243 | + foreach ($top_level_elements as $e) |
|
244 | + $this->display_element($e, $children_elements, $max_depth, 0, $args, $output); |
|
245 | 245 | |
246 | 246 | /* |
247 | 247 | * If we are displaying all levels, and remaining children_elements is not empty, |
248 | 248 | * then we got orphans, which should be displayed regardless. |
249 | 249 | */ |
250 | - if ( ( $max_depth == 0 ) && count( $children_elements ) > 0 ) { |
|
250 | + if (($max_depth == 0) && count($children_elements) > 0) { |
|
251 | 251 | $empty_array = array(); |
252 | - foreach ( $children_elements as $orphans ) |
|
253 | - foreach ( $orphans as $op ) |
|
254 | - $this->display_element( $op, $empty_array, 1, 0, $args, $output ); |
|
252 | + foreach ($children_elements as $orphans) |
|
253 | + foreach ($orphans as $op) |
|
254 | + $this->display_element($op, $empty_array, 1, 0, $args, $output); |
|
255 | 255 | } |
256 | 256 | |
257 | 257 | return $output; |
@@ -275,20 +275,20 @@ discard block |
||
275 | 275 | * @param int $per_page |
276 | 276 | * @return string XHTML of the specified page of elements |
277 | 277 | */ |
278 | - public function paged_walk( $elements, $max_depth, $page_num, $per_page ) { |
|
279 | - if ( empty( $elements ) || $max_depth < -1 ) { |
|
278 | + public function paged_walk($elements, $max_depth, $page_num, $per_page) { |
|
279 | + if (empty($elements) || $max_depth < -1) { |
|
280 | 280 | return ''; |
281 | 281 | } |
282 | 282 | |
283 | - $args = array_slice( func_get_args(), 4 ); |
|
283 | + $args = array_slice(func_get_args(), 4); |
|
284 | 284 | $output = ''; |
285 | 285 | |
286 | 286 | $parent_field = $this->db_fields['parent']; |
287 | 287 | |
288 | 288 | $count = -1; |
289 | 289 | if ( -1 == $max_depth ) |
290 | - $total_top = count( $elements ); |
|
291 | - if ( $page_num < 1 || $per_page < 0 ) { |
|
290 | + $total_top = count($elements); |
|
291 | + if ($page_num < 1 || $per_page < 0) { |
|
292 | 292 | // No paging |
293 | 293 | $paging = false; |
294 | 294 | $start = 0; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | $this->max_pages = 1; |
298 | 298 | } else { |
299 | 299 | $paging = true; |
300 | - $start = ( (int)$page_num - 1 ) * (int)$per_page; |
|
300 | + $start = ((int) $page_num - 1) * (int) $per_page; |
|
301 | 301 | $end = $start + $per_page; |
302 | 302 | if ( -1 == $max_depth ) |
303 | 303 | $this->max_pages = ceil($total_top / $per_page); |
@@ -305,21 +305,21 @@ discard block |
||
305 | 305 | |
306 | 306 | // flat display |
307 | 307 | if ( -1 == $max_depth ) { |
308 | - if ( !empty($args[0]['reverse_top_level']) ) { |
|
309 | - $elements = array_reverse( $elements ); |
|
308 | + if ( ! empty($args[0]['reverse_top_level'])) { |
|
309 | + $elements = array_reverse($elements); |
|
310 | 310 | $oldstart = $start; |
311 | 311 | $start = $total_top - $end; |
312 | 312 | $end = $total_top - $oldstart; |
313 | 313 | } |
314 | 314 | |
315 | 315 | $empty_array = array(); |
316 | - foreach ( $elements as $e ) { |
|
316 | + foreach ($elements as $e) { |
|
317 | 317 | $count++; |
318 | - if ( $count < $start ) |
|
318 | + if ($count < $start) |
|
319 | 319 | continue; |
320 | - if ( $count >= $end ) |
|
320 | + if ($count >= $end) |
|
321 | 321 | break; |
322 | - $this->display_element( $e, $empty_array, 1, 0, $args, $output ); |
|
322 | + $this->display_element($e, $empty_array, 1, 0, $args, $output); |
|
323 | 323 | } |
324 | 324 | return $output; |
325 | 325 | } |
@@ -331,51 +331,51 @@ discard block |
||
331 | 331 | */ |
332 | 332 | $top_level_elements = array(); |
333 | 333 | $children_elements = array(); |
334 | - foreach ( $elements as $e) { |
|
335 | - if ( 0 == $e->$parent_field ) |
|
334 | + foreach ($elements as $e) { |
|
335 | + if (0 == $e->$parent_field) |
|
336 | 336 | $top_level_elements[] = $e; |
337 | 337 | else |
338 | - $children_elements[ $e->$parent_field ][] = $e; |
|
338 | + $children_elements[$e->$parent_field][] = $e; |
|
339 | 339 | } |
340 | 340 | |
341 | - $total_top = count( $top_level_elements ); |
|
342 | - if ( $paging ) |
|
341 | + $total_top = count($top_level_elements); |
|
342 | + if ($paging) |
|
343 | 343 | $this->max_pages = ceil($total_top / $per_page); |
344 | 344 | else |
345 | 345 | $end = $total_top; |
346 | 346 | |
347 | - if ( !empty($args[0]['reverse_top_level']) ) { |
|
348 | - $top_level_elements = array_reverse( $top_level_elements ); |
|
347 | + if ( ! empty($args[0]['reverse_top_level'])) { |
|
348 | + $top_level_elements = array_reverse($top_level_elements); |
|
349 | 349 | $oldstart = $start; |
350 | 350 | $start = $total_top - $end; |
351 | 351 | $end = $total_top - $oldstart; |
352 | 352 | } |
353 | - if ( !empty($args[0]['reverse_children']) ) { |
|
354 | - foreach ( $children_elements as $parent => $children ) |
|
355 | - $children_elements[$parent] = array_reverse( $children ); |
|
353 | + if ( ! empty($args[0]['reverse_children'])) { |
|
354 | + foreach ($children_elements as $parent => $children) |
|
355 | + $children_elements[$parent] = array_reverse($children); |
|
356 | 356 | } |
357 | 357 | |
358 | - foreach ( $top_level_elements as $e ) { |
|
358 | + foreach ($top_level_elements as $e) { |
|
359 | 359 | $count++; |
360 | 360 | |
361 | 361 | // For the last page, need to unset earlier children in order to keep track of orphans. |
362 | - if ( $end >= $total_top && $count < $start ) |
|
363 | - $this->unset_children( $e, $children_elements ); |
|
362 | + if ($end >= $total_top && $count < $start) |
|
363 | + $this->unset_children($e, $children_elements); |
|
364 | 364 | |
365 | - if ( $count < $start ) |
|
365 | + if ($count < $start) |
|
366 | 366 | continue; |
367 | 367 | |
368 | - if ( $count >= $end ) |
|
368 | + if ($count >= $end) |
|
369 | 369 | break; |
370 | 370 | |
371 | - $this->display_element( $e, $children_elements, $max_depth, 0, $args, $output ); |
|
371 | + $this->display_element($e, $children_elements, $max_depth, 0, $args, $output); |
|
372 | 372 | } |
373 | 373 | |
374 | - if ( $end >= $total_top && count( $children_elements ) > 0 ) { |
|
374 | + if ($end >= $total_top && count($children_elements) > 0) { |
|
375 | 375 | $empty_array = array(); |
376 | - foreach ( $children_elements as $orphans ) |
|
377 | - foreach ( $orphans as $op ) |
|
378 | - $this->display_element( $op, $empty_array, 1, 0, $args, $output ); |
|
376 | + foreach ($children_elements as $orphans) |
|
377 | + foreach ($orphans as $op) |
|
378 | + $this->display_element($op, $empty_array, 1, 0, $args, $output); |
|
379 | 379 | } |
380 | 380 | |
381 | 381 | return $output; |
@@ -390,12 +390,12 @@ discard block |
||
390 | 390 | * @param array $elements Elements to list. |
391 | 391 | * @return int Number of root elements. |
392 | 392 | */ |
393 | - public function get_number_of_root_elements( $elements ){ |
|
393 | + public function get_number_of_root_elements($elements) { |
|
394 | 394 | $num = 0; |
395 | 395 | $parent_field = $this->db_fields['parent']; |
396 | 396 | |
397 | - foreach ( $elements as $e) { |
|
398 | - if ( 0 == $e->$parent_field ) |
|
397 | + foreach ($elements as $e) { |
|
398 | + if (0 == $e->$parent_field) |
|
399 | 399 | $num++; |
400 | 400 | } |
401 | 401 | return $num; |
@@ -409,19 +409,19 @@ discard block |
||
409 | 409 | * @param object $e |
410 | 410 | * @param array $children_elements |
411 | 411 | */ |
412 | - public function unset_children( $e, &$children_elements ){ |
|
413 | - if ( ! $e || ! $children_elements ) { |
|
412 | + public function unset_children($e, &$children_elements) { |
|
413 | + if ( ! $e || ! $children_elements) { |
|
414 | 414 | return; |
415 | 415 | } |
416 | 416 | |
417 | 417 | $id_field = $this->db_fields['id']; |
418 | 418 | $id = $e->$id_field; |
419 | 419 | |
420 | - if ( !empty($children_elements[$id]) && is_array($children_elements[$id]) ) |
|
421 | - foreach ( (array) $children_elements[$id] as $child ) |
|
422 | - $this->unset_children( $child, $children_elements ); |
|
420 | + if ( ! empty($children_elements[$id]) && is_array($children_elements[$id])) |
|
421 | + foreach ((array) $children_elements[$id] as $child) |
|
422 | + $this->unset_children($child, $children_elements); |
|
423 | 423 | |
424 | - unset( $children_elements[ $id ] ); |
|
424 | + unset($children_elements[$id]); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | } // Walker |
@@ -683,11 +683,13 @@ discard block |
||
683 | 683 | function wp_default_styles( &$styles ) { |
684 | 684 | include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version |
685 | 685 | |
686 | - if ( ! defined( 'SCRIPT_DEBUG' ) ) |
|
687 | - define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) ); |
|
686 | + if ( ! defined( 'SCRIPT_DEBUG' ) ) { |
|
687 | + define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) ); |
|
688 | + } |
|
688 | 689 | |
689 | - if ( ! $guessurl = site_url() ) |
|
690 | - $guessurl = wp_guess_url(); |
|
690 | + if ( ! $guessurl = site_url() ) { |
|
691 | + $guessurl = wp_guess_url(); |
|
692 | + } |
|
691 | 693 | |
692 | 694 | $styles->base_url = $guessurl; |
693 | 695 | $styles->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; |
@@ -812,14 +814,17 @@ discard block |
||
812 | 814 | * @return array Reordered array, if needed. |
813 | 815 | */ |
814 | 816 | function wp_prototype_before_jquery( $js_array ) { |
815 | - if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) |
|
816 | - return $js_array; |
|
817 | + if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) { |
|
818 | + return $js_array; |
|
819 | + } |
|
817 | 820 | |
818 | - if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) |
|
819 | - return $js_array; |
|
821 | + if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) { |
|
822 | + return $js_array; |
|
823 | + } |
|
820 | 824 | |
821 | - if ( $prototype < $jquery ) |
|
822 | - return $js_array; |
|
825 | + if ( $prototype < $jquery ) { |
|
826 | + return $js_array; |
|
827 | + } |
|
823 | 828 | |
824 | 829 | unset($js_array[$prototype]); |
825 | 830 | |
@@ -867,14 +872,16 @@ discard block |
||
867 | 872 | function wp_style_loader_src( $src, $handle ) { |
868 | 873 | global $_wp_admin_css_colors; |
869 | 874 | |
870 | - if ( wp_installing() ) |
|
871 | - return preg_replace( '#^wp-admin/#', './', $src ); |
|
875 | + if ( wp_installing() ) { |
|
876 | + return preg_replace( '#^wp-admin/#', './', $src ); |
|
877 | + } |
|
872 | 878 | |
873 | 879 | if ( 'colors' == $handle ) { |
874 | 880 | $color = get_user_option('admin_color'); |
875 | 881 | |
876 | - if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) |
|
877 | - $color = 'fresh'; |
|
882 | + if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) { |
|
883 | + $color = 'fresh'; |
|
884 | + } |
|
878 | 885 | |
879 | 886 | $color = $_wp_admin_css_colors[$color]; |
880 | 887 | $url = $color->url; |
@@ -985,8 +992,9 @@ discard block |
||
985 | 992 | global $wp_scripts, $compress_scripts; |
986 | 993 | |
987 | 994 | $zip = $compress_scripts ? 1 : 0; |
988 | - if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) |
|
989 | - $zip = 'gzip'; |
|
995 | + if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) { |
|
996 | + $zip = 'gzip'; |
|
997 | + } |
|
990 | 998 | |
991 | 999 | if ( $concat = trim( $wp_scripts->concat, ', ' ) ) { |
992 | 1000 | |
@@ -1009,9 +1017,10 @@ discard block |
||
1009 | 1017 | echo "<script type='text/javascript' src='" . esc_attr($src) . "'></script>\n"; |
1010 | 1018 | } |
1011 | 1019 | |
1012 | - if ( !empty($wp_scripts->print_html) ) |
|
1013 | - echo $wp_scripts->print_html; |
|
1014 | -} |
|
1020 | + if ( !empty($wp_scripts->print_html) ) { |
|
1021 | + echo $wp_scripts->print_html; |
|
1022 | + } |
|
1023 | + } |
|
1015 | 1024 | |
1016 | 1025 | /** |
1017 | 1026 | * Prints the script queue in the HTML head on the front end. |
@@ -1163,8 +1172,9 @@ discard block |
||
1163 | 1172 | $wp_styles = wp_styles(); |
1164 | 1173 | |
1165 | 1174 | $zip = $compress_css ? 1 : 0; |
1166 | - if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) |
|
1167 | - $zip = 'gzip'; |
|
1175 | + if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) { |
|
1176 | + $zip = 'gzip'; |
|
1177 | + } |
|
1168 | 1178 | |
1169 | 1179 | if ( $concat = trim( $wp_styles->concat, ', ' ) ) { |
1170 | 1180 | $dir = $wp_styles->text_direction; |
@@ -1183,9 +1193,10 @@ discard block |
||
1183 | 1193 | } |
1184 | 1194 | } |
1185 | 1195 | |
1186 | - if ( !empty($wp_styles->print_html) ) |
|
1187 | - echo $wp_styles->print_html; |
|
1188 | -} |
|
1196 | + if ( !empty($wp_styles->print_html) ) { |
|
1197 | + echo $wp_styles->print_html; |
|
1198 | + } |
|
1199 | + } |
|
1189 | 1200 | |
1190 | 1201 | /** |
1191 | 1202 | * Determine the concatenation and compression settings for scripts and styles. |
@@ -1203,19 +1214,22 @@ discard block |
||
1203 | 1214 | |
1204 | 1215 | if ( ! isset($concatenate_scripts) ) { |
1205 | 1216 | $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; |
1206 | - if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ) |
|
1207 | - $concatenate_scripts = false; |
|
1217 | + if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ) { |
|
1218 | + $concatenate_scripts = false; |
|
1219 | + } |
|
1208 | 1220 | } |
1209 | 1221 | |
1210 | 1222 | if ( ! isset($compress_scripts) ) { |
1211 | 1223 | $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; |
1212 | - if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) |
|
1213 | - $compress_scripts = false; |
|
1224 | + if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) { |
|
1225 | + $compress_scripts = false; |
|
1226 | + } |
|
1214 | 1227 | } |
1215 | 1228 | |
1216 | 1229 | if ( ! isset($compress_css) ) { |
1217 | 1230 | $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true; |
1218 | - if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) |
|
1219 | - $compress_css = false; |
|
1231 | + if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) { |
|
1232 | + $compress_css = false; |
|
1233 | + } |
|
1220 | 1234 | } |
1221 | 1235 | } |
@@ -17,22 +17,22 @@ discard block |
||
17 | 17 | */ |
18 | 18 | |
19 | 19 | /** WordPress Dependency Class */ |
20 | -require( ABSPATH . WPINC . '/class-wp-dependency.php' ); |
|
20 | +require(ABSPATH.WPINC.'/class-wp-dependency.php'); |
|
21 | 21 | |
22 | 22 | /** WordPress Dependencies Class */ |
23 | -require( ABSPATH . WPINC . '/class.wp-dependencies.php' ); |
|
23 | +require(ABSPATH.WPINC.'/class.wp-dependencies.php'); |
|
24 | 24 | |
25 | 25 | /** WordPress Scripts Class */ |
26 | -require( ABSPATH . WPINC . '/class.wp-scripts.php' ); |
|
26 | +require(ABSPATH.WPINC.'/class.wp-scripts.php'); |
|
27 | 27 | |
28 | 28 | /** WordPress Scripts Functions */ |
29 | -require( ABSPATH . WPINC . '/functions.wp-scripts.php' ); |
|
29 | +require(ABSPATH.WPINC.'/functions.wp-scripts.php'); |
|
30 | 30 | |
31 | 31 | /** WordPress Styles Class */ |
32 | -require( ABSPATH . WPINC . '/class.wp-styles.php' ); |
|
32 | +require(ABSPATH.WPINC.'/class.wp-styles.php'); |
|
33 | 33 | |
34 | 34 | /** WordPress Styles Functions */ |
35 | -require( ABSPATH . WPINC . '/functions.wp-styles.php' ); |
|
35 | +require(ABSPATH.WPINC.'/functions.wp-styles.php'); |
|
36 | 36 | |
37 | 37 | /** |
38 | 38 | * Register all WordPress scripts. |
@@ -45,103 +45,103 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @param WP_Scripts $scripts WP_Scripts object. |
47 | 47 | */ |
48 | -function wp_default_scripts( &$scripts ) { |
|
49 | - include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version |
|
48 | +function wp_default_scripts(&$scripts) { |
|
49 | + include(ABSPATH.WPINC.'/version.php'); // include an unmodified $wp_version |
|
50 | 50 | |
51 | - $develop_src = false !== strpos( $wp_version, '-src' ); |
|
51 | + $develop_src = false !== strpos($wp_version, '-src'); |
|
52 | 52 | |
53 | - if ( ! defined( 'SCRIPT_DEBUG' ) ) { |
|
54 | - define( 'SCRIPT_DEBUG', $develop_src ); |
|
53 | + if ( ! defined('SCRIPT_DEBUG')) { |
|
54 | + define('SCRIPT_DEBUG', $develop_src); |
|
55 | 55 | } |
56 | 56 | |
57 | - if ( ! $guessurl = site_url() ) { |
|
57 | + if ( ! $guessurl = site_url()) { |
|
58 | 58 | $guessed_url = true; |
59 | 59 | $guessurl = wp_guess_url(); |
60 | 60 | } |
61 | 61 | |
62 | 62 | $scripts->base_url = $guessurl; |
63 | - $scripts->content_url = defined('WP_CONTENT_URL')? WP_CONTENT_URL : ''; |
|
64 | - $scripts->default_version = get_bloginfo( 'version' ); |
|
63 | + $scripts->content_url = defined('WP_CONTENT_URL') ? WP_CONTENT_URL : ''; |
|
64 | + $scripts->default_version = get_bloginfo('version'); |
|
65 | 65 | $scripts->default_dirs = array('/wp-admin/js/', '/wp-includes/js/'); |
66 | 66 | |
67 | 67 | $suffix = SCRIPT_DEBUG ? '' : '.min'; |
68 | 68 | $dev_suffix = $develop_src ? '' : '.min'; |
69 | 69 | |
70 | - $scripts->add( 'utils', "/wp-includes/js/utils$suffix.js" ); |
|
71 | - did_action( 'init' ) && $scripts->localize( 'utils', 'userSettings', array( |
|
70 | + $scripts->add('utils', "/wp-includes/js/utils$suffix.js"); |
|
71 | + did_action('init') && $scripts->localize('utils', 'userSettings', array( |
|
72 | 72 | 'url' => (string) SITECOOKIEPATH, |
73 | 73 | 'uid' => (string) get_current_user_id(), |
74 | 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 ); |
|
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 | 126 | |
127 | 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 ); |
|
128 | + $scripts->add('wp-fullscreen-stub', "/wp-admin/js/wp-fullscreen-stub$suffix.js", array(), false, 1); |
|
129 | 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( |
|
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 | 132 | 'noPerm' => __('Sorry, you are not allowed to do that.'), |
133 | 133 | 'broken' => __('An unidentified error has occurred.') |
134 | - ) ); |
|
134 | + )); |
|
135 | 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( |
|
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 | 138 | 'dismiss' => __('Dismiss'), |
139 | - ) ); |
|
139 | + )); |
|
140 | 140 | |
141 | - $scripts->add( 'autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1 ); |
|
141 | + $scripts->add('autosave', "/wp-includes/js/autosave$suffix.js", array('heartbeat'), false, 1); |
|
142 | 142 | |
143 | - $scripts->add( 'heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1 ); |
|
144 | - did_action( 'init' ) && $scripts->localize( 'heartbeat', 'heartbeatSettings', |
|
143 | + $scripts->add('heartbeat', "/wp-includes/js/heartbeat$suffix.js", array('jquery'), false, 1); |
|
144 | + did_action('init') && $scripts->localize('heartbeat', 'heartbeatSettings', |
|
145 | 145 | /** |
146 | 146 | * Filters the Heartbeat settings. |
147 | 147 | * |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @param array $settings Heartbeat settings array. |
151 | 151 | */ |
152 | - apply_filters( 'heartbeat_settings', array() ) |
|
152 | + apply_filters('heartbeat_settings', array()) |
|
153 | 153 | ); |
154 | 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( |
|
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 | 157 | 'beforeunload' => __('Your session has expired. You can log in again from this page or go to the login page.'), |
158 | 158 | |
159 | 159 | /** |
@@ -164,104 +164,104 @@ discard block |
||
164 | 164 | * @param int $interval The interval in which to check a user's authentication. |
165 | 165 | * Default 3 minutes in seconds, or 180. |
166 | 166 | */ |
167 | - 'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ), |
|
168 | - ) ); |
|
167 | + 'interval' => apply_filters('wp_auth_check_interval', 3 * MINUTE_IN_SECONDS), |
|
168 | + )); |
|
169 | 169 | |
170 | - $scripts->add( 'wp-lists', "/wp-includes/js/wp-lists$suffix.js", array( 'wp-ajax-response', 'jquery-color' ), false, 1 ); |
|
170 | + $scripts->add('wp-lists', "/wp-includes/js/wp-lists$suffix.js", array('wp-ajax-response', 'jquery-color'), false, 1); |
|
171 | 171 | |
172 | 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') ); |
|
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 | 182 | |
183 | 183 | // not used in core, replaced by Jcrop.js |
184 | - $scripts->add( 'cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop') ); |
|
184 | + $scripts->add('cropper', '/wp-includes/js/crop/cropper.js', array('scriptaculous-dragdrop')); |
|
185 | 185 | |
186 | 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' ); |
|
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 | 190 | |
191 | 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 ); |
|
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 | 231 | |
232 | 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.' ), |
|
233 | + did_action('init') && $scripts->localize('jquery-ui-autocomplete', 'uiAutocompleteL10n', array( |
|
234 | + 'noResults' => __('No results found.'), |
|
235 | 235 | /* translators: Number of results found when using jQuery UI Autocomplete */ |
236 | - 'oneResult' => __( '1 result found. Use up and down arrow keys to navigate.' ), |
|
236 | + 'oneResult' => __('1 result found. Use up and down arrow keys to navigate.'), |
|
237 | 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 | - ) ); |
|
238 | + 'manyResults' => __('%d results found. Use up and down arrow keys to navigate.'), |
|
239 | + 'itemSelected' => __('Item selected.'), |
|
240 | + )); |
|
241 | 241 | |
242 | 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 ); |
|
243 | + $scripts->add('jquery-form', "/wp-includes/js/jquery/jquery.form$suffix.js", array('jquery'), '3.37.0', 1); |
|
244 | 244 | |
245 | 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 ); |
|
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 | 253 | |
254 | 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 ); |
|
255 | + $scripts->add('suggest', "/wp-includes/js/jquery/suggest$suffix.js", array('jquery'), '1.1-20110113', 1); |
|
256 | 256 | |
257 | 257 | // Masonry v2 depended on jQuery. v3 does not. The older jquery-masonry handle is a shiv. |
258 | 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 ); |
|
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 | 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( |
|
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 | 265 | 'next' => __('Next >'), |
266 | 266 | 'prev' => __('< Prev'), |
267 | 267 | 'image' => __('Image'), |
@@ -269,11 +269,11 @@ discard block |
||
269 | 269 | 'close' => __('Close'), |
270 | 270 | 'noiframes' => __('This feature requires inline frames. You have iframes disabled or your browser does not support them.'), |
271 | 271 | 'loadingAnimation' => includes_url('js/thickbox/loadingAnimation.gif'), |
272 | - ) ); |
|
272 | + )); |
|
273 | 273 | |
274 | - $scripts->add( 'jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12'); |
|
274 | + $scripts->add('jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.js", array('jquery'), '0.9.12'); |
|
275 | 275 | |
276 | - $scripts->add( 'swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417'); |
|
276 | + $scripts->add('swfobject', "/wp-includes/js/swfobject.js", array(), '2.2-20120417'); |
|
277 | 277 | |
278 | 278 | // error message for both plupload and swfupload |
279 | 279 | $uploader_l10n = array( |
@@ -302,82 +302,82 @@ discard block |
||
302 | 302 | 'error_uploading' => __('“%s” has failed to upload.') |
303 | 303 | ); |
304 | 304 | |
305 | - $scripts->add( 'plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.8' ); |
|
305 | + $scripts->add('plupload', '/wp-includes/js/plupload/plupload.full.min.js', array(), '2.1.8'); |
|
306 | 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' ); |
|
307 | + foreach (array('all', 'html5', 'flash', 'silverlight', 'html4') as $handle) { |
|
308 | + $scripts->add("plupload-$handle", false, array('plupload'), '2.1.1'); |
|
309 | 309 | } |
310 | 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 ); |
|
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 | 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 ); |
|
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 | 316 | |
317 | 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 ); |
|
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 | 325 | |
326 | - $scripts->add( 'comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1 ); |
|
326 | + $scripts->add('comment-reply', "/wp-includes/js/comment-reply$suffix.js", array(), false, 1); |
|
327 | 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' ); |
|
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 | 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 ); |
|
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 | 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( |
|
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 | 336 | 'ajax' => array( |
337 | - 'url' => admin_url( 'admin-ajax.php', 'relative' ), |
|
337 | + 'url' => admin_url('admin-ajax.php', 'relative'), |
|
338 | 338 | ), |
339 | - ) ); |
|
339 | + )); |
|
340 | 340 | |
341 | - $scripts->add( 'wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1 ); |
|
341 | + $scripts->add('wp-backbone', "/wp-includes/js/wp-backbone$suffix.js", array('backbone', 'wp-util'), false, 1); |
|
342 | 342 | |
343 | - $scripts->add( 'revisions', "/wp-admin/js/revisions$suffix.js", array( 'wp-backbone', 'jquery-ui-slider', 'hoverIntent' ), false, 1 ); |
|
343 | + $scripts->add('revisions', "/wp-admin/js/revisions$suffix.js", array('wp-backbone', 'jquery-ui-slider', 'hoverIntent'), false, 1); |
|
344 | 344 | |
345 | - $scripts->add( 'imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1 ); |
|
345 | + $scripts->add('imgareaselect', "/wp-includes/js/imgareaselect/jquery.imgareaselect$suffix.js", array('jquery'), false, 1); |
|
346 | 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' ), |
|
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 | 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' ), |
|
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 | 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.' ), |
|
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 | 372 | ), |
373 | - ) ); |
|
373 | + )); |
|
374 | 374 | |
375 | 375 | |
376 | - $scripts->add( 'wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array('mediaelement'), false, 1 ); |
|
376 | + $scripts->add('wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement$suffix.js", array('mediaelement'), false, 1); |
|
377 | 377 | $mejs_settings = array( |
378 | - 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), |
|
378 | + 'pluginPath' => includes_url('js/mediaelement/', 'relative'), |
|
379 | 379 | ); |
380 | - did_action( 'init' ) && $scripts->localize( 'mediaelement', '_wpmejsSettings', |
|
380 | + did_action('init') && $scripts->localize('mediaelement', '_wpmejsSettings', |
|
381 | 381 | /** |
382 | 382 | * Filters the MediaElement configuration settings. |
383 | 383 | * |
@@ -385,172 +385,172 @@ discard block |
||
385 | 385 | * |
386 | 386 | * @param array $mejs_settings MediaElement settings array. |
387 | 387 | */ |
388 | - apply_filters( 'mejs_settings', $mejs_settings ) |
|
388 | + apply_filters('mejs_settings', $mejs_settings) |
|
389 | 389 | ); |
390 | 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( |
|
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 | 428 | 'title' => __('Insert/edit link'), |
429 | 429 | 'update' => __('Update'), |
430 | 430 | 'save' => __('Add Link'), |
431 | 431 | 'noTitle' => __('(no title)'), |
432 | 432 | 'noMatchesFound' => __('No results found.'), |
433 | - 'linkSelected' => __( 'Link selected.' ), |
|
434 | - 'linkInserted' => __( 'Link inserted.' ), |
|
435 | - ) ); |
|
433 | + 'linkSelected' => __('Link selected.'), |
|
434 | + 'linkInserted' => __('Link inserted.'), |
|
435 | + )); |
|
436 | 436 | |
437 | - $scripts->add( 'wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array( 'jquery-ui-dialog' ), false, 1 ); |
|
437 | + $scripts->add('wpdialogs', "/wp-includes/js/wpdialog$suffix.js", array('jquery-ui-dialog'), false, 1); |
|
438 | 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( |
|
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 | 441 | /* |
442 | 442 | * translators: If your word count is based on single characters (e.g. East Asian characters), |
443 | 443 | * enter 'characters_excluding_spaces' or 'characters_including_spaces'. Otherwise, enter 'words'. |
444 | 444 | * Do not translate into your own language. |
445 | 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)' ), |
|
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 | 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 ); |
|
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 | 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 ); |
|
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 | 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 ); |
|
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 | 484 | |
485 | - $scripts->add( 'wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array( 'wp-a11y' ), false, 1 ); |
|
485 | + $scripts->add('wp-custom-header', "/wp-includes/js/wp-custom-header$suffix.js", array('wp-a11y'), false, 1); |
|
486 | 486 | |
487 | - $scripts->add( 'accordion', "/wp-admin/js/accordion$suffix.js", array( 'jquery' ), false, 1 ); |
|
487 | + $scripts->add('accordion', "/wp-admin/js/accordion$suffix.js", array('jquery'), false, 1); |
|
488 | 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( |
|
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 | 492 | 'settings' => array( |
493 | - 'ajaxurl' => admin_url( 'admin-ajax.php', 'relative' ), |
|
494 | - 'post' => array( 'id' => 0 ), |
|
493 | + 'ajaxurl' => admin_url('admin-ajax.php', 'relative'), |
|
494 | + 'post' => array('id' => 0), |
|
495 | 495 | ), |
496 | - ) ); |
|
496 | + )); |
|
497 | 497 | |
498 | - $scripts->add( 'wp-embed', "/wp-includes/js/wp-embed$suffix.js" ); |
|
498 | + $scripts->add('wp-embed', "/wp-includes/js/wp-embed$suffix.js"); |
|
499 | 499 | |
500 | 500 | // To enqueue media-views or media-editor, call wp_enqueue_media(). |
501 | 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' ), |
|
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 | 511 | 'versionString' => 'wp/v2/', |
512 | - ) ); |
|
512 | + )); |
|
513 | 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( |
|
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 | 517 | 'noPerm' => __('Sorry, you are not allowed to do that.'), |
518 | 518 | 'broken' => __('An unidentified error has occurred.') |
519 | 519 | )); |
520 | 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( |
|
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 | 523 | 'hotkeys_highlight_first' => isset($_GET['hotkeys_highlight_first']), |
524 | 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' ), |
|
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 | 530 | /* translators: %s: comments count */ |
531 | - 'docTitleCommentsCount' => __( 'Comments (%s)' ), |
|
532 | - ) ); |
|
531 | + 'docTitleCommentsCount' => __('Comments (%s)'), |
|
532 | + )); |
|
533 | 533 | |
534 | - $scripts->add( 'xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1 ); |
|
534 | + $scripts->add('xfn', "/wp-admin/js/xfn$suffix.js", array('jquery'), false, 1); |
|
535 | 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 | - ) ); |
|
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 | 540 | |
541 | - $scripts->add( 'tags-box', "/wp-admin/js/tags-box$suffix.js", array( 'jquery', 'tags-suggest' ), false, 1 ); |
|
541 | + $scripts->add('tags-box', "/wp-admin/js/tags-box$suffix.js", array('jquery', 'tags-suggest'), false, 1); |
|
542 | 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 | - ) ); |
|
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 | 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( |
|
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 | 554 | 'ok' => __('OK'), |
555 | 555 | 'cancel' => __('Cancel'), |
556 | 556 | 'publishOn' => __('Publish on:'), |
@@ -573,202 +573,202 @@ discard block |
||
573 | 573 | 'published' => __('Published'), |
574 | 574 | 'saveAlert' => __('The changes you made will be lost if you navigate away from this page.'), |
575 | 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.' ), |
|
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 | 584 | /* translators: %d: nth embed found in a post */ |
585 | - 'suggestedEmbedAlt' => __( 'Suggested embed #%d' ), |
|
585 | + 'suggestedEmbedAlt' => __('Suggested embed #%d'), |
|
586 | 586 | /* translators: %d: nth image found in a post */ |
587 | - 'suggestedImgAlt' => __( 'Suggested image #%d' ), |
|
588 | - ) ); |
|
587 | + 'suggestedImgAlt' => __('Suggested image #%d'), |
|
588 | + )); |
|
589 | 589 | |
590 | - $scripts->add( 'editor-expand', "/wp-admin/js/editor-expand$suffix.js", array( 'jquery', 'underscore' ), false, 1 ); |
|
590 | + $scripts->add('editor-expand', "/wp-admin/js/editor-expand$suffix.js", array('jquery', 'underscore'), false, 1); |
|
591 | 591 | |
592 | - $scripts->add( 'link', "/wp-admin/js/link$suffix.js", array( 'wp-lists', 'postbox' ), false, 1 ); |
|
592 | + $scripts->add('link', "/wp-admin/js/link$suffix.js", array('wp-lists', 'postbox'), false, 1); |
|
593 | 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:' ), |
|
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 | 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' ), |
|
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 | 635 | 'ays' => __('Are you sure you want to install this plugin?') |
636 | - ) ); |
|
636 | + )); |
|
637 | 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' ), |
|
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 | 641 | 'l10n' => array( |
642 | 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' ), |
|
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 | 652 | /* translators: %s: Plugin name and version */ |
653 | - 'pluginUpdateNowLabel' => _x( 'Update %s now', 'plugin' ), |
|
654 | - 'updateFailedShort' => __( 'Update Failed!' ), |
|
653 | + 'pluginUpdateNowLabel' => _x('Update %s now', 'plugin'), |
|
654 | + 'updateFailedShort' => __('Update Failed!'), |
|
655 | 655 | /* translators: %s: Error string for a failed update */ |
656 | - 'updateFailed' => __( 'Update Failed: %s' ), |
|
656 | + 'updateFailed' => __('Update Failed: %s'), |
|
657 | 657 | /* translators: %s: Plugin name and version */ |
658 | - 'pluginUpdatingLabel' => _x( 'Updating %s...', 'plugin' ), // No ellipsis. |
|
658 | + 'pluginUpdatingLabel' => _x('Updating %s...', 'plugin'), // No ellipsis. |
|
659 | 659 | /* translators: %s: Plugin name and version */ |
660 | - 'pluginUpdatedLabel' => _x( '%s updated!', 'plugin' ), |
|
660 | + 'pluginUpdatedLabel' => _x('%s updated!', 'plugin'), |
|
661 | 661 | /* translators: %s: Plugin name and version */ |
662 | - 'pluginUpdateFailedLabel' => _x( '%s update failed', 'plugin' ), |
|
662 | + 'pluginUpdateFailedLabel' => _x('%s update failed', 'plugin'), |
|
663 | 663 | /* translators: Accessibility text */ |
664 | - 'updatingMsg' => __( 'Updating... please wait.' ), // No ellipsis. |
|
664 | + 'updatingMsg' => __('Updating... please wait.'), // No ellipsis. |
|
665 | 665 | /* translators: Accessibility text */ |
666 | - 'updatedMsg' => __( 'Update completed successfully.' ), |
|
666 | + 'updatedMsg' => __('Update completed successfully.'), |
|
667 | 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' ), |
|
668 | + 'updateCancel' => __('Update canceled.'), |
|
669 | + 'beforeunload' => __('Updates may not complete if you navigate away from this page.'), |
|
670 | + 'installNow' => __('Install Now'), |
|
671 | 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!' ), |
|
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 | 677 | /* translators: %s: Error string for a failed installation */ |
678 | - 'installFailed' => __( 'Installation failed: %s' ), |
|
678 | + 'installFailed' => __('Installation failed: %s'), |
|
679 | 679 | /* translators: %s: Plugin name and version */ |
680 | - 'pluginInstallingLabel' => _x( 'Installing %s...', 'plugin' ), // no ellipsis |
|
680 | + 'pluginInstallingLabel' => _x('Installing %s...', 'plugin'), // no ellipsis |
|
681 | 681 | /* translators: %s: Theme name and version */ |
682 | - 'themeInstallingLabel' => _x( 'Installing %s...', 'theme' ), // no ellipsis |
|
682 | + 'themeInstallingLabel' => _x('Installing %s...', 'theme'), // no ellipsis |
|
683 | 683 | /* translators: %s: Plugin name and version */ |
684 | - 'pluginInstalledLabel' => _x( '%s installed!', 'plugin' ), |
|
684 | + 'pluginInstalledLabel' => _x('%s installed!', 'plugin'), |
|
685 | 685 | /* translators: %s: Theme name and version */ |
686 | - 'themeInstalledLabel' => _x( '%s installed!', 'theme' ), |
|
686 | + 'themeInstalledLabel' => _x('%s installed!', 'theme'), |
|
687 | 687 | /* translators: %s: Plugin name and version */ |
688 | - 'pluginInstallFailedLabel' => _x( '%s installation failed', 'plugin' ), |
|
688 | + 'pluginInstallFailedLabel' => _x('%s installation failed', 'plugin'), |
|
689 | 689 | /* translators: %s: Theme name and version */ |
690 | - 'themeInstallFailedLabel' => _x( '%s installation failed', 'theme' ), |
|
691 | - 'installingMsg' => __( 'Installing... please wait.' ), |
|
692 | - 'installedMsg' => __( 'Installation completed successfully.' ), |
|
690 | + 'themeInstallFailedLabel' => _x('%s installation failed', 'theme'), |
|
691 | + 'installingMsg' => __('Installing... please wait.'), |
|
692 | + 'installedMsg' => __('Installation completed successfully.'), |
|
693 | 693 | /* translators: %s: Activation URL */ |
694 | - 'importerInstalledMsg' => __( 'Importer installed successfully. <a href="%s">Run importer</a>' ), |
|
694 | + 'importerInstalledMsg' => __('Importer installed successfully. <a href="%s">Run importer</a>'), |
|
695 | 695 | /* translators: %s: Theme name */ |
696 | - 'aysDelete' => __( 'Are you sure you want to delete %s?' ), |
|
696 | + 'aysDelete' => __('Are you sure you want to delete %s?'), |
|
697 | 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...' ), |
|
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 | 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' ), |
|
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 | 709 | /* translators: %s: Plugin name */ |
710 | - 'activatePluginLabel' => is_network_admin() ? _x( 'Network Activate %s', 'plugin' ) : _x( 'Activate %s', 'plugin' ), |
|
710 | + 'activatePluginLabel' => is_network_admin() ? _x('Network Activate %s', 'plugin') : _x('Activate %s', 'plugin'), |
|
711 | 711 | /* translators: %s: Theme name */ |
712 | - 'activateThemeLabel' => is_network_admin() ? _x( 'Network Activate %s', 'theme' ) : _x( 'Activate %s', 'theme' ), |
|
713 | - 'activateImporter' => __( 'Run Importer' ), |
|
712 | + 'activateThemeLabel' => is_network_admin() ? _x('Network Activate %s', 'theme') : _x('Activate %s', 'theme'), |
|
713 | + 'activateImporter' => __('Run Importer'), |
|
714 | 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.' ), |
|
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 | 721 | ), |
722 | - ) ); |
|
722 | + )); |
|
723 | 723 | |
724 | - $scripts->add( 'farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2' ); |
|
724 | + $scripts->add('farbtastic', '/wp-admin/js/farbtastic.js', array('jquery'), '1.2'); |
|
725 | 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 | - ) ); |
|
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 | 734 | |
735 | - $scripts->add( 'dashboard', "/wp-admin/js/dashboard$suffix.js", array( 'jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y' ), false, 1 ); |
|
735 | + $scripts->add('dashboard', "/wp-admin/js/dashboard$suffix.js", array('jquery', 'admin-comments', 'postbox', 'wp-util', 'wp-a11y'), false, 1); |
|
736 | 736 | |
737 | - $scripts->add( 'list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js" ); |
|
737 | + $scripts->add('list-revisions', "/wp-includes/js/wp-list-revisions$suffix.js"); |
|
738 | 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.' ), |
|
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 | 743 | )); |
744 | 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.' ) |
|
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 | 748 | )); |
749 | 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 | - ) ); |
|
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 | 757 | |
758 | 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 ); |
|
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 | 772 | } |
773 | 773 | } |
774 | 774 | |
@@ -787,19 +787,19 @@ discard block |
||
787 | 787 | * |
788 | 788 | * @param WP_Styles $styles |
789 | 789 | */ |
790 | -function wp_default_styles( &$styles ) { |
|
791 | - include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version |
|
790 | +function wp_default_styles(&$styles) { |
|
791 | + include(ABSPATH.WPINC.'/version.php'); // include an unmodified $wp_version |
|
792 | 792 | |
793 | - if ( ! defined( 'SCRIPT_DEBUG' ) ) |
|
794 | - define( 'SCRIPT_DEBUG', false !== strpos( $wp_version, '-src' ) ); |
|
793 | + if ( ! defined('SCRIPT_DEBUG')) |
|
794 | + define('SCRIPT_DEBUG', false !== strpos($wp_version, '-src')); |
|
795 | 795 | |
796 | - if ( ! $guessurl = site_url() ) |
|
796 | + if ( ! $guessurl = site_url()) |
|
797 | 797 | $guessurl = wp_guess_url(); |
798 | 798 | |
799 | 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'; |
|
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 | 803 | $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/'); |
804 | 804 | |
805 | 805 | // Open Sans is no longer used by core, but may be relied upon by themes and plugins. |
@@ -808,19 +808,19 @@ discard block |
||
808 | 808 | /* translators: If there are characters in your language that are not supported |
809 | 809 | * by Open Sans, translate this to 'off'. Do not translate into your own language. |
810 | 810 | */ |
811 | - if ( 'off' !== _x( 'on', 'Open Sans font: on or off' ) ) { |
|
811 | + if ('off' !== _x('on', 'Open Sans font: on or off')) { |
|
812 | 812 | $subsets = 'latin,latin-ext'; |
813 | 813 | |
814 | 814 | /* translators: To add an additional Open Sans character subset specific to your language, |
815 | 815 | * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language. |
816 | 816 | */ |
817 | - $subset = _x( 'no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)' ); |
|
817 | + $subset = _x('no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)'); |
|
818 | 818 | |
819 | - if ( 'cyrillic' == $subset ) { |
|
819 | + if ('cyrillic' == $subset) { |
|
820 | 820 | $subsets .= ',cyrillic,cyrillic-ext'; |
821 | - } elseif ( 'greek' == $subset ) { |
|
821 | + } elseif ('greek' == $subset) { |
|
822 | 822 | $subsets .= ',greek,greek-ext'; |
823 | - } elseif ( 'vietnamese' == $subset ) { |
|
823 | + } elseif ('vietnamese' == $subset) { |
|
824 | 824 | $subsets .= ',vietnamese'; |
825 | 825 | } |
826 | 826 | |
@@ -829,66 +829,66 @@ discard block |
||
829 | 829 | } |
830 | 830 | |
831 | 831 | // Register a stylesheet for the selected admin color scheme. |
832 | - $styles->add( 'colors', true, array( 'wp-admin', 'buttons' ) ); |
|
832 | + $styles->add('colors', true, array('wp-admin', 'buttons')); |
|
833 | 833 | |
834 | 834 | $suffix = SCRIPT_DEBUG ? '' : '.min'; |
835 | 835 | |
836 | 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' ); |
|
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 | 864 | |
865 | 865 | // Common dependencies |
866 | - $styles->add( 'buttons', "/wp-includes/css/buttons$suffix.css" ); |
|
867 | - $styles->add( 'dashicons', "/wp-includes/css/dashicons$suffix.css" ); |
|
866 | + $styles->add('buttons', "/wp-includes/css/buttons$suffix.css"); |
|
867 | + $styles->add('dashicons', "/wp-includes/css/dashicons$suffix.css"); |
|
868 | 868 | |
869 | 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' ); |
|
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 | 878 | |
879 | 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' ) ); |
|
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 | 885 | |
886 | 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 |
|
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 | 892 | |
893 | 893 | // RTL CSS |
894 | 894 | $rtl_styles = array( |
@@ -903,10 +903,10 @@ discard block |
||
903 | 903 | 'deprecated-media', 'farbtastic', |
904 | 904 | ); |
905 | 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 ); |
|
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 | 910 | } |
911 | 911 | } |
912 | 912 | } |
@@ -919,19 +919,19 @@ discard block |
||
919 | 919 | * @param array $js_array JavaScript scripts array |
920 | 920 | * @return array Reordered array, if needed. |
921 | 921 | */ |
922 | -function wp_prototype_before_jquery( $js_array ) { |
|
923 | - if ( false === $prototype = array_search( 'prototype', $js_array, true ) ) |
|
922 | +function wp_prototype_before_jquery($js_array) { |
|
923 | + if (false === $prototype = array_search('prototype', $js_array, true)) |
|
924 | 924 | return $js_array; |
925 | 925 | |
926 | - if ( false === $jquery = array_search( 'jquery', $js_array, true ) ) |
|
926 | + if (false === $jquery = array_search('jquery', $js_array, true)) |
|
927 | 927 | return $js_array; |
928 | 928 | |
929 | - if ( $prototype < $jquery ) |
|
929 | + if ($prototype < $jquery) |
|
930 | 930 | return $js_array; |
931 | 931 | |
932 | 932 | unset($js_array[$prototype]); |
933 | 933 | |
934 | - array_splice( $js_array, $jquery, 0, 'prototype' ); |
|
934 | + array_splice($js_array, $jquery, 0, 'prototype'); |
|
935 | 935 | |
936 | 936 | return $js_array; |
937 | 937 | } |
@@ -945,10 +945,10 @@ discard block |
||
945 | 945 | */ |
946 | 946 | function wp_just_in_time_script_localization() { |
947 | 947 | |
948 | - wp_localize_script( 'autosave', 'autosaveL10n', array( |
|
948 | + wp_localize_script('autosave', 'autosaveL10n', array( |
|
949 | 949 | 'autosaveInterval' => AUTOSAVE_INTERVAL, |
950 | 950 | 'blog_id' => get_current_blog_id(), |
951 | - ) ); |
|
951 | + )); |
|
952 | 952 | } |
953 | 953 | |
954 | 954 | /** |
@@ -963,7 +963,7 @@ discard block |
||
963 | 963 | function wp_localize_jquery_ui_datepicker() { |
964 | 964 | global $wp_locale; |
965 | 965 | |
966 | - if ( ! wp_script_is( 'jquery-ui-datepicker', 'enqueued' ) ) { |
|
966 | + if ( ! wp_script_is('jquery-ui-datepicker', 'enqueued')) { |
|
967 | 967 | return; |
968 | 968 | } |
969 | 969 | |
@@ -979,25 +979,25 @@ discard block |
||
979 | 979 | 'MM', 'M', 'm', 'mm', |
980 | 980 | 'yy', 'y' |
981 | 981 | ), |
982 | - get_option( 'date_format' ) |
|
982 | + get_option('date_format') |
|
983 | 983 | ); |
984 | 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 ), |
|
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 | 995 | 'dateFormat' => $datepicker_date_format, |
996 | - 'firstDay' => absint( get_option( 'start_of_week' ) ), |
|
996 | + 'firstDay' => absint(get_option('start_of_week')), |
|
997 | 997 | 'isRTL' => $wp_locale->is_rtl(), |
998 | - ) ); |
|
998 | + )); |
|
999 | 999 | |
1000 | - wp_add_inline_script( 'jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});" ); |
|
1000 | + wp_add_inline_script('jquery-ui-datepicker', "jQuery(document).ready(function(jQuery){jQuery.datepicker.setDefaults({$datepicker_defaults});});"); |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | /** |
@@ -1006,15 +1006,15 @@ discard block |
||
1006 | 1006 | * @since 4.8.0 |
1007 | 1007 | */ |
1008 | 1008 | function wp_localize_community_events() { |
1009 | - if ( ! wp_script_is( 'dashboard' ) ) { |
|
1009 | + if ( ! wp_script_is('dashboard')) { |
|
1010 | 1010 | return; |
1011 | 1011 | } |
1012 | 1012 | |
1013 | - require_once( ABSPATH . 'wp-admin/includes/class-wp-community-events.php' ); |
|
1013 | + require_once(ABSPATH.'wp-admin/includes/class-wp-community-events.php'); |
|
1014 | 1014 | |
1015 | 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; |
|
1016 | + $saved_location = get_user_option('community-events-location', $user_id); |
|
1017 | + $saved_ip_address = isset($saved_location['ip']) ? $saved_location['ip'] : false; |
|
1018 | 1018 | $current_ip_address = WP_Community_Events::get_unsafe_client_ip(); |
1019 | 1019 | |
1020 | 1020 | /* |
@@ -1024,21 +1024,21 @@ discard block |
||
1024 | 1024 | * shown events in the city where they were when they first loaded the |
1025 | 1025 | * Dashboard, which could have been months or years ago. |
1026 | 1026 | */ |
1027 | - if ( $saved_ip_address && $current_ip_address && $current_ip_address !== $saved_ip_address ) { |
|
1027 | + if ($saved_ip_address && $current_ip_address && $current_ip_address !== $saved_ip_address) { |
|
1028 | 1028 | $saved_location['ip'] = $current_ip_address; |
1029 | - update_user_option( $user_id, 'community-events-location', $saved_location, true ); |
|
1029 | + update_user_option($user_id, 'community-events-location', $saved_location, true); |
|
1030 | 1030 | } |
1031 | 1031 | |
1032 | - $events_client = new WP_Community_Events( $user_id, $saved_location ); |
|
1032 | + $events_client = new WP_Community_Events($user_id, $saved_location); |
|
1033 | 1033 | |
1034 | - wp_localize_script( 'dashboard', 'communityEventsData', array( |
|
1035 | - 'nonce' => wp_create_nonce( 'community_events' ), |
|
1034 | + wp_localize_script('dashboard', 'communityEventsData', array( |
|
1035 | + 'nonce' => wp_create_nonce('community_events'), |
|
1036 | 1036 | 'cache' => $events_client->get_cached_events(), |
1037 | 1037 | |
1038 | 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.' ), |
|
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 | 1042 | |
1043 | 1043 | /* |
1044 | 1044 | * These specific examples were chosen to highlight the fact that a |
@@ -1055,13 +1055,13 @@ discard block |
||
1055 | 1055 | * or country. Use the endonym (native locale name) instead of the |
1056 | 1056 | * English name if possible. |
1057 | 1057 | */ |
1058 | - 'could_not_locate_city' => __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ), |
|
1058 | + 'could_not_locate_city' => __('We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.'), |
|
1059 | 1059 | |
1060 | 1060 | // This one is only used with wp.a11y.speak(), so it can/should be more brief. |
1061 | 1061 | /* translators: %s is the name of a city. */ |
1062 | - 'city_updated' => __( 'City updated. Listing events near %s.' ), |
|
1062 | + 'city_updated' => __('City updated. Listing events near %s.'), |
|
1063 | 1063 | ) |
1064 | - ) ); |
|
1064 | + )); |
|
1065 | 1065 | } |
1066 | 1066 | |
1067 | 1067 | /** |
@@ -1084,29 +1084,29 @@ discard block |
||
1084 | 1084 | * @param string $handle Either 'colors' or 'colors-rtl'. |
1085 | 1085 | * @return string|false URL path to CSS stylesheet for Administration Screens. |
1086 | 1086 | */ |
1087 | -function wp_style_loader_src( $src, $handle ) { |
|
1087 | +function wp_style_loader_src($src, $handle) { |
|
1088 | 1088 | global $_wp_admin_css_colors; |
1089 | 1089 | |
1090 | - if ( wp_installing() ) |
|
1091 | - return preg_replace( '#^wp-admin/#', './', $src ); |
|
1090 | + if (wp_installing()) |
|
1091 | + return preg_replace('#^wp-admin/#', './', $src); |
|
1092 | 1092 | |
1093 | - if ( 'colors' == $handle ) { |
|
1093 | + if ('colors' == $handle) { |
|
1094 | 1094 | $color = get_user_option('admin_color'); |
1095 | 1095 | |
1096 | - if ( empty($color) || !isset($_wp_admin_css_colors[$color]) ) |
|
1096 | + if (empty($color) || ! isset($_wp_admin_css_colors[$color])) |
|
1097 | 1097 | $color = 'fresh'; |
1098 | 1098 | |
1099 | 1099 | $color = $_wp_admin_css_colors[$color]; |
1100 | 1100 | $url = $color->url; |
1101 | 1101 | |
1102 | - if ( ! $url ) { |
|
1102 | + if ( ! $url) { |
|
1103 | 1103 | return false; |
1104 | 1104 | } |
1105 | 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 ); |
|
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 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | return $url; |
@@ -1132,9 +1132,9 @@ discard block |
||
1132 | 1132 | function print_head_scripts() { |
1133 | 1133 | global $concatenate_scripts; |
1134 | 1134 | |
1135 | - if ( ! did_action('wp_print_scripts') ) { |
|
1135 | + if ( ! did_action('wp_print_scripts')) { |
|
1136 | 1136 | /** This action is documented in wp-includes/functions.wp-scripts.php */ |
1137 | - do_action( 'wp_print_scripts' ); |
|
1137 | + do_action('wp_print_scripts'); |
|
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | $wp_scripts = wp_scripts(); |
@@ -1150,7 +1150,7 @@ discard block |
||
1150 | 1150 | * |
1151 | 1151 | * @param bool $print Whether to print the head scripts. Default true. |
1152 | 1152 | */ |
1153 | - if ( apply_filters( 'print_head_scripts', true ) ) { |
|
1153 | + if (apply_filters('print_head_scripts', true)) { |
|
1154 | 1154 | _print_scripts(); |
1155 | 1155 | } |
1156 | 1156 | |
@@ -1171,7 +1171,7 @@ discard block |
||
1171 | 1171 | function print_footer_scripts() { |
1172 | 1172 | global $wp_scripts, $concatenate_scripts; |
1173 | 1173 | |
1174 | - if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { |
|
1174 | + if ( ! ($wp_scripts instanceof WP_Scripts)) { |
|
1175 | 1175 | return array(); // No need to run if not instantiated. |
1176 | 1176 | } |
1177 | 1177 | script_concat_settings(); |
@@ -1185,7 +1185,7 @@ discard block |
||
1185 | 1185 | * |
1186 | 1186 | * @param bool $print Whether to print the footer scripts. Default true. |
1187 | 1187 | */ |
1188 | - if ( apply_filters( 'print_footer_scripts', true ) ) { |
|
1188 | + if (apply_filters('print_footer_scripts', true)) { |
|
1189 | 1189 | _print_scripts(); |
1190 | 1190 | } |
1191 | 1191 | |
@@ -1205,12 +1205,12 @@ discard block |
||
1205 | 1205 | global $wp_scripts, $compress_scripts; |
1206 | 1206 | |
1207 | 1207 | $zip = $compress_scripts ? 1 : 0; |
1208 | - if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) |
|
1208 | + if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) |
|
1209 | 1209 | $zip = 'gzip'; |
1210 | 1210 | |
1211 | - if ( $concat = trim( $wp_scripts->concat, ', ' ) ) { |
|
1211 | + if ($concat = trim($wp_scripts->concat, ', ')) { |
|
1212 | 1212 | |
1213 | - if ( !empty($wp_scripts->print_code) ) { |
|
1213 | + if ( ! empty($wp_scripts->print_code)) { |
|
1214 | 1214 | echo "\n<script type='text/javascript'>\n"; |
1215 | 1215 | echo "/* <![CDATA[ */\n"; // not needed in HTML 5 |
1216 | 1216 | echo $wp_scripts->print_code; |
@@ -1218,14 +1218,14 @@ discard block |
||
1218 | 1218 | echo "</script>\n"; |
1219 | 1219 | } |
1220 | 1220 | |
1221 | - $concat = str_split( $concat, 128 ); |
|
1222 | - $concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat ); |
|
1221 | + $concat = str_split($concat, 128); |
|
1222 | + $concat = 'load%5B%5D='.implode('&load%5B%5D=', $concat); |
|
1223 | 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"; |
|
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 | 1226 | } |
1227 | 1227 | |
1228 | - if ( !empty($wp_scripts->print_html) ) |
|
1228 | + if ( ! empty($wp_scripts->print_html)) |
|
1229 | 1229 | echo $wp_scripts->print_html; |
1230 | 1230 | } |
1231 | 1231 | |
@@ -1242,14 +1242,14 @@ discard block |
||
1242 | 1242 | * @return array |
1243 | 1243 | */ |
1244 | 1244 | function wp_print_head_scripts() { |
1245 | - if ( ! did_action('wp_print_scripts') ) { |
|
1245 | + if ( ! did_action('wp_print_scripts')) { |
|
1246 | 1246 | /** This action is documented in wp-includes/functions.wp-scripts.php */ |
1247 | - do_action( 'wp_print_scripts' ); |
|
1247 | + do_action('wp_print_scripts'); |
|
1248 | 1248 | } |
1249 | 1249 | |
1250 | 1250 | global $wp_scripts; |
1251 | 1251 | |
1252 | - if ( ! ( $wp_scripts instanceof WP_Scripts ) ) { |
|
1252 | + if ( ! ($wp_scripts instanceof WP_Scripts)) { |
|
1253 | 1253 | return array(); // no need to run if nothing is queued |
1254 | 1254 | } |
1255 | 1255 | return print_head_scripts(); |
@@ -1276,7 +1276,7 @@ discard block |
||
1276 | 1276 | * |
1277 | 1277 | * @since 2.8.0 |
1278 | 1278 | */ |
1279 | - do_action( 'wp_print_footer_scripts' ); |
|
1279 | + do_action('wp_print_footer_scripts'); |
|
1280 | 1280 | } |
1281 | 1281 | |
1282 | 1282 | /** |
@@ -1293,7 +1293,7 @@ discard block |
||
1293 | 1293 | * |
1294 | 1294 | * @since 2.8.0 |
1295 | 1295 | */ |
1296 | - do_action( 'wp_enqueue_scripts' ); |
|
1296 | + do_action('wp_enqueue_scripts'); |
|
1297 | 1297 | } |
1298 | 1298 | |
1299 | 1299 | /** |
@@ -1321,7 +1321,7 @@ discard block |
||
1321 | 1321 | * |
1322 | 1322 | * @param bool $print Whether to print the admin styles. Default true. |
1323 | 1323 | */ |
1324 | - if ( apply_filters( 'print_admin_styles', true ) ) { |
|
1324 | + if (apply_filters('print_admin_styles', true)) { |
|
1325 | 1325 | _print_styles(); |
1326 | 1326 | } |
1327 | 1327 | |
@@ -1342,7 +1342,7 @@ discard block |
||
1342 | 1342 | function print_late_styles() { |
1343 | 1343 | global $wp_styles, $concatenate_scripts; |
1344 | 1344 | |
1345 | - if ( ! ( $wp_styles instanceof WP_Styles ) ) { |
|
1345 | + if ( ! ($wp_styles instanceof WP_Styles)) { |
|
1346 | 1346 | return; |
1347 | 1347 | } |
1348 | 1348 | |
@@ -1357,7 +1357,7 @@ discard block |
||
1357 | 1357 | * |
1358 | 1358 | * @param bool $print Whether to print the 'late' styles. Default true. |
1359 | 1359 | */ |
1360 | - if ( apply_filters( 'print_late_styles', true ) ) { |
|
1360 | + if (apply_filters('print_late_styles', true)) { |
|
1361 | 1361 | _print_styles(); |
1362 | 1362 | } |
1363 | 1363 | |
@@ -1379,27 +1379,27 @@ discard block |
||
1379 | 1379 | $wp_styles = wp_styles(); |
1380 | 1380 | |
1381 | 1381 | $zip = $compress_css ? 1 : 0; |
1382 | - if ( $zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP ) |
|
1382 | + if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) |
|
1383 | 1383 | $zip = 'gzip'; |
1384 | 1384 | |
1385 | - if ( $concat = trim( $wp_styles->concat, ', ' ) ) { |
|
1385 | + if ($concat = trim($wp_styles->concat, ', ')) { |
|
1386 | 1386 | $dir = $wp_styles->text_direction; |
1387 | 1387 | $ver = $wp_styles->default_version; |
1388 | 1388 | |
1389 | - $concat = str_split( $concat, 128 ); |
|
1390 | - $concat = 'load%5B%5D=' . implode( '&load%5B%5D=', $concat ); |
|
1389 | + $concat = str_split($concat, 128); |
|
1390 | + $concat = 'load%5B%5D='.implode('&load%5B%5D=', $concat); |
|
1391 | 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"; |
|
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 | 1394 | |
1395 | - if ( !empty($wp_styles->print_code) ) { |
|
1395 | + if ( ! empty($wp_styles->print_code)) { |
|
1396 | 1396 | echo "<style type='text/css'>\n"; |
1397 | 1397 | echo $wp_styles->print_code; |
1398 | 1398 | echo "\n</style>\n"; |
1399 | 1399 | } |
1400 | 1400 | } |
1401 | 1401 | |
1402 | - if ( !empty($wp_styles->print_html) ) |
|
1402 | + if ( ! empty($wp_styles->print_html)) |
|
1403 | 1403 | echo $wp_styles->print_html; |
1404 | 1404 | } |
1405 | 1405 | |
@@ -1415,23 +1415,23 @@ discard block |
||
1415 | 1415 | function script_concat_settings() { |
1416 | 1416 | global $concatenate_scripts, $compress_scripts, $compress_css; |
1417 | 1417 | |
1418 | - $compressed_output = ( ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler') ); |
|
1418 | + $compressed_output = (ini_get('zlib.output_compression') || 'ob_gzhandler' == ini_get('output_handler')); |
|
1419 | 1419 | |
1420 | - if ( ! isset($concatenate_scripts) ) { |
|
1420 | + if ( ! isset($concatenate_scripts)) { |
|
1421 | 1421 | $concatenate_scripts = defined('CONCATENATE_SCRIPTS') ? CONCATENATE_SCRIPTS : true; |
1422 | - if ( ( ! is_admin() && ! did_action( 'login_init' ) ) || ( defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ) ) |
|
1422 | + if (( ! is_admin() && ! did_action('login_init')) || (defined('SCRIPT_DEBUG') && SCRIPT_DEBUG)) |
|
1423 | 1423 | $concatenate_scripts = false; |
1424 | 1424 | } |
1425 | 1425 | |
1426 | - if ( ! isset($compress_scripts) ) { |
|
1426 | + if ( ! isset($compress_scripts)) { |
|
1427 | 1427 | $compress_scripts = defined('COMPRESS_SCRIPTS') ? COMPRESS_SCRIPTS : true; |
1428 | - if ( $compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) |
|
1428 | + if ($compress_scripts && ( ! get_site_option('can_compress_scripts') || $compressed_output)) |
|
1429 | 1429 | $compress_scripts = false; |
1430 | 1430 | } |
1431 | 1431 | |
1432 | - if ( ! isset($compress_css) ) { |
|
1432 | + if ( ! isset($compress_css)) { |
|
1433 | 1433 | $compress_css = defined('COMPRESS_CSS') ? COMPRESS_CSS : true; |
1434 | - if ( $compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output ) ) |
|
1434 | + if ($compress_css && ( ! get_site_option('can_compress_scripts') || $compressed_output)) |
|
1435 | 1435 | $compress_css = false; |
1436 | 1436 | } |
1437 | 1437 | } |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | * @param string $supports Optional, not used. When implemented it will choose the right compression based on what the server supports. |
31 | 31 | * @return string|false False on failure. |
32 | 32 | */ |
33 | - public static function compress( $raw, $level = 9, $supports = null ) { |
|
34 | - return gzdeflate( $raw, $level ); |
|
33 | + public static function compress($raw, $level = 9, $supports = null) { |
|
34 | + return gzdeflate($raw, $level); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -50,24 +50,24 @@ discard block |
||
50 | 50 | * @param int $length The optional length of the compressed data. |
51 | 51 | * @return string|bool False on failure. |
52 | 52 | */ |
53 | - public static function decompress( $compressed, $length = null ) { |
|
53 | + public static function decompress($compressed, $length = null) { |
|
54 | 54 | |
55 | - if ( empty($compressed) ) |
|
55 | + if (empty($compressed)) |
|
56 | 56 | return $compressed; |
57 | 57 | |
58 | - if ( false !== ( $decompressed = @gzinflate( $compressed ) ) ) |
|
58 | + if (false !== ($decompressed = @gzinflate($compressed))) |
|
59 | 59 | return $decompressed; |
60 | 60 | |
61 | - if ( false !== ( $decompressed = self::compatible_gzinflate( $compressed ) ) ) |
|
61 | + if (false !== ($decompressed = self::compatible_gzinflate($compressed))) |
|
62 | 62 | return $decompressed; |
63 | 63 | |
64 | - if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) ) |
|
64 | + if (false !== ($decompressed = @gzuncompress($compressed))) |
|
65 | 65 | return $decompressed; |
66 | 66 | |
67 | - if ( function_exists('gzdecode') ) { |
|
68 | - $decompressed = @gzdecode( $compressed ); |
|
67 | + if (function_exists('gzdecode')) { |
|
68 | + $decompressed = @gzdecode($compressed); |
|
69 | 69 | |
70 | - if ( false !== $decompressed ) |
|
70 | + if (false !== $decompressed) |
|
71 | 71 | return $decompressed; |
72 | 72 | } |
73 | 73 | |
@@ -99,29 +99,29 @@ discard block |
||
99 | 99 | public static function compatible_gzinflate($gzData) { |
100 | 100 | |
101 | 101 | // Compressed data might contain a full header, if so strip it for gzinflate(). |
102 | - if ( substr($gzData, 0, 3) == "\x1f\x8b\x08" ) { |
|
102 | + if (substr($gzData, 0, 3) == "\x1f\x8b\x08") { |
|
103 | 103 | $i = 10; |
104 | - $flg = ord( substr($gzData, 3, 1) ); |
|
105 | - if ( $flg > 0 ) { |
|
106 | - if ( $flg & 4 ) { |
|
107 | - list($xlen) = unpack('v', substr($gzData, $i, 2) ); |
|
104 | + $flg = ord(substr($gzData, 3, 1)); |
|
105 | + if ($flg > 0) { |
|
106 | + if ($flg & 4) { |
|
107 | + list($xlen) = unpack('v', substr($gzData, $i, 2)); |
|
108 | 108 | $i = $i + 2 + $xlen; |
109 | 109 | } |
110 | - if ( $flg & 8 ) |
|
110 | + if ($flg & 8) |
|
111 | 111 | $i = strpos($gzData, "\0", $i) + 1; |
112 | - if ( $flg & 16 ) |
|
112 | + if ($flg & 16) |
|
113 | 113 | $i = strpos($gzData, "\0", $i) + 1; |
114 | - if ( $flg & 2 ) |
|
114 | + if ($flg & 2) |
|
115 | 115 | $i = $i + 2; |
116 | 116 | } |
117 | - $decompressed = @gzinflate( substr($gzData, $i, -8) ); |
|
118 | - if ( false !== $decompressed ) |
|
117 | + $decompressed = @gzinflate(substr($gzData, $i, -8)); |
|
118 | + if (false !== $decompressed) |
|
119 | 119 | return $decompressed; |
120 | 120 | } |
121 | 121 | |
122 | 122 | // Compressed data from java.util.zip.Deflater amongst others. |
123 | - $decompressed = @gzinflate( substr($gzData, 2) ); |
|
124 | - if ( false !== $decompressed ) |
|
123 | + $decompressed = @gzinflate(substr($gzData, 2)); |
|
124 | + if (false !== $decompressed) |
|
125 | 125 | return $decompressed; |
126 | 126 | |
127 | 127 | return false; |
@@ -138,25 +138,25 @@ discard block |
||
138 | 138 | * @param array $args |
139 | 139 | * @return string Types of encoding to accept. |
140 | 140 | */ |
141 | - public static function accept_encoding( $url, $args ) { |
|
141 | + public static function accept_encoding($url, $args) { |
|
142 | 142 | $type = array(); |
143 | 143 | $compression_enabled = self::is_available(); |
144 | 144 | |
145 | - if ( ! $args['decompress'] ) // Decompression specifically disabled. |
|
145 | + if ( ! $args['decompress']) // Decompression specifically disabled. |
|
146 | 146 | $compression_enabled = false; |
147 | - elseif ( $args['stream'] ) // Disable when streaming to file. |
|
147 | + elseif ($args['stream']) // Disable when streaming to file. |
|
148 | 148 | $compression_enabled = false; |
149 | - elseif ( isset( $args['limit_response_size'] ) ) // If only partial content is being requested, we won't be able to decompress it. |
|
149 | + elseif (isset($args['limit_response_size'])) // If only partial content is being requested, we won't be able to decompress it. |
|
150 | 150 | $compression_enabled = false; |
151 | 151 | |
152 | - if ( $compression_enabled ) { |
|
153 | - if ( function_exists( 'gzinflate' ) ) |
|
152 | + if ($compression_enabled) { |
|
153 | + if (function_exists('gzinflate')) |
|
154 | 154 | $type[] = 'deflate;q=1.0'; |
155 | 155 | |
156 | - if ( function_exists( 'gzuncompress' ) ) |
|
156 | + if (function_exists('gzuncompress')) |
|
157 | 157 | $type[] = 'compress;q=0.5'; |
158 | 158 | |
159 | - if ( function_exists( 'gzdecode' ) ) |
|
159 | + if (function_exists('gzdecode')) |
|
160 | 160 | $type[] = 'gzip;q=0.5'; |
161 | 161 | } |
162 | 162 | |
@@ -170,7 +170,7 @@ discard block |
||
170 | 170 | * @param string $url URL of the HTTP request. |
171 | 171 | * @param array $args HTTP request arguments. |
172 | 172 | */ |
173 | - $type = apply_filters( 'wp_http_accept_encoding', $type, $url, $args ); |
|
173 | + $type = apply_filters('wp_http_accept_encoding', $type, $url, $args); |
|
174 | 174 | |
175 | 175 | return implode(', ', $type); |
176 | 176 | } |
@@ -199,11 +199,11 @@ discard block |
||
199 | 199 | * @return bool |
200 | 200 | */ |
201 | 201 | public static function should_decode($headers) { |
202 | - if ( is_array( $headers ) ) { |
|
203 | - if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) ) |
|
202 | + if (is_array($headers)) { |
|
203 | + if (array_key_exists('content-encoding', $headers) && ! empty($headers['content-encoding'])) |
|
204 | 204 | return true; |
205 | - } elseif ( is_string( $headers ) ) { |
|
206 | - return ( stripos($headers, 'content-encoding:') !== false ); |
|
205 | + } elseif (is_string($headers)) { |
|
206 | + return (stripos($headers, 'content-encoding:') !== false); |
|
207 | 207 | } |
208 | 208 | |
209 | 209 | return false; |
@@ -223,6 +223,6 @@ discard block |
||
223 | 223 | * @return bool |
224 | 224 | */ |
225 | 225 | public static function is_available() { |
226 | - return ( function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate') ); |
|
226 | + return (function_exists('gzuncompress') || function_exists('gzdeflate') || function_exists('gzinflate')); |
|
227 | 227 | } |
228 | 228 | } |
@@ -52,23 +52,28 @@ discard block |
||
52 | 52 | */ |
53 | 53 | public static function decompress( $compressed, $length = null ) { |
54 | 54 | |
55 | - if ( empty($compressed) ) |
|
56 | - return $compressed; |
|
55 | + if ( empty($compressed) ) { |
|
56 | + return $compressed; |
|
57 | + } |
|
57 | 58 | |
58 | - if ( false !== ( $decompressed = @gzinflate( $compressed ) ) ) |
|
59 | - return $decompressed; |
|
59 | + if ( false !== ( $decompressed = @gzinflate( $compressed ) ) ) { |
|
60 | + return $decompressed; |
|
61 | + } |
|
60 | 62 | |
61 | - if ( false !== ( $decompressed = self::compatible_gzinflate( $compressed ) ) ) |
|
62 | - return $decompressed; |
|
63 | + if ( false !== ( $decompressed = self::compatible_gzinflate( $compressed ) ) ) { |
|
64 | + return $decompressed; |
|
65 | + } |
|
63 | 66 | |
64 | - if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) ) |
|
65 | - return $decompressed; |
|
67 | + if ( false !== ( $decompressed = @gzuncompress( $compressed ) ) ) { |
|
68 | + return $decompressed; |
|
69 | + } |
|
66 | 70 | |
67 | 71 | if ( function_exists('gzdecode') ) { |
68 | 72 | $decompressed = @gzdecode( $compressed ); |
69 | 73 | |
70 | - if ( false !== $decompressed ) |
|
71 | - return $decompressed; |
|
74 | + if ( false !== $decompressed ) { |
|
75 | + return $decompressed; |
|
76 | + } |
|
72 | 77 | } |
73 | 78 | |
74 | 79 | return $compressed; |
@@ -107,22 +112,27 @@ discard block |
||
107 | 112 | list($xlen) = unpack('v', substr($gzData, $i, 2) ); |
108 | 113 | $i = $i + 2 + $xlen; |
109 | 114 | } |
110 | - if ( $flg & 8 ) |
|
111 | - $i = strpos($gzData, "\0", $i) + 1; |
|
112 | - if ( $flg & 16 ) |
|
113 | - $i = strpos($gzData, "\0", $i) + 1; |
|
114 | - if ( $flg & 2 ) |
|
115 | - $i = $i + 2; |
|
115 | + if ( $flg & 8 ) { |
|
116 | + $i = strpos($gzData, "\0", $i) + 1; |
|
117 | + } |
|
118 | + if ( $flg & 16 ) { |
|
119 | + $i = strpos($gzData, "\0", $i) + 1; |
|
120 | + } |
|
121 | + if ( $flg & 2 ) { |
|
122 | + $i = $i + 2; |
|
123 | + } |
|
116 | 124 | } |
117 | 125 | $decompressed = @gzinflate( substr($gzData, $i, -8) ); |
118 | - if ( false !== $decompressed ) |
|
119 | - return $decompressed; |
|
126 | + if ( false !== $decompressed ) { |
|
127 | + return $decompressed; |
|
128 | + } |
|
120 | 129 | } |
121 | 130 | |
122 | 131 | // Compressed data from java.util.zip.Deflater amongst others. |
123 | 132 | $decompressed = @gzinflate( substr($gzData, 2) ); |
124 | - if ( false !== $decompressed ) |
|
125 | - return $decompressed; |
|
133 | + if ( false !== $decompressed ) { |
|
134 | + return $decompressed; |
|
135 | + } |
|
126 | 136 | |
127 | 137 | return false; |
128 | 138 | } |
@@ -142,22 +152,29 @@ discard block |
||
142 | 152 | $type = array(); |
143 | 153 | $compression_enabled = self::is_available(); |
144 | 154 | |
145 | - if ( ! $args['decompress'] ) // Decompression specifically disabled. |
|
155 | + if ( ! $args['decompress'] ) { |
|
156 | + // Decompression specifically disabled. |
|
146 | 157 | $compression_enabled = false; |
147 | - elseif ( $args['stream'] ) // Disable when streaming to file. |
|
158 | + } elseif ( $args['stream'] ) { |
|
159 | + // Disable when streaming to file. |
|
148 | 160 | $compression_enabled = false; |
149 | - elseif ( isset( $args['limit_response_size'] ) ) // If only partial content is being requested, we won't be able to decompress it. |
|
161 | + } elseif ( isset( $args['limit_response_size'] ) ) { |
|
162 | + // If only partial content is being requested, we won't be able to decompress it. |
|
150 | 163 | $compression_enabled = false; |
164 | + } |
|
151 | 165 | |
152 | 166 | if ( $compression_enabled ) { |
153 | - if ( function_exists( 'gzinflate' ) ) |
|
154 | - $type[] = 'deflate;q=1.0'; |
|
167 | + if ( function_exists( 'gzinflate' ) ) { |
|
168 | + $type[] = 'deflate;q=1.0'; |
|
169 | + } |
|
155 | 170 | |
156 | - if ( function_exists( 'gzuncompress' ) ) |
|
157 | - $type[] = 'compress;q=0.5'; |
|
171 | + if ( function_exists( 'gzuncompress' ) ) { |
|
172 | + $type[] = 'compress;q=0.5'; |
|
173 | + } |
|
158 | 174 | |
159 | - if ( function_exists( 'gzdecode' ) ) |
|
160 | - $type[] = 'gzip;q=0.5'; |
|
175 | + if ( function_exists( 'gzdecode' ) ) { |
|
176 | + $type[] = 'gzip;q=0.5'; |
|
177 | + } |
|
161 | 178 | } |
162 | 179 | |
163 | 180 | /** |
@@ -200,8 +217,9 @@ discard block |
||
200 | 217 | */ |
201 | 218 | public static function should_decode($headers) { |
202 | 219 | if ( is_array( $headers ) ) { |
203 | - if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) ) |
|
204 | - return true; |
|
220 | + if ( array_key_exists('content-encoding', $headers) && ! empty( $headers['content-encoding'] ) ) { |
|
221 | + return true; |
|
222 | + } |
|
205 | 223 | } elseif ( is_string( $headers ) ) { |
206 | 224 | return ( stripos($headers, 'content-encoding:') !== false ); |
207 | 225 | } |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | * @subpackage entry |
8 | 8 | */ |
9 | 9 | |
10 | -if ( ! class_exists( 'Translation_Entry', false ) ): |
|
10 | +if ( ! class_exists('Translation_Entry', false)): |
|
11 | 11 | /** |
12 | 12 | * Translation_Entry class encapsulates a translatable string |
13 | 13 | */ |
@@ -40,9 +40,9 @@ discard block |
||
40 | 40 | * - references (array) -- places in the code this strings is used, in relative_to_root_path/file.php:linenum form |
41 | 41 | * - flags (array) -- flags like php-format |
42 | 42 | */ |
43 | - function __construct( $args = array() ) { |
|
43 | + function __construct($args = array()) { |
|
44 | 44 | // if no singular -- empty object |
45 | - if (!isset($args['singular'])) { |
|
45 | + if ( ! isset($args['singular'])) { |
|
46 | 46 | return; |
47 | 47 | } |
48 | 48 | // get member variable values from args hash |
@@ -50,16 +50,16 @@ discard block |
||
50 | 50 | $this->$varname = $value; |
51 | 51 | } |
52 | 52 | if (isset($args['plural']) && $args['plural']) $this->is_plural = true; |
53 | - if (!is_array($this->translations)) $this->translations = array(); |
|
54 | - if (!is_array($this->references)) $this->references = array(); |
|
55 | - if (!is_array($this->flags)) $this->flags = array(); |
|
53 | + if ( ! is_array($this->translations)) $this->translations = array(); |
|
54 | + if ( ! is_array($this->references)) $this->references = array(); |
|
55 | + if ( ! is_array($this->flags)) $this->flags = array(); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
59 | 59 | * PHP4 constructor. |
60 | 60 | */ |
61 | - public function Translation_Entry( $args = array() ) { |
|
62 | - self::__construct( $args ); |
|
61 | + public function Translation_Entry($args = array()) { |
|
62 | + self::__construct($args); |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | /** |
@@ -68,12 +68,12 @@ discard block |
||
68 | 68 | * @return string|bool the key or false if the entry is empty |
69 | 69 | */ |
70 | 70 | function key() { |
71 | - if ( null === $this->singular || '' === $this->singular ) return false; |
|
71 | + if (null === $this->singular || '' === $this->singular) return false; |
|
72 | 72 | |
73 | 73 | // Prepend context and EOT, like in MO files |
74 | - $key = !$this->context? $this->singular : $this->context.chr(4).$this->singular; |
|
74 | + $key = ! $this->context ? $this->singular : $this->context.chr(4).$this->singular; |
|
75 | 75 | // Standardize on \n line endings |
76 | - $key = str_replace( array( "\r\n", "\r" ), "\n", $key ); |
|
76 | + $key = str_replace(array("\r\n", "\r"), "\n", $key); |
|
77 | 77 | |
78 | 78 | return $key; |
79 | 79 | } |
@@ -82,9 +82,9 @@ discard block |
||
82 | 82 | * @param object $other |
83 | 83 | */ |
84 | 84 | function merge_with(&$other) { |
85 | - $this->flags = array_unique( array_merge( $this->flags, $other->flags ) ); |
|
86 | - $this->references = array_unique( array_merge( $this->references, $other->references ) ); |
|
87 | - if ( $this->extracted_comments != $other->extracted_comments ) { |
|
85 | + $this->flags = array_unique(array_merge($this->flags, $other->flags)); |
|
86 | + $this->references = array_unique(array_merge($this->references, $other->references)); |
|
87 | + if ($this->extracted_comments != $other->extracted_comments) { |
|
88 | 88 | $this->extracted_comments .= $other->extracted_comments; |
89 | 89 | } |
90 | 90 |
@@ -49,10 +49,18 @@ discard block |
||
49 | 49 | foreach ($args as $varname => $value) { |
50 | 50 | $this->$varname = $value; |
51 | 51 | } |
52 | - if (isset($args['plural']) && $args['plural']) $this->is_plural = true; |
|
53 | - if (!is_array($this->translations)) $this->translations = array(); |
|
54 | - if (!is_array($this->references)) $this->references = array(); |
|
55 | - if (!is_array($this->flags)) $this->flags = array(); |
|
52 | + if (isset($args['plural']) && $args['plural']) { |
|
53 | + $this->is_plural = true; |
|
54 | + } |
|
55 | + if (!is_array($this->translations)) { |
|
56 | + $this->translations = array(); |
|
57 | + } |
|
58 | + if (!is_array($this->references)) { |
|
59 | + $this->references = array(); |
|
60 | + } |
|
61 | + if (!is_array($this->flags)) { |
|
62 | + $this->flags = array(); |
|
63 | + } |
|
56 | 64 | } |
57 | 65 | |
58 | 66 | /** |
@@ -68,7 +76,9 @@ discard block |
||
68 | 76 | * @return string|bool the key or false if the entry is empty |
69 | 77 | */ |
70 | 78 | function key() { |
71 | - if ( null === $this->singular || '' === $this->singular ) return false; |
|
79 | + if ( null === $this->singular || '' === $this->singular ) { |
|
80 | + return false; |
|
81 | + } |
|
72 | 82 | |
73 | 83 | // Prepend context and EOT, like in MO files |
74 | 84 | $key = !$this->context? $this->singular : $this->context.chr(4).$this->singular; |