@@ -14,7 +14,7 @@ discard block |
||
14 | 14 | * @return bool Whether the server is running Apache with the mod_rewrite module loaded. |
15 | 15 | */ |
16 | 16 | function got_mod_rewrite() { |
17 | - $got_rewrite = apache_mod_loaded( 'mod_rewrite', true ); |
|
17 | + $got_rewrite = apache_mod_loaded('mod_rewrite', true); |
|
18 | 18 | |
19 | 19 | /** |
20 | 20 | * Filters whether Apache and mod_rewrite are present. |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param bool $got_rewrite Whether Apache and mod_rewrite are present. |
30 | 30 | */ |
31 | - return apply_filters( 'got_rewrite', $got_rewrite ); |
|
31 | + return apply_filters('got_rewrite', $got_rewrite); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return bool Whether the server supports URL rewriting. |
44 | 44 | */ |
45 | 45 | function got_url_rewrite() { |
46 | - $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() ); |
|
46 | + $got_url_rewrite = (got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks()); |
|
47 | 47 | |
48 | 48 | /** |
49 | 49 | * Filters whether URL rewriting is available. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @param bool $got_url_rewrite Whether URL rewriting is available. |
54 | 54 | */ |
55 | - return apply_filters( 'got_url_rewrite', $got_url_rewrite ); |
|
55 | + return apply_filters('got_url_rewrite', $got_url_rewrite); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -64,31 +64,31 @@ discard block |
||
64 | 64 | * @param string $marker The marker to extract the strings from. |
65 | 65 | * @return string[] An array of strings from a file (.htaccess) from between BEGIN and END markers. |
66 | 66 | */ |
67 | -function extract_from_markers( $filename, $marker ) { |
|
67 | +function extract_from_markers($filename, $marker) { |
|
68 | 68 | $result = array(); |
69 | 69 | |
70 | - if ( ! file_exists( $filename ) ) { |
|
70 | + if (!file_exists($filename)) { |
|
71 | 71 | return $result; |
72 | 72 | } |
73 | 73 | |
74 | - $markerdata = explode( "\n", implode( '', file( $filename ) ) ); |
|
74 | + $markerdata = explode("\n", implode('', file($filename))); |
|
75 | 75 | |
76 | 76 | $state = false; |
77 | 77 | |
78 | - foreach ( $markerdata as $markerline ) { |
|
79 | - if ( false !== strpos( $markerline, '# END ' . $marker ) ) { |
|
78 | + foreach ($markerdata as $markerline) { |
|
79 | + if (false !== strpos($markerline, '# END ' . $marker)) { |
|
80 | 80 | $state = false; |
81 | 81 | } |
82 | 82 | |
83 | - if ( $state ) { |
|
84 | - if ( '#' === substr( $markerline, 0, 1 ) ) { |
|
83 | + if ($state) { |
|
84 | + if ('#' === substr($markerline, 0, 1)) { |
|
85 | 85 | continue; |
86 | 86 | } |
87 | 87 | |
88 | 88 | $result[] = $markerline; |
89 | 89 | } |
90 | 90 | |
91 | - if ( false !== strpos( $markerline, '# BEGIN ' . $marker ) ) { |
|
91 | + if (false !== strpos($markerline, '# BEGIN ' . $marker)) { |
|
92 | 92 | $state = true; |
93 | 93 | } |
94 | 94 | } |
@@ -110,31 +110,31 @@ discard block |
||
110 | 110 | * @param array|string $insertion The new content to insert. |
111 | 111 | * @return bool True on write success, false on failure. |
112 | 112 | */ |
113 | -function insert_with_markers( $filename, $marker, $insertion ) { |
|
114 | - if ( ! file_exists( $filename ) ) { |
|
115 | - if ( ! is_writable( dirname( $filename ) ) ) { |
|
113 | +function insert_with_markers($filename, $marker, $insertion) { |
|
114 | + if (!file_exists($filename)) { |
|
115 | + if (!is_writable(dirname($filename))) { |
|
116 | 116 | return false; |
117 | 117 | } |
118 | 118 | |
119 | - if ( ! touch( $filename ) ) { |
|
119 | + if (!touch($filename)) { |
|
120 | 120 | return false; |
121 | 121 | } |
122 | 122 | |
123 | 123 | // Make sure the file is created with a minimum set of permissions. |
124 | - $perms = fileperms( $filename ); |
|
124 | + $perms = fileperms($filename); |
|
125 | 125 | |
126 | - if ( $perms ) { |
|
127 | - chmod( $filename, $perms | 0644 ); |
|
126 | + if ($perms) { |
|
127 | + chmod($filename, $perms | 0644); |
|
128 | 128 | } |
129 | - } elseif ( ! is_writable( $filename ) ) { |
|
129 | + } elseif (!is_writable($filename)) { |
|
130 | 130 | return false; |
131 | 131 | } |
132 | 132 | |
133 | - if ( ! is_array( $insertion ) ) { |
|
134 | - $insertion = explode( "\n", $insertion ); |
|
133 | + if (!is_array($insertion)) { |
|
134 | + $insertion = explode("\n", $insertion); |
|
135 | 135 | } |
136 | 136 | |
137 | - $switched_locale = switch_to_locale( get_locale() ); |
|
137 | + $switched_locale = switch_to_locale(get_locale()); |
|
138 | 138 | |
139 | 139 | $instructions = sprintf( |
140 | 140 | /* translators: 1: Marker. */ |
@@ -146,10 +146,10 @@ discard block |
||
146 | 146 | $marker |
147 | 147 | ); |
148 | 148 | |
149 | - $instructions = explode( "\n", $instructions ); |
|
149 | + $instructions = explode("\n", $instructions); |
|
150 | 150 | |
151 | - foreach ( $instructions as $line => $text ) { |
|
152 | - $instructions[ $line ] = '# ' . $text; |
|
151 | + foreach ($instructions as $line => $text) { |
|
152 | + $instructions[$line] = '# ' . $text; |
|
153 | 153 | } |
154 | 154 | |
155 | 155 | /** |
@@ -160,30 +160,30 @@ discard block |
||
160 | 160 | * @param string[] $instructions Array of lines with inline instructions. |
161 | 161 | * @param string $marker The marker being inserted. |
162 | 162 | */ |
163 | - $instructions = apply_filters( 'insert_with_markers_inline_instructions', $instructions, $marker ); |
|
163 | + $instructions = apply_filters('insert_with_markers_inline_instructions', $instructions, $marker); |
|
164 | 164 | |
165 | - if ( $switched_locale ) { |
|
165 | + if ($switched_locale) { |
|
166 | 166 | restore_previous_locale(); |
167 | 167 | } |
168 | 168 | |
169 | - $insertion = array_merge( $instructions, $insertion ); |
|
169 | + $insertion = array_merge($instructions, $insertion); |
|
170 | 170 | |
171 | 171 | $start_marker = "# BEGIN {$marker}"; |
172 | 172 | $end_marker = "# END {$marker}"; |
173 | 173 | |
174 | - $fp = fopen( $filename, 'r+' ); |
|
174 | + $fp = fopen($filename, 'r+'); |
|
175 | 175 | |
176 | - if ( ! $fp ) { |
|
176 | + if (!$fp) { |
|
177 | 177 | return false; |
178 | 178 | } |
179 | 179 | |
180 | 180 | // Attempt to get a lock. If the filesystem supports locking, this will block until the lock is acquired. |
181 | - flock( $fp, LOCK_EX ); |
|
181 | + flock($fp, LOCK_EX); |
|
182 | 182 | |
183 | 183 | $lines = array(); |
184 | 184 | |
185 | - while ( ! feof( $fp ) ) { |
|
186 | - $lines[] = rtrim( fgets( $fp ), "\r\n" ); |
|
185 | + while (!feof($fp)) { |
|
186 | + $lines[] = rtrim(fgets($fp), "\r\n"); |
|
187 | 187 | } |
188 | 188 | |
189 | 189 | // Split out the existing file into the preceding lines, and those that appear after the marker. |
@@ -193,18 +193,18 @@ discard block |
||
193 | 193 | $found_marker = false; |
194 | 194 | $found_end_marker = false; |
195 | 195 | |
196 | - foreach ( $lines as $line ) { |
|
197 | - if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) { |
|
196 | + foreach ($lines as $line) { |
|
197 | + if (!$found_marker && false !== strpos($line, $start_marker)) { |
|
198 | 198 | $found_marker = true; |
199 | 199 | continue; |
200 | - } elseif ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) { |
|
200 | + } elseif (!$found_end_marker && false !== strpos($line, $end_marker)) { |
|
201 | 201 | $found_end_marker = true; |
202 | 202 | continue; |
203 | 203 | } |
204 | 204 | |
205 | - if ( ! $found_marker ) { |
|
205 | + if (!$found_marker) { |
|
206 | 206 | $pre_lines[] = $line; |
207 | - } elseif ( $found_marker && $found_end_marker ) { |
|
207 | + } elseif ($found_marker && $found_end_marker) { |
|
208 | 208 | $post_lines[] = $line; |
209 | 209 | } else { |
210 | 210 | $existing_lines[] = $line; |
@@ -212,9 +212,9 @@ discard block |
||
212 | 212 | } |
213 | 213 | |
214 | 214 | // Check to see if there was a change. |
215 | - if ( $existing_lines === $insertion ) { |
|
216 | - flock( $fp, LOCK_UN ); |
|
217 | - fclose( $fp ); |
|
215 | + if ($existing_lines === $insertion) { |
|
216 | + flock($fp, LOCK_UN); |
|
217 | + fclose($fp); |
|
218 | 218 | |
219 | 219 | return true; |
220 | 220 | } |
@@ -224,24 +224,24 @@ discard block |
||
224 | 224 | "\n", |
225 | 225 | array_merge( |
226 | 226 | $pre_lines, |
227 | - array( $start_marker ), |
|
227 | + array($start_marker), |
|
228 | 228 | $insertion, |
229 | - array( $end_marker ), |
|
229 | + array($end_marker), |
|
230 | 230 | $post_lines |
231 | 231 | ) |
232 | 232 | ); |
233 | 233 | |
234 | 234 | // Write to the start of the file, and truncate it to that length. |
235 | - fseek( $fp, 0 ); |
|
236 | - $bytes = fwrite( $fp, $new_file_data ); |
|
235 | + fseek($fp, 0); |
|
236 | + $bytes = fwrite($fp, $new_file_data); |
|
237 | 237 | |
238 | - if ( $bytes ) { |
|
239 | - ftruncate( $fp, ftell( $fp ) ); |
|
238 | + if ($bytes) { |
|
239 | + ftruncate($fp, ftell($fp)); |
|
240 | 240 | } |
241 | 241 | |
242 | - fflush( $fp ); |
|
243 | - flock( $fp, LOCK_UN ); |
|
244 | - fclose( $fp ); |
|
242 | + fflush($fp); |
|
243 | + flock($fp, LOCK_UN); |
|
244 | + fclose($fp); |
|
245 | 245 | |
246 | 246 | return (bool) $bytes; |
247 | 247 | } |
@@ -261,7 +261,7 @@ discard block |
||
261 | 261 | function save_mod_rewrite_rules() { |
262 | 262 | global $wp_rewrite; |
263 | 263 | |
264 | - if ( is_multisite() ) { |
|
264 | + if (is_multisite()) { |
|
265 | 265 | return; |
266 | 266 | } |
267 | 267 | |
@@ -275,13 +275,13 @@ discard block |
||
275 | 275 | * If the file doesn't already exist check for write access to the directory |
276 | 276 | * and whether we have some rules. Else check for write access to the file. |
277 | 277 | */ |
278 | - if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() |
|
279 | - || is_writable( $htaccess_file ) |
|
278 | + if (!file_exists($htaccess_file) && is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() |
|
279 | + || is_writable($htaccess_file) |
|
280 | 280 | ) { |
281 | - if ( got_mod_rewrite() ) { |
|
282 | - $rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() ); |
|
281 | + if (got_mod_rewrite()) { |
|
282 | + $rules = explode("\n", $wp_rewrite->mod_rewrite_rules()); |
|
283 | 283 | |
284 | - return insert_with_markers( $htaccess_file, 'WordPress', $rules ); |
|
284 | + return insert_with_markers($htaccess_file, 'WordPress', $rules); |
|
285 | 285 | } |
286 | 286 | } |
287 | 287 | |
@@ -301,7 +301,7 @@ discard block |
||
301 | 301 | function iis7_save_url_rewrite_rules() { |
302 | 302 | global $wp_rewrite; |
303 | 303 | |
304 | - if ( is_multisite() ) { |
|
304 | + if (is_multisite()) { |
|
305 | 305 | return; |
306 | 306 | } |
307 | 307 | |
@@ -312,16 +312,16 @@ discard block |
||
312 | 312 | $web_config_file = $home_path . 'web.config'; |
313 | 313 | |
314 | 314 | // Using win_is_writable() instead of is_writable() because of a bug in Windows PHP. |
315 | - if ( iis7_supports_permalinks() |
|
316 | - && ( ! file_exists( $web_config_file ) && win_is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks() |
|
317 | - || win_is_writable( $web_config_file ) ) |
|
315 | + if (iis7_supports_permalinks() |
|
316 | + && (!file_exists($web_config_file) && win_is_writable($home_path) && $wp_rewrite->using_mod_rewrite_permalinks() |
|
317 | + || win_is_writable($web_config_file)) |
|
318 | 318 | ) { |
319 | - $rule = $wp_rewrite->iis7_url_rewrite_rules( false ); |
|
319 | + $rule = $wp_rewrite->iis7_url_rewrite_rules(false); |
|
320 | 320 | |
321 | - if ( ! empty( $rule ) ) { |
|
322 | - return iis7_add_rewrite_rule( $web_config_file, $rule ); |
|
321 | + if (!empty($rule)) { |
|
322 | + return iis7_add_rewrite_rule($web_config_file, $rule); |
|
323 | 323 | } else { |
324 | - return iis7_delete_rewrite_rule( $web_config_file ); |
|
324 | + return iis7_delete_rewrite_rule($web_config_file); |
|
325 | 325 | } |
326 | 326 | } |
327 | 327 | |
@@ -335,23 +335,23 @@ discard block |
||
335 | 335 | * |
336 | 336 | * @param string $file |
337 | 337 | */ |
338 | -function update_recently_edited( $file ) { |
|
339 | - $oldfiles = (array) get_option( 'recently_edited' ); |
|
338 | +function update_recently_edited($file) { |
|
339 | + $oldfiles = (array) get_option('recently_edited'); |
|
340 | 340 | |
341 | - if ( $oldfiles ) { |
|
342 | - $oldfiles = array_reverse( $oldfiles ); |
|
341 | + if ($oldfiles) { |
|
342 | + $oldfiles = array_reverse($oldfiles); |
|
343 | 343 | $oldfiles[] = $file; |
344 | - $oldfiles = array_reverse( $oldfiles ); |
|
345 | - $oldfiles = array_unique( $oldfiles ); |
|
344 | + $oldfiles = array_reverse($oldfiles); |
|
345 | + $oldfiles = array_unique($oldfiles); |
|
346 | 346 | |
347 | - if ( 5 < count( $oldfiles ) ) { |
|
348 | - array_pop( $oldfiles ); |
|
347 | + if (5 < count($oldfiles)) { |
|
348 | + array_pop($oldfiles); |
|
349 | 349 | } |
350 | 350 | } else { |
351 | 351 | $oldfiles[] = $file; |
352 | 352 | } |
353 | 353 | |
354 | - update_option( 'recently_edited', $oldfiles ); |
|
354 | + update_option('recently_edited', $oldfiles); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -363,15 +363,15 @@ discard block |
||
363 | 363 | * @param array $allowed_files List of theme file paths. |
364 | 364 | * @return array Tree structure for listing theme files. |
365 | 365 | */ |
366 | -function wp_make_theme_file_tree( $allowed_files ) { |
|
366 | +function wp_make_theme_file_tree($allowed_files) { |
|
367 | 367 | $tree_list = array(); |
368 | 368 | |
369 | - foreach ( $allowed_files as $file_name => $absolute_filename ) { |
|
370 | - $list = explode( '/', $file_name ); |
|
369 | + foreach ($allowed_files as $file_name => $absolute_filename) { |
|
370 | + $list = explode('/', $file_name); |
|
371 | 371 | $last_dir = &$tree_list; |
372 | 372 | |
373 | - foreach ( $list as $dir ) { |
|
374 | - $last_dir =& $last_dir[ $dir ]; |
|
373 | + foreach ($list as $dir) { |
|
374 | + $last_dir = & $last_dir[$dir]; |
|
375 | 375 | } |
376 | 376 | |
377 | 377 | $last_dir = $file_name; |
@@ -395,27 +395,27 @@ discard block |
||
395 | 395 | * @param int $size The aria-setsize for the current iteration. |
396 | 396 | * @param int $index The aria-posinset for the current iteration. |
397 | 397 | */ |
398 | -function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) { |
|
398 | +function wp_print_theme_file_tree($tree, $level = 2, $size = 1, $index = 1) { |
|
399 | 399 | global $relative_file, $stylesheet; |
400 | 400 | |
401 | - if ( is_array( $tree ) ) { |
|
401 | + if (is_array($tree)) { |
|
402 | 402 | $index = 0; |
403 | - $size = count( $tree ); |
|
403 | + $size = count($tree); |
|
404 | 404 | |
405 | - foreach ( $tree as $label => $theme_file ) : |
|
405 | + foreach ($tree as $label => $theme_file) : |
|
406 | 406 | $index++; |
407 | 407 | |
408 | - if ( ! is_array( $theme_file ) ) { |
|
409 | - wp_print_theme_file_tree( $theme_file, $level, $index, $size ); |
|
408 | + if (!is_array($theme_file)) { |
|
409 | + wp_print_theme_file_tree($theme_file, $level, $index, $size); |
|
410 | 410 | continue; |
411 | 411 | } |
412 | 412 | ?> |
413 | 413 | <li role="treeitem" aria-expanded="true" tabindex="-1" |
414 | - aria-level="<?php echo esc_attr( $level ); ?>" |
|
415 | - aria-setsize="<?php echo esc_attr( $size ); ?>" |
|
416 | - aria-posinset="<?php echo esc_attr( $index ); ?>"> |
|
417 | - <span class="folder-label"><?php echo esc_html( $label ); ?> <span class="screen-reader-text"><?php _e( 'folder' ); ?></span><span aria-hidden="true" class="icon"></span></span> |
|
418 | - <ul role="group" class="tree-folder"><?php wp_print_theme_file_tree( $theme_file, $level + 1, $index, $size ); ?></ul> |
|
414 | + aria-level="<?php echo esc_attr($level); ?>" |
|
415 | + aria-setsize="<?php echo esc_attr($size); ?>" |
|
416 | + aria-posinset="<?php echo esc_attr($index); ?>"> |
|
417 | + <span class="folder-label"><?php echo esc_html($label); ?> <span class="screen-reader-text"><?php _e('folder'); ?></span><span aria-hidden="true" class="icon"></span></span> |
|
418 | + <ul role="group" class="tree-folder"><?php wp_print_theme_file_tree($theme_file, $level + 1, $index, $size); ?></ul> |
|
419 | 419 | </li> |
420 | 420 | <?php |
421 | 421 | endforeach; |
@@ -423,26 +423,26 @@ discard block |
||
423 | 423 | $filename = $tree; |
424 | 424 | $url = add_query_arg( |
425 | 425 | array( |
426 | - 'file' => rawurlencode( $tree ), |
|
427 | - 'theme' => rawurlencode( $stylesheet ), |
|
426 | + 'file' => rawurlencode($tree), |
|
427 | + 'theme' => rawurlencode($stylesheet), |
|
428 | 428 | ), |
429 | - self_admin_url( 'theme-editor.php' ) |
|
429 | + self_admin_url('theme-editor.php') |
|
430 | 430 | ); |
431 | 431 | ?> |
432 | - <li role="none" class="<?php echo esc_attr( $relative_file === $filename ? 'current-file' : '' ); ?>"> |
|
433 | - <a role="treeitem" tabindex="<?php echo esc_attr( $relative_file === $filename ? '0' : '-1' ); ?>" |
|
434 | - href="<?php echo esc_url( $url ); ?>" |
|
435 | - aria-level="<?php echo esc_attr( $level ); ?>" |
|
436 | - aria-setsize="<?php echo esc_attr( $size ); ?>" |
|
437 | - aria-posinset="<?php echo esc_attr( $index ); ?>"> |
|
432 | + <li role="none" class="<?php echo esc_attr($relative_file === $filename ? 'current-file' : ''); ?>"> |
|
433 | + <a role="treeitem" tabindex="<?php echo esc_attr($relative_file === $filename ? '0' : '-1'); ?>" |
|
434 | + href="<?php echo esc_url($url); ?>" |
|
435 | + aria-level="<?php echo esc_attr($level); ?>" |
|
436 | + aria-setsize="<?php echo esc_attr($size); ?>" |
|
437 | + aria-posinset="<?php echo esc_attr($index); ?>"> |
|
438 | 438 | <?php |
439 | - $file_description = esc_html( get_file_description( $filename ) ); |
|
439 | + $file_description = esc_html(get_file_description($filename)); |
|
440 | 440 | |
441 | - if ( $file_description !== $filename && wp_basename( $filename ) !== $file_description ) { |
|
442 | - $file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>'; |
|
441 | + if ($file_description !== $filename && wp_basename($filename) !== $file_description) { |
|
442 | + $file_description .= '<br /><span class="nonessential">(' . esc_html($filename) . ')</span>'; |
|
443 | 443 | } |
444 | 444 | |
445 | - if ( $relative_file === $filename ) { |
|
445 | + if ($relative_file === $filename) { |
|
446 | 446 | echo '<span class="notice notice-info">' . $file_description . '</span>'; |
447 | 447 | } else { |
448 | 448 | echo $file_description; |
@@ -463,15 +463,15 @@ discard block |
||
463 | 463 | * @param array $plugin_editable_files List of plugin file paths. |
464 | 464 | * @return array Tree structure for listing plugin files. |
465 | 465 | */ |
466 | -function wp_make_plugin_file_tree( $plugin_editable_files ) { |
|
466 | +function wp_make_plugin_file_tree($plugin_editable_files) { |
|
467 | 467 | $tree_list = array(); |
468 | 468 | |
469 | - foreach ( $plugin_editable_files as $plugin_file ) { |
|
470 | - $list = explode( '/', preg_replace( '#^.+?/#', '', $plugin_file ) ); |
|
469 | + foreach ($plugin_editable_files as $plugin_file) { |
|
470 | + $list = explode('/', preg_replace('#^.+?/#', '', $plugin_file)); |
|
471 | 471 | $last_dir = &$tree_list; |
472 | 472 | |
473 | - foreach ( $list as $dir ) { |
|
474 | - $last_dir =& $last_dir[ $dir ]; |
|
473 | + foreach ($list as $dir) { |
|
474 | + $last_dir = & $last_dir[$dir]; |
|
475 | 475 | } |
476 | 476 | |
477 | 477 | $last_dir = $plugin_file; |
@@ -492,50 +492,50 @@ discard block |
||
492 | 492 | * @param int $size The aria-setsize for the current iteration. |
493 | 493 | * @param int $index The aria-posinset for the current iteration. |
494 | 494 | */ |
495 | -function wp_print_plugin_file_tree( $tree, $label = '', $level = 2, $size = 1, $index = 1 ) { |
|
495 | +function wp_print_plugin_file_tree($tree, $label = '', $level = 2, $size = 1, $index = 1) { |
|
496 | 496 | global $file, $plugin; |
497 | 497 | |
498 | - if ( is_array( $tree ) ) { |
|
498 | + if (is_array($tree)) { |
|
499 | 499 | $index = 0; |
500 | - $size = count( $tree ); |
|
500 | + $size = count($tree); |
|
501 | 501 | |
502 | - foreach ( $tree as $label => $plugin_file ) : |
|
502 | + foreach ($tree as $label => $plugin_file) : |
|
503 | 503 | $index++; |
504 | 504 | |
505 | - if ( ! is_array( $plugin_file ) ) { |
|
506 | - wp_print_plugin_file_tree( $plugin_file, $label, $level, $index, $size ); |
|
505 | + if (!is_array($plugin_file)) { |
|
506 | + wp_print_plugin_file_tree($plugin_file, $label, $level, $index, $size); |
|
507 | 507 | continue; |
508 | 508 | } |
509 | 509 | ?> |
510 | 510 | <li role="treeitem" aria-expanded="true" tabindex="-1" |
511 | - aria-level="<?php echo esc_attr( $level ); ?>" |
|
512 | - aria-setsize="<?php echo esc_attr( $size ); ?>" |
|
513 | - aria-posinset="<?php echo esc_attr( $index ); ?>"> |
|
514 | - <span class="folder-label"><?php echo esc_html( $label ); ?> <span class="screen-reader-text"><?php _e( 'folder' ); ?></span><span aria-hidden="true" class="icon"></span></span> |
|
515 | - <ul role="group" class="tree-folder"><?php wp_print_plugin_file_tree( $plugin_file, '', $level + 1, $index, $size ); ?></ul> |
|
511 | + aria-level="<?php echo esc_attr($level); ?>" |
|
512 | + aria-setsize="<?php echo esc_attr($size); ?>" |
|
513 | + aria-posinset="<?php echo esc_attr($index); ?>"> |
|
514 | + <span class="folder-label"><?php echo esc_html($label); ?> <span class="screen-reader-text"><?php _e('folder'); ?></span><span aria-hidden="true" class="icon"></span></span> |
|
515 | + <ul role="group" class="tree-folder"><?php wp_print_plugin_file_tree($plugin_file, '', $level + 1, $index, $size); ?></ul> |
|
516 | 516 | </li> |
517 | 517 | <?php |
518 | 518 | endforeach; |
519 | 519 | } else { |
520 | 520 | $url = add_query_arg( |
521 | 521 | array( |
522 | - 'file' => rawurlencode( $tree ), |
|
523 | - 'plugin' => rawurlencode( $plugin ), |
|
522 | + 'file' => rawurlencode($tree), |
|
523 | + 'plugin' => rawurlencode($plugin), |
|
524 | 524 | ), |
525 | - self_admin_url( 'plugin-editor.php' ) |
|
525 | + self_admin_url('plugin-editor.php') |
|
526 | 526 | ); |
527 | 527 | ?> |
528 | - <li role="none" class="<?php echo esc_attr( $file === $tree ? 'current-file' : '' ); ?>"> |
|
529 | - <a role="treeitem" tabindex="<?php echo esc_attr( $file === $tree ? '0' : '-1' ); ?>" |
|
530 | - href="<?php echo esc_url( $url ); ?>" |
|
531 | - aria-level="<?php echo esc_attr( $level ); ?>" |
|
532 | - aria-setsize="<?php echo esc_attr( $size ); ?>" |
|
533 | - aria-posinset="<?php echo esc_attr( $index ); ?>"> |
|
528 | + <li role="none" class="<?php echo esc_attr($file === $tree ? 'current-file' : ''); ?>"> |
|
529 | + <a role="treeitem" tabindex="<?php echo esc_attr($file === $tree ? '0' : '-1'); ?>" |
|
530 | + href="<?php echo esc_url($url); ?>" |
|
531 | + aria-level="<?php echo esc_attr($level); ?>" |
|
532 | + aria-setsize="<?php echo esc_attr($size); ?>" |
|
533 | + aria-posinset="<?php echo esc_attr($index); ?>"> |
|
534 | 534 | <?php |
535 | - if ( $file === $tree ) { |
|
536 | - echo '<span class="notice notice-info">' . esc_html( $label ) . '</span>'; |
|
535 | + if ($file === $tree) { |
|
536 | + echo '<span class="notice notice-info">' . esc_html($label) . '</span>'; |
|
537 | 537 | } else { |
538 | - echo esc_html( $label ); |
|
538 | + echo esc_html($label); |
|
539 | 539 | } |
540 | 540 | ?> |
541 | 541 | </a> |
@@ -552,13 +552,13 @@ discard block |
||
552 | 552 | * @param string $old_value |
553 | 553 | * @param string $value |
554 | 554 | */ |
555 | -function update_home_siteurl( $old_value, $value ) { |
|
556 | - if ( wp_installing() ) { |
|
555 | +function update_home_siteurl($old_value, $value) { |
|
556 | + if (wp_installing()) { |
|
557 | 557 | return; |
558 | 558 | } |
559 | 559 | |
560 | - if ( is_multisite() && ms_is_switched() ) { |
|
561 | - delete_option( 'rewrite_rules' ); |
|
560 | + if (is_multisite() && ms_is_switched()) { |
|
561 | + delete_option('rewrite_rules'); |
|
562 | 562 | } else { |
563 | 563 | flush_rewrite_rules(); |
564 | 564 | } |
@@ -576,16 +576,16 @@ discard block |
||
576 | 576 | * |
577 | 577 | * @param array $vars An array of globals to reset. |
578 | 578 | */ |
579 | -function wp_reset_vars( $vars ) { |
|
580 | - foreach ( $vars as $var ) { |
|
581 | - if ( empty( $_POST[ $var ] ) ) { |
|
582 | - if ( empty( $_GET[ $var ] ) ) { |
|
583 | - $GLOBALS[ $var ] = ''; |
|
579 | +function wp_reset_vars($vars) { |
|
580 | + foreach ($vars as $var) { |
|
581 | + if (empty($_POST[$var])) { |
|
582 | + if (empty($_GET[$var])) { |
|
583 | + $GLOBALS[$var] = ''; |
|
584 | 584 | } else { |
585 | - $GLOBALS[ $var ] = $_GET[ $var ]; |
|
585 | + $GLOBALS[$var] = $_GET[$var]; |
|
586 | 586 | } |
587 | 587 | } else { |
588 | - $GLOBALS[ $var ] = $_POST[ $var ]; |
|
588 | + $GLOBALS[$var] = $_POST[$var]; |
|
589 | 589 | } |
590 | 590 | } |
591 | 591 | } |
@@ -597,9 +597,9 @@ discard block |
||
597 | 597 | * |
598 | 598 | * @param string|WP_Error $message |
599 | 599 | */ |
600 | -function show_message( $message ) { |
|
601 | - if ( is_wp_error( $message ) ) { |
|
602 | - if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) { |
|
600 | +function show_message($message) { |
|
601 | + if (is_wp_error($message)) { |
|
602 | + if ($message->get_error_data() && is_string($message->get_error_data())) { |
|
603 | 603 | $message = $message->get_error_message() . ': ' . $message->get_error_data(); |
604 | 604 | } else { |
605 | 605 | $message = $message->get_error_message(); |
@@ -617,40 +617,40 @@ discard block |
||
617 | 617 | * @param string $content |
618 | 618 | * @return array |
619 | 619 | */ |
620 | -function wp_doc_link_parse( $content ) { |
|
621 | - if ( ! is_string( $content ) || empty( $content ) ) { |
|
620 | +function wp_doc_link_parse($content) { |
|
621 | + if (!is_string($content) || empty($content)) { |
|
622 | 622 | return array(); |
623 | 623 | } |
624 | 624 | |
625 | - if ( ! function_exists( 'token_get_all' ) ) { |
|
625 | + if (!function_exists('token_get_all')) { |
|
626 | 626 | return array(); |
627 | 627 | } |
628 | 628 | |
629 | - $tokens = token_get_all( $content ); |
|
630 | - $count = count( $tokens ); |
|
629 | + $tokens = token_get_all($content); |
|
630 | + $count = count($tokens); |
|
631 | 631 | $functions = array(); |
632 | 632 | $ignore_functions = array(); |
633 | 633 | |
634 | - for ( $t = 0; $t < $count - 2; $t++ ) { |
|
635 | - if ( ! is_array( $tokens[ $t ] ) ) { |
|
634 | + for ($t = 0; $t < $count - 2; $t++) { |
|
635 | + if (!is_array($tokens[$t])) { |
|
636 | 636 | continue; |
637 | 637 | } |
638 | 638 | |
639 | - if ( T_STRING === $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) { |
|
639 | + if (T_STRING === $tokens[$t][0] && ('(' === $tokens[$t + 1] || '(' === $tokens[$t + 2])) { |
|
640 | 640 | // If it's a function or class defined locally, there's not going to be any docs available. |
641 | - if ( ( isset( $tokens[ $t - 2 ][1] ) && in_array( $tokens[ $t - 2 ][1], array( 'function', 'class' ), true ) ) |
|
642 | - || ( isset( $tokens[ $t - 2 ][0] ) && T_OBJECT_OPERATOR === $tokens[ $t - 1 ][0] ) |
|
641 | + if ((isset($tokens[$t - 2][1]) && in_array($tokens[$t - 2][1], array('function', 'class'), true)) |
|
642 | + || (isset($tokens[$t - 2][0]) && T_OBJECT_OPERATOR === $tokens[$t - 1][0]) |
|
643 | 643 | ) { |
644 | - $ignore_functions[] = $tokens[ $t ][1]; |
|
644 | + $ignore_functions[] = $tokens[$t][1]; |
|
645 | 645 | } |
646 | 646 | |
647 | 647 | // Add this to our stack of unique references. |
648 | - $functions[] = $tokens[ $t ][1]; |
|
648 | + $functions[] = $tokens[$t][1]; |
|
649 | 649 | } |
650 | 650 | } |
651 | 651 | |
652 | - $functions = array_unique( $functions ); |
|
653 | - sort( $functions ); |
|
652 | + $functions = array_unique($functions); |
|
653 | + sort($functions); |
|
654 | 654 | |
655 | 655 | /** |
656 | 656 | * Filters the list of functions and classes to be ignored from the documentation lookup. |
@@ -659,14 +659,14 @@ discard block |
||
659 | 659 | * |
660 | 660 | * @param string[] $ignore_functions Array of names of functions and classes to be ignored. |
661 | 661 | */ |
662 | - $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions ); |
|
662 | + $ignore_functions = apply_filters('documentation_ignore_functions', $ignore_functions); |
|
663 | 663 | |
664 | - $ignore_functions = array_unique( $ignore_functions ); |
|
664 | + $ignore_functions = array_unique($ignore_functions); |
|
665 | 665 | |
666 | 666 | $out = array(); |
667 | 667 | |
668 | - foreach ( $functions as $function ) { |
|
669 | - if ( in_array( $function, $ignore_functions, true ) ) { |
|
668 | + foreach ($functions as $function) { |
|
669 | + if (in_array($function, $ignore_functions, true)) { |
|
670 | 670 | continue; |
671 | 671 | } |
672 | 672 | |
@@ -682,38 +682,38 @@ discard block |
||
682 | 682 | * @since 2.8.0 |
683 | 683 | */ |
684 | 684 | function set_screen_options() { |
685 | - if ( ! isset( $_POST['wp_screen_options'] ) || ! is_array( $_POST['wp_screen_options'] ) ) { |
|
685 | + if (!isset($_POST['wp_screen_options']) || !is_array($_POST['wp_screen_options'])) { |
|
686 | 686 | return; |
687 | 687 | } |
688 | 688 | |
689 | - check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); |
|
689 | + check_admin_referer('screen-options-nonce', 'screenoptionnonce'); |
|
690 | 690 | |
691 | 691 | $user = wp_get_current_user(); |
692 | 692 | |
693 | - if ( ! $user ) { |
|
693 | + if (!$user) { |
|
694 | 694 | return; |
695 | 695 | } |
696 | 696 | |
697 | 697 | $option = $_POST['wp_screen_options']['option']; |
698 | 698 | $value = $_POST['wp_screen_options']['value']; |
699 | 699 | |
700 | - if ( sanitize_key( $option ) !== $option ) { |
|
700 | + if (sanitize_key($option) !== $option) { |
|
701 | 701 | return; |
702 | 702 | } |
703 | 703 | |
704 | 704 | $map_option = $option; |
705 | - $type = str_replace( 'edit_', '', $map_option ); |
|
706 | - $type = str_replace( '_per_page', '', $type ); |
|
705 | + $type = str_replace('edit_', '', $map_option); |
|
706 | + $type = str_replace('_per_page', '', $type); |
|
707 | 707 | |
708 | - if ( in_array( $type, get_taxonomies(), true ) ) { |
|
708 | + if (in_array($type, get_taxonomies(), true)) { |
|
709 | 709 | $map_option = 'edit_tags_per_page'; |
710 | - } elseif ( in_array( $type, get_post_types(), true ) ) { |
|
710 | + } elseif (in_array($type, get_post_types(), true)) { |
|
711 | 711 | $map_option = 'edit_per_page'; |
712 | 712 | } else { |
713 | - $option = str_replace( '-', '_', $option ); |
|
713 | + $option = str_replace('-', '_', $option); |
|
714 | 714 | } |
715 | 715 | |
716 | - switch ( $map_option ) { |
|
716 | + switch ($map_option) { |
|
717 | 717 | case 'edit_per_page': |
718 | 718 | case 'users_per_page': |
719 | 719 | case 'edit_comments_per_page': |
@@ -731,7 +731,7 @@ discard block |
||
731 | 731 | case 'site_themes_network_per_page': |
732 | 732 | $value = (int) $value; |
733 | 733 | |
734 | - if ( $value < 1 || $value > 999 ) { |
|
734 | + if ($value < 1 || $value > 999) { |
|
735 | 735 | return; |
736 | 736 | } |
737 | 737 | |
@@ -740,7 +740,7 @@ discard block |
||
740 | 740 | default: |
741 | 741 | $screen_option = false; |
742 | 742 | |
743 | - if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) { |
|
743 | + if ('_page' === substr($option, -5) || 'layout_columns' === $option) { |
|
744 | 744 | /** |
745 | 745 | * Filters a screen option value before it is set. |
746 | 746 | * |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | * @param string $option The option name. |
761 | 761 | * @param int $value The option value. |
762 | 762 | */ |
763 | - $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
763 | + $screen_option = apply_filters('set-screen-option', $screen_option, $option, $value); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -779,24 +779,24 @@ discard block |
||
779 | 779 | * @param string $option The option name. |
780 | 780 | * @param int $value The option value. |
781 | 781 | */ |
782 | - $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value ); |
|
782 | + $value = apply_filters("set_screen_option_{$option}", $screen_option, $option, $value); |
|
783 | 783 | |
784 | - if ( false === $value ) { |
|
784 | + if (false === $value) { |
|
785 | 785 | return; |
786 | 786 | } |
787 | 787 | |
788 | 788 | break; |
789 | 789 | } |
790 | 790 | |
791 | - update_user_meta( $user->ID, $option, $value ); |
|
791 | + update_user_meta($user->ID, $option, $value); |
|
792 | 792 | |
793 | - $url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() ); |
|
793 | + $url = remove_query_arg(array('pagenum', 'apage', 'paged'), wp_get_referer()); |
|
794 | 794 | |
795 | - if ( isset( $_POST['mode'] ) ) { |
|
796 | - $url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url ); |
|
795 | + if (isset($_POST['mode'])) { |
|
796 | + $url = add_query_arg(array('mode' => $_POST['mode']), $url); |
|
797 | 797 | } |
798 | 798 | |
799 | - wp_safe_redirect( $url ); |
|
799 | + wp_safe_redirect($url); |
|
800 | 800 | exit; |
801 | 801 | } |
802 | 802 | |
@@ -808,25 +808,25 @@ discard block |
||
808 | 808 | * @param string $filename The file path to the configuration file. |
809 | 809 | * @return bool |
810 | 810 | */ |
811 | -function iis7_rewrite_rule_exists( $filename ) { |
|
812 | - if ( ! file_exists( $filename ) ) { |
|
811 | +function iis7_rewrite_rule_exists($filename) { |
|
812 | + if (!file_exists($filename)) { |
|
813 | 813 | return false; |
814 | 814 | } |
815 | 815 | |
816 | - if ( ! class_exists( 'DOMDocument', false ) ) { |
|
816 | + if (!class_exists('DOMDocument', false)) { |
|
817 | 817 | return false; |
818 | 818 | } |
819 | 819 | |
820 | 820 | $doc = new DOMDocument(); |
821 | 821 | |
822 | - if ( $doc->load( $filename ) === false ) { |
|
822 | + if ($doc->load($filename) === false) { |
|
823 | 823 | return false; |
824 | 824 | } |
825 | 825 | |
826 | - $xpath = new DOMXPath( $doc ); |
|
827 | - $rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); |
|
826 | + $xpath = new DOMXPath($doc); |
|
827 | + $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]'); |
|
828 | 828 | |
829 | - if ( 0 === $rules->length ) { |
|
829 | + if (0 === $rules->length) { |
|
830 | 830 | return false; |
831 | 831 | } |
832 | 832 | |
@@ -841,32 +841,32 @@ discard block |
||
841 | 841 | * @param string $filename Name of the configuration file. |
842 | 842 | * @return bool |
843 | 843 | */ |
844 | -function iis7_delete_rewrite_rule( $filename ) { |
|
844 | +function iis7_delete_rewrite_rule($filename) { |
|
845 | 845 | // If configuration file does not exist then rules also do not exist, so there is nothing to delete. |
846 | - if ( ! file_exists( $filename ) ) { |
|
846 | + if (!file_exists($filename)) { |
|
847 | 847 | return true; |
848 | 848 | } |
849 | 849 | |
850 | - if ( ! class_exists( 'DOMDocument', false ) ) { |
|
850 | + if (!class_exists('DOMDocument', false)) { |
|
851 | 851 | return false; |
852 | 852 | } |
853 | 853 | |
854 | 854 | $doc = new DOMDocument(); |
855 | 855 | $doc->preserveWhiteSpace = false; |
856 | 856 | |
857 | - if ( $doc->load( $filename ) === false ) { |
|
857 | + if ($doc->load($filename) === false) { |
|
858 | 858 | return false; |
859 | 859 | } |
860 | 860 | |
861 | - $xpath = new DOMXPath( $doc ); |
|
862 | - $rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); |
|
861 | + $xpath = new DOMXPath($doc); |
|
862 | + $rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]'); |
|
863 | 863 | |
864 | - if ( $rules->length > 0 ) { |
|
865 | - $child = $rules->item( 0 ); |
|
864 | + if ($rules->length > 0) { |
|
865 | + $child = $rules->item(0); |
|
866 | 866 | $parent = $child->parentNode; |
867 | - $parent->removeChild( $child ); |
|
867 | + $parent->removeChild($child); |
|
868 | 868 | $doc->formatOutput = true; |
869 | - saveDomDocument( $doc, $filename ); |
|
869 | + saveDomDocument($doc, $filename); |
|
870 | 870 | } |
871 | 871 | |
872 | 872 | return true; |
@@ -881,81 +881,81 @@ discard block |
||
881 | 881 | * @param string $rewrite_rule The XML fragment with URL Rewrite rule. |
882 | 882 | * @return bool |
883 | 883 | */ |
884 | -function iis7_add_rewrite_rule( $filename, $rewrite_rule ) { |
|
885 | - if ( ! class_exists( 'DOMDocument', false ) ) { |
|
884 | +function iis7_add_rewrite_rule($filename, $rewrite_rule) { |
|
885 | + if (!class_exists('DOMDocument', false)) { |
|
886 | 886 | return false; |
887 | 887 | } |
888 | 888 | |
889 | 889 | // If configuration file does not exist then we create one. |
890 | - if ( ! file_exists( $filename ) ) { |
|
891 | - $fp = fopen( $filename, 'w' ); |
|
892 | - fwrite( $fp, '<configuration/>' ); |
|
893 | - fclose( $fp ); |
|
890 | + if (!file_exists($filename)) { |
|
891 | + $fp = fopen($filename, 'w'); |
|
892 | + fwrite($fp, '<configuration/>'); |
|
893 | + fclose($fp); |
|
894 | 894 | } |
895 | 895 | |
896 | 896 | $doc = new DOMDocument(); |
897 | 897 | $doc->preserveWhiteSpace = false; |
898 | 898 | |
899 | - if ( $doc->load( $filename ) === false ) { |
|
899 | + if ($doc->load($filename) === false) { |
|
900 | 900 | return false; |
901 | 901 | } |
902 | 902 | |
903 | - $xpath = new DOMXPath( $doc ); |
|
903 | + $xpath = new DOMXPath($doc); |
|
904 | 904 | |
905 | 905 | // First check if the rule already exists as in that case there is no need to re-add it. |
906 | - $wordpress_rules = $xpath->query( '/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]' ); |
|
906 | + $wordpress_rules = $xpath->query('/configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'wordpress\')] | /configuration/system.webServer/rewrite/rules/rule[starts-with(@name,\'WordPress\')]'); |
|
907 | 907 | |
908 | - if ( $wordpress_rules->length > 0 ) { |
|
908 | + if ($wordpress_rules->length > 0) { |
|
909 | 909 | return true; |
910 | 910 | } |
911 | 911 | |
912 | 912 | // Check the XPath to the rewrite rule and create XML nodes if they do not exist. |
913 | - $xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite/rules' ); |
|
913 | + $xml_nodes = $xpath->query('/configuration/system.webServer/rewrite/rules'); |
|
914 | 914 | |
915 | - if ( $xml_nodes->length > 0 ) { |
|
916 | - $rules_node = $xml_nodes->item( 0 ); |
|
915 | + if ($xml_nodes->length > 0) { |
|
916 | + $rules_node = $xml_nodes->item(0); |
|
917 | 917 | } else { |
918 | - $rules_node = $doc->createElement( 'rules' ); |
|
918 | + $rules_node = $doc->createElement('rules'); |
|
919 | 919 | |
920 | - $xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite' ); |
|
920 | + $xml_nodes = $xpath->query('/configuration/system.webServer/rewrite'); |
|
921 | 921 | |
922 | - if ( $xml_nodes->length > 0 ) { |
|
923 | - $rewrite_node = $xml_nodes->item( 0 ); |
|
924 | - $rewrite_node->appendChild( $rules_node ); |
|
922 | + if ($xml_nodes->length > 0) { |
|
923 | + $rewrite_node = $xml_nodes->item(0); |
|
924 | + $rewrite_node->appendChild($rules_node); |
|
925 | 925 | } else { |
926 | - $rewrite_node = $doc->createElement( 'rewrite' ); |
|
927 | - $rewrite_node->appendChild( $rules_node ); |
|
926 | + $rewrite_node = $doc->createElement('rewrite'); |
|
927 | + $rewrite_node->appendChild($rules_node); |
|
928 | 928 | |
929 | - $xml_nodes = $xpath->query( '/configuration/system.webServer' ); |
|
929 | + $xml_nodes = $xpath->query('/configuration/system.webServer'); |
|
930 | 930 | |
931 | - if ( $xml_nodes->length > 0 ) { |
|
932 | - $system_web_server_node = $xml_nodes->item( 0 ); |
|
933 | - $system_web_server_node->appendChild( $rewrite_node ); |
|
931 | + if ($xml_nodes->length > 0) { |
|
932 | + $system_web_server_node = $xml_nodes->item(0); |
|
933 | + $system_web_server_node->appendChild($rewrite_node); |
|
934 | 934 | } else { |
935 | - $system_web_server_node = $doc->createElement( 'system.webServer' ); |
|
936 | - $system_web_server_node->appendChild( $rewrite_node ); |
|
935 | + $system_web_server_node = $doc->createElement('system.webServer'); |
|
936 | + $system_web_server_node->appendChild($rewrite_node); |
|
937 | 937 | |
938 | - $xml_nodes = $xpath->query( '/configuration' ); |
|
938 | + $xml_nodes = $xpath->query('/configuration'); |
|
939 | 939 | |
940 | - if ( $xml_nodes->length > 0 ) { |
|
941 | - $config_node = $xml_nodes->item( 0 ); |
|
942 | - $config_node->appendChild( $system_web_server_node ); |
|
940 | + if ($xml_nodes->length > 0) { |
|
941 | + $config_node = $xml_nodes->item(0); |
|
942 | + $config_node->appendChild($system_web_server_node); |
|
943 | 943 | } else { |
944 | - $config_node = $doc->createElement( 'configuration' ); |
|
945 | - $doc->appendChild( $config_node ); |
|
946 | - $config_node->appendChild( $system_web_server_node ); |
|
944 | + $config_node = $doc->createElement('configuration'); |
|
945 | + $doc->appendChild($config_node); |
|
946 | + $config_node->appendChild($system_web_server_node); |
|
947 | 947 | } |
948 | 948 | } |
949 | 949 | } |
950 | 950 | } |
951 | 951 | |
952 | 952 | $rule_fragment = $doc->createDocumentFragment(); |
953 | - $rule_fragment->appendXML( $rewrite_rule ); |
|
954 | - $rules_node->appendChild( $rule_fragment ); |
|
953 | + $rule_fragment->appendXML($rewrite_rule); |
|
954 | + $rules_node->appendChild($rule_fragment); |
|
955 | 955 | |
956 | 956 | $doc->encoding = 'UTF-8'; |
957 | 957 | $doc->formatOutput = true; |
958 | - saveDomDocument( $doc, $filename ); |
|
958 | + saveDomDocument($doc, $filename); |
|
959 | 959 | |
960 | 960 | return true; |
961 | 961 | } |
@@ -968,13 +968,13 @@ discard block |
||
968 | 968 | * @param DOMDocument $doc |
969 | 969 | * @param string $filename |
970 | 970 | */ |
971 | -function saveDomDocument( $doc, $filename ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
|
971 | +function saveDomDocument($doc, $filename) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid |
|
972 | 972 | $config = $doc->saveXML(); |
973 | - $config = preg_replace( "/([^\r])\n/", "$1\r\n", $config ); |
|
973 | + $config = preg_replace("/([^\r])\n/", "$1\r\n", $config); |
|
974 | 974 | |
975 | - $fp = fopen( $filename, 'w' ); |
|
976 | - fwrite( $fp, $config ); |
|
977 | - fclose( $fp ); |
|
975 | + $fp = fopen($filename, 'w'); |
|
976 | + fwrite($fp, $config); |
|
977 | + fclose($fp); |
|
978 | 978 | } |
979 | 979 | |
980 | 980 | /** |
@@ -986,12 +986,12 @@ discard block |
||
986 | 986 | * |
987 | 987 | * @param int $user_id User ID. |
988 | 988 | */ |
989 | -function admin_color_scheme_picker( $user_id ) { |
|
989 | +function admin_color_scheme_picker($user_id) { |
|
990 | 990 | global $_wp_admin_css_colors; |
991 | 991 | |
992 | - ksort( $_wp_admin_css_colors ); |
|
992 | + ksort($_wp_admin_css_colors); |
|
993 | 993 | |
994 | - if ( isset( $_wp_admin_css_colors['fresh'] ) ) { |
|
994 | + if (isset($_wp_admin_css_colors['fresh'])) { |
|
995 | 995 | // Set Default ('fresh') and Light should go first. |
996 | 996 | $_wp_admin_css_colors = array_filter( |
997 | 997 | array_merge( |
@@ -1005,30 +1005,30 @@ discard block |
||
1005 | 1005 | ); |
1006 | 1006 | } |
1007 | 1007 | |
1008 | - $current_color = get_user_option( 'admin_color', $user_id ); |
|
1008 | + $current_color = get_user_option('admin_color', $user_id); |
|
1009 | 1009 | |
1010 | - if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) { |
|
1010 | + if (empty($current_color) || !isset($_wp_admin_css_colors[$current_color])) { |
|
1011 | 1011 | $current_color = 'fresh'; |
1012 | 1012 | } |
1013 | 1013 | ?> |
1014 | 1014 | <fieldset id="color-picker" class="scheme-list"> |
1015 | - <legend class="screen-reader-text"><span><?php _e( 'Admin Color Scheme' ); ?></span></legend> |
|
1015 | + <legend class="screen-reader-text"><span><?php _e('Admin Color Scheme'); ?></span></legend> |
|
1016 | 1016 | <?php |
1017 | - wp_nonce_field( 'save-color-scheme', 'color-nonce', false ); |
|
1018 | - foreach ( $_wp_admin_css_colors as $color => $color_info ) : |
|
1017 | + wp_nonce_field('save-color-scheme', 'color-nonce', false); |
|
1018 | + foreach ($_wp_admin_css_colors as $color => $color_info) : |
|
1019 | 1019 | |
1020 | 1020 | ?> |
1021 | - <div class="color-option <?php echo ( $color === $current_color ) ? 'selected' : ''; ?>"> |
|
1022 | - <input name="admin_color" id="admin_color_<?php echo esc_attr( $color ); ?>" type="radio" value="<?php echo esc_attr( $color ); ?>" class="tog" <?php checked( $color, $current_color ); ?> /> |
|
1023 | - <input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" /> |
|
1024 | - <input type="hidden" class="icon_colors" value="<?php echo esc_attr( wp_json_encode( array( 'icons' => $color_info->icon_colors ) ) ); ?>" /> |
|
1025 | - <label for="admin_color_<?php echo esc_attr( $color ); ?>"><?php echo esc_html( $color_info->name ); ?></label> |
|
1021 | + <div class="color-option <?php echo ($color === $current_color) ? 'selected' : ''; ?>"> |
|
1022 | + <input name="admin_color" id="admin_color_<?php echo esc_attr($color); ?>" type="radio" value="<?php echo esc_attr($color); ?>" class="tog" <?php checked($color, $current_color); ?> /> |
|
1023 | + <input type="hidden" class="css_url" value="<?php echo esc_url($color_info->url); ?>" /> |
|
1024 | + <input type="hidden" class="icon_colors" value="<?php echo esc_attr(wp_json_encode(array('icons' => $color_info->icon_colors))); ?>" /> |
|
1025 | + <label for="admin_color_<?php echo esc_attr($color); ?>"><?php echo esc_html($color_info->name); ?></label> |
|
1026 | 1026 | <table class="color-palette"> |
1027 | 1027 | <tr> |
1028 | 1028 | <?php |
1029 | - foreach ( $color_info->colors as $html_color ) { |
|
1029 | + foreach ($color_info->colors as $html_color) { |
|
1030 | 1030 | ?> |
1031 | - <td style="background-color: <?php echo esc_attr( $html_color ); ?>"> </td> |
|
1031 | + <td style="background-color: <?php echo esc_attr($html_color); ?>"> </td> |
|
1032 | 1032 | <?php |
1033 | 1033 | } |
1034 | 1034 | ?> |
@@ -1050,16 +1050,16 @@ discard block |
||
1050 | 1050 | function wp_color_scheme_settings() { |
1051 | 1051 | global $_wp_admin_css_colors; |
1052 | 1052 | |
1053 | - $color_scheme = get_user_option( 'admin_color' ); |
|
1053 | + $color_scheme = get_user_option('admin_color'); |
|
1054 | 1054 | |
1055 | 1055 | // It's possible to have a color scheme set that is no longer registered. |
1056 | - if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) { |
|
1056 | + if (empty($_wp_admin_css_colors[$color_scheme])) { |
|
1057 | 1057 | $color_scheme = 'fresh'; |
1058 | 1058 | } |
1059 | 1059 | |
1060 | - if ( ! empty( $_wp_admin_css_colors[ $color_scheme ]->icon_colors ) ) { |
|
1061 | - $icon_colors = $_wp_admin_css_colors[ $color_scheme ]->icon_colors; |
|
1062 | - } elseif ( ! empty( $_wp_admin_css_colors['fresh']->icon_colors ) ) { |
|
1060 | + if (!empty($_wp_admin_css_colors[$color_scheme]->icon_colors)) { |
|
1061 | + $icon_colors = $_wp_admin_css_colors[$color_scheme]->icon_colors; |
|
1062 | + } elseif (!empty($_wp_admin_css_colors['fresh']->icon_colors)) { |
|
1063 | 1063 | $icon_colors = $_wp_admin_css_colors['fresh']->icon_colors; |
1064 | 1064 | } else { |
1065 | 1065 | // Fall back to the default set of icon colors if the default scheme is missing. |
@@ -1070,7 +1070,7 @@ discard block |
||
1070 | 1070 | ); |
1071 | 1071 | } |
1072 | 1072 | |
1073 | - echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n"; |
|
1073 | + echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode(array('icons' => $icon_colors)) . ";</script>\n"; |
|
1074 | 1074 | } |
1075 | 1075 | |
1076 | 1076 | /** |
@@ -1086,13 +1086,13 @@ discard block |
||
1086 | 1086 | * |
1087 | 1087 | * @param string $viewport_meta The viewport meta. |
1088 | 1088 | */ |
1089 | - $viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' ); |
|
1089 | + $viewport_meta = apply_filters('admin_viewport_meta', 'width=device-width,initial-scale=1.0'); |
|
1090 | 1090 | |
1091 | - if ( empty( $viewport_meta ) ) { |
|
1091 | + if (empty($viewport_meta)) { |
|
1092 | 1092 | return; |
1093 | 1093 | } |
1094 | 1094 | |
1095 | - echo '<meta name="viewport" content="' . esc_attr( $viewport_meta ) . '">'; |
|
1095 | + echo '<meta name="viewport" content="' . esc_attr($viewport_meta) . '">'; |
|
1096 | 1096 | } |
1097 | 1097 | |
1098 | 1098 | /** |
@@ -1105,8 +1105,8 @@ discard block |
||
1105 | 1105 | * @param string $viewport_meta The viewport meta. |
1106 | 1106 | * @return string Filtered viewport meta. |
1107 | 1107 | */ |
1108 | -function _customizer_mobile_viewport_meta( $viewport_meta ) { |
|
1109 | - return trim( $viewport_meta, ',' ) . ',minimum-scale=0.5,maximum-scale=1.2'; |
|
1108 | +function _customizer_mobile_viewport_meta($viewport_meta) { |
|
1109 | + return trim($viewport_meta, ',') . ',minimum-scale=0.5,maximum-scale=1.2'; |
|
1110 | 1110 | } |
1111 | 1111 | |
1112 | 1112 | /** |
@@ -1119,41 +1119,41 @@ discard block |
||
1119 | 1119 | * @param string $screen_id The screen ID. |
1120 | 1120 | * @return array The Heartbeat response. |
1121 | 1121 | */ |
1122 | -function wp_check_locked_posts( $response, $data, $screen_id ) { |
|
1122 | +function wp_check_locked_posts($response, $data, $screen_id) { |
|
1123 | 1123 | $checked = array(); |
1124 | 1124 | |
1125 | - if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) { |
|
1126 | - foreach ( $data['wp-check-locked-posts'] as $key ) { |
|
1127 | - $post_id = absint( substr( $key, 5 ) ); |
|
1125 | + if (array_key_exists('wp-check-locked-posts', $data) && is_array($data['wp-check-locked-posts'])) { |
|
1126 | + foreach ($data['wp-check-locked-posts'] as $key) { |
|
1127 | + $post_id = absint(substr($key, 5)); |
|
1128 | 1128 | |
1129 | - if ( ! $post_id ) { |
|
1129 | + if (!$post_id) { |
|
1130 | 1130 | continue; |
1131 | 1131 | } |
1132 | 1132 | |
1133 | - $user_id = wp_check_post_lock( $post_id ); |
|
1133 | + $user_id = wp_check_post_lock($post_id); |
|
1134 | 1134 | |
1135 | - if ( $user_id ) { |
|
1136 | - $user = get_userdata( $user_id ); |
|
1135 | + if ($user_id) { |
|
1136 | + $user = get_userdata($user_id); |
|
1137 | 1137 | |
1138 | - if ( $user && current_user_can( 'edit_post', $post_id ) ) { |
|
1138 | + if ($user && current_user_can('edit_post', $post_id)) { |
|
1139 | 1139 | $send = array( |
1140 | 1140 | 'name' => $user->display_name, |
1141 | 1141 | /* translators: %s: User's display name. */ |
1142 | - 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ), |
|
1142 | + 'text' => sprintf(__('%s is currently editing'), $user->display_name), |
|
1143 | 1143 | ); |
1144 | 1144 | |
1145 | - if ( get_option( 'show_avatars' ) ) { |
|
1146 | - $send['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 18 ) ); |
|
1147 | - $send['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 36 ) ); |
|
1145 | + if (get_option('show_avatars')) { |
|
1146 | + $send['avatar_src'] = get_avatar_url($user->ID, array('size' => 18)); |
|
1147 | + $send['avatar_src_2x'] = get_avatar_url($user->ID, array('size' => 36)); |
|
1148 | 1148 | } |
1149 | 1149 | |
1150 | - $checked[ $key ] = $send; |
|
1150 | + $checked[$key] = $send; |
|
1151 | 1151 | } |
1152 | 1152 | } |
1153 | 1153 | } |
1154 | 1154 | } |
1155 | 1155 | |
1156 | - if ( ! empty( $checked ) ) { |
|
1156 | + if (!empty($checked)) { |
|
1157 | 1157 | $response['wp-check-locked-posts'] = $checked; |
1158 | 1158 | } |
1159 | 1159 | |
@@ -1170,42 +1170,42 @@ discard block |
||
1170 | 1170 | * @param string $screen_id The screen ID. |
1171 | 1171 | * @return array The Heartbeat response. |
1172 | 1172 | */ |
1173 | -function wp_refresh_post_lock( $response, $data, $screen_id ) { |
|
1174 | - if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) { |
|
1173 | +function wp_refresh_post_lock($response, $data, $screen_id) { |
|
1174 | + if (array_key_exists('wp-refresh-post-lock', $data)) { |
|
1175 | 1175 | $received = $data['wp-refresh-post-lock']; |
1176 | 1176 | $send = array(); |
1177 | 1177 | |
1178 | - $post_id = absint( $received['post_id'] ); |
|
1178 | + $post_id = absint($received['post_id']); |
|
1179 | 1179 | |
1180 | - if ( ! $post_id ) { |
|
1180 | + if (!$post_id) { |
|
1181 | 1181 | return $response; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
1184 | + if (!current_user_can('edit_post', $post_id)) { |
|
1185 | 1185 | return $response; |
1186 | 1186 | } |
1187 | 1187 | |
1188 | - $user_id = wp_check_post_lock( $post_id ); |
|
1189 | - $user = get_userdata( $user_id ); |
|
1188 | + $user_id = wp_check_post_lock($post_id); |
|
1189 | + $user = get_userdata($user_id); |
|
1190 | 1190 | |
1191 | - if ( $user ) { |
|
1191 | + if ($user) { |
|
1192 | 1192 | $error = array( |
1193 | 1193 | 'name' => $user->display_name, |
1194 | 1194 | /* translators: %s: User's display name. */ |
1195 | - 'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ), |
|
1195 | + 'text' => sprintf(__('%s has taken over and is currently editing.'), $user->display_name), |
|
1196 | 1196 | ); |
1197 | 1197 | |
1198 | - if ( get_option( 'show_avatars' ) ) { |
|
1199 | - $error['avatar_src'] = get_avatar_url( $user->ID, array( 'size' => 64 ) ); |
|
1200 | - $error['avatar_src_2x'] = get_avatar_url( $user->ID, array( 'size' => 128 ) ); |
|
1198 | + if (get_option('show_avatars')) { |
|
1199 | + $error['avatar_src'] = get_avatar_url($user->ID, array('size' => 64)); |
|
1200 | + $error['avatar_src_2x'] = get_avatar_url($user->ID, array('size' => 128)); |
|
1201 | 1201 | } |
1202 | 1202 | |
1203 | 1203 | $send['lock_error'] = $error; |
1204 | 1204 | } else { |
1205 | - $new_lock = wp_set_post_lock( $post_id ); |
|
1205 | + $new_lock = wp_set_post_lock($post_id); |
|
1206 | 1206 | |
1207 | - if ( $new_lock ) { |
|
1208 | - $send['new_lock'] = implode( ':', $new_lock ); |
|
1207 | + if ($new_lock) { |
|
1208 | + $send['new_lock'] = implode(':', $new_lock); |
|
1209 | 1209 | } |
1210 | 1210 | } |
1211 | 1211 | |
@@ -1225,29 +1225,29 @@ discard block |
||
1225 | 1225 | * @param string $screen_id The screen ID. |
1226 | 1226 | * @return array The Heartbeat response. |
1227 | 1227 | */ |
1228 | -function wp_refresh_post_nonces( $response, $data, $screen_id ) { |
|
1229 | - if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) { |
|
1228 | +function wp_refresh_post_nonces($response, $data, $screen_id) { |
|
1229 | + if (array_key_exists('wp-refresh-post-nonces', $data)) { |
|
1230 | 1230 | $received = $data['wp-refresh-post-nonces']; |
1231 | 1231 | |
1232 | - $response['wp-refresh-post-nonces'] = array( 'check' => 1 ); |
|
1232 | + $response['wp-refresh-post-nonces'] = array('check' => 1); |
|
1233 | 1233 | |
1234 | - $post_id = absint( $received['post_id'] ); |
|
1234 | + $post_id = absint($received['post_id']); |
|
1235 | 1235 | |
1236 | - if ( ! $post_id ) { |
|
1236 | + if (!$post_id) { |
|
1237 | 1237 | return $response; |
1238 | 1238 | } |
1239 | 1239 | |
1240 | - if ( ! current_user_can( 'edit_post', $post_id ) ) { |
|
1240 | + if (!current_user_can('edit_post', $post_id)) { |
|
1241 | 1241 | return $response; |
1242 | 1242 | } |
1243 | 1243 | |
1244 | 1244 | $response['wp-refresh-post-nonces'] = array( |
1245 | 1245 | 'replace' => array( |
1246 | - 'getpermalinknonce' => wp_create_nonce( 'getpermalink' ), |
|
1247 | - 'samplepermalinknonce' => wp_create_nonce( 'samplepermalink' ), |
|
1248 | - 'closedpostboxesnonce' => wp_create_nonce( 'closedpostboxes' ), |
|
1249 | - '_ajax_linking_nonce' => wp_create_nonce( 'internal-linking' ), |
|
1250 | - '_wpnonce' => wp_create_nonce( 'update-post_' . $post_id ), |
|
1246 | + 'getpermalinknonce' => wp_create_nonce('getpermalink'), |
|
1247 | + 'samplepermalinknonce' => wp_create_nonce('samplepermalink'), |
|
1248 | + 'closedpostboxesnonce' => wp_create_nonce('closedpostboxes'), |
|
1249 | + '_ajax_linking_nonce' => wp_create_nonce('internal-linking'), |
|
1250 | + '_wpnonce' => wp_create_nonce('update-post_' . $post_id), |
|
1251 | 1251 | ), |
1252 | 1252 | ); |
1253 | 1253 | } |
@@ -1263,12 +1263,12 @@ discard block |
||
1263 | 1263 | * @param array $response The Heartbeat response. |
1264 | 1264 | * @return array The Heartbeat response. |
1265 | 1265 | */ |
1266 | -function wp_refresh_heartbeat_nonces( $response ) { |
|
1266 | +function wp_refresh_heartbeat_nonces($response) { |
|
1267 | 1267 | // Refresh the Rest API nonce. |
1268 | - $response['rest_nonce'] = wp_create_nonce( 'wp_rest' ); |
|
1268 | + $response['rest_nonce'] = wp_create_nonce('wp_rest'); |
|
1269 | 1269 | |
1270 | 1270 | // Refresh the Heartbeat nonce. |
1271 | - $response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' ); |
|
1271 | + $response['heartbeat_nonce'] = wp_create_nonce('heartbeat-nonce'); |
|
1272 | 1272 | |
1273 | 1273 | return $response; |
1274 | 1274 | } |
@@ -1283,10 +1283,10 @@ discard block |
||
1283 | 1283 | * @param array $settings An array of Heartbeat settings. |
1284 | 1284 | * @return array Filtered Heartbeat settings. |
1285 | 1285 | */ |
1286 | -function wp_heartbeat_set_suspension( $settings ) { |
|
1286 | +function wp_heartbeat_set_suspension($settings) { |
|
1287 | 1287 | global $pagenow; |
1288 | 1288 | |
1289 | - if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) { |
|
1289 | + if ('post.php' === $pagenow || 'post-new.php' === $pagenow) { |
|
1290 | 1290 | $settings['suspension'] = 'disable'; |
1291 | 1291 | } |
1292 | 1292 | |
@@ -1302,27 +1302,27 @@ discard block |
||
1302 | 1302 | * @param array $data The $_POST data sent. |
1303 | 1303 | * @return array The Heartbeat response. |
1304 | 1304 | */ |
1305 | -function heartbeat_autosave( $response, $data ) { |
|
1306 | - if ( ! empty( $data['wp_autosave'] ) ) { |
|
1307 | - $saved = wp_autosave( $data['wp_autosave'] ); |
|
1305 | +function heartbeat_autosave($response, $data) { |
|
1306 | + if (!empty($data['wp_autosave'])) { |
|
1307 | + $saved = wp_autosave($data['wp_autosave']); |
|
1308 | 1308 | |
1309 | - if ( is_wp_error( $saved ) ) { |
|
1309 | + if (is_wp_error($saved)) { |
|
1310 | 1310 | $response['wp_autosave'] = array( |
1311 | 1311 | 'success' => false, |
1312 | 1312 | 'message' => $saved->get_error_message(), |
1313 | 1313 | ); |
1314 | - } elseif ( empty( $saved ) ) { |
|
1314 | + } elseif (empty($saved)) { |
|
1315 | 1315 | $response['wp_autosave'] = array( |
1316 | 1316 | 'success' => false, |
1317 | - 'message' => __( 'Error while saving.' ), |
|
1317 | + 'message' => __('Error while saving.'), |
|
1318 | 1318 | ); |
1319 | 1319 | } else { |
1320 | 1320 | /* translators: Draft saved date format, see https://www.php.net/manual/datetime.format.php */ |
1321 | - $draft_saved_date_format = __( 'g:i:s a' ); |
|
1321 | + $draft_saved_date_format = __('g:i:s a'); |
|
1322 | 1322 | $response['wp_autosave'] = array( |
1323 | 1323 | 'success' => true, |
1324 | 1324 | /* translators: %s: Date and time. */ |
1325 | - 'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ), |
|
1325 | + 'message' => sprintf(__('Draft saved at %s.'), date_i18n($draft_saved_date_format)), |
|
1326 | 1326 | ); |
1327 | 1327 | } |
1328 | 1328 | } |
@@ -1341,15 +1341,15 @@ discard block |
||
1341 | 1341 | function wp_admin_canonical_url() { |
1342 | 1342 | $removable_query_args = wp_removable_query_args(); |
1343 | 1343 | |
1344 | - if ( empty( $removable_query_args ) ) { |
|
1344 | + if (empty($removable_query_args)) { |
|
1345 | 1345 | return; |
1346 | 1346 | } |
1347 | 1347 | |
1348 | 1348 | // Ensure we're using an absolute URL. |
1349 | - $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] ); |
|
1350 | - $filtered_url = remove_query_arg( $removable_query_args, $current_url ); |
|
1349 | + $current_url = set_url_scheme('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']); |
|
1350 | + $filtered_url = remove_query_arg($removable_query_args, $current_url); |
|
1351 | 1351 | ?> |
1352 | - <link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" /> |
|
1352 | + <link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url($filtered_url); ?>" /> |
|
1353 | 1353 | <script> |
1354 | 1354 | if ( window.history.replaceState ) { |
1355 | 1355 | window.history.replaceState( null, null, document.getElementById( 'wp-admin-canonical' ).href + window.location.hash ); |
@@ -1376,9 +1376,9 @@ discard block |
||
1376 | 1376 | * |
1377 | 1377 | * @param string $policy The admin referrer policy header value. Default 'strict-origin-when-cross-origin'. |
1378 | 1378 | */ |
1379 | - $policy = apply_filters( 'admin_referrer_policy', $policy ); |
|
1379 | + $policy = apply_filters('admin_referrer_policy', $policy); |
|
1380 | 1380 | |
1381 | - header( sprintf( 'Referrer-Policy: %s', $policy ) ); |
|
1381 | + header(sprintf('Referrer-Policy: %s', $policy)); |
|
1382 | 1382 | } |
1383 | 1383 | |
1384 | 1384 | /** |
@@ -1410,19 +1410,19 @@ discard block |
||
1410 | 1410 | * @param string $old_value The old site admin email address. |
1411 | 1411 | * @param string $value The proposed new site admin email address. |
1412 | 1412 | */ |
1413 | -function update_option_new_admin_email( $old_value, $value ) { |
|
1414 | - if ( get_option( 'admin_email' ) === $value || ! is_email( $value ) ) { |
|
1413 | +function update_option_new_admin_email($old_value, $value) { |
|
1414 | + if (get_option('admin_email') === $value || !is_email($value)) { |
|
1415 | 1415 | return; |
1416 | 1416 | } |
1417 | 1417 | |
1418 | - $hash = md5( $value . time() . wp_rand() ); |
|
1418 | + $hash = md5($value . time() . wp_rand()); |
|
1419 | 1419 | $new_admin_email = array( |
1420 | 1420 | 'hash' => $hash, |
1421 | 1421 | 'newemail' => $value, |
1422 | 1422 | ); |
1423 | - update_option( 'adminhash', $new_admin_email ); |
|
1423 | + update_option('adminhash', $new_admin_email); |
|
1424 | 1424 | |
1425 | - $switched_locale = switch_to_locale( get_user_locale() ); |
|
1425 | + $switched_locale = switch_to_locale(get_user_locale()); |
|
1426 | 1426 | |
1427 | 1427 | /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */ |
1428 | 1428 | $email_text = __( |
@@ -1466,32 +1466,32 @@ discard block |
||
1466 | 1466 | * @type string $newemail The proposed new site admin email address. |
1467 | 1467 | * } |
1468 | 1468 | */ |
1469 | - $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email ); |
|
1469 | + $content = apply_filters('new_admin_email_content', $email_text, $new_admin_email); |
|
1470 | 1470 | |
1471 | 1471 | $current_user = wp_get_current_user(); |
1472 | - $content = str_replace( '###USERNAME###', $current_user->user_login, $content ); |
|
1473 | - $content = str_replace( '###ADMIN_URL###', esc_url( self_admin_url( 'options.php?adminhash=' . $hash ) ), $content ); |
|
1474 | - $content = str_replace( '###EMAIL###', $value, $content ); |
|
1475 | - $content = str_replace( '###SITENAME###', wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $content ); |
|
1476 | - $content = str_replace( '###SITEURL###', home_url(), $content ); |
|
1477 | - |
|
1478 | - if ( '' !== get_option( 'blogname' ) ) { |
|
1479 | - $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
1472 | + $content = str_replace('###USERNAME###', $current_user->user_login, $content); |
|
1473 | + $content = str_replace('###ADMIN_URL###', esc_url(self_admin_url('options.php?adminhash=' . $hash)), $content); |
|
1474 | + $content = str_replace('###EMAIL###', $value, $content); |
|
1475 | + $content = str_replace('###SITENAME###', wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), $content); |
|
1476 | + $content = str_replace('###SITEURL###', home_url(), $content); |
|
1477 | + |
|
1478 | + if ('' !== get_option('blogname')) { |
|
1479 | + $site_title = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
1480 | 1480 | } else { |
1481 | - $site_title = parse_url( home_url(), PHP_URL_HOST ); |
|
1481 | + $site_title = parse_url(home_url(), PHP_URL_HOST); |
|
1482 | 1482 | } |
1483 | 1483 | |
1484 | 1484 | wp_mail( |
1485 | 1485 | $value, |
1486 | 1486 | sprintf( |
1487 | 1487 | /* translators: New admin email address notification email subject. %s: Site title. */ |
1488 | - __( '[%s] New Admin Email Address' ), |
|
1488 | + __('[%s] New Admin Email Address'), |
|
1489 | 1489 | $site_title |
1490 | 1490 | ), |
1491 | 1491 | $content |
1492 | 1492 | ); |
1493 | 1493 | |
1494 | - if ( $switched_locale ) { |
|
1494 | + if ($switched_locale) { |
|
1495 | 1495 | restore_previous_locale(); |
1496 | 1496 | } |
1497 | 1497 | } |
@@ -1507,10 +1507,10 @@ discard block |
||
1507 | 1507 | * @param WP_Post $page Page data object. |
1508 | 1508 | * @return string Page title. |
1509 | 1509 | */ |
1510 | -function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) { |
|
1511 | - if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) { |
|
1510 | +function _wp_privacy_settings_filter_draft_page_titles($title, $page) { |
|
1511 | + if ('draft' === $page->post_status && 'privacy' === get_current_screen()->id) { |
|
1512 | 1512 | /* translators: %s: Page title. */ |
1513 | - $title = sprintf( __( '%s (Draft)' ), $title ); |
|
1513 | + $title = sprintf(__('%s (Draft)'), $title); |
|
1514 | 1514 | } |
1515 | 1515 | |
1516 | 1516 | return $title; |
@@ -1526,22 +1526,22 @@ discard block |
||
1526 | 1526 | */ |
1527 | 1527 | function wp_check_php_version() { |
1528 | 1528 | $version = phpversion(); |
1529 | - $key = md5( $version ); |
|
1529 | + $key = md5($version); |
|
1530 | 1530 | |
1531 | - $response = get_site_transient( 'php_check_' . $key ); |
|
1531 | + $response = get_site_transient('php_check_' . $key); |
|
1532 | 1532 | |
1533 | - if ( false === $response ) { |
|
1533 | + if (false === $response) { |
|
1534 | 1534 | $url = 'http://api.wordpress.org/core/serve-happy/1.0/'; |
1535 | 1535 | |
1536 | - if ( wp_http_supports( array( 'ssl' ) ) ) { |
|
1537 | - $url = set_url_scheme( $url, 'https' ); |
|
1536 | + if (wp_http_supports(array('ssl'))) { |
|
1537 | + $url = set_url_scheme($url, 'https'); |
|
1538 | 1538 | } |
1539 | 1539 | |
1540 | - $url = add_query_arg( 'php_version', $version, $url ); |
|
1540 | + $url = add_query_arg('php_version', $version, $url); |
|
1541 | 1541 | |
1542 | - $response = wp_remote_get( $url ); |
|
1542 | + $response = wp_remote_get($url); |
|
1543 | 1543 | |
1544 | - if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) { |
|
1544 | + if (is_wp_error($response) || 200 !== wp_remote_retrieve_response_code($response)) { |
|
1545 | 1545 | return false; |
1546 | 1546 | } |
1547 | 1547 | |
@@ -1552,16 +1552,16 @@ discard block |
||
1552 | 1552 | * 'is_secure' - boolean - Whether the PHP version receives security updates. |
1553 | 1553 | * 'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress. |
1554 | 1554 | */ |
1555 | - $response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
1555 | + $response = json_decode(wp_remote_retrieve_body($response), true); |
|
1556 | 1556 | |
1557 | - if ( ! is_array( $response ) ) { |
|
1557 | + if (!is_array($response)) { |
|
1558 | 1558 | return false; |
1559 | 1559 | } |
1560 | 1560 | |
1561 | - set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS ); |
|
1561 | + set_site_transient('php_check_' . $key, $response, WEEK_IN_SECONDS); |
|
1562 | 1562 | } |
1563 | 1563 | |
1564 | - if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) { |
|
1564 | + if (isset($response['is_acceptable']) && $response['is_acceptable']) { |
|
1565 | 1565 | /** |
1566 | 1566 | * Filters whether the active PHP version is considered acceptable by WordPress. |
1567 | 1567 | * |
@@ -1575,7 +1575,7 @@ discard block |
||
1575 | 1575 | * @param bool $is_acceptable Whether the PHP version is considered acceptable. Default true. |
1576 | 1576 | * @param string $version PHP version checked. |
1577 | 1577 | */ |
1578 | - $response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version ); |
|
1578 | + $response['is_acceptable'] = (bool) apply_filters('wp_is_php_version_acceptable', true, $version); |
|
1579 | 1579 | } |
1580 | 1580 | |
1581 | 1581 | return $response; |
@@ -34,18 +34,18 @@ discard block |
||
34 | 34 | * |
35 | 35 | * @param array $args An associative array of arguments. |
36 | 36 | */ |
37 | - public function __construct( $args = array() ) { |
|
37 | + public function __construct($args = array()) { |
|
38 | 38 | $this->status_list = array( |
39 | - 'archived' => array( 'site-archived', __( 'Archived' ) ), |
|
40 | - 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), |
|
41 | - 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), |
|
42 | - 'mature' => array( 'site-mature', __( 'Mature' ) ), |
|
39 | + 'archived' => array('site-archived', __('Archived')), |
|
40 | + 'spam' => array('site-spammed', _x('Spam', 'site')), |
|
41 | + 'deleted' => array('site-deleted', __('Deleted')), |
|
42 | + 'mature' => array('site-mature', __('Mature')), |
|
43 | 43 | ); |
44 | 44 | |
45 | 45 | parent::__construct( |
46 | 46 | array( |
47 | 47 | 'plural' => 'sites', |
48 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
48 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
49 | 49 | ) |
50 | 50 | ); |
51 | 51 | } |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | * @return bool |
55 | 55 | */ |
56 | 56 | public function ajax_user_can() { |
57 | - return current_user_can( 'manage_sites' ); |
|
57 | + return current_user_can('manage_sites'); |
|
58 | 58 | } |
59 | 59 | |
60 | 60 | /** |
@@ -69,34 +69,34 @@ discard block |
||
69 | 69 | public function prepare_items() { |
70 | 70 | global $mode, $s, $wpdb; |
71 | 71 | |
72 | - if ( ! empty( $_REQUEST['mode'] ) ) { |
|
72 | + if (!empty($_REQUEST['mode'])) { |
|
73 | 73 | $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list'; |
74 | - set_user_setting( 'sites_list_mode', $mode ); |
|
74 | + set_user_setting('sites_list_mode', $mode); |
|
75 | 75 | } else { |
76 | - $mode = get_user_setting( 'sites_list_mode', 'list' ); |
|
76 | + $mode = get_user_setting('sites_list_mode', 'list'); |
|
77 | 77 | } |
78 | 78 | |
79 | - $per_page = $this->get_items_per_page( 'sites_network_per_page' ); |
|
79 | + $per_page = $this->get_items_per_page('sites_network_per_page'); |
|
80 | 80 | |
81 | 81 | $pagenum = $this->get_pagenum(); |
82 | 82 | |
83 | - $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; |
|
83 | + $s = isset($_REQUEST['s']) ? wp_unslash(trim($_REQUEST['s'])) : ''; |
|
84 | 84 | $wild = ''; |
85 | - if ( false !== strpos( $s, '*' ) ) { |
|
85 | + if (false !== strpos($s, '*')) { |
|
86 | 86 | $wild = '*'; |
87 | - $s = trim( $s, '*' ); |
|
87 | + $s = trim($s, '*'); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /* |
91 | 91 | * If the network is large and a search is not being performed, show only |
92 | 92 | * the latest sites with no paging in order to avoid expensive count queries. |
93 | 93 | */ |
94 | - if ( ! $s && wp_is_large_network() ) { |
|
95 | - if ( ! isset( $_REQUEST['orderby'] ) ) { |
|
94 | + if (!$s && wp_is_large_network()) { |
|
95 | + if (!isset($_REQUEST['orderby'])) { |
|
96 | 96 | $_GET['orderby'] = ''; |
97 | 97 | $_REQUEST['orderby'] = ''; |
98 | 98 | } |
99 | - if ( ! isset( $_REQUEST['order'] ) ) { |
|
99 | + if (!isset($_REQUEST['order'])) { |
|
100 | 100 | $_GET['order'] = 'DESC'; |
101 | 101 | $_REQUEST['order'] = 'DESC'; |
102 | 102 | } |
@@ -104,66 +104,66 @@ discard block |
||
104 | 104 | |
105 | 105 | $args = array( |
106 | 106 | 'number' => (int) $per_page, |
107 | - 'offset' => (int) ( ( $pagenum - 1 ) * $per_page ), |
|
107 | + 'offset' => (int) (($pagenum - 1) * $per_page), |
|
108 | 108 | 'network_id' => get_current_network_id(), |
109 | 109 | ); |
110 | 110 | |
111 | - if ( empty( $s ) ) { |
|
111 | + if (empty($s)) { |
|
112 | 112 | // Nothing to do. |
113 | - } elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) || |
|
114 | - preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || |
|
115 | - preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || |
|
116 | - preg_match( '/^[0-9]{1,3}\.$/', $s ) ) { |
|
113 | + } elseif (preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s) || |
|
114 | + preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s) || |
|
115 | + preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s) || |
|
116 | + preg_match('/^[0-9]{1,3}\.$/', $s)) { |
|
117 | 117 | // IPv4 address. |
118 | - $sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) ); |
|
119 | - $reg_blog_ids = $wpdb->get_col( $sql ); |
|
118 | + $sql = $wpdb->prepare("SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like($s) . (!empty($wild) ? '%' : '')); |
|
119 | + $reg_blog_ids = $wpdb->get_col($sql); |
|
120 | 120 | |
121 | - if ( $reg_blog_ids ) { |
|
121 | + if ($reg_blog_ids) { |
|
122 | 122 | $args['site__in'] = $reg_blog_ids; |
123 | 123 | } |
124 | - } elseif ( is_numeric( $s ) && empty( $wild ) ) { |
|
124 | + } elseif (is_numeric($s) && empty($wild)) { |
|
125 | 125 | $args['ID'] = $s; |
126 | 126 | } else { |
127 | 127 | $args['search'] = $s; |
128 | 128 | |
129 | - if ( ! is_subdomain_install() ) { |
|
130 | - $args['search_columns'] = array( 'path' ); |
|
129 | + if (!is_subdomain_install()) { |
|
130 | + $args['search_columns'] = array('path'); |
|
131 | 131 | } |
132 | 132 | } |
133 | 133 | |
134 | - $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : ''; |
|
135 | - if ( 'registered' === $order_by ) { |
|
134 | + $order_by = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : ''; |
|
135 | + if ('registered' === $order_by) { |
|
136 | 136 | // 'registered' is a valid field name. |
137 | - } elseif ( 'lastupdated' === $order_by ) { |
|
137 | + } elseif ('lastupdated' === $order_by) { |
|
138 | 138 | $order_by = 'last_updated'; |
139 | - } elseif ( 'blogname' === $order_by ) { |
|
140 | - if ( is_subdomain_install() ) { |
|
139 | + } elseif ('blogname' === $order_by) { |
|
140 | + if (is_subdomain_install()) { |
|
141 | 141 | $order_by = 'domain'; |
142 | 142 | } else { |
143 | 143 | $order_by = 'path'; |
144 | 144 | } |
145 | - } elseif ( 'blog_id' === $order_by ) { |
|
145 | + } elseif ('blog_id' === $order_by) { |
|
146 | 146 | $order_by = 'id'; |
147 | - } elseif ( ! $order_by ) { |
|
147 | + } elseif (!$order_by) { |
|
148 | 148 | $order_by = false; |
149 | 149 | } |
150 | 150 | |
151 | 151 | $args['orderby'] = $order_by; |
152 | 152 | |
153 | - if ( $order_by ) { |
|
154 | - $args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC'; |
|
153 | + if ($order_by) { |
|
154 | + $args['order'] = (isset($_REQUEST['order']) && 'DESC' === strtoupper($_REQUEST['order'])) ? 'DESC' : 'ASC'; |
|
155 | 155 | } |
156 | 156 | |
157 | - if ( wp_is_large_network() ) { |
|
157 | + if (wp_is_large_network()) { |
|
158 | 158 | $args['no_found_rows'] = true; |
159 | 159 | } else { |
160 | 160 | $args['no_found_rows'] = false; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // Take into account the role the user has selected. |
164 | - $status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; |
|
165 | - if ( in_array( $status, array( 'public', 'archived', 'mature', 'spam', 'deleted' ), true ) ) { |
|
166 | - $args[ $status ] = 1; |
|
164 | + $status = isset($_REQUEST['status']) ? wp_unslash(trim($_REQUEST['status'])) : ''; |
|
165 | + if (in_array($status, array('public', 'archived', 'mature', 'spam', 'deleted'), true)) { |
|
166 | + $args[$status] = 1; |
|
167 | 167 | } |
168 | 168 | |
169 | 169 | /** |
@@ -173,13 +173,13 @@ discard block |
||
173 | 173 | * |
174 | 174 | * @param array $args An array of get_sites() arguments. |
175 | 175 | */ |
176 | - $args = apply_filters( 'ms_sites_list_table_query_args', $args ); |
|
176 | + $args = apply_filters('ms_sites_list_table_query_args', $args); |
|
177 | 177 | |
178 | - $_sites = get_sites( $args ); |
|
179 | - if ( is_array( $_sites ) ) { |
|
180 | - update_site_cache( $_sites ); |
|
178 | + $_sites = get_sites($args); |
|
179 | + if (is_array($_sites)) { |
|
180 | + update_site_cache($_sites); |
|
181 | 181 | |
182 | - $this->items = array_slice( $_sites, 0, $per_page ); |
|
182 | + $this->items = array_slice($_sites, 0, $per_page); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | $total_sites = get_sites( |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | /** |
205 | 205 | */ |
206 | 206 | public function no_items() { |
207 | - _e( 'No sites found.' ); |
|
207 | + _e('No sites found.'); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -258,20 +258,20 @@ discard block |
||
258 | 258 | ); |
259 | 259 | |
260 | 260 | $view_links = array(); |
261 | - $requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; |
|
261 | + $requested_status = isset($_REQUEST['status']) ? wp_unslash(trim($_REQUEST['status'])) : ''; |
|
262 | 262 | $url = 'sites.php'; |
263 | 263 | |
264 | - foreach ( $statuses as $status => $label_count ) { |
|
265 | - $current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status ) |
|
264 | + foreach ($statuses as $status => $label_count) { |
|
265 | + $current_link_attributes = $requested_status === $status || ('' === $requested_status && 'all' === $status) |
|
266 | 266 | ? ' class="current" aria-current="page"' |
267 | 267 | : ''; |
268 | - if ( (int) $counts[ $status ] > 0 ) { |
|
269 | - $label = sprintf( translate_nooped_plural( $label_count, $counts[ $status ] ), number_format_i18n( $counts[ $status ] ) ); |
|
270 | - $full_url = 'all' === $status ? $url : add_query_arg( 'status', $status, $url ); |
|
268 | + if ((int) $counts[$status] > 0) { |
|
269 | + $label = sprintf(translate_nooped_plural($label_count, $counts[$status]), number_format_i18n($counts[$status])); |
|
270 | + $full_url = 'all' === $status ? $url : add_query_arg('status', $status, $url); |
|
271 | 271 | |
272 | - $view_links[ $status ] = sprintf( |
|
272 | + $view_links[$status] = sprintf( |
|
273 | 273 | '<a href="%1$s"%2$s>%3$s</a>', |
274 | - esc_url( $full_url ), |
|
274 | + esc_url($full_url), |
|
275 | 275 | $current_link_attributes, |
276 | 276 | $label |
277 | 277 | ); |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | */ |
287 | 287 | protected function get_bulk_actions() { |
288 | 288 | $actions = array(); |
289 | - if ( current_user_can( 'delete_sites' ) ) { |
|
290 | - $actions['delete'] = __( 'Delete' ); |
|
289 | + if (current_user_can('delete_sites')) { |
|
290 | + $actions['delete'] = __('Delete'); |
|
291 | 291 | } |
292 | - $actions['spam'] = _x( 'Mark as spam', 'site' ); |
|
293 | - $actions['notspam'] = _x( 'Not spam', 'site' ); |
|
292 | + $actions['spam'] = _x('Mark as spam', 'site'); |
|
293 | + $actions['notspam'] = _x('Not spam', 'site'); |
|
294 | 294 | |
295 | 295 | return $actions; |
296 | 296 | } |
@@ -300,13 +300,13 @@ discard block |
||
300 | 300 | * |
301 | 301 | * @param string $which The location of the pagination nav markup: 'top' or 'bottom'. |
302 | 302 | */ |
303 | - protected function pagination( $which ) { |
|
303 | + protected function pagination($which) { |
|
304 | 304 | global $mode; |
305 | 305 | |
306 | - parent::pagination( $which ); |
|
306 | + parent::pagination($which); |
|
307 | 307 | |
308 | - if ( 'top' === $which ) { |
|
309 | - $this->view_switcher( $mode ); |
|
308 | + if ('top' === $which) { |
|
309 | + $this->view_switcher($mode); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
@@ -317,11 +317,11 @@ discard block |
||
317 | 317 | * |
318 | 318 | * @param string $which The location of the extra table nav markup: 'top' or 'bottom'. |
319 | 319 | */ |
320 | - protected function extra_tablenav( $which ) { |
|
320 | + protected function extra_tablenav($which) { |
|
321 | 321 | ?> |
322 | 322 | <div class="alignleft actions"> |
323 | 323 | <?php |
324 | - if ( 'top' === $which ) { |
|
324 | + if ('top' === $which) { |
|
325 | 325 | ob_start(); |
326 | 326 | |
327 | 327 | /** |
@@ -331,13 +331,13 @@ discard block |
||
331 | 331 | * |
332 | 332 | * @param string $which The location of the extra table nav markup: 'top' or 'bottom'. |
333 | 333 | */ |
334 | - do_action( 'restrict_manage_sites', $which ); |
|
334 | + do_action('restrict_manage_sites', $which); |
|
335 | 335 | |
336 | 336 | $output = ob_get_clean(); |
337 | 337 | |
338 | - if ( ! empty( $output ) ) { |
|
338 | + if (!empty($output)) { |
|
339 | 339 | echo $output; |
340 | - submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'site-query-submit' ) ); |
|
340 | + submit_button(__('Filter'), '', 'filter_action', false, array('id' => 'site-query-submit')); |
|
341 | 341 | } |
342 | 342 | } |
343 | 343 | ?> |
@@ -351,7 +351,7 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @param string $which The location of the extra table nav markup: 'top' or 'bottom'. |
353 | 353 | */ |
354 | - do_action( 'manage_sites_extra_tablenav', $which ); |
|
354 | + do_action('manage_sites_extra_tablenav', $which); |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | /** |
@@ -360,14 +360,14 @@ discard block |
||
360 | 360 | public function get_columns() { |
361 | 361 | $sites_columns = array( |
362 | 362 | 'cb' => '<input type="checkbox" />', |
363 | - 'blogname' => __( 'URL' ), |
|
364 | - 'lastupdated' => __( 'Last Updated' ), |
|
365 | - 'registered' => _x( 'Registered', 'site' ), |
|
366 | - 'users' => __( 'Users' ), |
|
363 | + 'blogname' => __('URL'), |
|
364 | + 'lastupdated' => __('Last Updated'), |
|
365 | + 'registered' => _x('Registered', 'site'), |
|
366 | + 'users' => __('Users'), |
|
367 | 367 | ); |
368 | 368 | |
369 | - if ( has_filter( 'wpmublogsaction' ) ) { |
|
370 | - $sites_columns['plugins'] = __( 'Actions' ); |
|
369 | + if (has_filter('wpmublogsaction')) { |
|
370 | + $sites_columns['plugins'] = __('Actions'); |
|
371 | 371 | } |
372 | 372 | |
373 | 373 | /** |
@@ -378,7 +378,7 @@ discard block |
||
378 | 378 | * @param string[] $sites_columns An array of displayed site columns. Default 'cb', |
379 | 379 | * 'blogname', 'lastupdated', 'registered', 'users'. |
380 | 380 | */ |
381 | - return apply_filters( 'wpmu_blogs_columns', $sites_columns ); |
|
381 | + return apply_filters('wpmu_blogs_columns', $sites_columns); |
|
382 | 382 | } |
383 | 383 | |
384 | 384 | /** |
@@ -400,20 +400,20 @@ discard block |
||
400 | 400 | * |
401 | 401 | * @param array $item Current site. |
402 | 402 | */ |
403 | - public function column_cb( $item ) { |
|
403 | + public function column_cb($item) { |
|
404 | 404 | // Restores the more descriptive, specific name for use within this method. |
405 | 405 | $blog = $item; |
406 | 406 | |
407 | - if ( ! is_main_site( $blog['blog_id'] ) ) : |
|
408 | - $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); |
|
407 | + if (!is_main_site($blog['blog_id'])) : |
|
408 | + $blogname = untrailingslashit($blog['domain'] . $blog['path']); |
|
409 | 409 | ?> |
410 | 410 | <label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"> |
411 | 411 | <?php |
412 | 412 | /* translators: %s: Site URL. */ |
413 | - printf( __( 'Select %s' ), $blogname ); |
|
413 | + printf(__('Select %s'), $blogname); |
|
414 | 414 | ?> |
415 | 415 | </label> |
416 | - <input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ); ?>" /> |
|
416 | + <input type="checkbox" id="blog_<?php echo $blog['blog_id']; ?>" name="allblogs[]" value="<?php echo esc_attr($blog['blog_id']); ?>" /> |
|
417 | 417 | <?php |
418 | 418 | endif; |
419 | 419 | } |
@@ -425,7 +425,7 @@ discard block |
||
425 | 425 | * |
426 | 426 | * @param array $blog Current site. |
427 | 427 | */ |
428 | - public function column_id( $blog ) { |
|
428 | + public function column_id($blog) { |
|
429 | 429 | echo $blog['blog_id']; |
430 | 430 | } |
431 | 431 | |
@@ -438,25 +438,25 @@ discard block |
||
438 | 438 | * |
439 | 439 | * @param array $blog Current site. |
440 | 440 | */ |
441 | - public function column_blogname( $blog ) { |
|
441 | + public function column_blogname($blog) { |
|
442 | 442 | global $mode; |
443 | 443 | |
444 | - $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); |
|
444 | + $blogname = untrailingslashit($blog['domain'] . $blog['path']); |
|
445 | 445 | |
446 | 446 | ?> |
447 | 447 | <strong> |
448 | - <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname; ?></a> |
|
449 | - <?php $this->site_states( $blog ); ?> |
|
448 | + <a href="<?php echo esc_url(network_admin_url('site-info.php?id=' . $blog['blog_id'])); ?>" class="edit"><?php echo $blogname; ?></a> |
|
449 | + <?php $this->site_states($blog); ?> |
|
450 | 450 | </strong> |
451 | 451 | <?php |
452 | - if ( 'list' !== $mode ) { |
|
453 | - switch_to_blog( $blog['blog_id'] ); |
|
452 | + if ('list' !== $mode) { |
|
453 | + switch_to_blog($blog['blog_id']); |
|
454 | 454 | echo '<p>'; |
455 | 455 | printf( |
456 | 456 | /* translators: 1: Site title, 2: Site tagline. */ |
457 | - __( '%1$s – %2$s' ), |
|
458 | - get_option( 'blogname' ), |
|
459 | - '<em>' . get_option( 'blogdescription' ) . '</em>' |
|
457 | + __('%1$s – %2$s'), |
|
458 | + get_option('blogname'), |
|
459 | + '<em>' . get_option('blogdescription') . '</em>' |
|
460 | 460 | ); |
461 | 461 | echo '</p>'; |
462 | 462 | restore_current_blog(); |
@@ -472,16 +472,16 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @param array $blog Current site. |
474 | 474 | */ |
475 | - public function column_lastupdated( $blog ) { |
|
475 | + public function column_lastupdated($blog) { |
|
476 | 476 | global $mode; |
477 | 477 | |
478 | - if ( 'list' === $mode ) { |
|
479 | - $date = __( 'Y/m/d' ); |
|
478 | + if ('list' === $mode) { |
|
479 | + $date = __('Y/m/d'); |
|
480 | 480 | } else { |
481 | - $date = __( 'Y/m/d g:i:s a' ); |
|
481 | + $date = __('Y/m/d g:i:s a'); |
|
482 | 482 | } |
483 | 483 | |
484 | - echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); |
|
484 | + echo ('0000-00-00 00:00:00' === $blog['last_updated']) ? __('Never') : mysql2date($date, $blog['last_updated']); |
|
485 | 485 | } |
486 | 486 | |
487 | 487 | /** |
@@ -493,19 +493,19 @@ discard block |
||
493 | 493 | * |
494 | 494 | * @param array $blog Current site. |
495 | 495 | */ |
496 | - public function column_registered( $blog ) { |
|
496 | + public function column_registered($blog) { |
|
497 | 497 | global $mode; |
498 | 498 | |
499 | - if ( 'list' === $mode ) { |
|
500 | - $date = __( 'Y/m/d' ); |
|
499 | + if ('list' === $mode) { |
|
500 | + $date = __('Y/m/d'); |
|
501 | 501 | } else { |
502 | - $date = __( 'Y/m/d g:i:s a' ); |
|
502 | + $date = __('Y/m/d g:i:s a'); |
|
503 | 503 | } |
504 | 504 | |
505 | - if ( '0000-00-00 00:00:00' === $blog['registered'] ) { |
|
505 | + if ('0000-00-00 00:00:00' === $blog['registered']) { |
|
506 | 506 | echo '—'; |
507 | 507 | } else { |
508 | - echo mysql2date( $date, $blog['registered'] ); |
|
508 | + echo mysql2date($date, $blog['registered']); |
|
509 | 509 | } |
510 | 510 | } |
511 | 511 | |
@@ -516,9 +516,9 @@ discard block |
||
516 | 516 | * |
517 | 517 | * @param array $blog Current site. |
518 | 518 | */ |
519 | - public function column_users( $blog ) { |
|
520 | - $user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' ); |
|
521 | - if ( ! $user_count ) { |
|
519 | + public function column_users($blog) { |
|
520 | + $user_count = wp_cache_get($blog['blog_id'] . '_user_count', 'blog-details'); |
|
521 | + if (!$user_count) { |
|
522 | 522 | $blog_users = new WP_User_Query( |
523 | 523 | array( |
524 | 524 | 'blog_id' => $blog['blog_id'], |
@@ -528,13 +528,13 @@ discard block |
||
528 | 528 | ) |
529 | 529 | ); |
530 | 530 | $user_count = $blog_users->get_total(); |
531 | - wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS ); |
|
531 | + wp_cache_set($blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS); |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | printf( |
535 | 535 | '<a href="%s">%s</a>', |
536 | - esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ), |
|
537 | - number_format_i18n( $user_count ) |
|
536 | + esc_url(network_admin_url('site-users.php?id=' . $blog['blog_id'])), |
|
537 | + number_format_i18n($user_count) |
|
538 | 538 | ); |
539 | 539 | } |
540 | 540 | |
@@ -545,8 +545,8 @@ discard block |
||
545 | 545 | * |
546 | 546 | * @param array $blog Current site. |
547 | 547 | */ |
548 | - public function column_plugins( $blog ) { |
|
549 | - if ( has_filter( 'wpmublogsaction' ) ) { |
|
548 | + public function column_plugins($blog) { |
|
549 | + if (has_filter('wpmublogsaction')) { |
|
550 | 550 | /** |
551 | 551 | * Fires inside the auxiliary 'Actions' column of the Sites list table. |
552 | 552 | * |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | * |
557 | 557 | * @param int $blog_id The site ID. |
558 | 558 | */ |
559 | - do_action( 'wpmublogsaction', $blog['blog_id'] ); |
|
559 | + do_action('wpmublogsaction', $blog['blog_id']); |
|
560 | 560 | } |
561 | 561 | } |
562 | 562 | |
@@ -569,7 +569,7 @@ discard block |
||
569 | 569 | * @param array $item Current site. |
570 | 570 | * @param string $column_name Current column name. |
571 | 571 | */ |
572 | - public function column_default( $item, $column_name ) { |
|
572 | + public function column_default($item, $column_name) { |
|
573 | 573 | /** |
574 | 574 | * Fires for each registered custom column in the Sites list table. |
575 | 575 | * |
@@ -578,27 +578,27 @@ discard block |
||
578 | 578 | * @param string $column_name The name of the column to display. |
579 | 579 | * @param int $blog_id The site ID. |
580 | 580 | */ |
581 | - do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] ); |
|
581 | + do_action('manage_sites_custom_column', $column_name, $item['blog_id']); |
|
582 | 582 | } |
583 | 583 | |
584 | 584 | /** |
585 | 585 | * @global string $mode List table view mode. |
586 | 586 | */ |
587 | 587 | public function display_rows() { |
588 | - foreach ( $this->items as $blog ) { |
|
588 | + foreach ($this->items as $blog) { |
|
589 | 589 | $blog = $blog->to_array(); |
590 | 590 | $class = ''; |
591 | - reset( $this->status_list ); |
|
591 | + reset($this->status_list); |
|
592 | 592 | |
593 | - foreach ( $this->status_list as $status => $col ) { |
|
594 | - if ( 1 == $blog[ $status ] ) { |
|
593 | + foreach ($this->status_list as $status => $col) { |
|
594 | + if (1 == $blog[$status]) { |
|
595 | 595 | $class = " class='{$col[0]}'"; |
596 | 596 | } |
597 | 597 | } |
598 | 598 | |
599 | 599 | echo "<tr{$class}>"; |
600 | 600 | |
601 | - $this->single_row_columns( $blog ); |
|
601 | + $this->single_row_columns($blog); |
|
602 | 602 | |
603 | 603 | echo '</tr>'; |
604 | 604 | } |
@@ -611,22 +611,22 @@ discard block |
||
611 | 611 | * |
612 | 612 | * @param array $site |
613 | 613 | */ |
614 | - protected function site_states( $site ) { |
|
614 | + protected function site_states($site) { |
|
615 | 615 | $site_states = array(); |
616 | 616 | |
617 | 617 | // $site is still an array, so get the object. |
618 | - $_site = WP_Site::get_instance( $site['blog_id'] ); |
|
618 | + $_site = WP_Site::get_instance($site['blog_id']); |
|
619 | 619 | |
620 | - if ( is_main_site( $_site->id ) ) { |
|
621 | - $site_states['main'] = __( 'Main' ); |
|
620 | + if (is_main_site($_site->id)) { |
|
621 | + $site_states['main'] = __('Main'); |
|
622 | 622 | } |
623 | 623 | |
624 | - reset( $this->status_list ); |
|
624 | + reset($this->status_list); |
|
625 | 625 | |
626 | - $site_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : ''; |
|
627 | - foreach ( $this->status_list as $status => $col ) { |
|
628 | - if ( ( 1 === (int) $_site->{$status} ) && ( $site_status !== $status ) ) { |
|
629 | - $site_states[ $col[0] ] = $col[1]; |
|
626 | + $site_status = isset($_REQUEST['status']) ? wp_unslash(trim($_REQUEST['status'])) : ''; |
|
627 | + foreach ($this->status_list as $status => $col) { |
|
628 | + if ((1 === (int) $_site->{$status} ) && ($site_status !== $status)) { |
|
629 | + $site_states[$col[0]] = $col[1]; |
|
630 | 630 | } |
631 | 631 | } |
632 | 632 | |
@@ -639,19 +639,19 @@ discard block |
||
639 | 639 | * 'Archived', 'Mature', 'Spam', 'Deleted'. |
640 | 640 | * @param WP_Site $site The current site object. |
641 | 641 | */ |
642 | - $site_states = apply_filters( 'display_site_states', $site_states, $_site ); |
|
642 | + $site_states = apply_filters('display_site_states', $site_states, $_site); |
|
643 | 643 | |
644 | - if ( ! empty( $site_states ) ) { |
|
645 | - $state_count = count( $site_states ); |
|
644 | + if (!empty($site_states)) { |
|
645 | + $state_count = count($site_states); |
|
646 | 646 | |
647 | 647 | $i = 0; |
648 | 648 | |
649 | 649 | echo ' — '; |
650 | 650 | |
651 | - foreach ( $site_states as $state ) { |
|
651 | + foreach ($site_states as $state) { |
|
652 | 652 | ++$i; |
653 | 653 | |
654 | - $sep = ( $i < $state_count ) ? ', ' : ''; |
|
654 | + $sep = ($i < $state_count) ? ', ' : ''; |
|
655 | 655 | |
656 | 656 | echo "<span class='post-state'>{$state}{$sep}</span>"; |
657 | 657 | } |
@@ -681,14 +681,14 @@ discard block |
||
681 | 681 | * @return string Row actions output for sites in Multisite, or an empty string |
682 | 682 | * if the current column is not the primary column. |
683 | 683 | */ |
684 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
685 | - if ( $primary !== $column_name ) { |
|
684 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
685 | + if ($primary !== $column_name) { |
|
686 | 686 | return ''; |
687 | 687 | } |
688 | 688 | |
689 | 689 | // Restores the more descriptive, specific name for use within this method. |
690 | 690 | $blog = $item; |
691 | - $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); |
|
691 | + $blogname = untrailingslashit($blog['domain'] . $blog['path']); |
|
692 | 692 | |
693 | 693 | // Preordered. |
694 | 694 | $actions = array( |
@@ -704,33 +704,33 @@ discard block |
||
704 | 704 | 'visit' => '', |
705 | 705 | ); |
706 | 706 | |
707 | - $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>'; |
|
708 | - $actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>'; |
|
709 | - if ( get_network()->site_id != $blog['blog_id'] ) { |
|
710 | - if ( '1' == $blog['deleted'] ) { |
|
711 | - $actions['activate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>'; |
|
707 | + $actions['edit'] = '<a href="' . esc_url(network_admin_url('site-info.php?id=' . $blog['blog_id'])) . '">' . __('Edit') . '</a>'; |
|
708 | + $actions['backend'] = "<a href='" . esc_url(get_admin_url($blog['blog_id'])) . "' class='edit'>" . __('Dashboard') . '</a>'; |
|
709 | + if (get_network()->site_id != $blog['blog_id']) { |
|
710 | + if ('1' == $blog['deleted']) { |
|
711 | + $actions['activate'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id']), 'activateblog_' . $blog['blog_id'])) . '">' . __('Activate') . '</a>'; |
|
712 | 712 | } else { |
713 | - $actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; |
|
713 | + $actions['deactivate'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id']), 'deactivateblog_' . $blog['blog_id'])) . '">' . __('Deactivate') . '</a>'; |
|
714 | 714 | } |
715 | 715 | |
716 | - if ( '1' == $blog['archived'] ) { |
|
717 | - $actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>'; |
|
716 | + if ('1' == $blog['archived']) { |
|
717 | + $actions['unarchive'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id']), 'unarchiveblog_' . $blog['blog_id'])) . '">' . __('Unarchive') . '</a>'; |
|
718 | 718 | } else { |
719 | - $actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>'; |
|
719 | + $actions['archive'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id']), 'archiveblog_' . $blog['blog_id'])) . '">' . _x('Archive', 'verb; site') . '</a>'; |
|
720 | 720 | } |
721 | 721 | |
722 | - if ( '1' == $blog['spam'] ) { |
|
723 | - $actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>'; |
|
722 | + if ('1' == $blog['spam']) { |
|
723 | + $actions['unspam'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id']), 'unspamblog_' . $blog['blog_id'])) . '">' . _x('Not Spam', 'site') . '</a>'; |
|
724 | 724 | } else { |
725 | - $actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>'; |
|
725 | + $actions['spam'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id']), 'spamblog_' . $blog['blog_id'])) . '">' . _x('Spam', 'site') . '</a>'; |
|
726 | 726 | } |
727 | 727 | |
728 | - if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { |
|
729 | - $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
728 | + if (current_user_can('delete_site', $blog['blog_id'])) { |
|
729 | + $actions['delete'] = '<a href="' . esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id']), 'deleteblog_' . $blog['blog_id'])) . '">' . __('Delete') . '</a>'; |
|
730 | 730 | } |
731 | 731 | } |
732 | 732 | |
733 | - $actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>'; |
|
733 | + $actions['visit'] = "<a href='" . esc_url(get_home_url($blog['blog_id'], '/')) . "' rel='bookmark'>" . __('Visit') . '</a>'; |
|
734 | 734 | |
735 | 735 | /** |
736 | 736 | * Filters the action links displayed for each site in the Sites list table. |
@@ -747,8 +747,8 @@ discard block |
||
747 | 747 | * @param string $blogname Site path, formatted depending on whether it is a sub-domain |
748 | 748 | * or subdirectory multisite installation. |
749 | 749 | */ |
750 | - $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); |
|
750 | + $actions = apply_filters('manage_sites_action_links', array_filter($actions), $blog['blog_id'], $blogname); |
|
751 | 751 | |
752 | - return $this->row_actions( $actions ); |
|
752 | + return $this->row_actions($actions); |
|
753 | 753 | } |
754 | 754 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | * @see wp_editor() |
19 | 19 | */ |
20 | 20 | function tinymce_include() { |
21 | - _deprecated_function( __FUNCTION__, '2.1.0', 'wp_editor()' ); |
|
21 | + _deprecated_function(__FUNCTION__, '2.1.0', 'wp_editor()'); |
|
22 | 22 | |
23 | 23 | wp_tiny_mce(); |
24 | 24 | } |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | */ |
33 | 33 | function documentation_link() { |
34 | - _deprecated_function( __FUNCTION__, '2.5.0' ); |
|
34 | + _deprecated_function(__FUNCTION__, '2.5.0'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * @param int $hmax Maximum wanted height |
48 | 48 | * @return array Shrunk dimensions (width, height). |
49 | 49 | */ |
50 | -function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) { |
|
51 | - _deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' ); |
|
52 | - return wp_constrain_dimensions( $width, $height, $wmax, $hmax ); |
|
50 | +function wp_shrink_dimensions($width, $height, $wmax = 128, $hmax = 96) { |
|
51 | + _deprecated_function(__FUNCTION__, '3.0.0', 'wp_constrain_dimensions()'); |
|
52 | + return wp_constrain_dimensions($width, $height, $wmax, $hmax); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | /** |
@@ -63,9 +63,9 @@ discard block |
||
63 | 63 | * @param int $height Current height of the image |
64 | 64 | * @return array Shrunk dimensions (width, height). |
65 | 65 | */ |
66 | -function get_udims( $width, $height ) { |
|
67 | - _deprecated_function( __FUNCTION__, '3.5.0', 'wp_constrain_dimensions()' ); |
|
68 | - return wp_constrain_dimensions( $width, $height, 128, 96 ); |
|
66 | +function get_udims($width, $height) { |
|
67 | + _deprecated_function(__FUNCTION__, '3.5.0', 'wp_constrain_dimensions()'); |
|
68 | + return wp_constrain_dimensions($width, $height, 128, 96); |
|
69 | 69 | } |
70 | 70 | |
71 | 71 | /** |
@@ -81,10 +81,10 @@ discard block |
||
81 | 81 | * @param int $category_parent Unused. |
82 | 82 | * @param array $popular_ids Unused. |
83 | 83 | */ |
84 | -function dropdown_categories( $default_category = 0, $category_parent = 0, $popular_ids = array() ) { |
|
85 | - _deprecated_function( __FUNCTION__, '2.6.0', 'wp_category_checklist()' ); |
|
84 | +function dropdown_categories($default_category = 0, $category_parent = 0, $popular_ids = array()) { |
|
85 | + _deprecated_function(__FUNCTION__, '2.6.0', 'wp_category_checklist()'); |
|
86 | 86 | global $post_ID; |
87 | - wp_category_checklist( $post_ID ); |
|
87 | + wp_category_checklist($post_ID); |
|
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
@@ -98,10 +98,10 @@ discard block |
||
98 | 98 | * |
99 | 99 | * @param int $default_link_category Unused. |
100 | 100 | */ |
101 | -function dropdown_link_categories( $default_link_category = 0 ) { |
|
102 | - _deprecated_function( __FUNCTION__, '2.6.0', 'wp_link_category_checklist()' ); |
|
101 | +function dropdown_link_categories($default_link_category = 0) { |
|
102 | + _deprecated_function(__FUNCTION__, '2.6.0', 'wp_link_category_checklist()'); |
|
103 | 103 | global $link_id; |
104 | - wp_link_category_checklist( $link_id ); |
|
104 | + wp_link_category_checklist($link_id); |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | /** |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * @param string $file Filesystem path relative to the wp-content directory. |
115 | 115 | * @return string Full filesystem path to edit. |
116 | 116 | */ |
117 | -function get_real_file_to_edit( $file ) { |
|
118 | - _deprecated_function( __FUNCTION__, '2.9.0' ); |
|
117 | +function get_real_file_to_edit($file) { |
|
118 | + _deprecated_function(__FUNCTION__, '2.9.0'); |
|
119 | 119 | |
120 | 120 | return WP_CONTENT_DIR . $file; |
121 | 121 | } |
@@ -134,21 +134,21 @@ discard block |
||
134 | 134 | * @param array $categories Optional. Categories to include in the control. Default 0. |
135 | 135 | * @return void|false Void on success, false if no categories were found. |
136 | 136 | */ |
137 | -function wp_dropdown_cats( $current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0 ) { |
|
138 | - _deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' ); |
|
139 | - if (!$categories ) |
|
140 | - $categories = get_categories( array('hide_empty' => 0) ); |
|
137 | +function wp_dropdown_cats($current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0) { |
|
138 | + _deprecated_function(__FUNCTION__, '3.0.0', 'wp_dropdown_categories()'); |
|
139 | + if (!$categories) |
|
140 | + $categories = get_categories(array('hide_empty' => 0)); |
|
141 | 141 | |
142 | - if ( $categories ) { |
|
143 | - foreach ( $categories as $category ) { |
|
144 | - if ( $current_cat != $category->term_id && $category_parent == $category->parent) { |
|
145 | - $pad = str_repeat( '– ', $level ); |
|
146 | - $category->name = esc_html( $category->name ); |
|
142 | + if ($categories) { |
|
143 | + foreach ($categories as $category) { |
|
144 | + if ($current_cat != $category->term_id && $category_parent == $category->parent) { |
|
145 | + $pad = str_repeat('– ', $level); |
|
146 | + $category->name = esc_html($category->name); |
|
147 | 147 | echo "\n\t<option value='$category->term_id'"; |
148 | - if ( $current_parent == $category->term_id ) |
|
148 | + if ($current_parent == $category->term_id) |
|
149 | 149 | echo " selected='selected'"; |
150 | 150 | echo ">$pad$category->name</option>"; |
151 | - wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories ); |
|
151 | + wp_dropdown_cats($current_cat, $current_parent, $category->term_id, $level + 1, $categories); |
|
152 | 152 | } |
153 | 153 | } |
154 | 154 | } else { |
@@ -169,9 +169,9 @@ discard block |
||
169 | 169 | * @param string $option_name The name of an option to sanitize and save. |
170 | 170 | * @param callable $sanitize_callback Optional. A callback function that sanitizes the option's value. |
171 | 171 | */ |
172 | -function add_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { |
|
173 | - _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' ); |
|
174 | - register_setting( $option_group, $option_name, $sanitize_callback ); |
|
172 | +function add_option_update_handler($option_group, $option_name, $sanitize_callback = '') { |
|
173 | + _deprecated_function(__FUNCTION__, '3.0.0', 'register_setting()'); |
|
174 | + register_setting($option_group, $option_name, $sanitize_callback); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | /** |
@@ -185,9 +185,9 @@ discard block |
||
185 | 185 | * @param string $option_name The name of the option to unregister. |
186 | 186 | * @param callable $sanitize_callback Optional. Deprecated. |
187 | 187 | */ |
188 | -function remove_option_update_handler( $option_group, $option_name, $sanitize_callback = '' ) { |
|
189 | - _deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' ); |
|
190 | - unregister_setting( $option_group, $option_name, $sanitize_callback ); |
|
188 | +function remove_option_update_handler($option_group, $option_name, $sanitize_callback = '') { |
|
189 | + _deprecated_function(__FUNCTION__, '3.0.0', 'unregister_setting()'); |
|
190 | + unregister_setting($option_group, $option_name, $sanitize_callback); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -198,8 +198,8 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @param string $filename |
200 | 200 | **/ |
201 | -function codepress_get_lang( $filename ) { |
|
202 | - _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
201 | +function codepress_get_lang($filename) { |
|
202 | + _deprecated_function(__FUNCTION__, '3.0.0'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | /** |
@@ -209,7 +209,7 @@ discard block |
||
209 | 209 | * @deprecated 3.0.0 |
210 | 210 | **/ |
211 | 211 | function codepress_footer_js() { |
212 | - _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
212 | + _deprecated_function(__FUNCTION__, '3.0.0'); |
|
213 | 213 | } |
214 | 214 | |
215 | 215 | /** |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | * @deprecated 3.0.0 |
220 | 220 | **/ |
221 | 221 | function use_codepress() { |
222 | - _deprecated_function( __FUNCTION__, '3.0.0' ); |
|
222 | + _deprecated_function(__FUNCTION__, '3.0.0'); |
|
223 | 223 | } |
224 | 224 | |
225 | 225 | /** |
@@ -232,15 +232,15 @@ discard block |
||
232 | 232 | * @return array List of user IDs. |
233 | 233 | */ |
234 | 234 | function get_author_user_ids() { |
235 | - _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); |
|
235 | + _deprecated_function(__FUNCTION__, '3.1.0', 'get_users()'); |
|
236 | 236 | |
237 | 237 | global $wpdb; |
238 | - if ( !is_multisite() ) |
|
238 | + if (!is_multisite()) |
|
239 | 239 | $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
240 | 240 | else |
241 | 241 | $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels. |
242 | 242 | |
243 | - return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) ); |
|
243 | + return $wpdb->get_col($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key)); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -253,18 +253,18 @@ discard block |
||
253 | 253 | * @param int $user_id User ID. |
254 | 254 | * @return array|false List of editable authors. False if no editable users. |
255 | 255 | */ |
256 | -function get_editable_authors( $user_id ) { |
|
257 | - _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); |
|
256 | +function get_editable_authors($user_id) { |
|
257 | + _deprecated_function(__FUNCTION__, '3.1.0', 'get_users()'); |
|
258 | 258 | |
259 | 259 | global $wpdb; |
260 | 260 | |
261 | - $editable = get_editable_user_ids( $user_id ); |
|
261 | + $editable = get_editable_user_ids($user_id); |
|
262 | 262 | |
263 | - if ( !$editable ) { |
|
263 | + if (!$editable) { |
|
264 | 264 | return false; |
265 | 265 | } else { |
266 | 266 | $editable = join(',', $editable); |
267 | - $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" ); |
|
267 | + $authors = $wpdb->get_results("SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name"); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | return apply_filters('get_editable_authors', $authors); |
@@ -281,32 +281,32 @@ discard block |
||
281 | 281 | * @param bool $exclude_zeros Optional. Whether to exclude zeroes. Default true. |
282 | 282 | * @return array Array of editable user IDs, empty array otherwise. |
283 | 283 | */ |
284 | -function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) { |
|
285 | - _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); |
|
284 | +function get_editable_user_ids($user_id, $exclude_zeros = true, $post_type = 'post') { |
|
285 | + _deprecated_function(__FUNCTION__, '3.1.0', 'get_users()'); |
|
286 | 286 | |
287 | 287 | global $wpdb; |
288 | 288 | |
289 | - if ( ! $user = get_userdata( $user_id ) ) |
|
289 | + if (!$user = get_userdata($user_id)) |
|
290 | 290 | return array(); |
291 | 291 | $post_type_obj = get_post_type_object($post_type); |
292 | 292 | |
293 | - if ( ! $user->has_cap($post_type_obj->cap->edit_others_posts) ) { |
|
294 | - if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) |
|
293 | + if (!$user->has_cap($post_type_obj->cap->edit_others_posts)) { |
|
294 | + if ($user->has_cap($post_type_obj->cap->edit_posts) || !$exclude_zeros) |
|
295 | 295 | return array($user->ID); |
296 | 296 | else |
297 | 297 | return array(); |
298 | 298 | } |
299 | 299 | |
300 | - if ( !is_multisite() ) |
|
300 | + if (!is_multisite()) |
|
301 | 301 | $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
302 | 302 | else |
303 | 303 | $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels. |
304 | 304 | |
305 | 305 | $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key); |
306 | - if ( $exclude_zeros ) |
|
306 | + if ($exclude_zeros) |
|
307 | 307 | $query .= " AND meta_value != '0'"; |
308 | 308 | |
309 | - return $wpdb->get_col( $query ); |
|
309 | + return $wpdb->get_col($query); |
|
310 | 310 | } |
311 | 311 | |
312 | 312 | /** |
@@ -317,19 +317,19 @@ discard block |
||
317 | 317 | * @global wpdb $wpdb WordPress database abstraction object. |
318 | 318 | */ |
319 | 319 | function get_nonauthor_user_ids() { |
320 | - _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' ); |
|
320 | + _deprecated_function(__FUNCTION__, '3.1.0', 'get_users()'); |
|
321 | 321 | |
322 | 322 | global $wpdb; |
323 | 323 | |
324 | - if ( !is_multisite() ) |
|
324 | + if (!is_multisite()) |
|
325 | 325 | $level_key = $wpdb->get_blog_prefix() . 'user_level'; |
326 | 326 | else |
327 | 327 | $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels. |
328 | 328 | |
329 | - return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) ); |
|
329 | + return $wpdb->get_col($wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key)); |
|
330 | 330 | } |
331 | 331 | |
332 | -if ( ! class_exists( 'WP_User_Search', false ) ) : |
|
332 | +if (!class_exists('WP_User_Search', false)) : |
|
333 | 333 | /** |
334 | 334 | * WordPress User Search class. |
335 | 335 | * |
@@ -492,12 +492,12 @@ discard block |
||
492 | 492 | * @param string $role Role name. |
493 | 493 | * @return WP_User_Search |
494 | 494 | */ |
495 | - function __construct( $search_term = '', $page = '', $role = '' ) { |
|
496 | - _deprecated_function( __FUNCTION__, '3.1.0', 'WP_User_Query' ); |
|
495 | + function __construct($search_term = '', $page = '', $role = '') { |
|
496 | + _deprecated_function(__FUNCTION__, '3.1.0', 'WP_User_Query'); |
|
497 | 497 | |
498 | - $this->search_term = wp_unslash( $search_term ); |
|
499 | - $this->raw_page = ( '' == $page ) ? false : (int) $page; |
|
500 | - $this->page = ( '' == $page ) ? 1 : (int) $page; |
|
498 | + $this->search_term = wp_unslash($search_term); |
|
499 | + $this->raw_page = ('' == $page) ? false : (int) $page; |
|
500 | + $this->page = ('' == $page) ? 1 : (int) $page; |
|
501 | 501 | $this->role = $role; |
502 | 502 | |
503 | 503 | $this->prepare_query(); |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | * @param string $role Role name. |
516 | 516 | * @return WP_User_Search |
517 | 517 | */ |
518 | - public function WP_User_Search( $search_term = '', $page = '', $role = '' ) { |
|
519 | - self::__construct( $search_term, $page, $role ); |
|
518 | + public function WP_User_Search($search_term = '', $page = '', $role = '') { |
|
519 | + self::__construct($search_term, $page, $role); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | /** |
@@ -533,11 +533,11 @@ discard block |
||
533 | 533 | $this->query_orderby = ' ORDER BY user_login'; |
534 | 534 | |
535 | 535 | $search_sql = ''; |
536 | - if ( $this->search_term ) { |
|
536 | + if ($this->search_term) { |
|
537 | 537 | $searches = array(); |
538 | 538 | $search_sql = 'AND ('; |
539 | - foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) |
|
540 | - $searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' ); |
|
539 | + foreach (array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col) |
|
540 | + $searches[] = $wpdb->prepare($col . ' LIKE %s', '%' . like_escape($this->search_term) . '%'); |
|
541 | 541 | $search_sql .= implode(' OR ', $searches); |
542 | 542 | $search_sql .= ')'; |
543 | 543 | } |
@@ -545,16 +545,16 @@ discard block |
||
545 | 545 | $this->query_from = " FROM $wpdb->users"; |
546 | 546 | $this->query_where = " WHERE 1=1 $search_sql"; |
547 | 547 | |
548 | - if ( $this->role ) { |
|
548 | + if ($this->role) { |
|
549 | 549 | $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id"; |
550 | 550 | $this->query_where .= $wpdb->prepare(" AND $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%'); |
551 | - } elseif ( is_multisite() ) { |
|
551 | + } elseif (is_multisite()) { |
|
552 | 552 | $level_key = $wpdb->prefix . 'capabilities'; // WPMU site admins don't have user_levels. |
553 | 553 | $this->query_from .= ", $wpdb->usermeta"; |
554 | 554 | $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'"; |
555 | 555 | } |
556 | 556 | |
557 | - do_action_ref_array( 'pre_user_search', array( &$this ) ); |
|
557 | + do_action_ref_array('pre_user_search', array(&$this)); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | /** |
@@ -568,7 +568,7 @@ discard block |
||
568 | 568 | |
569 | 569 | $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit); |
570 | 570 | |
571 | - if ( $this->results ) |
|
571 | + if ($this->results) |
|
572 | 572 | $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // No limit. |
573 | 573 | else |
574 | 574 | $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.')); |
@@ -589,27 +589,27 @@ discard block |
||
589 | 589 | * @access public |
590 | 590 | */ |
591 | 591 | public function do_paging() { |
592 | - if ( $this->total_users_for_query > $this->users_per_page ) { // Have to page the results. |
|
592 | + if ($this->total_users_for_query > $this->users_per_page) { // Have to page the results. |
|
593 | 593 | $args = array(); |
594 | - if ( ! empty($this->search_term) ) |
|
594 | + if (!empty($this->search_term)) |
|
595 | 595 | $args['usersearch'] = urlencode($this->search_term); |
596 | - if ( ! empty($this->role) ) |
|
596 | + if (!empty($this->role)) |
|
597 | 597 | $args['role'] = urlencode($this->role); |
598 | 598 | |
599 | - $this->paging_text = paginate_links( array( |
|
599 | + $this->paging_text = paginate_links(array( |
|
600 | 600 | 'total' => ceil($this->total_users_for_query / $this->users_per_page), |
601 | 601 | 'current' => $this->page, |
602 | 602 | 'base' => 'users.php?%_%', |
603 | 603 | 'format' => 'userspage=%#%', |
604 | 604 | 'add_args' => $args |
605 | - ) ); |
|
606 | - if ( $this->paging_text ) { |
|
605 | + )); |
|
606 | + if ($this->paging_text) { |
|
607 | 607 | $this->paging_text = sprintf( |
608 | 608 | /* translators: 1: Starting number of users on the current page, 2: Ending number of users, 3: Total number of users. */ |
609 | - '<span class="displaying-num">' . __( 'Displaying %1$s–%2$s of %3$s' ) . '</span>%s', |
|
610 | - number_format_i18n( ( $this->page - 1 ) * $this->users_per_page + 1 ), |
|
611 | - number_format_i18n( min( $this->page * $this->users_per_page, $this->total_users_for_query ) ), |
|
612 | - number_format_i18n( $this->total_users_for_query ), |
|
609 | + '<span class="displaying-num">' . __('Displaying %1$s–%2$s of %3$s') . '</span>%s', |
|
610 | + number_format_i18n(($this->page - 1) * $this->users_per_page + 1), |
|
611 | + number_format_i18n(min($this->page * $this->users_per_page, $this->total_users_for_query)), |
|
612 | + number_format_i18n($this->total_users_for_query), |
|
613 | 613 | $this->paging_text |
614 | 614 | ); |
615 | 615 | } |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | * @return bool |
652 | 652 | */ |
653 | 653 | function results_are_paged() { |
654 | - if ( $this->paging_text ) |
|
654 | + if ($this->paging_text) |
|
655 | 655 | return true; |
656 | 656 | return false; |
657 | 657 | } |
@@ -665,7 +665,7 @@ discard block |
||
665 | 665 | * @return bool |
666 | 666 | */ |
667 | 667 | function is_search() { |
668 | - if ( $this->search_term ) |
|
668 | + if ($this->search_term) |
|
669 | 669 | return true; |
670 | 670 | return false; |
671 | 671 | } |
@@ -686,25 +686,25 @@ discard block |
||
686 | 686 | * Default 'any'. |
687 | 687 | * @return array List of posts from others. |
688 | 688 | */ |
689 | -function get_others_unpublished_posts( $user_id, $type = 'any' ) { |
|
690 | - _deprecated_function( __FUNCTION__, '3.1.0' ); |
|
689 | +function get_others_unpublished_posts($user_id, $type = 'any') { |
|
690 | + _deprecated_function(__FUNCTION__, '3.1.0'); |
|
691 | 691 | |
692 | 692 | global $wpdb; |
693 | 693 | |
694 | - $editable = get_editable_user_ids( $user_id ); |
|
694 | + $editable = get_editable_user_ids($user_id); |
|
695 | 695 | |
696 | - if ( in_array($type, array('draft', 'pending')) ) |
|
696 | + if (in_array($type, array('draft', 'pending'))) |
|
697 | 697 | $type_sql = " post_status = '$type' "; |
698 | 698 | else |
699 | 699 | $type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) "; |
700 | 700 | |
701 | - $dir = ( 'pending' == $type ) ? 'ASC' : 'DESC'; |
|
701 | + $dir = ('pending' == $type) ? 'ASC' : 'DESC'; |
|
702 | 702 | |
703 | - if ( !$editable ) { |
|
703 | + if (!$editable) { |
|
704 | 704 | $other_unpubs = ''; |
705 | 705 | } else { |
706 | 706 | $editable = join(',', $editable); |
707 | - $other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) ); |
|
707 | + $other_unpubs = $wpdb->get_results($wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id)); |
|
708 | 708 | } |
709 | 709 | |
710 | 710 | return apply_filters('get_others_drafts', $other_unpubs); |
@@ -720,7 +720,7 @@ discard block |
||
720 | 720 | * @return array List of drafts from other users. |
721 | 721 | */ |
722 | 722 | function get_others_drafts($user_id) { |
723 | - _deprecated_function( __FUNCTION__, '3.1.0' ); |
|
723 | + _deprecated_function(__FUNCTION__, '3.1.0'); |
|
724 | 724 | |
725 | 725 | return get_others_unpublished_posts($user_id, 'draft'); |
726 | 726 | } |
@@ -735,7 +735,7 @@ discard block |
||
735 | 735 | * @return array List of posts with pending review post type from other users. |
736 | 736 | */ |
737 | 737 | function get_others_pending($user_id) { |
738 | - _deprecated_function( __FUNCTION__, '3.1.0' ); |
|
738 | + _deprecated_function(__FUNCTION__, '3.1.0'); |
|
739 | 739 | |
740 | 740 | return get_others_unpublished_posts($user_id, 'pending'); |
741 | 741 | } |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | * @see wp_dashboard_quick_press() |
749 | 749 | */ |
750 | 750 | function wp_dashboard_quick_press_output() { |
751 | - _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' ); |
|
751 | + _deprecated_function(__FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()'); |
|
752 | 752 | wp_dashboard_quick_press(); |
753 | 753 | } |
754 | 754 | |
@@ -759,12 +759,12 @@ discard block |
||
759 | 759 | * @deprecated 3.3.0 Use wp_editor() |
760 | 760 | * @see wp_editor() |
761 | 761 | */ |
762 | -function wp_tiny_mce( $teeny = false, $settings = false ) { |
|
763 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); |
|
762 | +function wp_tiny_mce($teeny = false, $settings = false) { |
|
763 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_editor()'); |
|
764 | 764 | |
765 | 765 | static $num = 1; |
766 | 766 | |
767 | - if ( ! class_exists( '_WP_Editors', false ) ) |
|
767 | + if (!class_exists('_WP_Editors', false)) |
|
768 | 768 | require_once ABSPATH . WPINC . '/class-wp-editor.php'; |
769 | 769 | |
770 | 770 | $editor_id = 'content' . $num++; |
@@ -786,7 +786,7 @@ discard block |
||
786 | 786 | * @see wp_editor() |
787 | 787 | */ |
788 | 788 | function wp_preload_dialogs() { |
789 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); |
|
789 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_editor()'); |
|
790 | 790 | } |
791 | 791 | |
792 | 792 | /** |
@@ -796,7 +796,7 @@ discard block |
||
796 | 796 | * @see wp_editor() |
797 | 797 | */ |
798 | 798 | function wp_print_editor_js() { |
799 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); |
|
799 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_editor()'); |
|
800 | 800 | } |
801 | 801 | |
802 | 802 | /** |
@@ -806,7 +806,7 @@ discard block |
||
806 | 806 | * @see wp_editor() |
807 | 807 | */ |
808 | 808 | function wp_quicktags() { |
809 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' ); |
|
809 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_editor()'); |
|
810 | 810 | } |
811 | 811 | |
812 | 812 | /** |
@@ -816,12 +816,12 @@ discard block |
||
816 | 816 | * @deprecated 3.3.0 WP_Screen::render_screen_layout() |
817 | 817 | * @see WP_Screen::render_screen_layout() |
818 | 818 | */ |
819 | -function screen_layout( $screen ) { |
|
820 | - _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' ); |
|
819 | +function screen_layout($screen) { |
|
820 | + _deprecated_function(__FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()'); |
|
821 | 821 | |
822 | 822 | $current_screen = get_current_screen(); |
823 | 823 | |
824 | - if ( ! $current_screen ) |
|
824 | + if (!$current_screen) |
|
825 | 825 | return ''; |
826 | 826 | |
827 | 827 | ob_start(); |
@@ -836,12 +836,12 @@ discard block |
||
836 | 836 | * @deprecated 3.3.0 Use WP_Screen::render_per_page_options() |
837 | 837 | * @see WP_Screen::render_per_page_options() |
838 | 838 | */ |
839 | -function screen_options( $screen ) { |
|
840 | - _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' ); |
|
839 | +function screen_options($screen) { |
|
840 | + _deprecated_function(__FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()'); |
|
841 | 841 | |
842 | 842 | $current_screen = get_current_screen(); |
843 | 843 | |
844 | - if ( ! $current_screen ) |
|
844 | + if (!$current_screen) |
|
845 | 845 | return ''; |
846 | 846 | |
847 | 847 | ob_start(); |
@@ -856,7 +856,7 @@ discard block |
||
856 | 856 | * @deprecated 3.3.0 Use WP_Screen::render_screen_meta() |
857 | 857 | * @see WP_Screen::render_screen_meta() |
858 | 858 | */ |
859 | -function screen_meta( $screen ) { |
|
859 | +function screen_meta($screen) { |
|
860 | 860 | $current_screen = get_current_screen(); |
861 | 861 | $current_screen->render_screen_meta(); |
862 | 862 | } |
@@ -869,7 +869,7 @@ discard block |
||
869 | 869 | * @see WP_Admin_Bar |
870 | 870 | */ |
871 | 871 | function favorite_actions() { |
872 | - _deprecated_function( __FUNCTION__, '3.2.0', 'WP_Admin_Bar' ); |
|
872 | + _deprecated_function(__FUNCTION__, '3.2.0', 'WP_Admin_Bar'); |
|
873 | 873 | } |
874 | 874 | |
875 | 875 | /** |
@@ -881,7 +881,7 @@ discard block |
||
881 | 881 | * @return null|string |
882 | 882 | */ |
883 | 883 | function media_upload_image() { |
884 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); |
|
884 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_media_upload_handler()'); |
|
885 | 885 | return wp_media_upload_handler(); |
886 | 886 | } |
887 | 887 | |
@@ -894,7 +894,7 @@ discard block |
||
894 | 894 | * @return null|string |
895 | 895 | */ |
896 | 896 | function media_upload_audio() { |
897 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); |
|
897 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_media_upload_handler()'); |
|
898 | 898 | return wp_media_upload_handler(); |
899 | 899 | } |
900 | 900 | |
@@ -907,7 +907,7 @@ discard block |
||
907 | 907 | * @return null|string |
908 | 908 | */ |
909 | 909 | function media_upload_video() { |
910 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); |
|
910 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_media_upload_handler()'); |
|
911 | 911 | return wp_media_upload_handler(); |
912 | 912 | } |
913 | 913 | |
@@ -920,7 +920,7 @@ discard block |
||
920 | 920 | * @return null|string |
921 | 921 | */ |
922 | 922 | function media_upload_file() { |
923 | - _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' ); |
|
923 | + _deprecated_function(__FUNCTION__, '3.3.0', 'wp_media_upload_handler()'); |
|
924 | 924 | return wp_media_upload_handler(); |
925 | 925 | } |
926 | 926 | |
@@ -933,8 +933,8 @@ discard block |
||
933 | 933 | * @return string |
934 | 934 | */ |
935 | 935 | function type_url_form_image() { |
936 | - _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')" ); |
|
937 | - return wp_media_insert_url_form( 'image' ); |
|
936 | + _deprecated_function(__FUNCTION__, '3.3.0', "wp_media_insert_url_form('image')"); |
|
937 | + return wp_media_insert_url_form('image'); |
|
938 | 938 | } |
939 | 939 | |
940 | 940 | /** |
@@ -946,8 +946,8 @@ discard block |
||
946 | 946 | * @return string |
947 | 947 | */ |
948 | 948 | function type_url_form_audio() { |
949 | - _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')" ); |
|
950 | - return wp_media_insert_url_form( 'audio' ); |
|
949 | + _deprecated_function(__FUNCTION__, '3.3.0', "wp_media_insert_url_form('audio')"); |
|
950 | + return wp_media_insert_url_form('audio'); |
|
951 | 951 | } |
952 | 952 | |
953 | 953 | /** |
@@ -959,8 +959,8 @@ discard block |
||
959 | 959 | * @return string |
960 | 960 | */ |
961 | 961 | function type_url_form_video() { |
962 | - _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')" ); |
|
963 | - return wp_media_insert_url_form( 'video' ); |
|
962 | + _deprecated_function(__FUNCTION__, '3.3.0', "wp_media_insert_url_form('video')"); |
|
963 | + return wp_media_insert_url_form('video'); |
|
964 | 964 | } |
965 | 965 | |
966 | 966 | /** |
@@ -972,8 +972,8 @@ discard block |
||
972 | 972 | * @return string |
973 | 973 | */ |
974 | 974 | function type_url_form_file() { |
975 | - _deprecated_function( __FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')" ); |
|
976 | - return wp_media_insert_url_form( 'file' ); |
|
975 | + _deprecated_function(__FUNCTION__, '3.3.0', "wp_media_insert_url_form('file')"); |
|
976 | + return wp_media_insert_url_form('file'); |
|
977 | 977 | } |
978 | 978 | |
979 | 979 | /** |
@@ -989,13 +989,13 @@ discard block |
||
989 | 989 | * the hook name returned by the `add_*_page()` functions. |
990 | 990 | * @param string $help The content of an 'Overview' help tab. |
991 | 991 | */ |
992 | -function add_contextual_help( $screen, $help ) { |
|
993 | - _deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' ); |
|
992 | +function add_contextual_help($screen, $help) { |
|
993 | + _deprecated_function(__FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()'); |
|
994 | 994 | |
995 | - if ( is_string( $screen ) ) |
|
996 | - $screen = convert_to_screen( $screen ); |
|
995 | + if (is_string($screen)) |
|
996 | + $screen = convert_to_screen($screen); |
|
997 | 997 | |
998 | - WP_Screen::add_old_compat_help( $screen, $help ); |
|
998 | + WP_Screen::add_old_compat_help($screen, $help); |
|
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | /** |
@@ -1008,13 +1008,13 @@ discard block |
||
1008 | 1008 | * @return WP_Theme[] Array of WP_Theme objects keyed by their name. |
1009 | 1009 | */ |
1010 | 1010 | function get_allowed_themes() { |
1011 | - _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )" ); |
|
1011 | + _deprecated_function(__FUNCTION__, '3.4.0', "wp_get_themes( array( 'allowed' => true ) )"); |
|
1012 | 1012 | |
1013 | - $themes = wp_get_themes( array( 'allowed' => true ) ); |
|
1013 | + $themes = wp_get_themes(array('allowed' => true)); |
|
1014 | 1014 | |
1015 | 1015 | $wp_themes = array(); |
1016 | - foreach ( $themes as $theme ) { |
|
1017 | - $wp_themes[ $theme->get('Name') ] = $theme; |
|
1016 | + foreach ($themes as $theme) { |
|
1017 | + $wp_themes[$theme->get('Name')] = $theme; |
|
1018 | 1018 | } |
1019 | 1019 | |
1020 | 1020 | return $wp_themes; |
@@ -1030,13 +1030,13 @@ discard block |
||
1030 | 1030 | * @return array |
1031 | 1031 | */ |
1032 | 1032 | function get_broken_themes() { |
1033 | - _deprecated_function( __FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )" ); |
|
1033 | + _deprecated_function(__FUNCTION__, '3.4.0', "wp_get_themes( array( 'errors' => true )"); |
|
1034 | 1034 | |
1035 | - $themes = wp_get_themes( array( 'errors' => true ) ); |
|
1035 | + $themes = wp_get_themes(array('errors' => true)); |
|
1036 | 1036 | $broken = array(); |
1037 | - foreach ( $themes as $theme ) { |
|
1037 | + foreach ($themes as $theme) { |
|
1038 | 1038 | $name = $theme->get('Name'); |
1039 | - $broken[ $name ] = array( |
|
1039 | + $broken[$name] = array( |
|
1040 | 1040 | 'Name' => $name, |
1041 | 1041 | 'Title' => $name, |
1042 | 1042 | 'Description' => $theme->errors()->get_error_message(), |
@@ -1055,7 +1055,7 @@ discard block |
||
1055 | 1055 | * @return WP_Theme |
1056 | 1056 | */ |
1057 | 1057 | function current_theme_info() { |
1058 | - _deprecated_function( __FUNCTION__, '3.4.0', 'wp_get_theme()' ); |
|
1058 | + _deprecated_function(__FUNCTION__, '3.4.0', 'wp_get_theme()'); |
|
1059 | 1059 | |
1060 | 1060 | return wp_get_theme(); |
1061 | 1061 | } |
@@ -1067,8 +1067,8 @@ discard block |
||
1067 | 1067 | * |
1068 | 1068 | * @deprecated 3.5.0 |
1069 | 1069 | */ |
1070 | -function _insert_into_post_button( $type ) { |
|
1071 | - _deprecated_function( __FUNCTION__, '3.5.0' ); |
|
1070 | +function _insert_into_post_button($type) { |
|
1071 | + _deprecated_function(__FUNCTION__, '3.5.0'); |
|
1072 | 1072 | } |
1073 | 1073 | |
1074 | 1074 | /** |
@@ -1079,7 +1079,7 @@ discard block |
||
1079 | 1079 | * @deprecated 3.5.0 |
1080 | 1080 | */ |
1081 | 1081 | function _media_button($title, $icon, $type, $id) { |
1082 | - _deprecated_function( __FUNCTION__, '3.5.0' ); |
|
1082 | + _deprecated_function(__FUNCTION__, '3.5.0'); |
|
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | /** |
@@ -1092,10 +1092,10 @@ discard block |
||
1092 | 1092 | * @param int $id |
1093 | 1093 | * @return WP_Post |
1094 | 1094 | */ |
1095 | -function get_post_to_edit( $id ) { |
|
1096 | - _deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' ); |
|
1095 | +function get_post_to_edit($id) { |
|
1096 | + _deprecated_function(__FUNCTION__, '3.5.0', 'get_post()'); |
|
1097 | 1097 | |
1098 | - return get_post( $id, OBJECT, 'edit' ); |
|
1098 | + return get_post($id, OBJECT, 'edit'); |
|
1099 | 1099 | } |
1100 | 1100 | |
1101 | 1101 | /** |
@@ -1108,7 +1108,7 @@ discard block |
||
1108 | 1108 | * @return WP_Post Post object containing all the default post data as attributes |
1109 | 1109 | */ |
1110 | 1110 | function get_default_page_to_edit() { |
1111 | - _deprecated_function( __FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )" ); |
|
1111 | + _deprecated_function(__FUNCTION__, '3.5.0', "get_default_post_to_edit( 'page' )"); |
|
1112 | 1112 | |
1113 | 1113 | $page = get_default_post_to_edit(); |
1114 | 1114 | $page->post_type = 'page'; |
@@ -1127,9 +1127,9 @@ discard block |
||
1127 | 1127 | * @param mixed $deprecated Never used. |
1128 | 1128 | * @return string Thumbnail path on success, Error string on failure. |
1129 | 1129 | */ |
1130 | -function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) { |
|
1131 | - _deprecated_function( __FUNCTION__, '3.5.0', 'image_resize()' ); |
|
1132 | - return apply_filters( 'wp_create_thumbnail', image_resize( $file, $max_side, $max_side ) ); |
|
1130 | +function wp_create_thumbnail($file, $max_side, $deprecated = '') { |
|
1131 | + _deprecated_function(__FUNCTION__, '3.5.0', 'image_resize()'); |
|
1132 | + return apply_filters('wp_create_thumbnail', image_resize($file, $max_side, $max_side)); |
|
1133 | 1133 | } |
1134 | 1134 | |
1135 | 1135 | /** |
@@ -1141,7 +1141,7 @@ discard block |
||
1141 | 1141 | * @deprecated 3.6.0 |
1142 | 1142 | */ |
1143 | 1143 | function wp_nav_menu_locations_meta_box() { |
1144 | - _deprecated_function( __FUNCTION__, '3.6.0' ); |
|
1144 | + _deprecated_function(__FUNCTION__, '3.6.0'); |
|
1145 | 1145 | } |
1146 | 1146 | |
1147 | 1147 | /** |
@@ -1155,9 +1155,9 @@ discard block |
||
1155 | 1155 | * @see Core_Upgrader |
1156 | 1156 | */ |
1157 | 1157 | function wp_update_core($current, $feedback = '') { |
1158 | - _deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' ); |
|
1158 | + _deprecated_function(__FUNCTION__, '3.7.0', 'new Core_Upgrader();'); |
|
1159 | 1159 | |
1160 | - if ( !empty($feedback) ) |
|
1160 | + if (!empty($feedback)) |
|
1161 | 1161 | add_filter('update_feedback', $feedback); |
1162 | 1162 | |
1163 | 1163 | require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
@@ -1178,9 +1178,9 @@ discard block |
||
1178 | 1178 | * @see Plugin_Upgrader |
1179 | 1179 | */ |
1180 | 1180 | function wp_update_plugin($plugin, $feedback = '') { |
1181 | - _deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' ); |
|
1181 | + _deprecated_function(__FUNCTION__, '3.7.0', 'new Plugin_Upgrader();'); |
|
1182 | 1182 | |
1183 | - if ( !empty($feedback) ) |
|
1183 | + if (!empty($feedback)) |
|
1184 | 1184 | add_filter('update_feedback', $feedback); |
1185 | 1185 | |
1186 | 1186 | require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
@@ -1200,9 +1200,9 @@ discard block |
||
1200 | 1200 | * @see Theme_Upgrader |
1201 | 1201 | */ |
1202 | 1202 | function wp_update_theme($theme, $feedback = '') { |
1203 | - _deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' ); |
|
1203 | + _deprecated_function(__FUNCTION__, '3.7.0', 'new Theme_Upgrader();'); |
|
1204 | 1204 | |
1205 | - if ( !empty($feedback) ) |
|
1205 | + if (!empty($feedback)) |
|
1206 | 1206 | add_filter('update_feedback', $feedback); |
1207 | 1207 | |
1208 | 1208 | require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php'; |
@@ -1218,8 +1218,8 @@ discard block |
||
1218 | 1218 | * |
1219 | 1219 | * @param int|bool $id |
1220 | 1220 | */ |
1221 | -function the_attachment_links( $id = false ) { |
|
1222 | - _deprecated_function( __FUNCTION__, '3.7.0' ); |
|
1221 | +function the_attachment_links($id = false) { |
|
1222 | + _deprecated_function(__FUNCTION__, '3.7.0'); |
|
1223 | 1223 | } |
1224 | 1224 | |
1225 | 1225 | /** |
@@ -1229,7 +1229,7 @@ discard block |
||
1229 | 1229 | * @deprecated 3.8.0 |
1230 | 1230 | */ |
1231 | 1231 | function screen_icon() { |
1232 | - _deprecated_function( __FUNCTION__, '3.8.0' ); |
|
1232 | + _deprecated_function(__FUNCTION__, '3.8.0'); |
|
1233 | 1233 | echo get_screen_icon(); |
1234 | 1234 | } |
1235 | 1235 | |
@@ -1242,7 +1242,7 @@ discard block |
||
1242 | 1242 | * @return string An HTML comment explaining that icons are no longer used. |
1243 | 1243 | */ |
1244 | 1244 | function get_screen_icon() { |
1245 | - _deprecated_function( __FUNCTION__, '3.8.0' ); |
|
1245 | + _deprecated_function(__FUNCTION__, '3.8.0'); |
|
1246 | 1246 | return '<!-- Screen icons are no longer used as of WordPress 3.8. -->'; |
1247 | 1247 | } |
1248 | 1248 | |
@@ -1320,49 +1320,49 @@ discard block |
||
1320 | 1320 | * @param string $rss The RSS feed URL. |
1321 | 1321 | * @param array $args Array of arguments for this RSS feed. |
1322 | 1322 | */ |
1323 | -function wp_dashboard_plugins_output( $rss, $args = array() ) { |
|
1324 | - _deprecated_function( __FUNCTION__, '4.8.0' ); |
|
1323 | +function wp_dashboard_plugins_output($rss, $args = array()) { |
|
1324 | + _deprecated_function(__FUNCTION__, '4.8.0'); |
|
1325 | 1325 | |
1326 | 1326 | // Plugin feeds plus link to install them. |
1327 | - $popular = fetch_feed( $args['url']['popular'] ); |
|
1327 | + $popular = fetch_feed($args['url']['popular']); |
|
1328 | 1328 | |
1329 | - if ( false === $plugin_slugs = get_transient( 'plugin_slugs' ) ) { |
|
1330 | - $plugin_slugs = array_keys( get_plugins() ); |
|
1331 | - set_transient( 'plugin_slugs', $plugin_slugs, DAY_IN_SECONDS ); |
|
1329 | + if (false === $plugin_slugs = get_transient('plugin_slugs')) { |
|
1330 | + $plugin_slugs = array_keys(get_plugins()); |
|
1331 | + set_transient('plugin_slugs', $plugin_slugs, DAY_IN_SECONDS); |
|
1332 | 1332 | } |
1333 | 1333 | |
1334 | 1334 | echo '<ul>'; |
1335 | 1335 | |
1336 | - foreach ( array( $popular ) as $feed ) { |
|
1337 | - if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() ) |
|
1336 | + foreach (array($popular) as $feed) { |
|
1337 | + if (is_wp_error($feed) || !$feed->get_item_quantity()) |
|
1338 | 1338 | continue; |
1339 | 1339 | |
1340 | 1340 | $items = $feed->get_items(0, 5); |
1341 | 1341 | |
1342 | 1342 | // Pick a random, non-installed plugin. |
1343 | - while ( true ) { |
|
1343 | + while (true) { |
|
1344 | 1344 | // Abort this foreach loop iteration if there's no plugins left of this type. |
1345 | - if ( 0 === count($items) ) |
|
1345 | + if (0 === count($items)) |
|
1346 | 1346 | continue 2; |
1347 | 1347 | |
1348 | 1348 | $item_key = array_rand($items); |
1349 | 1349 | $item = $items[$item_key]; |
1350 | 1350 | |
1351 | - list($link, $frag) = explode( '#', $item->get_link() ); |
|
1351 | + list($link, $frag) = explode('#', $item->get_link()); |
|
1352 | 1352 | |
1353 | 1353 | $link = esc_url($link); |
1354 | - if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) |
|
1354 | + if (preg_match('|/([^/]+?)/?$|', $link, $matches)) |
|
1355 | 1355 | $slug = $matches[1]; |
1356 | 1356 | else { |
1357 | - unset( $items[$item_key] ); |
|
1357 | + unset($items[$item_key]); |
|
1358 | 1358 | continue; |
1359 | 1359 | } |
1360 | 1360 | |
1361 | 1361 | // Is this random plugin's slug already installed? If so, try again. |
1362 | - reset( $plugin_slugs ); |
|
1363 | - foreach ( $plugin_slugs as $plugin_slug ) { |
|
1364 | - if ( $slug == substr( $plugin_slug, 0, strlen( $slug ) ) ) { |
|
1365 | - unset( $items[$item_key] ); |
|
1362 | + reset($plugin_slugs); |
|
1363 | + foreach ($plugin_slugs as $plugin_slug) { |
|
1364 | + if ($slug == substr($plugin_slug, 0, strlen($slug))) { |
|
1365 | + unset($items[$item_key]); |
|
1366 | 1366 | continue 2; |
1367 | 1367 | } |
1368 | 1368 | } |
@@ -1372,22 +1372,22 @@ discard block |
||
1372 | 1372 | } |
1373 | 1373 | |
1374 | 1374 | // Eliminate some common badly formed plugin descriptions. |
1375 | - while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) |
|
1375 | + while ((null !== $item_key = array_rand($items)) && false !== strpos($items[$item_key]->get_description(), 'Plugin Name:')) |
|
1376 | 1376 | unset($items[$item_key]); |
1377 | 1377 | |
1378 | - if ( !isset($items[$item_key]) ) |
|
1378 | + if (!isset($items[$item_key])) |
|
1379 | 1379 | continue; |
1380 | 1380 | |
1381 | 1381 | $raw_title = $item->get_title(); |
1382 | 1382 | |
1383 | 1383 | $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&TB_iframe=true&width=600&height=800'; |
1384 | - echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) . |
|
1384 | + echo '<li class="dashboard-news-plugin"><span>' . __('Popular Plugin') . ':</span> ' . esc_html($raw_title) . |
|
1385 | 1385 | ' <a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' . |
1386 | 1386 | /* translators: %s: Plugin name. */ |
1387 | - esc_attr( sprintf( _x( 'Install %s', 'plugin' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>'; |
|
1387 | + esc_attr(sprintf(_x('Install %s', 'plugin'), $raw_title)) . '">(' . __('Install') . ')</a></li>'; |
|
1388 | 1388 | |
1389 | 1389 | $feed->__destruct(); |
1390 | - unset( $feed ); |
|
1390 | + unset($feed); |
|
1391 | 1391 | } |
1392 | 1392 | |
1393 | 1393 | echo '</ul>'; |
@@ -1403,8 +1403,8 @@ discard block |
||
1403 | 1403 | * @param int $old_ID |
1404 | 1404 | * @param int $new_ID |
1405 | 1405 | */ |
1406 | -function _relocate_children( $old_ID, $new_ID ) { |
|
1407 | - _deprecated_function( __FUNCTION__, '3.9.0' ); |
|
1406 | +function _relocate_children($old_ID, $new_ID) { |
|
1407 | + _deprecated_function(__FUNCTION__, '3.9.0'); |
|
1408 | 1408 | } |
1409 | 1409 | |
1410 | 1410 | /** |
@@ -1430,8 +1430,8 @@ discard block |
||
1430 | 1430 | * @param string $icon_url Optional. The URL to the icon to be used for this menu. |
1431 | 1431 | * @return string The resulting page's hook_suffix. |
1432 | 1432 | */ |
1433 | -function add_object_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { |
|
1434 | - _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' ); |
|
1433 | +function add_object_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { |
|
1434 | + _deprecated_function(__FUNCTION__, '4.5.0', 'add_menu_page()'); |
|
1435 | 1435 | |
1436 | 1436 | global $_wp_last_object_menu; |
1437 | 1437 | |
@@ -1463,8 +1463,8 @@ discard block |
||
1463 | 1463 | * @param string $icon_url Optional. The URL to the icon to be used for this menu. |
1464 | 1464 | * @return string The resulting page's hook_suffix. |
1465 | 1465 | */ |
1466 | -function add_utility_page( $page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { |
|
1467 | - _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' ); |
|
1466 | +function add_utility_page($page_title, $menu_title, $capability, $menu_slug, $callback = '', $icon_url = '') { |
|
1467 | + _deprecated_function(__FUNCTION__, '4.5.0', 'add_menu_page()'); |
|
1468 | 1468 | |
1469 | 1469 | global $_wp_last_utility_menu; |
1470 | 1470 | |
@@ -1491,9 +1491,9 @@ discard block |
||
1491 | 1491 | function post_form_autocomplete_off() { |
1492 | 1492 | global $is_safari, $is_chrome; |
1493 | 1493 | |
1494 | - _deprecated_function( __FUNCTION__, '4.6.0' ); |
|
1494 | + _deprecated_function(__FUNCTION__, '4.6.0'); |
|
1495 | 1495 | |
1496 | - if ( $is_safari || $is_chrome ) { |
|
1496 | + if ($is_safari || $is_chrome) { |
|
1497 | 1497 | echo ' autocomplete="off"'; |
1498 | 1498 | } |
1499 | 1499 | } |
@@ -1528,14 +1528,14 @@ discard block |
||
1528 | 1528 | * @deprecated 5.3.0 |
1529 | 1529 | */ |
1530 | 1530 | class WP_Privacy_Data_Export_Requests_Table extends WP_Privacy_Data_Export_Requests_List_Table { |
1531 | - function __construct( $args ) { |
|
1532 | - _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Export_Requests_List_Table' ); |
|
1531 | + function __construct($args) { |
|
1532 | + _deprecated_function(__CLASS__, '5.3.0', 'WP_Privacy_Data_Export_Requests_List_Table'); |
|
1533 | 1533 | |
1534 | - if ( ! isset( $args['screen'] ) || $args['screen'] === 'export_personal_data' ) { |
|
1534 | + if (!isset($args['screen']) || $args['screen'] === 'export_personal_data') { |
|
1535 | 1535 | $args['screen'] = 'export-personal-data'; |
1536 | 1536 | } |
1537 | 1537 | |
1538 | - parent::__construct( $args ); |
|
1538 | + parent::__construct($args); |
|
1539 | 1539 | } |
1540 | 1540 | } |
1541 | 1541 | |
@@ -1546,14 +1546,14 @@ discard block |
||
1546 | 1546 | * @deprecated 5.3.0 |
1547 | 1547 | */ |
1548 | 1548 | class WP_Privacy_Data_Removal_Requests_Table extends WP_Privacy_Data_Removal_Requests_List_Table { |
1549 | - function __construct( $args ) { |
|
1550 | - _deprecated_function( __CLASS__, '5.3.0', 'WP_Privacy_Data_Removal_Requests_List_Table' ); |
|
1549 | + function __construct($args) { |
|
1550 | + _deprecated_function(__CLASS__, '5.3.0', 'WP_Privacy_Data_Removal_Requests_List_Table'); |
|
1551 | 1551 | |
1552 | - if ( ! isset( $args['screen'] ) || $args['screen'] === 'remove_personal_data' ) { |
|
1552 | + if (!isset($args['screen']) || $args['screen'] === 'remove_personal_data') { |
|
1553 | 1553 | $args['screen'] = 'erase-personal-data'; |
1554 | 1554 | } |
1555 | 1555 | |
1556 | - parent::__construct( $args ); |
|
1556 | + parent::__construct($args); |
|
1557 | 1557 | } |
1558 | 1558 | } |
1559 | 1559 | |
@@ -1565,7 +1565,7 @@ discard block |
||
1565 | 1565 | * @deprecated 5.3.0 |
1566 | 1566 | */ |
1567 | 1567 | function _wp_privacy_requests_screen_options() { |
1568 | - _deprecated_function( __FUNCTION__, '5.3.0' ); |
|
1568 | + _deprecated_function(__FUNCTION__, '5.3.0'); |
|
1569 | 1569 | } |
1570 | 1570 | |
1571 | 1571 | /** |
@@ -1579,8 +1579,8 @@ discard block |
||
1579 | 1579 | * @param array $attachment An array of attachment metadata. |
1580 | 1580 | * @return array Attachment post object converted to an array. |
1581 | 1581 | */ |
1582 | -function image_attachment_fields_to_save( $post, $attachment ) { |
|
1583 | - _deprecated_function( __FUNCTION__, '6.0.0' ); |
|
1582 | +function image_attachment_fields_to_save($post, $attachment) { |
|
1583 | + _deprecated_function(__FUNCTION__, '6.0.0'); |
|
1584 | 1584 | |
1585 | 1585 | return $post; |
1586 | 1586 | } |
@@ -15,11 +15,11 @@ discard block |
||
15 | 15 | */ |
16 | 16 | function get_preferred_from_update_core() { |
17 | 17 | $updates = get_core_updates(); |
18 | - if ( ! is_array( $updates ) ) { |
|
18 | + if (!is_array($updates)) { |
|
19 | 19 | return false; |
20 | 20 | } |
21 | - if ( empty( $updates ) ) { |
|
22 | - return (object) array( 'response' => 'latest' ); |
|
21 | + if (empty($updates)) { |
|
22 | + return (object) array('response' => 'latest'); |
|
23 | 23 | } |
24 | 24 | return $updates[0]; |
25 | 25 | } |
@@ -33,40 +33,40 @@ discard block |
||
33 | 33 | * set $options['available'] to false to skip not-dismissed updates. |
34 | 34 | * @return array|false Array of the update objects on success, false on failure. |
35 | 35 | */ |
36 | -function get_core_updates( $options = array() ) { |
|
37 | - $options = array_merge( |
|
36 | +function get_core_updates($options = array()) { |
|
37 | + $options = array_merge( |
|
38 | 38 | array( |
39 | 39 | 'available' => true, |
40 | 40 | 'dismissed' => false, |
41 | 41 | ), |
42 | 42 | $options |
43 | 43 | ); |
44 | - $dismissed = get_site_option( 'dismissed_update_core' ); |
|
44 | + $dismissed = get_site_option('dismissed_update_core'); |
|
45 | 45 | |
46 | - if ( ! is_array( $dismissed ) ) { |
|
46 | + if (!is_array($dismissed)) { |
|
47 | 47 | $dismissed = array(); |
48 | 48 | } |
49 | 49 | |
50 | - $from_api = get_site_transient( 'update_core' ); |
|
50 | + $from_api = get_site_transient('update_core'); |
|
51 | 51 | |
52 | - if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) { |
|
52 | + if (!isset($from_api->updates) || !is_array($from_api->updates)) { |
|
53 | 53 | return false; |
54 | 54 | } |
55 | 55 | |
56 | 56 | $updates = $from_api->updates; |
57 | 57 | $result = array(); |
58 | - foreach ( $updates as $update ) { |
|
59 | - if ( 'autoupdate' === $update->response ) { |
|
58 | + foreach ($updates as $update) { |
|
59 | + if ('autoupdate' === $update->response) { |
|
60 | 60 | continue; |
61 | 61 | } |
62 | 62 | |
63 | - if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) { |
|
64 | - if ( $options['dismissed'] ) { |
|
63 | + if (array_key_exists($update->current . '|' . $update->locale, $dismissed)) { |
|
64 | + if ($options['dismissed']) { |
|
65 | 65 | $update->dismissed = true; |
66 | 66 | $result[] = $update; |
67 | 67 | } |
68 | 68 | } else { |
69 | - if ( $options['available'] ) { |
|
69 | + if ($options['available']) { |
|
70 | 70 | $update->dismissed = false; |
71 | 71 | $result[] = $update; |
72 | 72 | } |
@@ -85,8 +85,8 @@ discard block |
||
85 | 85 | * @return object|false The core update offering on success, false on failure. |
86 | 86 | */ |
87 | 87 | function find_core_auto_update() { |
88 | - $updates = get_site_transient( 'update_core' ); |
|
89 | - if ( ! $updates || empty( $updates->updates ) ) { |
|
88 | + $updates = get_site_transient('update_core'); |
|
89 | + if (!$updates || empty($updates->updates)) { |
|
90 | 90 | return false; |
91 | 91 | } |
92 | 92 | |
@@ -94,16 +94,16 @@ discard block |
||
94 | 94 | |
95 | 95 | $auto_update = false; |
96 | 96 | $upgrader = new WP_Automatic_Updater; |
97 | - foreach ( $updates->updates as $update ) { |
|
98 | - if ( 'autoupdate' !== $update->response ) { |
|
97 | + foreach ($updates->updates as $update) { |
|
98 | + if ('autoupdate' !== $update->response) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | 101 | |
102 | - if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) { |
|
102 | + if (!$upgrader->should_update('core', $update, ABSPATH)) { |
|
103 | 103 | continue; |
104 | 104 | } |
105 | 105 | |
106 | - if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) { |
|
106 | + if (!$auto_update || version_compare($update->current, $auto_update->current, '>')) { |
|
107 | 107 | $auto_update = $update; |
108 | 108 | } |
109 | 109 | } |
@@ -119,40 +119,40 @@ discard block |
||
119 | 119 | * @param string $locale Locale to query. |
120 | 120 | * @return array|false An array of checksums on success, false on failure. |
121 | 121 | */ |
122 | -function get_core_checksums( $version, $locale ) { |
|
123 | - $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), '', '&' ); |
|
122 | +function get_core_checksums($version, $locale) { |
|
123 | + $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query(compact('version', 'locale'), '', '&'); |
|
124 | 124 | $url = $http_url; |
125 | 125 | |
126 | - $ssl = wp_http_supports( array( 'ssl' ) ); |
|
127 | - if ( $ssl ) { |
|
128 | - $url = set_url_scheme( $url, 'https' ); |
|
126 | + $ssl = wp_http_supports(array('ssl')); |
|
127 | + if ($ssl) { |
|
128 | + $url = set_url_scheme($url, 'https'); |
|
129 | 129 | } |
130 | 130 | |
131 | 131 | $options = array( |
132 | 132 | 'timeout' => wp_doing_cron() ? 30 : 3, |
133 | 133 | ); |
134 | 134 | |
135 | - $response = wp_remote_get( $url, $options ); |
|
136 | - if ( $ssl && is_wp_error( $response ) ) { |
|
135 | + $response = wp_remote_get($url, $options); |
|
136 | + if ($ssl && is_wp_error($response)) { |
|
137 | 137 | trigger_error( |
138 | 138 | sprintf( |
139 | 139 | /* translators: %s: Support forums URL. */ |
140 | - __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.' ), |
|
141 | - __( 'https://wordpress.org/support/forums/' ) |
|
142 | - ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), |
|
140 | + __('An unexpected error occurred. Something may be wrong with WordPress.org or this server’s configuration. If you continue to have problems, please try the <a href="%s">support forums</a>.'), |
|
141 | + __('https://wordpress.org/support/forums/') |
|
142 | + ) . ' ' . __('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), |
|
143 | 143 | headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE |
144 | 144 | ); |
145 | - $response = wp_remote_get( $http_url, $options ); |
|
145 | + $response = wp_remote_get($http_url, $options); |
|
146 | 146 | } |
147 | 147 | |
148 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
148 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) { |
|
149 | 149 | return false; |
150 | 150 | } |
151 | 151 | |
152 | - $body = trim( wp_remote_retrieve_body( $response ) ); |
|
153 | - $body = json_decode( $body, true ); |
|
152 | + $body = trim(wp_remote_retrieve_body($response)); |
|
153 | + $body = json_decode($body, true); |
|
154 | 154 | |
155 | - if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) ) { |
|
155 | + if (!is_array($body) || !isset($body['checksums']) || !is_array($body['checksums'])) { |
|
156 | 156 | return false; |
157 | 157 | } |
158 | 158 | |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | * @param object $update |
168 | 168 | * @return bool |
169 | 169 | */ |
170 | -function dismiss_core_update( $update ) { |
|
171 | - $dismissed = get_site_option( 'dismissed_update_core' ); |
|
172 | - $dismissed[ $update->current . '|' . $update->locale ] = true; |
|
173 | - return update_site_option( 'dismissed_update_core', $dismissed ); |
|
170 | +function dismiss_core_update($update) { |
|
171 | + $dismissed = get_site_option('dismissed_update_core'); |
|
172 | + $dismissed[$update->current . '|' . $update->locale] = true; |
|
173 | + return update_site_option('dismissed_update_core', $dismissed); |
|
174 | 174 | } |
175 | 175 | |
176 | 176 | /** |
@@ -182,16 +182,16 @@ discard block |
||
182 | 182 | * @param string $locale |
183 | 183 | * @return bool |
184 | 184 | */ |
185 | -function undismiss_core_update( $version, $locale ) { |
|
186 | - $dismissed = get_site_option( 'dismissed_update_core' ); |
|
185 | +function undismiss_core_update($version, $locale) { |
|
186 | + $dismissed = get_site_option('dismissed_update_core'); |
|
187 | 187 | $key = $version . '|' . $locale; |
188 | 188 | |
189 | - if ( ! isset( $dismissed[ $key ] ) ) { |
|
189 | + if (!isset($dismissed[$key])) { |
|
190 | 190 | return false; |
191 | 191 | } |
192 | 192 | |
193 | - unset( $dismissed[ $key ] ); |
|
194 | - return update_site_option( 'dismissed_update_core', $dismissed ); |
|
193 | + unset($dismissed[$key]); |
|
194 | + return update_site_option('dismissed_update_core', $dismissed); |
|
195 | 195 | } |
196 | 196 | |
197 | 197 | /** |
@@ -203,16 +203,16 @@ discard block |
||
203 | 203 | * @param string $locale Locale to find the update for. |
204 | 204 | * @return object|false The core update offering on success, false on failure. |
205 | 205 | */ |
206 | -function find_core_update( $version, $locale ) { |
|
207 | - $from_api = get_site_transient( 'update_core' ); |
|
206 | +function find_core_update($version, $locale) { |
|
207 | + $from_api = get_site_transient('update_core'); |
|
208 | 208 | |
209 | - if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) { |
|
209 | + if (!isset($from_api->updates) || !is_array($from_api->updates)) { |
|
210 | 210 | return false; |
211 | 211 | } |
212 | 212 | |
213 | 213 | $updates = $from_api->updates; |
214 | - foreach ( $updates as $update ) { |
|
215 | - if ( $update->current == $version && $update->locale == $locale ) { |
|
214 | + foreach ($updates as $update) { |
|
215 | + if ($update->current == $version && $update->locale == $locale) { |
|
216 | 216 | return $update; |
217 | 217 | } |
218 | 218 | } |
@@ -225,52 +225,52 @@ discard block |
||
225 | 225 | * @param string $msg |
226 | 226 | * @return string |
227 | 227 | */ |
228 | -function core_update_footer( $msg = '' ) { |
|
229 | - if ( ! current_user_can( 'update_core' ) ) { |
|
228 | +function core_update_footer($msg = '') { |
|
229 | + if (!current_user_can('update_core')) { |
|
230 | 230 | /* translators: %s: WordPress version. */ |
231 | - return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); |
|
231 | + return sprintf(__('Version %s'), get_bloginfo('version', 'display')); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | $cur = get_preferred_from_update_core(); |
235 | - if ( ! is_object( $cur ) ) { |
|
235 | + if (!is_object($cur)) { |
|
236 | 236 | $cur = new stdClass; |
237 | 237 | } |
238 | 238 | |
239 | - if ( ! isset( $cur->current ) ) { |
|
239 | + if (!isset($cur->current)) { |
|
240 | 240 | $cur->current = ''; |
241 | 241 | } |
242 | 242 | |
243 | - if ( ! isset( $cur->response ) ) { |
|
243 | + if (!isset($cur->response)) { |
|
244 | 244 | $cur->response = ''; |
245 | 245 | } |
246 | 246 | |
247 | 247 | // Include an unmodified $wp_version. |
248 | 248 | require ABSPATH . WPINC . '/version.php'; |
249 | 249 | |
250 | - $is_development_version = preg_match( '/alpha|beta|RC/', $wp_version ); |
|
250 | + $is_development_version = preg_match('/alpha|beta|RC/', $wp_version); |
|
251 | 251 | |
252 | - if ( $is_development_version ) { |
|
252 | + if ($is_development_version) { |
|
253 | 253 | return sprintf( |
254 | 254 | /* translators: 1: WordPress version number, 2: URL to WordPress Updates screen. */ |
255 | - __( 'You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.' ), |
|
256 | - get_bloginfo( 'version', 'display' ), |
|
257 | - network_admin_url( 'update-core.php' ) |
|
255 | + __('You are using a development version (%1$s). Cool! Please <a href="%2$s">stay updated</a>.'), |
|
256 | + get_bloginfo('version', 'display'), |
|
257 | + network_admin_url('update-core.php') |
|
258 | 258 | ); |
259 | 259 | } |
260 | 260 | |
261 | - switch ( $cur->response ) { |
|
261 | + switch ($cur->response) { |
|
262 | 262 | case 'upgrade': |
263 | 263 | return sprintf( |
264 | 264 | '<strong><a href="%s">%s</a></strong>', |
265 | - network_admin_url( 'update-core.php' ), |
|
265 | + network_admin_url('update-core.php'), |
|
266 | 266 | /* translators: %s: WordPress version. */ |
267 | - sprintf( __( 'Get Version %s' ), $cur->current ) |
|
267 | + sprintf(__('Get Version %s'), $cur->current) |
|
268 | 268 | ); |
269 | 269 | |
270 | 270 | case 'latest': |
271 | 271 | default: |
272 | 272 | /* translators: %s: WordPress version. */ |
273 | - return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) ); |
|
273 | + return sprintf(__('Version %s'), get_bloginfo('version', 'display')); |
|
274 | 274 | } |
275 | 275 | } |
276 | 276 | |
@@ -283,39 +283,39 @@ discard block |
||
283 | 283 | function update_nag() { |
284 | 284 | global $pagenow; |
285 | 285 | |
286 | - if ( is_multisite() && ! current_user_can( 'update_core' ) ) { |
|
286 | + if (is_multisite() && !current_user_can('update_core')) { |
|
287 | 287 | return false; |
288 | 288 | } |
289 | 289 | |
290 | - if ( 'update-core.php' === $pagenow ) { |
|
290 | + if ('update-core.php' === $pagenow) { |
|
291 | 291 | return; |
292 | 292 | } |
293 | 293 | |
294 | 294 | $cur = get_preferred_from_update_core(); |
295 | 295 | |
296 | - if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) { |
|
296 | + if (!isset($cur->response) || 'upgrade' !== $cur->response) { |
|
297 | 297 | return false; |
298 | 298 | } |
299 | 299 | |
300 | 300 | $version_url = sprintf( |
301 | 301 | /* translators: %s: WordPress version. */ |
302 | - esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ), |
|
303 | - sanitize_title( $cur->current ) |
|
302 | + esc_url(__('https://wordpress.org/support/wordpress-version/version-%s/')), |
|
303 | + sanitize_title($cur->current) |
|
304 | 304 | ); |
305 | 305 | |
306 | - if ( current_user_can( 'update_core' ) ) { |
|
306 | + if (current_user_can('update_core')) { |
|
307 | 307 | $msg = sprintf( |
308 | 308 | /* translators: 1: URL to WordPress release notes, 2: New WordPress version, 3: URL to network admin, 4: Accessibility text. */ |
309 | - __( '<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.' ), |
|
309 | + __('<a href="%1$s">WordPress %2$s</a> is available! <a href="%3$s" aria-label="%4$s">Please update now</a>.'), |
|
310 | 310 | $version_url, |
311 | 311 | $cur->current, |
312 | - network_admin_url( 'update-core.php' ), |
|
313 | - esc_attr__( 'Please update WordPress now' ) |
|
312 | + network_admin_url('update-core.php'), |
|
313 | + esc_attr__('Please update WordPress now') |
|
314 | 314 | ); |
315 | 315 | } else { |
316 | 316 | $msg = sprintf( |
317 | 317 | /* translators: 1: URL to WordPress release notes, 2: New WordPress version. */ |
318 | - __( '<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.' ), |
|
318 | + __('<a href="%1$s">WordPress %2$s</a> is available! Please notify the site administrator.'), |
|
319 | 319 | $version_url, |
320 | 320 | $cur->current |
321 | 321 | ); |
@@ -331,27 +331,27 @@ discard block |
||
331 | 331 | */ |
332 | 332 | function update_right_now_message() { |
333 | 333 | $theme_name = wp_get_theme(); |
334 | - if ( current_user_can( 'switch_themes' ) ) { |
|
335 | - $theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme_name ); |
|
334 | + if (current_user_can('switch_themes')) { |
|
335 | + $theme_name = sprintf('<a href="themes.php">%1$s</a>', $theme_name); |
|
336 | 336 | } |
337 | 337 | |
338 | 338 | $msg = ''; |
339 | 339 | |
340 | - if ( current_user_can( 'update_core' ) ) { |
|
340 | + if (current_user_can('update_core')) { |
|
341 | 341 | $cur = get_preferred_from_update_core(); |
342 | 342 | |
343 | - if ( isset( $cur->response ) && 'upgrade' === $cur->response ) { |
|
343 | + if (isset($cur->response) && 'upgrade' === $cur->response) { |
|
344 | 344 | $msg .= sprintf( |
345 | 345 | '<a href="%s" class="button" aria-describedby="wp-version">%s</a> ', |
346 | - network_admin_url( 'update-core.php' ), |
|
346 | + network_admin_url('update-core.php'), |
|
347 | 347 | /* translators: %s: WordPress version number, or 'Latest' string. */ |
348 | - sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) ) |
|
348 | + sprintf(__('Update to %s'), $cur->current ? $cur->current : __('Latest')) |
|
349 | 349 | ); |
350 | 350 | } |
351 | 351 | } |
352 | 352 | |
353 | 353 | /* translators: 1: Version number, 2: Theme name. */ |
354 | - $content = __( 'WordPress %1$s running %2$s theme.' ); |
|
354 | + $content = __('WordPress %1$s running %2$s theme.'); |
|
355 | 355 | |
356 | 356 | /** |
357 | 357 | * Filters the text displayed in the 'At a Glance' dashboard widget. |
@@ -362,9 +362,9 @@ discard block |
||
362 | 362 | * |
363 | 363 | * @param string $content Default text. |
364 | 364 | */ |
365 | - $content = apply_filters( 'update_right_now_text', $content ); |
|
365 | + $content = apply_filters('update_right_now_text', $content); |
|
366 | 366 | |
367 | - $msg .= sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name ); |
|
367 | + $msg .= sprintf('<span id="wp-version">' . $content . '</span>', get_bloginfo('version', 'display'), $theme_name); |
|
368 | 368 | |
369 | 369 | echo "<p id='wp-version-message'>$msg</p>"; |
370 | 370 | } |
@@ -377,11 +377,11 @@ discard block |
||
377 | 377 | function get_plugin_updates() { |
378 | 378 | $all_plugins = get_plugins(); |
379 | 379 | $upgrade_plugins = array(); |
380 | - $current = get_site_transient( 'update_plugins' ); |
|
381 | - foreach ( (array) $all_plugins as $plugin_file => $plugin_data ) { |
|
382 | - if ( isset( $current->response[ $plugin_file ] ) ) { |
|
383 | - $upgrade_plugins[ $plugin_file ] = (object) $plugin_data; |
|
384 | - $upgrade_plugins[ $plugin_file ]->update = $current->response[ $plugin_file ]; |
|
380 | + $current = get_site_transient('update_plugins'); |
|
381 | + foreach ((array) $all_plugins as $plugin_file => $plugin_data) { |
|
382 | + if (isset($current->response[$plugin_file])) { |
|
383 | + $upgrade_plugins[$plugin_file] = (object) $plugin_data; |
|
384 | + $upgrade_plugins[$plugin_file]->update = $current->response[$plugin_file]; |
|
385 | 385 | } |
386 | 386 | } |
387 | 387 | |
@@ -392,15 +392,15 @@ discard block |
||
392 | 392 | * @since 2.9.0 |
393 | 393 | */ |
394 | 394 | function wp_plugin_update_rows() { |
395 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
395 | + if (!current_user_can('update_plugins')) { |
|
396 | 396 | return; |
397 | 397 | } |
398 | 398 | |
399 | - $plugins = get_site_transient( 'update_plugins' ); |
|
400 | - if ( isset( $plugins->response ) && is_array( $plugins->response ) ) { |
|
401 | - $plugins = array_keys( $plugins->response ); |
|
402 | - foreach ( $plugins as $plugin_file ) { |
|
403 | - add_action( "after_plugin_row_{$plugin_file}", 'wp_plugin_update_row', 10, 2 ); |
|
399 | + $plugins = get_site_transient('update_plugins'); |
|
400 | + if (isset($plugins->response) && is_array($plugins->response)) { |
|
401 | + $plugins = array_keys($plugins->response); |
|
402 | + foreach ($plugins as $plugin_file) { |
|
403 | + add_action("after_plugin_row_{$plugin_file}", 'wp_plugin_update_row', 10, 2); |
|
404 | 404 | } |
405 | 405 | } |
406 | 406 | } |
@@ -414,32 +414,32 @@ discard block |
||
414 | 414 | * @param array $plugin_data Plugin information. |
415 | 415 | * @return void|false |
416 | 416 | */ |
417 | -function wp_plugin_update_row( $file, $plugin_data ) { |
|
418 | - $current = get_site_transient( 'update_plugins' ); |
|
419 | - if ( ! isset( $current->response[ $file ] ) ) { |
|
417 | +function wp_plugin_update_row($file, $plugin_data) { |
|
418 | + $current = get_site_transient('update_plugins'); |
|
419 | + if (!isset($current->response[$file])) { |
|
420 | 420 | return false; |
421 | 421 | } |
422 | 422 | |
423 | - $response = $current->response[ $file ]; |
|
423 | + $response = $current->response[$file]; |
|
424 | 424 | |
425 | 425 | $plugins_allowedtags = array( |
426 | 426 | 'a' => array( |
427 | 427 | 'href' => array(), |
428 | 428 | 'title' => array(), |
429 | 429 | ), |
430 | - 'abbr' => array( 'title' => array() ), |
|
431 | - 'acronym' => array( 'title' => array() ), |
|
430 | + 'abbr' => array('title' => array()), |
|
431 | + 'acronym' => array('title' => array()), |
|
432 | 432 | 'code' => array(), |
433 | 433 | 'em' => array(), |
434 | 434 | 'strong' => array(), |
435 | 435 | ); |
436 | 436 | |
437 | - $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags ); |
|
438 | - $plugin_slug = isset( $response->slug ) ? $response->slug : $response->id; |
|
437 | + $plugin_name = wp_kses($plugin_data['Name'], $plugins_allowedtags); |
|
438 | + $plugin_slug = isset($response->slug) ? $response->slug : $response->id; |
|
439 | 439 | |
440 | - if ( isset( $response->slug ) ) { |
|
441 | - $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '§ion=changelog' ); |
|
442 | - } elseif ( isset( $response->url ) ) { |
|
440 | + if (isset($response->slug)) { |
|
441 | + $details_url = self_admin_url('plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '§ion=changelog'); |
|
442 | + } elseif (isset($response->url)) { |
|
443 | 443 | $details_url = $response->url; |
444 | 444 | } else { |
445 | 445 | $details_url = $plugin_data['PluginURI']; |
@@ -462,15 +462,15 @@ discard block |
||
462 | 462 | ) |
463 | 463 | ); |
464 | 464 | |
465 | - if ( is_network_admin() || ! is_multisite() ) { |
|
466 | - if ( is_network_admin() ) { |
|
467 | - $active_class = is_plugin_active_for_network( $file ) ? ' active' : ''; |
|
465 | + if (is_network_admin() || !is_multisite()) { |
|
466 | + if (is_network_admin()) { |
|
467 | + $active_class = is_plugin_active_for_network($file) ? ' active' : ''; |
|
468 | 468 | } else { |
469 | - $active_class = is_plugin_active( $file ) ? ' active' : ''; |
|
469 | + $active_class = is_plugin_active($file) ? ' active' : ''; |
|
470 | 470 | } |
471 | 471 | |
472 | - $requires_php = isset( $response->requires_php ) ? $response->requires_php : null; |
|
473 | - $compatible_php = is_php_version_compatible( $requires_php ); |
|
472 | + $requires_php = isset($response->requires_php) ? $response->requires_php : null; |
|
473 | + $compatible_php = is_php_version_compatible($requires_php); |
|
474 | 474 | $notice_type = $compatible_php ? 'notice-warning' : 'notice-error'; |
475 | 475 | |
476 | 476 | printf( |
@@ -478,74 +478,74 @@ discard block |
||
478 | 478 | '<td colspan="%s" class="plugin-update colspanchange">' . |
479 | 479 | '<div class="update-message notice inline %s notice-alt"><p>', |
480 | 480 | $active_class, |
481 | - esc_attr( $plugin_slug . '-update' ), |
|
482 | - esc_attr( $plugin_slug ), |
|
483 | - esc_attr( $file ), |
|
484 | - esc_attr( $wp_list_table->get_column_count() ), |
|
481 | + esc_attr($plugin_slug . '-update'), |
|
482 | + esc_attr($plugin_slug), |
|
483 | + esc_attr($file), |
|
484 | + esc_attr($wp_list_table->get_column_count()), |
|
485 | 485 | $notice_type |
486 | 486 | ); |
487 | 487 | |
488 | - if ( ! current_user_can( 'update_plugins' ) ) { |
|
488 | + if (!current_user_can('update_plugins')) { |
|
489 | 489 | printf( |
490 | 490 | /* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number. */ |
491 | - __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ), |
|
491 | + __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.'), |
|
492 | 492 | $plugin_name, |
493 | - esc_url( $details_url ), |
|
493 | + esc_url($details_url), |
|
494 | 494 | sprintf( |
495 | 495 | 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
496 | 496 | /* translators: 1: Plugin name, 2: Version number. */ |
497 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) |
|
497 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_name, $response->new_version)) |
|
498 | 498 | ), |
499 | - esc_attr( $response->new_version ) |
|
499 | + esc_attr($response->new_version) |
|
500 | 500 | ); |
501 | - } elseif ( empty( $response->package ) ) { |
|
501 | + } elseif (empty($response->package)) { |
|
502 | 502 | printf( |
503 | 503 | /* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number. */ |
504 | - __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>' ), |
|
504 | + __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this plugin.</em>'), |
|
505 | 505 | $plugin_name, |
506 | - esc_url( $details_url ), |
|
506 | + esc_url($details_url), |
|
507 | 507 | sprintf( |
508 | 508 | 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
509 | 509 | /* translators: 1: Plugin name, 2: Version number. */ |
510 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) |
|
510 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_name, $response->new_version)) |
|
511 | 511 | ), |
512 | - esc_attr( $response->new_version ) |
|
512 | + esc_attr($response->new_version) |
|
513 | 513 | ); |
514 | 514 | } else { |
515 | - if ( $compatible_php ) { |
|
515 | + if ($compatible_php) { |
|
516 | 516 | printf( |
517 | 517 | /* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */ |
518 | - __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ), |
|
518 | + __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.'), |
|
519 | 519 | $plugin_name, |
520 | - esc_url( $details_url ), |
|
520 | + esc_url($details_url), |
|
521 | 521 | sprintf( |
522 | 522 | 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
523 | 523 | /* translators: 1: Plugin name, 2: Version number. */ |
524 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) |
|
524 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_name, $response->new_version)) |
|
525 | 525 | ), |
526 | - esc_attr( $response->new_version ), |
|
527 | - wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ), |
|
526 | + esc_attr($response->new_version), |
|
527 | + wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=') . $file, 'upgrade-plugin_' . $file), |
|
528 | 528 | sprintf( |
529 | 529 | 'class="update-link" aria-label="%s"', |
530 | 530 | /* translators: %s: Plugin name. */ |
531 | - esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $plugin_name ) ) |
|
531 | + esc_attr(sprintf(_x('Update %s now', 'plugin'), $plugin_name)) |
|
532 | 532 | ) |
533 | 533 | ); |
534 | 534 | } else { |
535 | 535 | printf( |
536 | 536 | /* translators: 1: Plugin name, 2: Details URL, 3: Additional link attributes, 4: Version number 5: URL to Update PHP page. */ |
537 | - __( 'There is a new version of %1$s available, but it does not work with your version of PHP. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.' ), |
|
537 | + __('There is a new version of %1$s available, but it does not work with your version of PHP. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s">learn more about updating PHP</a>.'), |
|
538 | 538 | $plugin_name, |
539 | - esc_url( $details_url ), |
|
539 | + esc_url($details_url), |
|
540 | 540 | sprintf( |
541 | 541 | 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
542 | 542 | /* translators: 1: Plugin name, 2: Version number. */ |
543 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) ) |
|
543 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $plugin_name, $response->new_version)) |
|
544 | 544 | ), |
545 | - esc_attr( $response->new_version ), |
|
546 | - esc_url( wp_get_update_php_url() ) |
|
545 | + esc_attr($response->new_version), |
|
546 | + esc_url(wp_get_update_php_url()) |
|
547 | 547 | ); |
548 | - wp_update_php_annotation( '<br><em>', '</em>' ); |
|
548 | + wp_update_php_annotation('<br><em>', '</em>'); |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
@@ -578,7 +578,7 @@ discard block |
||
578 | 578 | * @type string $requires_php The version of PHP which the plugin requires. |
579 | 579 | * } |
580 | 580 | */ |
581 | - do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
581 | + do_action("in_plugin_update_message-{$file}", $plugin_data, $response); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
582 | 582 | |
583 | 583 | echo '</p></div></td></tr>'; |
584 | 584 | } |
@@ -590,16 +590,16 @@ discard block |
||
590 | 590 | * @return array |
591 | 591 | */ |
592 | 592 | function get_theme_updates() { |
593 | - $current = get_site_transient( 'update_themes' ); |
|
593 | + $current = get_site_transient('update_themes'); |
|
594 | 594 | |
595 | - if ( ! isset( $current->response ) ) { |
|
595 | + if (!isset($current->response)) { |
|
596 | 596 | return array(); |
597 | 597 | } |
598 | 598 | |
599 | 599 | $update_themes = array(); |
600 | - foreach ( $current->response as $stylesheet => $data ) { |
|
601 | - $update_themes[ $stylesheet ] = wp_get_theme( $stylesheet ); |
|
602 | - $update_themes[ $stylesheet ]->update = $data; |
|
600 | + foreach ($current->response as $stylesheet => $data) { |
|
601 | + $update_themes[$stylesheet] = wp_get_theme($stylesheet); |
|
602 | + $update_themes[$stylesheet]->update = $data; |
|
603 | 603 | } |
604 | 604 | |
605 | 605 | return $update_themes; |
@@ -609,16 +609,16 @@ discard block |
||
609 | 609 | * @since 3.1.0 |
610 | 610 | */ |
611 | 611 | function wp_theme_update_rows() { |
612 | - if ( ! current_user_can( 'update_themes' ) ) { |
|
612 | + if (!current_user_can('update_themes')) { |
|
613 | 613 | return; |
614 | 614 | } |
615 | 615 | |
616 | - $themes = get_site_transient( 'update_themes' ); |
|
617 | - if ( isset( $themes->response ) && is_array( $themes->response ) ) { |
|
618 | - $themes = array_keys( $themes->response ); |
|
616 | + $themes = get_site_transient('update_themes'); |
|
617 | + if (isset($themes->response) && is_array($themes->response)) { |
|
618 | + $themes = array_keys($themes->response); |
|
619 | 619 | |
620 | - foreach ( $themes as $theme ) { |
|
621 | - add_action( "after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2 ); |
|
620 | + foreach ($themes as $theme) { |
|
621 | + add_action("after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2); |
|
622 | 622 | } |
623 | 623 | } |
624 | 624 | } |
@@ -632,14 +632,14 @@ discard block |
||
632 | 632 | * @param WP_Theme $theme Theme object. |
633 | 633 | * @return void|false |
634 | 634 | */ |
635 | -function wp_theme_update_row( $theme_key, $theme ) { |
|
636 | - $current = get_site_transient( 'update_themes' ); |
|
635 | +function wp_theme_update_row($theme_key, $theme) { |
|
636 | + $current = get_site_transient('update_themes'); |
|
637 | 637 | |
638 | - if ( ! isset( $current->response[ $theme_key ] ) ) { |
|
638 | + if (!isset($current->response[$theme_key])) { |
|
639 | 639 | return false; |
640 | 640 | } |
641 | 641 | |
642 | - $response = $current->response[ $theme_key ]; |
|
642 | + $response = $current->response[$theme_key]; |
|
643 | 643 | |
644 | 644 | $details_url = add_query_arg( |
645 | 645 | array( |
@@ -647,132 +647,132 @@ discard block |
||
647 | 647 | 'width' => 1024, |
648 | 648 | 'height' => 800, |
649 | 649 | ), |
650 | - $current->response[ $theme_key ]['url'] |
|
650 | + $current->response[$theme_key]['url'] |
|
651 | 651 | ); |
652 | 652 | |
653 | 653 | /** @var WP_MS_Themes_List_Table $wp_list_table */ |
654 | - $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' ); |
|
654 | + $wp_list_table = _get_list_table('WP_MS_Themes_List_Table'); |
|
655 | 655 | |
656 | - $active = $theme->is_allowed( 'network' ) ? ' active' : ''; |
|
656 | + $active = $theme->is_allowed('network') ? ' active' : ''; |
|
657 | 657 | |
658 | - $requires_wp = isset( $response['requires'] ) ? $response['requires'] : null; |
|
659 | - $requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null; |
|
658 | + $requires_wp = isset($response['requires']) ? $response['requires'] : null; |
|
659 | + $requires_php = isset($response['requires_php']) ? $response['requires_php'] : null; |
|
660 | 660 | |
661 | - $compatible_wp = is_wp_version_compatible( $requires_wp ); |
|
662 | - $compatible_php = is_php_version_compatible( $requires_php ); |
|
661 | + $compatible_wp = is_wp_version_compatible($requires_wp); |
|
662 | + $compatible_php = is_php_version_compatible($requires_php); |
|
663 | 663 | |
664 | 664 | printf( |
665 | 665 | '<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' . |
666 | 666 | '<td colspan="%s" class="plugin-update colspanchange">' . |
667 | 667 | '<div class="update-message notice inline notice-warning notice-alt"><p>', |
668 | 668 | $active, |
669 | - esc_attr( $theme->get_stylesheet() . '-update' ), |
|
670 | - esc_attr( $theme->get_stylesheet() ), |
|
669 | + esc_attr($theme->get_stylesheet() . '-update'), |
|
670 | + esc_attr($theme->get_stylesheet()), |
|
671 | 671 | $wp_list_table->get_column_count() |
672 | 672 | ); |
673 | 673 | |
674 | - if ( $compatible_wp && $compatible_php ) { |
|
675 | - if ( ! current_user_can( 'update_themes' ) ) { |
|
674 | + if ($compatible_wp && $compatible_php) { |
|
675 | + if (!current_user_can('update_themes')) { |
|
676 | 676 | printf( |
677 | 677 | /* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */ |
678 | - __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.' ), |
|
678 | + __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>.'), |
|
679 | 679 | $theme['Name'], |
680 | - esc_url( $details_url ), |
|
680 | + esc_url($details_url), |
|
681 | 681 | sprintf( |
682 | 682 | 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
683 | 683 | /* translators: 1: Theme name, 2: Version number. */ |
684 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) |
|
684 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $theme['Name'], $response['new_version'])) |
|
685 | 685 | ), |
686 | 686 | $response['new_version'] |
687 | 687 | ); |
688 | - } elseif ( empty( $response['package'] ) ) { |
|
688 | + } elseif (empty($response['package'])) { |
|
689 | 689 | printf( |
690 | 690 | /* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number. */ |
691 | - __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>' ), |
|
691 | + __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a>. <em>Automatic update is unavailable for this theme.</em>'), |
|
692 | 692 | $theme['Name'], |
693 | - esc_url( $details_url ), |
|
693 | + esc_url($details_url), |
|
694 | 694 | sprintf( |
695 | 695 | 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
696 | 696 | /* translators: 1: Theme name, 2: Version number. */ |
697 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) |
|
697 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $theme['Name'], $response['new_version'])) |
|
698 | 698 | ), |
699 | 699 | $response['new_version'] |
700 | 700 | ); |
701 | 701 | } else { |
702 | 702 | printf( |
703 | 703 | /* translators: 1: Theme name, 2: Details URL, 3: Additional link attributes, 4: Version number, 5: Update URL, 6: Additional link attributes. */ |
704 | - __( 'There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.' ), |
|
704 | + __('There is a new version of %1$s available. <a href="%2$s" %3$s>View version %4$s details</a> or <a href="%5$s" %6$s>update now</a>.'), |
|
705 | 705 | $theme['Name'], |
706 | - esc_url( $details_url ), |
|
706 | + esc_url($details_url), |
|
707 | 707 | sprintf( |
708 | 708 | 'class="thickbox open-plugin-details-modal" aria-label="%s"', |
709 | 709 | /* translators: 1: Theme name, 2: Version number. */ |
710 | - esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) ) |
|
710 | + esc_attr(sprintf(__('View %1$s version %2$s details'), $theme['Name'], $response['new_version'])) |
|
711 | 711 | ), |
712 | 712 | $response['new_version'], |
713 | - wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ), |
|
713 | + wp_nonce_url(self_admin_url('update.php?action=upgrade-theme&theme=') . $theme_key, 'upgrade-theme_' . $theme_key), |
|
714 | 714 | sprintf( |
715 | 715 | 'class="update-link" aria-label="%s"', |
716 | 716 | /* translators: %s: Theme name. */ |
717 | - esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme['Name'] ) ) |
|
717 | + esc_attr(sprintf(_x('Update %s now', 'theme'), $theme['Name'])) |
|
718 | 718 | ) |
719 | 719 | ); |
720 | 720 | } |
721 | 721 | } else { |
722 | - if ( ! $compatible_wp && ! $compatible_php ) { |
|
722 | + if (!$compatible_wp && !$compatible_php) { |
|
723 | 723 | printf( |
724 | 724 | /* translators: %s: Theme name. */ |
725 | - __( 'There is a new version of %s available, but it does not work with your versions of WordPress and PHP.' ), |
|
725 | + __('There is a new version of %s available, but it does not work with your versions of WordPress and PHP.'), |
|
726 | 726 | $theme['Name'] |
727 | 727 | ); |
728 | - if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) { |
|
728 | + if (current_user_can('update_core') && current_user_can('update_php')) { |
|
729 | 729 | printf( |
730 | 730 | /* translators: 1: URL to WordPress Updates screen, 2: URL to Update PHP page. */ |
731 | - ' ' . __( '<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.' ), |
|
732 | - self_admin_url( 'update-core.php' ), |
|
733 | - esc_url( wp_get_update_php_url() ) |
|
731 | + ' ' . __('<a href="%1$s">Please update WordPress</a>, and then <a href="%2$s">learn more about updating PHP</a>.'), |
|
732 | + self_admin_url('update-core.php'), |
|
733 | + esc_url(wp_get_update_php_url()) |
|
734 | 734 | ); |
735 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
736 | - } elseif ( current_user_can( 'update_core' ) ) { |
|
735 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
736 | + } elseif (current_user_can('update_core')) { |
|
737 | 737 | printf( |
738 | 738 | /* translators: %s: URL to WordPress Updates screen. */ |
739 | - ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
740 | - self_admin_url( 'update-core.php' ) |
|
739 | + ' ' . __('<a href="%s">Please update WordPress</a>.'), |
|
740 | + self_admin_url('update-core.php') |
|
741 | 741 | ); |
742 | - } elseif ( current_user_can( 'update_php' ) ) { |
|
742 | + } elseif (current_user_can('update_php')) { |
|
743 | 743 | printf( |
744 | 744 | /* translators: %s: URL to Update PHP page. */ |
745 | - ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
746 | - esc_url( wp_get_update_php_url() ) |
|
745 | + ' ' . __('<a href="%s">Learn more about updating PHP</a>.'), |
|
746 | + esc_url(wp_get_update_php_url()) |
|
747 | 747 | ); |
748 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
748 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
749 | 749 | } |
750 | - } elseif ( ! $compatible_wp ) { |
|
750 | + } elseif (!$compatible_wp) { |
|
751 | 751 | printf( |
752 | 752 | /* translators: %s: Theme name. */ |
753 | - __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ), |
|
753 | + __('There is a new version of %s available, but it does not work with your version of WordPress.'), |
|
754 | 754 | $theme['Name'] |
755 | 755 | ); |
756 | - if ( current_user_can( 'update_core' ) ) { |
|
756 | + if (current_user_can('update_core')) { |
|
757 | 757 | printf( |
758 | 758 | /* translators: %s: URL to WordPress Updates screen. */ |
759 | - ' ' . __( '<a href="%s">Please update WordPress</a>.' ), |
|
760 | - self_admin_url( 'update-core.php' ) |
|
759 | + ' ' . __('<a href="%s">Please update WordPress</a>.'), |
|
760 | + self_admin_url('update-core.php') |
|
761 | 761 | ); |
762 | 762 | } |
763 | - } elseif ( ! $compatible_php ) { |
|
763 | + } elseif (!$compatible_php) { |
|
764 | 764 | printf( |
765 | 765 | /* translators: %s: Theme name. */ |
766 | - __( 'There is a new version of %s available, but it does not work with your version of PHP.' ), |
|
766 | + __('There is a new version of %s available, but it does not work with your version of PHP.'), |
|
767 | 767 | $theme['Name'] |
768 | 768 | ); |
769 | - if ( current_user_can( 'update_php' ) ) { |
|
769 | + if (current_user_can('update_php')) { |
|
770 | 770 | printf( |
771 | 771 | /* translators: %s: URL to Update PHP page. */ |
772 | - ' ' . __( '<a href="%s">Learn more about updating PHP</a>.' ), |
|
773 | - esc_url( wp_get_update_php_url() ) |
|
772 | + ' ' . __('<a href="%s">Learn more about updating PHP</a>.'), |
|
773 | + esc_url(wp_get_update_php_url()) |
|
774 | 774 | ); |
775 | - wp_update_php_annotation( '</p><p><em>', '</em>' ); |
|
775 | + wp_update_php_annotation('</p><p><em>', '</em>'); |
|
776 | 776 | } |
777 | 777 | } |
778 | 778 | } |
@@ -795,7 +795,7 @@ discard block |
||
795 | 795 | * @type string $package Theme update package URL. |
796 | 796 | * } |
797 | 797 | */ |
798 | - do_action( "in_theme_update_message-{$theme_key}", $theme, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
798 | + do_action("in_theme_update_message-{$theme_key}", $theme, $response); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores |
|
799 | 799 | |
800 | 800 | echo '</p></div></td></tr>'; |
801 | 801 | } |
@@ -810,9 +810,9 @@ discard block |
||
810 | 810 | // Include an unmodified $wp_version. |
811 | 811 | require ABSPATH . WPINC . '/version.php'; |
812 | 812 | global $upgrading; |
813 | - $nag = isset( $upgrading ); |
|
814 | - if ( ! $nag ) { |
|
815 | - $failed = get_site_option( 'auto_core_update_failed' ); |
|
813 | + $nag = isset($upgrading); |
|
814 | + if (!$nag) { |
|
815 | + $failed = get_site_option('auto_core_update_failed'); |
|
816 | 816 | /* |
817 | 817 | * If an update failed critically, we may have copied over version.php but not other files. |
818 | 818 | * In that case, if the installation claims we're running the version we attempted, nag. |
@@ -823,24 +823,24 @@ discard block |
||
823 | 823 | * |
824 | 824 | * This flag is cleared whenever a successful update occurs using Core_Upgrader. |
825 | 825 | */ |
826 | - $comparison = ! empty( $failed['critical'] ) ? '>=' : '>'; |
|
827 | - if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], $wp_version, $comparison ) ) { |
|
826 | + $comparison = !empty($failed['critical']) ? '>=' : '>'; |
|
827 | + if (isset($failed['attempted']) && version_compare($failed['attempted'], $wp_version, $comparison)) { |
|
828 | 828 | $nag = true; |
829 | 829 | } |
830 | 830 | } |
831 | 831 | |
832 | - if ( ! $nag ) { |
|
832 | + if (!$nag) { |
|
833 | 833 | return false; |
834 | 834 | } |
835 | 835 | |
836 | - if ( current_user_can( 'update_core' ) ) { |
|
836 | + if (current_user_can('update_core')) { |
|
837 | 837 | $msg = sprintf( |
838 | 838 | /* translators: %s: URL to WordPress Updates screen. */ |
839 | - __( 'An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.' ), |
|
839 | + __('An automated WordPress update has failed to complete - <a href="%s">please attempt the update again now</a>.'), |
|
840 | 840 | 'update-core.php' |
841 | 841 | ); |
842 | 842 | } else { |
843 | - $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' ); |
|
843 | + $msg = __('An automated WordPress update has failed to complete! Please notify the site administrator.'); |
|
844 | 844 | } |
845 | 845 | |
846 | 846 | echo "<div class='update-nag notice notice-warning inline'>$msg</div>"; |
@@ -875,24 +875,24 @@ discard block |
||
875 | 875 | <# if ( 'plugin' === data.type ) { #> |
876 | 876 | <?php |
877 | 877 | /* translators: %s: Number of plugins. */ |
878 | - printf( __( '%s plugin successfully updated.' ), '{{ data.successes }}' ); |
|
878 | + printf(__('%s plugin successfully updated.'), '{{ data.successes }}'); |
|
879 | 879 | ?> |
880 | 880 | <# } else { #> |
881 | 881 | <?php |
882 | 882 | /* translators: %s: Number of themes. */ |
883 | - printf( __( '%s theme successfully updated.' ), '{{ data.successes }}' ); |
|
883 | + printf(__('%s theme successfully updated.'), '{{ data.successes }}'); |
|
884 | 884 | ?> |
885 | 885 | <# } #> |
886 | 886 | <# } else { #> |
887 | 887 | <# if ( 'plugin' === data.type ) { #> |
888 | 888 | <?php |
889 | 889 | /* translators: %s: Number of plugins. */ |
890 | - printf( __( '%s plugins successfully updated.' ), '{{ data.successes }}' ); |
|
890 | + printf(__('%s plugins successfully updated.'), '{{ data.successes }}'); |
|
891 | 891 | ?> |
892 | 892 | <# } else { #> |
893 | 893 | <?php |
894 | 894 | /* translators: %s: Number of themes. */ |
895 | - printf( __( '%s themes successfully updated.' ), '{{ data.successes }}' ); |
|
895 | + printf(__('%s themes successfully updated.'), '{{ data.successes }}'); |
|
896 | 896 | ?> |
897 | 897 | <# } #> |
898 | 898 | <# } #> |
@@ -902,15 +902,15 @@ discard block |
||
902 | 902 | <# if ( 1 === data.errors ) { #> |
903 | 903 | <?php |
904 | 904 | /* translators: %s: Number of failed updates. */ |
905 | - printf( __( '%s update failed.' ), '{{ data.errors }}' ); |
|
905 | + printf(__('%s update failed.'), '{{ data.errors }}'); |
|
906 | 906 | ?> |
907 | 907 | <# } else { #> |
908 | 908 | <?php |
909 | 909 | /* translators: %s: Number of failed updates. */ |
910 | - printf( __( '%s updates failed.' ), '{{ data.errors }}' ); |
|
910 | + printf(__('%s updates failed.'), '{{ data.errors }}'); |
|
911 | 911 | ?> |
912 | 912 | <# } #> |
913 | - <span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span> |
|
913 | + <span class="screen-reader-text"><?php _e('Show more details'); ?></span> |
|
914 | 914 | <span class="toggle-indicator" aria-hidden="true"></span> |
915 | 915 | </button> |
916 | 916 | <# } #> |
@@ -970,7 +970,7 @@ discard block |
||
970 | 970 | <?php |
971 | 971 | printf( |
972 | 972 | /* translators: %s: Plugin name. */ |
973 | - _x( '%s was successfully deleted.', 'plugin' ), |
|
973 | + _x('%s was successfully deleted.', 'plugin'), |
|
974 | 974 | '<strong>{{{ data.name }}}</strong>' |
975 | 975 | ); |
976 | 976 | ?> |
@@ -978,7 +978,7 @@ discard block |
||
978 | 978 | <?php |
979 | 979 | printf( |
980 | 980 | /* translators: %s: Theme name. */ |
981 | - _x( '%s was successfully deleted.', 'theme' ), |
|
981 | + _x('%s was successfully deleted.', 'theme'), |
|
982 | 982 | '<strong>{{{ data.name }}}</strong>' |
983 | 983 | ); |
984 | 984 | ?> |
@@ -995,13 +995,13 @@ discard block |
||
995 | 995 | * @since 5.2.0 |
996 | 996 | */ |
997 | 997 | function wp_recovery_mode_nag() { |
998 | - if ( ! wp_is_recovery_mode() ) { |
|
998 | + if (!wp_is_recovery_mode()) { |
|
999 | 999 | return; |
1000 | 1000 | } |
1001 | 1001 | |
1002 | 1002 | $url = wp_login_url(); |
1003 | - $url = add_query_arg( 'action', WP_Recovery_Mode::EXIT_ACTION, $url ); |
|
1004 | - $url = wp_nonce_url( $url, WP_Recovery_Mode::EXIT_ACTION ); |
|
1003 | + $url = add_query_arg('action', WP_Recovery_Mode::EXIT_ACTION, $url); |
|
1004 | + $url = wp_nonce_url($url, WP_Recovery_Mode::EXIT_ACTION); |
|
1005 | 1005 | |
1006 | 1006 | ?> |
1007 | 1007 | <div class="notice notice-info"> |
@@ -1009,8 +1009,8 @@ discard block |
||
1009 | 1009 | <?php |
1010 | 1010 | printf( |
1011 | 1011 | /* translators: %s: Recovery Mode exit link. */ |
1012 | - __( 'You are in recovery mode. This means there may be an error with a theme or plugin. To exit recovery mode, log out or use the Exit button. <a href="%s">Exit Recovery Mode</a>' ), |
|
1013 | - esc_url( $url ) |
|
1012 | + __('You are in recovery mode. This means there may be an error with a theme or plugin. To exit recovery mode, log out or use the Exit button. <a href="%s">Exit Recovery Mode</a>'), |
|
1013 | + esc_url($url) |
|
1014 | 1014 | ); |
1015 | 1015 | ?> |
1016 | 1016 | </p> |
@@ -1026,15 +1026,15 @@ discard block |
||
1026 | 1026 | * @param string $type The type of update being checked: 'theme' or 'plugin'. |
1027 | 1027 | * @return bool True if auto-updates are enabled for `$type`, false otherwise. |
1028 | 1028 | */ |
1029 | -function wp_is_auto_update_enabled_for_type( $type ) { |
|
1030 | - if ( ! class_exists( 'WP_Automatic_Updater' ) ) { |
|
1029 | +function wp_is_auto_update_enabled_for_type($type) { |
|
1030 | + if (!class_exists('WP_Automatic_Updater')) { |
|
1031 | 1031 | require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php'; |
1032 | 1032 | } |
1033 | 1033 | |
1034 | 1034 | $updater = new WP_Automatic_Updater(); |
1035 | - $enabled = ! $updater->is_disabled(); |
|
1035 | + $enabled = !$updater->is_disabled(); |
|
1036 | 1036 | |
1037 | - switch ( $type ) { |
|
1037 | + switch ($type) { |
|
1038 | 1038 | case 'plugin': |
1039 | 1039 | /** |
1040 | 1040 | * Filters whether plugins auto-update is enabled. |
@@ -1043,7 +1043,7 @@ discard block |
||
1043 | 1043 | * |
1044 | 1044 | * @param bool $enabled True if plugins auto-update is enabled, false otherwise. |
1045 | 1045 | */ |
1046 | - return apply_filters( 'plugins_auto_update_enabled', $enabled ); |
|
1046 | + return apply_filters('plugins_auto_update_enabled', $enabled); |
|
1047 | 1047 | case 'theme': |
1048 | 1048 | /** |
1049 | 1049 | * Filters whether themes auto-update is enabled. |
@@ -1052,7 +1052,7 @@ discard block |
||
1052 | 1052 | * |
1053 | 1053 | * @param bool $enabled True if themes auto-update is enabled, false otherwise. |
1054 | 1054 | */ |
1055 | - return apply_filters( 'themes_auto_update_enabled', $enabled ); |
|
1055 | + return apply_filters('themes_auto_update_enabled', $enabled); |
|
1056 | 1056 | } |
1057 | 1057 | |
1058 | 1058 | return false; |
@@ -1069,9 +1069,9 @@ discard block |
||
1069 | 1069 | * @param object $item The update offer. |
1070 | 1070 | * @return bool True if auto-updates are forced for `$item`, false otherwise. |
1071 | 1071 | */ |
1072 | -function wp_is_auto_update_forced_for_item( $type, $update, $item ) { |
|
1072 | +function wp_is_auto_update_forced_for_item($type, $update, $item) { |
|
1073 | 1073 | /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */ |
1074 | - return apply_filters( "auto_update_{$type}", $update, $item ); |
|
1074 | + return apply_filters("auto_update_{$type}", $update, $item); |
|
1075 | 1075 | } |
1076 | 1076 | |
1077 | 1077 | /** |
@@ -1082,27 +1082,27 @@ discard block |
||
1082 | 1082 | * @return string The update message to be shown. |
1083 | 1083 | */ |
1084 | 1084 | function wp_get_auto_update_message() { |
1085 | - $next_update_time = wp_next_scheduled( 'wp_version_check' ); |
|
1085 | + $next_update_time = wp_next_scheduled('wp_version_check'); |
|
1086 | 1086 | |
1087 | 1087 | // Check if the event exists. |
1088 | - if ( false === $next_update_time ) { |
|
1089 | - $message = __( 'Automatic update not scheduled. There may be a problem with WP-Cron.' ); |
|
1088 | + if (false === $next_update_time) { |
|
1089 | + $message = __('Automatic update not scheduled. There may be a problem with WP-Cron.'); |
|
1090 | 1090 | } else { |
1091 | - $time_to_next_update = human_time_diff( (int) $next_update_time ); |
|
1091 | + $time_to_next_update = human_time_diff((int) $next_update_time); |
|
1092 | 1092 | |
1093 | 1093 | // See if cron is overdue. |
1094 | - $overdue = ( time() - $next_update_time ) > 0; |
|
1094 | + $overdue = (time() - $next_update_time) > 0; |
|
1095 | 1095 | |
1096 | - if ( $overdue ) { |
|
1096 | + if ($overdue) { |
|
1097 | 1097 | $message = sprintf( |
1098 | 1098 | /* translators: %s: Duration that WP-Cron has been overdue. */ |
1099 | - __( 'Automatic update overdue by %s. There may be a problem with WP-Cron.' ), |
|
1099 | + __('Automatic update overdue by %s. There may be a problem with WP-Cron.'), |
|
1100 | 1100 | $time_to_next_update |
1101 | 1101 | ); |
1102 | 1102 | } else { |
1103 | 1103 | $message = sprintf( |
1104 | 1104 | /* translators: %s: Time until the next update. */ |
1105 | - __( 'Automatic update scheduled in %s.' ), |
|
1105 | + __('Automatic update scheduled in %s.'), |
|
1106 | 1106 | $time_to_next_update |
1107 | 1107 | ); |
1108 | 1108 | } |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | function network_domain_check() { |
20 | 20 | global $wpdb; |
21 | 21 | |
22 | - $sql = $wpdb->prepare( 'SHOW TABLES LIKE %s', $wpdb->esc_like( $wpdb->site ) ); |
|
23 | - if ( $wpdb->get_var( $sql ) ) { |
|
24 | - return $wpdb->get_var( "SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1" ); |
|
22 | + $sql = $wpdb->prepare('SHOW TABLES LIKE %s', $wpdb->esc_like($wpdb->site)); |
|
23 | + if ($wpdb->get_var($sql)) { |
|
24 | + return $wpdb->get_var("SELECT domain FROM $wpdb->site ORDER BY id ASC LIMIT 1"); |
|
25 | 25 | } |
26 | 26 | return false; |
27 | 27 | } |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @return bool Whether subdomain installation is allowed |
34 | 34 | */ |
35 | 35 | function allow_subdomain_install() { |
36 | - $domain = preg_replace( '|https?://([^/]+)|', '$1', get_option( 'home' ) ); |
|
37 | - if ( parse_url( get_option( 'home' ), PHP_URL_PATH ) || 'localhost' === $domain || preg_match( '|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain ) ) { |
|
36 | + $domain = preg_replace('|https?://([^/]+)|', '$1', get_option('home')); |
|
37 | + if (parse_url(get_option('home'), PHP_URL_PATH) || 'localhost' === $domain || preg_match('|^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$|', $domain)) { |
|
38 | 38 | return false; |
39 | 39 | } |
40 | 40 | |
@@ -61,16 +61,16 @@ discard block |
||
61 | 61 | * @param bool $allow Whether to enable the subdirectory installation feature in Multisite. |
62 | 62 | * Default false. |
63 | 63 | */ |
64 | - if ( apply_filters( 'allow_subdirectory_install', false ) ) { |
|
64 | + if (apply_filters('allow_subdirectory_install', false)) { |
|
65 | 65 | return true; |
66 | 66 | } |
67 | 67 | |
68 | - if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) { |
|
68 | + if (defined('ALLOW_SUBDIRECTORY_INSTALL') && ALLOW_SUBDIRECTORY_INSTALL) { |
|
69 | 69 | return true; |
70 | 70 | } |
71 | 71 | |
72 | - $post = $wpdb->get_row( "SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'" ); |
|
73 | - if ( empty( $post ) ) { |
|
72 | + $post = $wpdb->get_row("SELECT ID FROM $wpdb->posts WHERE post_date < DATE_SUB(NOW(), INTERVAL 1 MONTH) AND post_status = 'publish'"); |
|
73 | + if (empty($post)) { |
|
74 | 74 | return true; |
75 | 75 | } |
76 | 76 | |
@@ -85,13 +85,13 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function get_clean_basedomain() { |
87 | 87 | $existing_domain = network_domain_check(); |
88 | - if ( $existing_domain ) { |
|
88 | + if ($existing_domain) { |
|
89 | 89 | return $existing_domain; |
90 | 90 | } |
91 | - $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); |
|
92 | - $slash = strpos( $domain, '/' ); |
|
93 | - if ( $slash ) { |
|
94 | - $domain = substr( $domain, 0, $slash ); |
|
91 | + $domain = preg_replace('|https?://|', '', get_option('siteurl')); |
|
92 | + $slash = strpos($domain, '/'); |
|
93 | + if ($slash) { |
|
94 | + $domain = substr($domain, 0, $slash); |
|
95 | 95 | } |
96 | 96 | return $domain; |
97 | 97 | } |
@@ -109,13 +109,13 @@ discard block |
||
109 | 109 | * |
110 | 110 | * @param false|WP_Error $errors Optional. Error object. Default false. |
111 | 111 | */ |
112 | -function network_step1( $errors = false ) { |
|
112 | +function network_step1($errors = false) { |
|
113 | 113 | global $is_apache; |
114 | 114 | |
115 | - if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { |
|
116 | - echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf( |
|
115 | + if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) { |
|
116 | + echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . sprintf( |
|
117 | 117 | /* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */ |
118 | - __( 'The constant %s cannot be defined when creating a network.' ), |
|
118 | + __('The constant %s cannot be defined when creating a network.'), |
|
119 | 119 | '<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>' |
120 | 120 | ) . '</p></div>'; |
121 | 121 | echo '</div>'; |
@@ -123,29 +123,29 @@ discard block |
||
123 | 123 | die(); |
124 | 124 | } |
125 | 125 | |
126 | - $active_plugins = get_option( 'active_plugins' ); |
|
127 | - if ( ! empty( $active_plugins ) ) { |
|
128 | - echo '<div class="notice notice-warning"><p><strong>' . __( 'Warning:' ) . '</strong> ' . sprintf( |
|
126 | + $active_plugins = get_option('active_plugins'); |
|
127 | + if (!empty($active_plugins)) { |
|
128 | + echo '<div class="notice notice-warning"><p><strong>' . __('Warning:') . '</strong> ' . sprintf( |
|
129 | 129 | /* translators: %s: URL to Plugins screen. */ |
130 | - __( 'Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.' ), |
|
131 | - admin_url( 'plugins.php?plugin_status=active' ) |
|
130 | + __('Please <a href="%s">deactivate your plugins</a> before enabling the Network feature.'), |
|
131 | + admin_url('plugins.php?plugin_status=active') |
|
132 | 132 | ) . '</p></div>'; |
133 | - echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>'; |
|
133 | + echo '<p>' . __('Once the network is created, you may reactivate your plugins.') . '</p>'; |
|
134 | 134 | echo '</div>'; |
135 | 135 | require_once ABSPATH . 'wp-admin/admin-footer.php'; |
136 | 136 | die(); |
137 | 137 | } |
138 | 138 | |
139 | 139 | $hostname = get_clean_basedomain(); |
140 | - $has_ports = strstr( $hostname, ':' ); |
|
141 | - if ( ( false !== $has_ports && ! in_array( $has_ports, array( ':80', ':443' ), true ) ) ) { |
|
142 | - echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . __( 'You cannot install a network of sites with your server address.' ) . '</p></div>'; |
|
140 | + $has_ports = strstr($hostname, ':'); |
|
141 | + if ((false !== $has_ports && !in_array($has_ports, array(':80', ':443'), true))) { |
|
142 | + echo '<div class="error"><p><strong>' . __('Error:') . '</strong> ' . __('You cannot install a network of sites with your server address.') . '</p></div>'; |
|
143 | 143 | echo '<p>' . sprintf( |
144 | 144 | /* translators: %s: Port number. */ |
145 | - __( 'You cannot use port numbers such as %s.' ), |
|
145 | + __('You cannot use port numbers such as %s.'), |
|
146 | 146 | '<code>' . $has_ports . '</code>' |
147 | 147 | ) . '</p>'; |
148 | - echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>'; |
|
148 | + echo '<a href="' . esc_url(admin_url()) . '">' . __('Go to Dashboard') . '</a>'; |
|
149 | 149 | echo '</div>'; |
150 | 150 | require_once ABSPATH . 'wp-admin/admin-footer.php'; |
151 | 151 | die(); |
@@ -153,67 +153,67 @@ discard block |
||
153 | 153 | |
154 | 154 | echo '<form method="post">'; |
155 | 155 | |
156 | - wp_nonce_field( 'install-network-1' ); |
|
156 | + wp_nonce_field('install-network-1'); |
|
157 | 157 | |
158 | 158 | $error_codes = array(); |
159 | - if ( is_wp_error( $errors ) ) { |
|
160 | - echo '<div class="error"><p><strong>' . __( 'Error: The network could not be created.' ) . '</strong></p>'; |
|
161 | - foreach ( $errors->get_error_messages() as $error ) { |
|
159 | + if (is_wp_error($errors)) { |
|
160 | + echo '<div class="error"><p><strong>' . __('Error: The network could not be created.') . '</strong></p>'; |
|
161 | + foreach ($errors->get_error_messages() as $error) { |
|
162 | 162 | echo "<p>$error</p>"; |
163 | 163 | } |
164 | 164 | echo '</div>'; |
165 | 165 | $error_codes = $errors->get_error_codes(); |
166 | 166 | } |
167 | 167 | |
168 | - if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) { |
|
168 | + if (!empty($_POST['sitename']) && !in_array('empty_sitename', $error_codes, true)) { |
|
169 | 169 | $site_name = $_POST['sitename']; |
170 | 170 | } else { |
171 | 171 | /* translators: %s: Default network title. */ |
172 | - $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) ); |
|
172 | + $site_name = sprintf(__('%s Sites'), get_option('blogname')); |
|
173 | 173 | } |
174 | 174 | |
175 | - if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) { |
|
175 | + if (!empty($_POST['email']) && !in_array('invalid_email', $error_codes, true)) { |
|
176 | 176 | $admin_email = $_POST['email']; |
177 | 177 | } else { |
178 | - $admin_email = get_option( 'admin_email' ); |
|
178 | + $admin_email = get_option('admin_email'); |
|
179 | 179 | } |
180 | 180 | ?> |
181 | - <p><?php _e( 'Welcome to the Network installation process!' ); ?></p> |
|
182 | - <p><?php _e( 'Fill in the information below and you’ll be on your way to creating a network of WordPress sites. Configuration files will be created in the next step.' ); ?></p> |
|
181 | + <p><?php _e('Welcome to the Network installation process!'); ?></p> |
|
182 | + <p><?php _e('Fill in the information below and you’ll be on your way to creating a network of WordPress sites. Configuration files will be created in the next step.'); ?></p> |
|
183 | 183 | <?php |
184 | 184 | |
185 | - if ( isset( $_POST['subdomain_install'] ) ) { |
|
185 | + if (isset($_POST['subdomain_install'])) { |
|
186 | 186 | $subdomain_install = (bool) $_POST['subdomain_install']; |
187 | - } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing. |
|
187 | + } elseif (apache_mod_loaded('mod_rewrite')) { // Assume nothing. |
|
188 | 188 | $subdomain_install = true; |
189 | - } elseif ( ! allow_subdirectory_install() ) { |
|
189 | + } elseif (!allow_subdirectory_install()) { |
|
190 | 190 | $subdomain_install = true; |
191 | 191 | } else { |
192 | 192 | $subdomain_install = false; |
193 | 193 | $got_mod_rewrite = got_mod_rewrite(); |
194 | - if ( $got_mod_rewrite ) { // Dangerous assumptions. |
|
195 | - echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> '; |
|
194 | + if ($got_mod_rewrite) { // Dangerous assumptions. |
|
195 | + echo '<div class="updated inline"><p><strong>' . __('Note:') . '</strong> '; |
|
196 | 196 | printf( |
197 | 197 | /* translators: %s: mod_rewrite */ |
198 | - __( 'Please make sure the Apache %s module is installed as it will be used at the end of this installation.' ), |
|
198 | + __('Please make sure the Apache %s module is installed as it will be used at the end of this installation.'), |
|
199 | 199 | '<code>mod_rewrite</code>' |
200 | 200 | ); |
201 | 201 | echo '</p>'; |
202 | - } elseif ( $is_apache ) { |
|
203 | - echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> '; |
|
202 | + } elseif ($is_apache) { |
|
203 | + echo '<div class="error inline"><p><strong>' . __('Warning:') . '</strong> '; |
|
204 | 204 | printf( |
205 | 205 | /* translators: %s: mod_rewrite */ |
206 | - __( 'It looks like the Apache %s module is not installed.' ), |
|
206 | + __('It looks like the Apache %s module is not installed.'), |
|
207 | 207 | '<code>mod_rewrite</code>' |
208 | 208 | ); |
209 | 209 | echo '</p>'; |
210 | 210 | } |
211 | 211 | |
212 | - if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache). |
|
212 | + if ($got_mod_rewrite || $is_apache) { // Protect against mod_rewrite mimicry (but ! Apache). |
|
213 | 213 | echo '<p>'; |
214 | 214 | printf( |
215 | 215 | /* translators: 1: mod_rewrite, 2: mod_rewrite documentation URL, 3: Google search for mod_rewrite. */ |
216 | - __( 'If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.' ), |
|
216 | + __('If %1$s is disabled, ask your administrator to enable that module, or look at the <a href="%2$s">Apache documentation</a> or <a href="%3$s">elsewhere</a> for help setting it up.'), |
|
217 | 217 | '<code>mod_rewrite</code>', |
218 | 218 | 'https://httpd.apache.org/docs/mod/mod_rewrite.html', |
219 | 219 | 'https://www.google.com/search?q=apache+mod_rewrite' |
@@ -222,33 +222,33 @@ discard block |
||
222 | 222 | } |
223 | 223 | } |
224 | 224 | |
225 | - if ( allow_subdomain_install() && allow_subdirectory_install() ) : |
|
225 | + if (allow_subdomain_install() && allow_subdirectory_install()) : |
|
226 | 226 | ?> |
227 | - <h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3> |
|
228 | - <p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.' ); ?> |
|
229 | - <strong><?php _e( 'You cannot change this later.' ); ?></strong></p> |
|
230 | - <p><?php _e( 'You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.' ); ?></p> |
|
227 | + <h3><?php esc_html_e('Addresses of Sites in your Network'); ?></h3> |
|
228 | + <p><?php _e('Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.'); ?> |
|
229 | + <strong><?php _e('You cannot change this later.'); ?></strong></p> |
|
230 | + <p><?php _e('You will need a wildcard DNS record if you are going to use the virtual host (sub-domain) functionality.'); ?></p> |
|
231 | 231 | <?php // @todo Link to an MS readme? ?> |
232 | 232 | <table class="form-table" role="presentation"> |
233 | 233 | <tr> |
234 | - <th><label><input type="radio" name="subdomain_install" value="1"<?php checked( $subdomain_install ); ?> /> <?php _e( 'Sub-domains' ); ?></label></th> |
|
234 | + <th><label><input type="radio" name="subdomain_install" value="1"<?php checked($subdomain_install); ?> /> <?php _e('Sub-domains'); ?></label></th> |
|
235 | 235 | <td> |
236 | 236 | <?php |
237 | 237 | printf( |
238 | 238 | /* translators: 1: Host name. */ |
239 | - _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ), |
|
239 | + _x('like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples'), |
|
240 | 240 | $hostname |
241 | 241 | ); |
242 | 242 | ?> |
243 | 243 | </td> |
244 | 244 | </tr> |
245 | 245 | <tr> |
246 | - <th><label><input type="radio" name="subdomain_install" value="0"<?php checked( ! $subdomain_install ); ?> /> <?php _e( 'Sub-directories' ); ?></label></th> |
|
246 | + <th><label><input type="radio" name="subdomain_install" value="0"<?php checked(!$subdomain_install); ?> /> <?php _e('Sub-directories'); ?></label></th> |
|
247 | 247 | <td> |
248 | 248 | <?php |
249 | 249 | printf( |
250 | 250 | /* translators: 1: Host name. */ |
251 | - _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ), |
|
251 | + _x('like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples'), |
|
252 | 252 | $hostname |
253 | 253 | ); |
254 | 254 | ?> |
@@ -259,20 +259,20 @@ discard block |
||
259 | 259 | <?php |
260 | 260 | endif; |
261 | 261 | |
262 | - if ( WP_CONTENT_DIR !== ABSPATH . 'wp-content' && ( allow_subdirectory_install() || ! allow_subdomain_install() ) ) { |
|
263 | - echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</p></div>'; |
|
262 | + if (WP_CONTENT_DIR !== ABSPATH . 'wp-content' && (allow_subdirectory_install() || !allow_subdomain_install())) { |
|
263 | + echo '<div class="error inline"><p><strong>' . __('Warning:') . '</strong> ' . __('Subdirectory networks may not be fully compatible with custom wp-content directories.') . '</p></div>'; |
|
264 | 264 | } |
265 | 265 | |
266 | - $is_www = ( 0 === strpos( $hostname, 'www.' ) ); |
|
267 | - if ( $is_www ) : |
|
266 | + $is_www = (0 === strpos($hostname, 'www.')); |
|
267 | + if ($is_www) : |
|
268 | 268 | ?> |
269 | - <h3><?php esc_html_e( 'Server Address' ); ?></h3> |
|
269 | + <h3><?php esc_html_e('Server Address'); ?></h3> |
|
270 | 270 | <p> |
271 | 271 | <?php |
272 | 272 | printf( |
273 | 273 | /* translators: 1: Site URL, 2: Host name, 3: www. */ |
274 | - __( 'You should consider changing your site domain to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.' ), |
|
275 | - '<code>' . substr( $hostname, 4 ) . '</code>', |
|
274 | + __('You should consider changing your site domain to %1$s before enabling the network feature. It will still be possible to visit your site using the %3$s prefix with an address like %2$s but any links will not have the %3$s prefix.'), |
|
275 | + '<code>' . substr($hostname, 4) . '</code>', |
|
276 | 276 | '<code>' . $hostname . '</code>', |
277 | 277 | '<code>www</code>' |
278 | 278 | ); |
@@ -280,12 +280,12 @@ discard block |
||
280 | 280 | </p> |
281 | 281 | <table class="form-table" role="presentation"> |
282 | 282 | <tr> |
283 | - <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> |
|
283 | + <th scope='row'><?php esc_html_e('Server Address'); ?></th> |
|
284 | 284 | <td> |
285 | 285 | <?php |
286 | 286 | printf( |
287 | 287 | /* translators: %s: Host name. */ |
288 | - __( 'The internet address of your network will be %s.' ), |
|
288 | + __('The internet address of your network will be %s.'), |
|
289 | 289 | '<code>' . $hostname . '</code>' |
290 | 290 | ); |
291 | 291 | ?> |
@@ -294,58 +294,58 @@ discard block |
||
294 | 294 | </table> |
295 | 295 | <?php endif; ?> |
296 | 296 | |
297 | - <h3><?php esc_html_e( 'Network Details' ); ?></h3> |
|
297 | + <h3><?php esc_html_e('Network Details'); ?></h3> |
|
298 | 298 | <table class="form-table" role="presentation"> |
299 | - <?php if ( 'localhost' === $hostname ) : ?> |
|
299 | + <?php if ('localhost' === $hostname) : ?> |
|
300 | 300 | <tr> |
301 | - <th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th> |
|
301 | + <th scope="row"><?php esc_html_e('Sub-directory Installation'); ?></th> |
|
302 | 302 | <td> |
303 | 303 | <?php |
304 | 304 | printf( |
305 | 305 | /* translators: 1: localhost, 2: localhost.localdomain */ |
306 | - __( 'Because you are using %1$s, the sites in your WordPress network must use sub-directories. Consider using %2$s if you wish to use sub-domains.' ), |
|
306 | + __('Because you are using %1$s, the sites in your WordPress network must use sub-directories. Consider using %2$s if you wish to use sub-domains.'), |
|
307 | 307 | '<code>localhost</code>', |
308 | 308 | '<code>localhost.localdomain</code>' |
309 | 309 | ); |
310 | 310 | // Uh oh: |
311 | - if ( ! allow_subdirectory_install() ) { |
|
312 | - echo ' <strong>' . __( 'Warning:' ) . ' ' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
311 | + if (!allow_subdirectory_install()) { |
|
312 | + echo ' <strong>' . __('Warning:') . ' ' . __('The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>'; |
|
313 | 313 | } |
314 | 314 | ?> |
315 | 315 | </td> |
316 | 316 | </tr> |
317 | - <?php elseif ( ! allow_subdomain_install() ) : ?> |
|
317 | + <?php elseif (!allow_subdomain_install()) : ?> |
|
318 | 318 | <tr> |
319 | - <th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th> |
|
319 | + <th scope="row"><?php esc_html_e('Sub-directory Installation'); ?></th> |
|
320 | 320 | <td> |
321 | 321 | <?php |
322 | - _e( 'Because your installation is in a directory, the sites in your WordPress network must use sub-directories.' ); |
|
322 | + _e('Because your installation is in a directory, the sites in your WordPress network must use sub-directories.'); |
|
323 | 323 | // Uh oh: |
324 | - if ( ! allow_subdirectory_install() ) { |
|
325 | - echo ' <strong>' . __( 'Warning:' ) . ' ' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
324 | + if (!allow_subdirectory_install()) { |
|
325 | + echo ' <strong>' . __('Warning:') . ' ' . __('The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>'; |
|
326 | 326 | } |
327 | 327 | ?> |
328 | 328 | </td> |
329 | 329 | </tr> |
330 | - <?php elseif ( ! allow_subdirectory_install() ) : ?> |
|
330 | + <?php elseif (!allow_subdirectory_install()) : ?> |
|
331 | 331 | <tr> |
332 | - <th scope="row"><?php esc_html_e( 'Sub-domain Installation' ); ?></th> |
|
332 | + <th scope="row"><?php esc_html_e('Sub-domain Installation'); ?></th> |
|
333 | 333 | <td> |
334 | 334 | <?php |
335 | - _e( 'Because your installation is not new, the sites in your WordPress network must use sub-domains.' ); |
|
336 | - echo ' <strong>' . __( 'The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.' ) . '</strong>'; |
|
335 | + _e('Because your installation is not new, the sites in your WordPress network must use sub-domains.'); |
|
336 | + echo ' <strong>' . __('The main site in a sub-directory installation will need to use a modified permalink structure, potentially breaking existing links.') . '</strong>'; |
|
337 | 337 | ?> |
338 | 338 | </td> |
339 | 339 | </tr> |
340 | 340 | <?php endif; ?> |
341 | - <?php if ( ! $is_www ) : ?> |
|
341 | + <?php if (!$is_www) : ?> |
|
342 | 342 | <tr> |
343 | - <th scope='row'><?php esc_html_e( 'Server Address' ); ?></th> |
|
343 | + <th scope='row'><?php esc_html_e('Server Address'); ?></th> |
|
344 | 344 | <td> |
345 | 345 | <?php |
346 | 346 | printf( |
347 | 347 | /* translators: %s: Host name. */ |
348 | - __( 'The internet address of your network will be %s.' ), |
|
348 | + __('The internet address of your network will be %s.'), |
|
349 | 349 | '<code>' . $hostname . '</code>' |
350 | 350 | ); |
351 | 351 | ?> |
@@ -353,25 +353,25 @@ discard block |
||
353 | 353 | </tr> |
354 | 354 | <?php endif; ?> |
355 | 355 | <tr> |
356 | - <th scope='row'><label for="sitename"><?php esc_html_e( 'Network Title' ); ?></label></th> |
|
356 | + <th scope='row'><label for="sitename"><?php esc_html_e('Network Title'); ?></label></th> |
|
357 | 357 | <td> |
358 | - <input name='sitename' id='sitename' type='text' size='45' value='<?php echo esc_attr( $site_name ); ?>' /> |
|
358 | + <input name='sitename' id='sitename' type='text' size='45' value='<?php echo esc_attr($site_name); ?>' /> |
|
359 | 359 | <p class="description"> |
360 | - <?php _e( 'What would you like to call your network?' ); ?> |
|
360 | + <?php _e('What would you like to call your network?'); ?> |
|
361 | 361 | </p> |
362 | 362 | </td> |
363 | 363 | </tr> |
364 | 364 | <tr> |
365 | - <th scope='row'><label for="email"><?php esc_html_e( 'Network Admin Email' ); ?></label></th> |
|
365 | + <th scope='row'><label for="email"><?php esc_html_e('Network Admin Email'); ?></label></th> |
|
366 | 366 | <td> |
367 | - <input name='email' id='email' type='text' size='45' value='<?php echo esc_attr( $admin_email ); ?>' /> |
|
367 | + <input name='email' id='email' type='text' size='45' value='<?php echo esc_attr($admin_email); ?>' /> |
|
368 | 368 | <p class="description"> |
369 | - <?php _e( 'Your email address.' ); ?> |
|
369 | + <?php _e('Your email address.'); ?> |
|
370 | 370 | </p> |
371 | 371 | </td> |
372 | 372 | </tr> |
373 | 373 | </table> |
374 | - <?php submit_button( __( 'Install' ), 'primary', 'submit' ); ?> |
|
374 | + <?php submit_button(__('Install'), 'primary', 'submit'); ?> |
|
375 | 375 | </form> |
376 | 376 | <?php |
377 | 377 | } |
@@ -386,46 +386,46 @@ discard block |
||
386 | 386 | * |
387 | 387 | * @param false|WP_Error $errors Optional. Error object. Default false. |
388 | 388 | */ |
389 | -function network_step2( $errors = false ) { |
|
389 | +function network_step2($errors = false) { |
|
390 | 390 | global $wpdb, $is_nginx; |
391 | 391 | |
392 | 392 | $hostname = get_clean_basedomain(); |
393 | - $slashed_home = trailingslashit( get_option( 'home' ) ); |
|
394 | - $base = parse_url( $slashed_home, PHP_URL_PATH ); |
|
395 | - $document_root_fix = str_replace( '\\', '/', realpath( $_SERVER['DOCUMENT_ROOT'] ) ); |
|
396 | - $abspath_fix = str_replace( '\\', '/', ABSPATH ); |
|
397 | - $home_path = 0 === strpos( $abspath_fix, $document_root_fix ) ? $document_root_fix . $base : get_home_path(); |
|
398 | - $wp_siteurl_subdir = preg_replace( '#^' . preg_quote( $home_path, '#' ) . '#', '', $abspath_fix ); |
|
399 | - $rewrite_base = ! empty( $wp_siteurl_subdir ) ? ltrim( trailingslashit( $wp_siteurl_subdir ), '/' ) : ''; |
|
393 | + $slashed_home = trailingslashit(get_option('home')); |
|
394 | + $base = parse_url($slashed_home, PHP_URL_PATH); |
|
395 | + $document_root_fix = str_replace('\\', '/', realpath($_SERVER['DOCUMENT_ROOT'])); |
|
396 | + $abspath_fix = str_replace('\\', '/', ABSPATH); |
|
397 | + $home_path = 0 === strpos($abspath_fix, $document_root_fix) ? $document_root_fix . $base : get_home_path(); |
|
398 | + $wp_siteurl_subdir = preg_replace('#^' . preg_quote($home_path, '#') . '#', '', $abspath_fix); |
|
399 | + $rewrite_base = !empty($wp_siteurl_subdir) ? ltrim(trailingslashit($wp_siteurl_subdir), '/') : ''; |
|
400 | 400 | |
401 | 401 | $location_of_wp_config = $abspath_fix; |
402 | - if ( ! file_exists( ABSPATH . 'wp-config.php' ) && file_exists( dirname( ABSPATH ) . '/wp-config.php' ) ) { |
|
403 | - $location_of_wp_config = dirname( $abspath_fix ); |
|
402 | + if (!file_exists(ABSPATH . 'wp-config.php') && file_exists(dirname(ABSPATH) . '/wp-config.php')) { |
|
403 | + $location_of_wp_config = dirname($abspath_fix); |
|
404 | 404 | } |
405 | - $location_of_wp_config = trailingslashit( $location_of_wp_config ); |
|
405 | + $location_of_wp_config = trailingslashit($location_of_wp_config); |
|
406 | 406 | |
407 | 407 | // Wildcard DNS message. |
408 | - if ( is_wp_error( $errors ) ) { |
|
408 | + if (is_wp_error($errors)) { |
|
409 | 409 | echo '<div class="error">' . $errors->get_error_message() . '</div>'; |
410 | 410 | } |
411 | 411 | |
412 | - if ( $_POST ) { |
|
413 | - if ( allow_subdomain_install() ) { |
|
414 | - $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true; |
|
412 | + if ($_POST) { |
|
413 | + if (allow_subdomain_install()) { |
|
414 | + $subdomain_install = allow_subdirectory_install() ? !empty($_POST['subdomain_install']) : true; |
|
415 | 415 | } else { |
416 | 416 | $subdomain_install = false; |
417 | 417 | } |
418 | 418 | } else { |
419 | - if ( is_multisite() ) { |
|
419 | + if (is_multisite()) { |
|
420 | 420 | $subdomain_install = is_subdomain_install(); |
421 | 421 | ?> |
422 | - <p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p> |
|
422 | + <p><?php _e('The original configuration steps are shown here for reference.'); ?></p> |
|
423 | 423 | <?php |
424 | 424 | } else { |
425 | - $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" ); |
|
425 | + $subdomain_install = (bool) $wpdb->get_var("SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'"); |
|
426 | 426 | ?> |
427 | - <div class="error"><p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div> |
|
428 | - <p><?php _e( 'Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.' ); ?></p> |
|
427 | + <div class="error"><p><strong><?php _e('Warning:'); ?></strong> <?php _e('An existing WordPress network was detected.'); ?></p></div> |
|
428 | + <p><?php _e('Please complete the configuration steps. To create a new network, you will need to empty or remove the network database tables.'); ?></p> |
|
429 | 429 | <?php |
430 | 430 | } |
431 | 431 | } |
@@ -434,33 +434,33 @@ discard block |
||
434 | 434 | $subdir_replacement_01 = $subdomain_install ? '' : '$1'; |
435 | 435 | $subdir_replacement_12 = $subdomain_install ? '$1' : '$2'; |
436 | 436 | |
437 | - if ( $_POST || ! is_multisite() ) { |
|
437 | + if ($_POST || !is_multisite()) { |
|
438 | 438 | ?> |
439 | - <h3><?php esc_html_e( 'Enabling the Network' ); ?></h3> |
|
440 | - <p><?php _e( 'Complete the following steps to enable the features for creating a network of sites.' ); ?></p> |
|
439 | + <h3><?php esc_html_e('Enabling the Network'); ?></h3> |
|
440 | + <p><?php _e('Complete the following steps to enable the features for creating a network of sites.'); ?></p> |
|
441 | 441 | <div class="notice notice-warning inline"><p> |
442 | 442 | <?php |
443 | - if ( file_exists( $home_path . '.htaccess' ) ) { |
|
444 | - echo '<strong>' . __( 'Caution:' ) . '</strong> '; |
|
443 | + if (file_exists($home_path . '.htaccess')) { |
|
444 | + echo '<strong>' . __('Caution:') . '</strong> '; |
|
445 | 445 | printf( |
446 | 446 | /* translators: 1: wp-config.php, 2: .htaccess */ |
447 | - __( 'You should back up your existing %1$s and %2$s files.' ), |
|
447 | + __('You should back up your existing %1$s and %2$s files.'), |
|
448 | 448 | '<code>wp-config.php</code>', |
449 | 449 | '<code>.htaccess</code>' |
450 | 450 | ); |
451 | - } elseif ( file_exists( $home_path . 'web.config' ) ) { |
|
452 | - echo '<strong>' . __( 'Caution:' ) . '</strong> '; |
|
451 | + } elseif (file_exists($home_path . 'web.config')) { |
|
452 | + echo '<strong>' . __('Caution:') . '</strong> '; |
|
453 | 453 | printf( |
454 | 454 | /* translators: 1: wp-config.php, 2: web.config */ |
455 | - __( 'You should back up your existing %1$s and %2$s files.' ), |
|
455 | + __('You should back up your existing %1$s and %2$s files.'), |
|
456 | 456 | '<code>wp-config.php</code>', |
457 | 457 | '<code>web.config</code>' |
458 | 458 | ); |
459 | 459 | } else { |
460 | - echo '<strong>' . __( 'Caution:' ) . '</strong> '; |
|
460 | + echo '<strong>' . __('Caution:') . '</strong> '; |
|
461 | 461 | printf( |
462 | 462 | /* translators: %s: wp-config.php */ |
463 | - __( 'You should back up your existing %s file.' ), |
|
463 | + __('You should back up your existing %s file.'), |
|
464 | 464 | '<code>wp-config.php</code>' |
465 | 465 | ); |
466 | 466 | } |
@@ -474,7 +474,7 @@ discard block |
||
474 | 474 | <?php |
475 | 475 | printf( |
476 | 476 | /* translators: 1: wp-config.php, 2: Location of wp-config file, 3: Translated version of "That's all, stop editing! Happy publishing." */ |
477 | - __( 'Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:' ), |
|
477 | + __('Add the following to your %1$s file in %2$s <strong>above</strong> the line reading %3$s:'), |
|
478 | 478 | '<code>wp-config.php</code>', |
479 | 479 | '<code>' . $location_of_wp_config . '</code>', |
480 | 480 | /* |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | * You can check the localized release package or |
483 | 483 | * https://i18n.svn.wordpress.org/<locale code>/branches/<wp version>/dist/wp-config-sample.php |
484 | 484 | */ |
485 | - '<code>/* ' . __( 'That’s all, stop editing! Happy publishing.' ) . ' */</code>' |
|
485 | + '<code>/* ' . __('That’s all, stop editing! Happy publishing.') . ' */</code>' |
|
486 | 486 | ); |
487 | 487 | ?> |
488 | 488 | </p> |
@@ -505,55 +505,55 @@ discard block |
||
505 | 505 | 'LOGGED_IN_SALT' => '', |
506 | 506 | 'NONCE_SALT' => '', |
507 | 507 | ); |
508 | - foreach ( $keys_salts as $c => $v ) { |
|
509 | - if ( defined( $c ) ) { |
|
510 | - unset( $keys_salts[ $c ] ); |
|
508 | + foreach ($keys_salts as $c => $v) { |
|
509 | + if (defined($c)) { |
|
510 | + unset($keys_salts[$c]); |
|
511 | 511 | } |
512 | 512 | } |
513 | 513 | |
514 | - if ( ! empty( $keys_salts ) ) { |
|
514 | + if (!empty($keys_salts)) { |
|
515 | 515 | $keys_salts_str = ''; |
516 | - $from_api = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' ); |
|
517 | - if ( is_wp_error( $from_api ) ) { |
|
518 | - foreach ( $keys_salts as $c => $v ) { |
|
519 | - $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password( 64, true, true ) . "' );"; |
|
516 | + $from_api = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/'); |
|
517 | + if (is_wp_error($from_api)) { |
|
518 | + foreach ($keys_salts as $c => $v) { |
|
519 | + $keys_salts_str .= "\ndefine( '$c', '" . wp_generate_password(64, true, true) . "' );"; |
|
520 | 520 | } |
521 | 521 | } else { |
522 | - $from_api = explode( "\n", wp_remote_retrieve_body( $from_api ) ); |
|
523 | - foreach ( $keys_salts as $c => $v ) { |
|
524 | - $keys_salts_str .= "\ndefine( '$c', '" . substr( array_shift( $from_api ), 28, 64 ) . "' );"; |
|
522 | + $from_api = explode("\n", wp_remote_retrieve_body($from_api)); |
|
523 | + foreach ($keys_salts as $c => $v) { |
|
524 | + $keys_salts_str .= "\ndefine( '$c', '" . substr(array_shift($from_api), 28, 64) . "' );"; |
|
525 | 525 | } |
526 | 526 | } |
527 | - $num_keys_salts = count( $keys_salts ); |
|
527 | + $num_keys_salts = count($keys_salts); |
|
528 | 528 | ?> |
529 | 529 | <p> |
530 | 530 | <?php |
531 | - if ( 1 === $num_keys_salts ) { |
|
531 | + if (1 === $num_keys_salts) { |
|
532 | 532 | printf( |
533 | 533 | /* translators: %s: wp-config.php */ |
534 | - __( 'This unique authentication key is also missing from your %s file.' ), |
|
534 | + __('This unique authentication key is also missing from your %s file.'), |
|
535 | 535 | '<code>wp-config.php</code>' |
536 | 536 | ); |
537 | 537 | } else { |
538 | 538 | printf( |
539 | 539 | /* translators: %s: wp-config.php */ |
540 | - __( 'These unique authentication keys are also missing from your %s file.' ), |
|
540 | + __('These unique authentication keys are also missing from your %s file.'), |
|
541 | 541 | '<code>wp-config.php</code>' |
542 | 542 | ); |
543 | 543 | } |
544 | 544 | ?> |
545 | - <?php _e( 'To make your installation more secure, you should also add:' ); ?> |
|
545 | + <?php _e('To make your installation more secure, you should also add:'); ?> |
|
546 | 546 | </p> |
547 | - <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea( $keys_salts_str ); ?></textarea> |
|
547 | + <textarea class="code" readonly="readonly" cols="100" rows="<?php echo $num_keys_salts; ?>"><?php echo esc_textarea($keys_salts_str); ?></textarea> |
|
548 | 548 | <?php |
549 | 549 | } |
550 | 550 | ?> |
551 | 551 | </li> |
552 | 552 | <?php |
553 | - if ( iis7_supports_permalinks() ) : |
|
553 | + if (iis7_supports_permalinks()) : |
|
554 | 554 | // IIS doesn't support RewriteBase, all your RewriteBase are belong to us. |
555 | - $iis_subdir_match = ltrim( $base, '/' ) . $subdir_match; |
|
556 | - $iis_rewrite_base = ltrim( $base, '/' ) . $rewrite_base; |
|
555 | + $iis_subdir_match = ltrim($base, '/') . $subdir_match; |
|
556 | + $iis_rewrite_base = ltrim($base, '/') . $rewrite_base; |
|
557 | 557 | $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}'; |
558 | 558 | |
559 | 559 | $web_config_file = '<?xml version="1.0" encoding="UTF-8"?> |
@@ -565,7 +565,7 @@ discard block |
||
565 | 565 | <match url="^index\.php$" ignoreCase="false" /> |
566 | 566 | <action type="None" /> |
567 | 567 | </rule>'; |
568 | - if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { |
|
568 | + if (is_multisite() && get_site_option('ms_files_rewriting')) { |
|
569 | 569 | $web_config_file .= ' |
570 | 570 | <rule name="WordPress Rule for Files" stopProcessing="true"> |
571 | 571 | <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" /> |
@@ -606,34 +606,34 @@ discard block |
||
606 | 606 | echo '<li><p>'; |
607 | 607 | printf( |
608 | 608 | /* translators: 1: File name (.htaccess or web.config), 2: File path. */ |
609 | - __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
|
609 | + __('Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:'), |
|
610 | 610 | '<code>web.config</code>', |
611 | 611 | '<code>' . $home_path . '</code>' |
612 | 612 | ); |
613 | 613 | echo '</p>'; |
614 | - if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { |
|
615 | - echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
614 | + if (!$subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content') { |
|
615 | + echo '<p><strong>' . __('Warning:') . ' ' . __('Subdirectory networks may not be fully compatible with custom wp-content directories.') . '</strong></p>'; |
|
616 | 616 | } |
617 | 617 | ?> |
618 | - <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea( $web_config_file ); ?></textarea> |
|
618 | + <textarea class="code" readonly="readonly" cols="100" rows="20"><?php echo esc_textarea($web_config_file); ?></textarea> |
|
619 | 619 | </li> |
620 | 620 | </ol> |
621 | 621 | |
622 | 622 | <?php |
623 | - elseif ( $is_nginx ) : // End iis7_supports_permalinks(). Link to Nginx documentation instead: |
|
623 | + elseif ($is_nginx) : // End iis7_supports_permalinks(). Link to Nginx documentation instead: |
|
624 | 624 | |
625 | 625 | echo '<li><p>'; |
626 | 626 | printf( |
627 | 627 | /* translators: %s: Documentation URL. */ |
628 | - __( 'It seems your network is running with Nginx web server. <a href="%s">Learn more about further configuration</a>.' ), |
|
629 | - __( 'https://wordpress.org/support/article/nginx/' ) |
|
628 | + __('It seems your network is running with Nginx web server. <a href="%s">Learn more about further configuration</a>.'), |
|
629 | + __('https://wordpress.org/support/article/nginx/') |
|
630 | 630 | ); |
631 | 631 | echo '</p></li>'; |
632 | 632 | |
633 | 633 | else : // End $is_nginx. Construct an .htaccess file instead: |
634 | 634 | |
635 | 635 | $ms_files_rewriting = ''; |
636 | - if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) { |
|
636 | + if (is_multisite() && get_site_option('ms_files_rewriting')) { |
|
637 | 637 | $ms_files_rewriting = "\n# uploaded files\nRewriteRule ^"; |
638 | 638 | $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n"; |
639 | 639 | } |
@@ -659,25 +659,25 @@ discard block |
||
659 | 659 | echo '<li><p>'; |
660 | 660 | printf( |
661 | 661 | /* translators: 1: File name (.htaccess or web.config), 2: File path. */ |
662 | - __( 'Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:' ), |
|
662 | + __('Add the following to your %1$s file in %2$s, <strong>replacing</strong> other WordPress rules:'), |
|
663 | 663 | '<code>.htaccess</code>', |
664 | 664 | '<code>' . $home_path . '</code>' |
665 | 665 | ); |
666 | 666 | echo '</p>'; |
667 | - if ( ! $subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content' ) { |
|
668 | - echo '<p><strong>' . __( 'Warning:' ) . ' ' . __( 'Subdirectory networks may not be fully compatible with custom wp-content directories.' ) . '</strong></p>'; |
|
667 | + if (!$subdomain_install && WP_CONTENT_DIR !== ABSPATH . 'wp-content') { |
|
668 | + echo '<p><strong>' . __('Warning:') . ' ' . __('Subdirectory networks may not be fully compatible with custom wp-content directories.') . '</strong></p>'; |
|
669 | 669 | } |
670 | 670 | ?> |
671 | - <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count( $htaccess_file, "\n" ) + 1; ?>"><?php echo esc_textarea( $htaccess_file ); ?></textarea> |
|
671 | + <textarea class="code" readonly="readonly" cols="100" rows="<?php echo substr_count($htaccess_file, "\n") + 1; ?>"><?php echo esc_textarea($htaccess_file); ?></textarea> |
|
672 | 672 | </li> |
673 | 673 | </ol> |
674 | 674 | |
675 | 675 | <?php |
676 | 676 | endif; // End IIS/Nginx/Apache code branches. |
677 | 677 | |
678 | - if ( ! is_multisite() ) { |
|
678 | + if (!is_multisite()) { |
|
679 | 679 | ?> |
680 | - <p><?php _e( 'Once you complete these steps, your network is enabled and configured. You will have to log in again.' ); ?> <a href="<?php echo esc_url( wp_login_url() ); ?>"><?php _e( 'Log In' ); ?></a></p> |
|
680 | + <p><?php _e('Once you complete these steps, your network is enabled and configured. You will have to log in again.'); ?> <a href="<?php echo esc_url(wp_login_url()); ?>"><?php _e('Log In'); ?></a></p> |
|
681 | 681 | <?php |
682 | 682 | } |
683 | 683 | } |
@@ -29,16 +29,16 @@ discard block |
||
29 | 29 | */ |
30 | 30 | public function is_disabled() { |
31 | 31 | // Background updates are disabled if you don't want file changes. |
32 | - if ( ! wp_is_file_mod_allowed( 'automatic_updater' ) ) { |
|
32 | + if (!wp_is_file_mod_allowed('automatic_updater')) { |
|
33 | 33 | return true; |
34 | 34 | } |
35 | 35 | |
36 | - if ( wp_installing() ) { |
|
36 | + if (wp_installing()) { |
|
37 | 37 | return true; |
38 | 38 | } |
39 | 39 | |
40 | 40 | // More fine grained control can be done through the WP_AUTO_UPDATE_CORE constant and filters. |
41 | - $disabled = defined( 'AUTOMATIC_UPDATER_DISABLED' ) && AUTOMATIC_UPDATER_DISABLED; |
|
41 | + $disabled = defined('AUTOMATIC_UPDATER_DISABLED') && AUTOMATIC_UPDATER_DISABLED; |
|
42 | 42 | |
43 | 43 | /** |
44 | 44 | * Filters whether to entirely disable background updates. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @param bool $disabled Whether the updater should be disabled. |
54 | 54 | */ |
55 | - return apply_filters( 'automatic_updater_disabled', $disabled ); |
|
55 | + return apply_filters('automatic_updater_disabled', $disabled); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -73,36 +73,36 @@ discard block |
||
73 | 73 | * @return bool True if a VCS checkout was discovered at `$context` or ABSPATH, |
74 | 74 | * or anywhere higher. False otherwise. |
75 | 75 | */ |
76 | - public function is_vcs_checkout( $context ) { |
|
77 | - $context_dirs = array( untrailingslashit( $context ) ); |
|
78 | - if ( ABSPATH !== $context ) { |
|
79 | - $context_dirs[] = untrailingslashit( ABSPATH ); |
|
76 | + public function is_vcs_checkout($context) { |
|
77 | + $context_dirs = array(untrailingslashit($context)); |
|
78 | + if (ABSPATH !== $context) { |
|
79 | + $context_dirs[] = untrailingslashit(ABSPATH); |
|
80 | 80 | } |
81 | 81 | |
82 | - $vcs_dirs = array( '.svn', '.git', '.hg', '.bzr' ); |
|
82 | + $vcs_dirs = array('.svn', '.git', '.hg', '.bzr'); |
|
83 | 83 | $check_dirs = array(); |
84 | 84 | |
85 | - foreach ( $context_dirs as $context_dir ) { |
|
85 | + foreach ($context_dirs as $context_dir) { |
|
86 | 86 | // Walk up from $context_dir to the root. |
87 | 87 | do { |
88 | 88 | $check_dirs[] = $context_dir; |
89 | 89 | |
90 | 90 | // Once we've hit '/' or 'C:\', we need to stop. dirname will keep returning the input here. |
91 | - if ( dirname( $context_dir ) === $context_dir ) { |
|
91 | + if (dirname($context_dir) === $context_dir) { |
|
92 | 92 | break; |
93 | 93 | } |
94 | 94 | |
95 | 95 | // Continue one level at a time. |
96 | - } while ( $context_dir = dirname( $context_dir ) ); |
|
96 | + } while ($context_dir = dirname($context_dir)); |
|
97 | 97 | } |
98 | 98 | |
99 | - $check_dirs = array_unique( $check_dirs ); |
|
99 | + $check_dirs = array_unique($check_dirs); |
|
100 | 100 | |
101 | 101 | // Search all directories we've found for evidence of version control. |
102 | - foreach ( $vcs_dirs as $vcs_dir ) { |
|
103 | - foreach ( $check_dirs as $check_dir ) { |
|
104 | - $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ); |
|
105 | - if ( $checkout ) { |
|
102 | + foreach ($vcs_dirs as $vcs_dir) { |
|
103 | + foreach ($check_dirs as $check_dir) { |
|
104 | + $checkout = @is_dir(rtrim($check_dir, '\\/') . "/$vcs_dir"); |
|
105 | + if ($checkout) { |
|
106 | 106 | break 2; |
107 | 107 | } |
108 | 108 | } |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param string $context The filesystem context (a path) against which |
120 | 120 | * filesystem status should be checked. |
121 | 121 | */ |
122 | - return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context ); |
|
122 | + return apply_filters('automatic_updates_is_vcs_checkout', $checkout, $context); |
|
123 | 123 | } |
124 | 124 | |
125 | 125 | /** |
@@ -136,47 +136,47 @@ discard block |
||
136 | 136 | * access and status should be checked. |
137 | 137 | * @return bool True if the item should be updated, false otherwise. |
138 | 138 | */ |
139 | - public function should_update( $type, $item, $context ) { |
|
139 | + public function should_update($type, $item, $context) { |
|
140 | 140 | // Used to see if WP_Filesystem is set up to allow unattended updates. |
141 | 141 | $skin = new Automatic_Upgrader_Skin; |
142 | 142 | |
143 | - if ( $this->is_disabled() ) { |
|
143 | + if ($this->is_disabled()) { |
|
144 | 144 | return false; |
145 | 145 | } |
146 | 146 | |
147 | 147 | // Only relax the filesystem checks when the update doesn't include new files. |
148 | 148 | $allow_relaxed_file_ownership = false; |
149 | - if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) { |
|
149 | + if ('core' === $type && isset($item->new_files) && !$item->new_files) { |
|
150 | 150 | $allow_relaxed_file_ownership = true; |
151 | 151 | } |
152 | 152 | |
153 | 153 | // If we can't do an auto core update, we may still be able to email the user. |
154 | - if ( ! $skin->request_filesystem_credentials( false, $context, $allow_relaxed_file_ownership ) |
|
155 | - || $this->is_vcs_checkout( $context ) |
|
154 | + if (!$skin->request_filesystem_credentials(false, $context, $allow_relaxed_file_ownership) |
|
155 | + || $this->is_vcs_checkout($context) |
|
156 | 156 | ) { |
157 | - if ( 'core' === $type ) { |
|
158 | - $this->send_core_update_notification_email( $item ); |
|
157 | + if ('core' === $type) { |
|
158 | + $this->send_core_update_notification_email($item); |
|
159 | 159 | } |
160 | 160 | return false; |
161 | 161 | } |
162 | 162 | |
163 | 163 | // Next up, is this an item we can update? |
164 | - if ( 'core' === $type ) { |
|
165 | - $update = Core_Upgrader::should_update_to_version( $item->current ); |
|
166 | - } elseif ( 'plugin' === $type || 'theme' === $type ) { |
|
167 | - $update = ! empty( $item->autoupdate ); |
|
164 | + if ('core' === $type) { |
|
165 | + $update = Core_Upgrader::should_update_to_version($item->current); |
|
166 | + } elseif ('plugin' === $type || 'theme' === $type) { |
|
167 | + $update = !empty($item->autoupdate); |
|
168 | 168 | |
169 | - if ( ! $update && wp_is_auto_update_enabled_for_type( $type ) ) { |
|
169 | + if (!$update && wp_is_auto_update_enabled_for_type($type)) { |
|
170 | 170 | // Check if the site admin has enabled auto-updates by default for the specific item. |
171 | - $auto_updates = (array) get_site_option( "auto_update_{$type}s", array() ); |
|
172 | - $update = in_array( $item->{$type}, $auto_updates, true ); |
|
171 | + $auto_updates = (array) get_site_option("auto_update_{$type}s", array()); |
|
172 | + $update = in_array($item->{$type}, $auto_updates, true); |
|
173 | 173 | } |
174 | 174 | } else { |
175 | - $update = ! empty( $item->autoupdate ); |
|
175 | + $update = !empty($item->autoupdate); |
|
176 | 176 | } |
177 | 177 | |
178 | 178 | // If the `disable_autoupdate` flag is set, override any user-choice, but allow filters. |
179 | - if ( ! empty( $item->disable_autoupdate ) ) { |
|
179 | + if (!empty($item->disable_autoupdate)) { |
|
180 | 180 | $update = $item->disable_autoupdate; |
181 | 181 | } |
182 | 182 | |
@@ -209,34 +209,34 @@ discard block |
||
209 | 209 | * to detect whether nothing has hooked into this filter. |
210 | 210 | * @param object $item The update offer. |
211 | 211 | */ |
212 | - $update = apply_filters( "auto_update_{$type}", $update, $item ); |
|
212 | + $update = apply_filters("auto_update_{$type}", $update, $item); |
|
213 | 213 | |
214 | - if ( ! $update ) { |
|
215 | - if ( 'core' === $type ) { |
|
216 | - $this->send_core_update_notification_email( $item ); |
|
214 | + if (!$update) { |
|
215 | + if ('core' === $type) { |
|
216 | + $this->send_core_update_notification_email($item); |
|
217 | 217 | } |
218 | 218 | return false; |
219 | 219 | } |
220 | 220 | |
221 | 221 | // If it's a core update, are we actually compatible with its requirements? |
222 | - if ( 'core' === $type ) { |
|
222 | + if ('core' === $type) { |
|
223 | 223 | global $wpdb; |
224 | 224 | |
225 | - $php_compat = version_compare( phpversion(), $item->php_version, '>=' ); |
|
226 | - if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) { |
|
225 | + $php_compat = version_compare(phpversion(), $item->php_version, '>='); |
|
226 | + if (file_exists(WP_CONTENT_DIR . '/db.php') && empty($wpdb->is_mysql)) { |
|
227 | 227 | $mysql_compat = true; |
228 | 228 | } else { |
229 | - $mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' ); |
|
229 | + $mysql_compat = version_compare($wpdb->db_version(), $item->mysql_version, '>='); |
|
230 | 230 | } |
231 | 231 | |
232 | - if ( ! $php_compat || ! $mysql_compat ) { |
|
232 | + if (!$php_compat || !$mysql_compat) { |
|
233 | 233 | return false; |
234 | 234 | } |
235 | 235 | } |
236 | 236 | |
237 | 237 | // If updating a plugin or theme, ensure the minimum PHP version requirements are satisfied. |
238 | - if ( in_array( $type, array( 'plugin', 'theme' ), true ) ) { |
|
239 | - if ( ! empty( $item->requires_php ) && version_compare( phpversion(), $item->requires_php, '<' ) ) { |
|
238 | + if (in_array($type, array('plugin', 'theme'), true)) { |
|
239 | + if (!empty($item->requires_php) && version_compare(phpversion(), $item->requires_php, '<')) { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | } |
@@ -253,19 +253,19 @@ discard block |
||
253 | 253 | * @return bool True if the site administrator is notified of a core update, |
254 | 254 | * false otherwise. |
255 | 255 | */ |
256 | - protected function send_core_update_notification_email( $item ) { |
|
257 | - $notified = get_site_option( 'auto_core_update_notified' ); |
|
256 | + protected function send_core_update_notification_email($item) { |
|
257 | + $notified = get_site_option('auto_core_update_notified'); |
|
258 | 258 | |
259 | 259 | // Don't notify if we've already notified the same email address of the same version. |
260 | - if ( $notified |
|
261 | - && get_site_option( 'admin_email' ) === $notified['email'] |
|
260 | + if ($notified |
|
261 | + && get_site_option('admin_email') === $notified['email'] |
|
262 | 262 | && $notified['version'] === $item->current |
263 | 263 | ) { |
264 | 264 | return false; |
265 | 265 | } |
266 | 266 | |
267 | 267 | // See if we need to notify users of a core update. |
268 | - $notify = ! empty( $item->notify_email ); |
|
268 | + $notify = !empty($item->notify_email); |
|
269 | 269 | |
270 | 270 | /** |
271 | 271 | * Filters whether to notify the site administrator of a new core update. |
@@ -286,11 +286,11 @@ discard block |
||
286 | 286 | * @param bool $notify Whether the site administrator is notified. |
287 | 287 | * @param object $item The update offer. |
288 | 288 | */ |
289 | - if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) { |
|
289 | + if (!apply_filters('send_core_update_notification_email', $notify, $item)) { |
|
290 | 290 | return false; |
291 | 291 | } |
292 | 292 | |
293 | - $this->send_email( 'manual', $item ); |
|
293 | + $this->send_email('manual', $item); |
|
294 | 294 | return true; |
295 | 295 | } |
296 | 296 | |
@@ -303,32 +303,32 @@ discard block |
||
303 | 303 | * @param object $item The update offer. |
304 | 304 | * @return null|WP_Error |
305 | 305 | */ |
306 | - public function update( $type, $item ) { |
|
306 | + public function update($type, $item) { |
|
307 | 307 | $skin = new Automatic_Upgrader_Skin; |
308 | 308 | |
309 | - switch ( $type ) { |
|
309 | + switch ($type) { |
|
310 | 310 | case 'core': |
311 | 311 | // The Core upgrader doesn't use the Upgrader's skin during the actual main part of the upgrade, instead, firing a filter. |
312 | - add_filter( 'update_feedback', array( $skin, 'feedback' ) ); |
|
313 | - $upgrader = new Core_Upgrader( $skin ); |
|
312 | + add_filter('update_feedback', array($skin, 'feedback')); |
|
313 | + $upgrader = new Core_Upgrader($skin); |
|
314 | 314 | $context = ABSPATH; |
315 | 315 | break; |
316 | 316 | case 'plugin': |
317 | - $upgrader = new Plugin_Upgrader( $skin ); |
|
317 | + $upgrader = new Plugin_Upgrader($skin); |
|
318 | 318 | $context = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR. |
319 | 319 | break; |
320 | 320 | case 'theme': |
321 | - $upgrader = new Theme_Upgrader( $skin ); |
|
322 | - $context = get_theme_root( $item->theme ); |
|
321 | + $upgrader = new Theme_Upgrader($skin); |
|
322 | + $context = get_theme_root($item->theme); |
|
323 | 323 | break; |
324 | 324 | case 'translation': |
325 | - $upgrader = new Language_Pack_Upgrader( $skin ); |
|
325 | + $upgrader = new Language_Pack_Upgrader($skin); |
|
326 | 326 | $context = WP_CONTENT_DIR; // WP_LANG_DIR; |
327 | 327 | break; |
328 | 328 | } |
329 | 329 | |
330 | 330 | // Determine whether we can and should perform this update. |
331 | - if ( ! $this->should_update( $type, $item, $context ) ) { |
|
331 | + if (!$this->should_update($type, $item, $context)) { |
|
332 | 332 | return false; |
333 | 333 | } |
334 | 334 | |
@@ -342,51 +342,51 @@ discard block |
||
342 | 342 | * @param string $context The filesystem context (a path) against which filesystem access and status |
343 | 343 | * should be checked. |
344 | 344 | */ |
345 | - do_action( 'pre_auto_update', $type, $item, $context ); |
|
345 | + do_action('pre_auto_update', $type, $item, $context); |
|
346 | 346 | |
347 | 347 | $upgrader_item = $item; |
348 | - switch ( $type ) { |
|
348 | + switch ($type) { |
|
349 | 349 | case 'core': |
350 | 350 | /* translators: %s: WordPress version. */ |
351 | - $skin->feedback( __( 'Updating to WordPress %s' ), $item->version ); |
|
351 | + $skin->feedback(__('Updating to WordPress %s'), $item->version); |
|
352 | 352 | /* translators: %s: WordPress version. */ |
353 | - $item_name = sprintf( __( 'WordPress %s' ), $item->version ); |
|
353 | + $item_name = sprintf(__('WordPress %s'), $item->version); |
|
354 | 354 | break; |
355 | 355 | case 'theme': |
356 | 356 | $upgrader_item = $item->theme; |
357 | - $theme = wp_get_theme( $upgrader_item ); |
|
358 | - $item_name = $theme->Get( 'Name' ); |
|
357 | + $theme = wp_get_theme($upgrader_item); |
|
358 | + $item_name = $theme->Get('Name'); |
|
359 | 359 | // Add the current version so that it can be reported in the notification email. |
360 | - $item->current_version = $theme->get( 'Version' ); |
|
361 | - if ( empty( $item->current_version ) ) { |
|
360 | + $item->current_version = $theme->get('Version'); |
|
361 | + if (empty($item->current_version)) { |
|
362 | 362 | $item->current_version = false; |
363 | 363 | } |
364 | 364 | /* translators: %s: Theme name. */ |
365 | - $skin->feedback( __( 'Updating theme: %s' ), $item_name ); |
|
365 | + $skin->feedback(__('Updating theme: %s'), $item_name); |
|
366 | 366 | break; |
367 | 367 | case 'plugin': |
368 | 368 | $upgrader_item = $item->plugin; |
369 | - $plugin_data = get_plugin_data( $context . '/' . $upgrader_item ); |
|
369 | + $plugin_data = get_plugin_data($context . '/' . $upgrader_item); |
|
370 | 370 | $item_name = $plugin_data['Name']; |
371 | 371 | // Add the current version so that it can be reported in the notification email. |
372 | 372 | $item->current_version = $plugin_data['Version']; |
373 | - if ( empty( $item->current_version ) ) { |
|
373 | + if (empty($item->current_version)) { |
|
374 | 374 | $item->current_version = false; |
375 | 375 | } |
376 | 376 | /* translators: %s: Plugin name. */ |
377 | - $skin->feedback( __( 'Updating plugin: %s' ), $item_name ); |
|
377 | + $skin->feedback(__('Updating plugin: %s'), $item_name); |
|
378 | 378 | break; |
379 | 379 | case 'translation': |
380 | - $language_item_name = $upgrader->get_name_for_update( $item ); |
|
380 | + $language_item_name = $upgrader->get_name_for_update($item); |
|
381 | 381 | /* translators: %s: Project name (plugin, theme, or WordPress). */ |
382 | - $item_name = sprintf( __( 'Translations for %s' ), $language_item_name ); |
|
382 | + $item_name = sprintf(__('Translations for %s'), $language_item_name); |
|
383 | 383 | /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */ |
384 | - $skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)…' ), $language_item_name, $item->language ) ); |
|
384 | + $skin->feedback(sprintf(__('Updating translations for %1$s (%2$s)…'), $language_item_name, $item->language)); |
|
385 | 385 | break; |
386 | 386 | } |
387 | 387 | |
388 | 388 | $allow_relaxed_file_ownership = false; |
389 | - if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) { |
|
389 | + if ('core' === $type && isset($item->new_files) && !$item->new_files) { |
|
390 | 390 | $allow_relaxed_file_ownership = true; |
391 | 391 | } |
392 | 392 | |
@@ -405,14 +405,14 @@ discard block |
||
405 | 405 | ); |
406 | 406 | |
407 | 407 | // If the filesystem is unavailable, false is returned. |
408 | - if ( false === $upgrade_result ) { |
|
409 | - $upgrade_result = new WP_Error( 'fs_unavailable', __( 'Could not access filesystem.' ) ); |
|
408 | + if (false === $upgrade_result) { |
|
409 | + $upgrade_result = new WP_Error('fs_unavailable', __('Could not access filesystem.')); |
|
410 | 410 | } |
411 | 411 | |
412 | - if ( 'core' === $type ) { |
|
413 | - if ( is_wp_error( $upgrade_result ) |
|
414 | - && ( 'up_to_date' === $upgrade_result->get_error_code() |
|
415 | - || 'locked' === $upgrade_result->get_error_code() ) |
|
412 | + if ('core' === $type) { |
|
413 | + if (is_wp_error($upgrade_result) |
|
414 | + && ('up_to_date' === $upgrade_result->get_error_code() |
|
415 | + || 'locked' === $upgrade_result->get_error_code()) |
|
416 | 416 | ) { |
417 | 417 | // These aren't actual errors, treat it as a skipped-update instead |
418 | 418 | // to avoid triggering the post-core update failure routines. |
@@ -420,15 +420,15 @@ discard block |
||
420 | 420 | } |
421 | 421 | |
422 | 422 | // Core doesn't output this, so let's append it, so we don't get confused. |
423 | - if ( is_wp_error( $upgrade_result ) ) { |
|
424 | - $upgrade_result->add( 'installation_failed', __( 'Installation failed.' ) ); |
|
425 | - $skin->error( $upgrade_result ); |
|
423 | + if (is_wp_error($upgrade_result)) { |
|
424 | + $upgrade_result->add('installation_failed', __('Installation failed.')); |
|
425 | + $skin->error($upgrade_result); |
|
426 | 426 | } else { |
427 | - $skin->feedback( __( 'WordPress updated successfully.' ) ); |
|
427 | + $skin->feedback(__('WordPress updated successfully.')); |
|
428 | 428 | } |
429 | 429 | } |
430 | 430 | |
431 | - $this->update_results[ $type ][] = (object) array( |
|
431 | + $this->update_results[$type][] = (object) array( |
|
432 | 432 | 'item' => $item, |
433 | 433 | 'result' => $upgrade_result, |
434 | 434 | 'name' => $item_name, |
@@ -444,41 +444,41 @@ discard block |
||
444 | 444 | * @since 3.7.0 |
445 | 445 | */ |
446 | 446 | public function run() { |
447 | - if ( $this->is_disabled() ) { |
|
447 | + if ($this->is_disabled()) { |
|
448 | 448 | return; |
449 | 449 | } |
450 | 450 | |
451 | - if ( ! is_main_network() || ! is_main_site() ) { |
|
451 | + if (!is_main_network() || !is_main_site()) { |
|
452 | 452 | return; |
453 | 453 | } |
454 | 454 | |
455 | - if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) { |
|
455 | + if (!WP_Upgrader::create_lock('auto_updater')) { |
|
456 | 456 | return; |
457 | 457 | } |
458 | 458 | |
459 | 459 | // Don't automatically run these things, as we'll handle it ourselves. |
460 | - remove_action( 'upgrader_process_complete', array( 'Language_Pack_Upgrader', 'async_upgrade' ), 20 ); |
|
461 | - remove_action( 'upgrader_process_complete', 'wp_version_check' ); |
|
462 | - remove_action( 'upgrader_process_complete', 'wp_update_plugins' ); |
|
463 | - remove_action( 'upgrader_process_complete', 'wp_update_themes' ); |
|
460 | + remove_action('upgrader_process_complete', array('Language_Pack_Upgrader', 'async_upgrade'), 20); |
|
461 | + remove_action('upgrader_process_complete', 'wp_version_check'); |
|
462 | + remove_action('upgrader_process_complete', 'wp_update_plugins'); |
|
463 | + remove_action('upgrader_process_complete', 'wp_update_themes'); |
|
464 | 464 | |
465 | 465 | // Next, plugins. |
466 | 466 | wp_update_plugins(); // Check for plugin updates. |
467 | - $plugin_updates = get_site_transient( 'update_plugins' ); |
|
468 | - if ( $plugin_updates && ! empty( $plugin_updates->response ) ) { |
|
469 | - foreach ( $plugin_updates->response as $plugin ) { |
|
470 | - $this->update( 'plugin', $plugin ); |
|
467 | + $plugin_updates = get_site_transient('update_plugins'); |
|
468 | + if ($plugin_updates && !empty($plugin_updates->response)) { |
|
469 | + foreach ($plugin_updates->response as $plugin) { |
|
470 | + $this->update('plugin', $plugin); |
|
471 | 471 | } |
472 | 472 | // Force refresh of plugin update information. |
473 | 473 | wp_clean_plugins_cache(); |
474 | 474 | } |
475 | 475 | |
476 | 476 | // Next, those themes we all love. |
477 | - wp_update_themes(); // Check for theme updates. |
|
478 | - $theme_updates = get_site_transient( 'update_themes' ); |
|
479 | - if ( $theme_updates && ! empty( $theme_updates->response ) ) { |
|
480 | - foreach ( $theme_updates->response as $theme ) { |
|
481 | - $this->update( 'theme', (object) $theme ); |
|
477 | + wp_update_themes(); // Check for theme updates. |
|
478 | + $theme_updates = get_site_transient('update_themes'); |
|
479 | + if ($theme_updates && !empty($theme_updates->response)) { |
|
480 | + foreach ($theme_updates->response as $theme) { |
|
481 | + $this->update('theme', (object) $theme); |
|
482 | 482 | } |
483 | 483 | // Force refresh of theme update information. |
484 | 484 | wp_clean_themes_cache(); |
@@ -488,46 +488,46 @@ discard block |
||
488 | 488 | wp_version_check(); // Check for core updates. |
489 | 489 | $core_update = find_core_auto_update(); |
490 | 490 | |
491 | - if ( $core_update ) { |
|
492 | - $this->update( 'core', $core_update ); |
|
491 | + if ($core_update) { |
|
492 | + $this->update('core', $core_update); |
|
493 | 493 | } |
494 | 494 | |
495 | 495 | // Clean up, and check for any pending translations. |
496 | 496 | // (Core_Upgrader checks for core updates.) |
497 | 497 | $theme_stats = array(); |
498 | - if ( isset( $this->update_results['theme'] ) ) { |
|
499 | - foreach ( $this->update_results['theme'] as $upgrade ) { |
|
500 | - $theme_stats[ $upgrade->item->theme ] = ( true === $upgrade->result ); |
|
498 | + if (isset($this->update_results['theme'])) { |
|
499 | + foreach ($this->update_results['theme'] as $upgrade) { |
|
500 | + $theme_stats[$upgrade->item->theme] = (true === $upgrade->result); |
|
501 | 501 | } |
502 | 502 | } |
503 | - wp_update_themes( $theme_stats ); // Check for theme updates. |
|
503 | + wp_update_themes($theme_stats); // Check for theme updates. |
|
504 | 504 | |
505 | 505 | $plugin_stats = array(); |
506 | - if ( isset( $this->update_results['plugin'] ) ) { |
|
507 | - foreach ( $this->update_results['plugin'] as $upgrade ) { |
|
508 | - $plugin_stats[ $upgrade->item->plugin ] = ( true === $upgrade->result ); |
|
506 | + if (isset($this->update_results['plugin'])) { |
|
507 | + foreach ($this->update_results['plugin'] as $upgrade) { |
|
508 | + $plugin_stats[$upgrade->item->plugin] = (true === $upgrade->result); |
|
509 | 509 | } |
510 | 510 | } |
511 | - wp_update_plugins( $plugin_stats ); // Check for plugin updates. |
|
511 | + wp_update_plugins($plugin_stats); // Check for plugin updates. |
|
512 | 512 | |
513 | 513 | // Finally, process any new translations. |
514 | 514 | $language_updates = wp_get_translation_updates(); |
515 | - if ( $language_updates ) { |
|
516 | - foreach ( $language_updates as $update ) { |
|
517 | - $this->update( 'translation', $update ); |
|
515 | + if ($language_updates) { |
|
516 | + foreach ($language_updates as $update) { |
|
517 | + $this->update('translation', $update); |
|
518 | 518 | } |
519 | 519 | |
520 | 520 | // Clear existing caches. |
521 | 521 | wp_clean_update_cache(); |
522 | 522 | |
523 | - wp_version_check(); // Check for core updates. |
|
524 | - wp_update_themes(); // Check for theme updates. |
|
523 | + wp_version_check(); // Check for core updates. |
|
524 | + wp_update_themes(); // Check for theme updates. |
|
525 | 525 | wp_update_plugins(); // Check for plugin updates. |
526 | 526 | } |
527 | 527 | |
528 | 528 | // Send debugging email to admin for all development installations. |
529 | - if ( ! empty( $this->update_results ) ) { |
|
530 | - $development_version = false !== strpos( get_bloginfo( 'version' ), '-' ); |
|
529 | + if (!empty($this->update_results)) { |
|
530 | + $development_version = false !== strpos(get_bloginfo('version'), '-'); |
|
531 | 531 | |
532 | 532 | /** |
533 | 533 | * Filters whether to send a debugging email for each automatic background update. |
@@ -538,14 +538,14 @@ discard block |
||
538 | 538 | * install is a development version. |
539 | 539 | * Return false to avoid the email. |
540 | 540 | */ |
541 | - if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) ) { |
|
541 | + if (apply_filters('automatic_updates_send_debug_email', $development_version)) { |
|
542 | 542 | $this->send_debug_email(); |
543 | 543 | } |
544 | 544 | |
545 | - if ( ! empty( $this->update_results['core'] ) ) { |
|
546 | - $this->after_core_update( $this->update_results['core'][0] ); |
|
547 | - } elseif ( ! empty( $this->update_results['plugin'] ) || ! empty( $this->update_results['theme'] ) ) { |
|
548 | - $this->after_plugin_theme_update( $this->update_results ); |
|
545 | + if (!empty($this->update_results['core'])) { |
|
546 | + $this->after_core_update($this->update_results['core'][0]); |
|
547 | + } elseif (!empty($this->update_results['plugin']) || !empty($this->update_results['theme'])) { |
|
548 | + $this->after_plugin_theme_update($this->update_results); |
|
549 | 549 | } |
550 | 550 | |
551 | 551 | /** |
@@ -555,10 +555,10 @@ discard block |
||
555 | 555 | * |
556 | 556 | * @param array $update_results The results of all attempted updates. |
557 | 557 | */ |
558 | - do_action( 'automatic_updates_complete', $this->update_results ); |
|
558 | + do_action('automatic_updates_complete', $this->update_results); |
|
559 | 559 | } |
560 | 560 | |
561 | - WP_Upgrader::release_lock( 'auto_updater' ); |
|
561 | + WP_Upgrader::release_lock('auto_updater'); |
|
562 | 562 | } |
563 | 563 | |
564 | 564 | /** |
@@ -569,14 +569,14 @@ discard block |
||
569 | 569 | * |
570 | 570 | * @param object $update_result The result of the core update. Includes the update offer and result. |
571 | 571 | */ |
572 | - protected function after_core_update( $update_result ) { |
|
573 | - $wp_version = get_bloginfo( 'version' ); |
|
572 | + protected function after_core_update($update_result) { |
|
573 | + $wp_version = get_bloginfo('version'); |
|
574 | 574 | |
575 | 575 | $core_update = $update_result->item; |
576 | 576 | $result = $update_result->result; |
577 | 577 | |
578 | - if ( ! is_wp_error( $result ) ) { |
|
579 | - $this->send_email( 'success', $core_update ); |
|
578 | + if (!is_wp_error($result)) { |
|
579 | + $this->send_email('success', $core_update); |
|
580 | 580 | return; |
581 | 581 | } |
582 | 582 | |
@@ -585,17 +585,17 @@ discard block |
||
585 | 585 | // Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files. |
586 | 586 | // We should not try to perform a background update again until there is a successful one-click update performed by the user. |
587 | 587 | $critical = false; |
588 | - if ( 'disk_full' === $error_code || false !== strpos( $error_code, '__copy_dir' ) ) { |
|
588 | + if ('disk_full' === $error_code || false !== strpos($error_code, '__copy_dir')) { |
|
589 | 589 | $critical = true; |
590 | - } elseif ( 'rollback_was_required' === $error_code && is_wp_error( $result->get_error_data()->rollback ) ) { |
|
590 | + } elseif ('rollback_was_required' === $error_code && is_wp_error($result->get_error_data()->rollback)) { |
|
591 | 591 | // A rollback is only critical if it failed too. |
592 | 592 | $critical = true; |
593 | 593 | $rollback_result = $result->get_error_data()->rollback; |
594 | - } elseif ( false !== strpos( $error_code, 'do_rollback' ) ) { |
|
594 | + } elseif (false !== strpos($error_code, 'do_rollback')) { |
|
595 | 595 | $critical = true; |
596 | 596 | } |
597 | 597 | |
598 | - if ( $critical ) { |
|
598 | + if ($critical) { |
|
599 | 599 | $critical_data = array( |
600 | 600 | 'attempted' => $core_update->current, |
601 | 601 | 'current' => $wp_version, |
@@ -604,12 +604,12 @@ discard block |
||
604 | 604 | 'timestamp' => time(), |
605 | 605 | 'critical' => true, |
606 | 606 | ); |
607 | - if ( isset( $rollback_result ) ) { |
|
607 | + if (isset($rollback_result)) { |
|
608 | 608 | $critical_data['rollback_code'] = $rollback_result->get_error_code(); |
609 | 609 | $critical_data['rollback_data'] = $rollback_result->get_error_data(); |
610 | 610 | } |
611 | - update_site_option( 'auto_core_update_failed', $critical_data ); |
|
612 | - $this->send_email( 'critical', $core_update, $result ); |
|
611 | + update_site_option('auto_core_update_failed', $critical_data); |
|
612 | + $this->send_email('critical', $core_update, $result); |
|
613 | 613 | return; |
614 | 614 | } |
615 | 615 | |
@@ -625,18 +625,18 @@ discard block |
||
625 | 625 | * the issue could actually be on WordPress.org's side.) If that one fails, then email. |
626 | 626 | */ |
627 | 627 | $send = true; |
628 | - $transient_failures = array( 'incompatible_archive', 'download_failed', 'insane_distro', 'locked' ); |
|
629 | - if ( in_array( $error_code, $transient_failures, true ) && ! get_site_option( 'auto_core_update_failed' ) ) { |
|
630 | - wp_schedule_single_event( time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update' ); |
|
628 | + $transient_failures = array('incompatible_archive', 'download_failed', 'insane_distro', 'locked'); |
|
629 | + if (in_array($error_code, $transient_failures, true) && !get_site_option('auto_core_update_failed')) { |
|
630 | + wp_schedule_single_event(time() + HOUR_IN_SECONDS, 'wp_maybe_auto_update'); |
|
631 | 631 | $send = false; |
632 | 632 | } |
633 | 633 | |
634 | - $notified = get_site_option( 'auto_core_update_notified' ); |
|
634 | + $notified = get_site_option('auto_core_update_notified'); |
|
635 | 635 | |
636 | 636 | // Don't notify if we've already notified the same email address of the same version of the same notification type. |
637 | - if ( $notified |
|
637 | + if ($notified |
|
638 | 638 | && 'fail' === $notified['type'] |
639 | - && get_site_option( 'admin_email' ) === $notified['email'] |
|
639 | + && get_site_option('admin_email') === $notified['email'] |
|
640 | 640 | && $notified['version'] === $core_update->current |
641 | 641 | ) { |
642 | 642 | $send = false; |
@@ -650,12 +650,12 @@ discard block |
||
650 | 650 | 'error_code' => $error_code, |
651 | 651 | 'error_data' => $result->get_error_data(), |
652 | 652 | 'timestamp' => time(), |
653 | - 'retry' => in_array( $error_code, $transient_failures, true ), |
|
653 | + 'retry' => in_array($error_code, $transient_failures, true), |
|
654 | 654 | ) |
655 | 655 | ); |
656 | 656 | |
657 | - if ( $send ) { |
|
658 | - $this->send_email( 'fail', $core_update, $result ); |
|
657 | + if ($send) { |
|
658 | + $this->send_email('fail', $core_update, $result); |
|
659 | 659 | } |
660 | 660 | } |
661 | 661 | |
@@ -668,12 +668,12 @@ discard block |
||
668 | 668 | * @param object $core_update The update offer that was attempted. |
669 | 669 | * @param mixed $result Optional. The result for the core update. Can be WP_Error. |
670 | 670 | */ |
671 | - protected function send_email( $type, $core_update, $result = null ) { |
|
671 | + protected function send_email($type, $core_update, $result = null) { |
|
672 | 672 | update_site_option( |
673 | 673 | 'auto_core_update_notified', |
674 | 674 | array( |
675 | 675 | 'type' => $type, |
676 | - 'email' => get_site_option( 'admin_email' ), |
|
676 | + 'email' => get_site_option('admin_email'), |
|
677 | 677 | 'version' => $core_update->current, |
678 | 678 | 'timestamp' => time(), |
679 | 679 | ) |
@@ -682,12 +682,12 @@ discard block |
||
682 | 682 | $next_user_core_update = get_preferred_from_update_core(); |
683 | 683 | |
684 | 684 | // If the update transient is empty, use the update we just performed. |
685 | - if ( ! $next_user_core_update ) { |
|
685 | + if (!$next_user_core_update) { |
|
686 | 686 | $next_user_core_update = $core_update; |
687 | 687 | } |
688 | 688 | |
689 | - if ( 'upgrade' === $next_user_core_update->response |
|
690 | - && version_compare( $next_user_core_update->version, $core_update->version, '>' ) |
|
689 | + if ('upgrade' === $next_user_core_update->response |
|
690 | + && version_compare($next_user_core_update->version, $core_update->version, '>') |
|
691 | 691 | ) { |
692 | 692 | $newer_version_available = true; |
693 | 693 | } else { |
@@ -705,25 +705,25 @@ discard block |
||
705 | 705 | * @param object $core_update The update offer that was attempted. |
706 | 706 | * @param mixed $result The result for the core update. Can be WP_Error. |
707 | 707 | */ |
708 | - if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) { |
|
708 | + if ('manual' !== $type && !apply_filters('auto_core_update_send_email', true, $type, $core_update, $result)) { |
|
709 | 709 | return; |
710 | 710 | } |
711 | 711 | |
712 | - switch ( $type ) { |
|
712 | + switch ($type) { |
|
713 | 713 | case 'success': // We updated. |
714 | 714 | /* translators: Site updated notification email subject. 1: Site title, 2: WordPress version. */ |
715 | - $subject = __( '[%1$s] Your site has updated to WordPress %2$s' ); |
|
715 | + $subject = __('[%1$s] Your site has updated to WordPress %2$s'); |
|
716 | 716 | break; |
717 | 717 | |
718 | 718 | case 'fail': // We tried to update but couldn't. |
719 | 719 | case 'manual': // We can't update (and made no attempt). |
720 | 720 | /* translators: Update available notification email subject. 1: Site title, 2: WordPress version. */ |
721 | - $subject = __( '[%1$s] WordPress %2$s is available. Please update!' ); |
|
721 | + $subject = __('[%1$s] WordPress %2$s is available. Please update!'); |
|
722 | 722 | break; |
723 | 723 | |
724 | 724 | case 'critical': // We tried to update, started to copy files, then things went wrong. |
725 | 725 | /* translators: Site down notification email subject. 1: Site title. */ |
726 | - $subject = __( '[%1$s] URGENT: Your site may be down due to a failed update' ); |
|
726 | + $subject = __('[%1$s] URGENT: Your site may be down due to a failed update'); |
|
727 | 727 | break; |
728 | 728 | |
729 | 729 | default: |
@@ -732,34 +732,34 @@ discard block |
||
732 | 732 | |
733 | 733 | // If the auto-update is not to the latest version, say that the current version of WP is available instead. |
734 | 734 | $version = 'success' === $type ? $core_update->current : $next_user_core_update->current; |
735 | - $subject = sprintf( $subject, wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ), $version ); |
|
735 | + $subject = sprintf($subject, wp_specialchars_decode(get_option('blogname'), ENT_QUOTES), $version); |
|
736 | 736 | |
737 | 737 | $body = ''; |
738 | 738 | |
739 | - switch ( $type ) { |
|
739 | + switch ($type) { |
|
740 | 740 | case 'success': |
741 | 741 | $body .= sprintf( |
742 | 742 | /* translators: 1: Home URL, 2: WordPress version. */ |
743 | - __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ), |
|
743 | + __('Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.'), |
|
744 | 744 | home_url(), |
745 | 745 | $core_update->current |
746 | 746 | ); |
747 | 747 | $body .= "\n\n"; |
748 | - if ( ! $newer_version_available ) { |
|
749 | - $body .= __( 'No further action is needed on your part.' ) . ' '; |
|
748 | + if (!$newer_version_available) { |
|
749 | + $body .= __('No further action is needed on your part.') . ' '; |
|
750 | 750 | } |
751 | 751 | |
752 | 752 | // Can only reference the About screen if their update was successful. |
753 | - list( $about_version ) = explode( '-', $core_update->current, 2 ); |
|
753 | + list($about_version) = explode('-', $core_update->current, 2); |
|
754 | 754 | /* translators: %s: WordPress version. */ |
755 | - $body .= sprintf( __( 'For more on version %s, see the About WordPress screen:' ), $about_version ); |
|
756 | - $body .= "\n" . admin_url( 'about.php' ); |
|
755 | + $body .= sprintf(__('For more on version %s, see the About WordPress screen:'), $about_version); |
|
756 | + $body .= "\n" . admin_url('about.php'); |
|
757 | 757 | |
758 | - if ( $newer_version_available ) { |
|
758 | + if ($newer_version_available) { |
|
759 | 759 | /* translators: %s: WordPress latest version. */ |
760 | - $body .= "\n\n" . sprintf( __( 'WordPress %s is also now available.' ), $next_user_core_update->current ) . ' '; |
|
761 | - $body .= __( 'Updating is easy and only takes a few moments:' ); |
|
762 | - $body .= "\n" . network_admin_url( 'update-core.php' ); |
|
760 | + $body .= "\n\n" . sprintf(__('WordPress %s is also now available.'), $next_user_core_update->current) . ' '; |
|
761 | + $body .= __('Updating is easy and only takes a few moments:'); |
|
762 | + $body .= "\n" . network_admin_url('update-core.php'); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | break; |
@@ -768,7 +768,7 @@ discard block |
||
768 | 768 | case 'manual': |
769 | 769 | $body .= sprintf( |
770 | 770 | /* translators: 1: Home URL, 2: WordPress version. */ |
771 | - __( 'Please update your site at %1$s to WordPress %2$s.' ), |
|
771 | + __('Please update your site at %1$s to WordPress %2$s.'), |
|
772 | 772 | home_url(), |
773 | 773 | $next_user_core_update->current |
774 | 774 | ); |
@@ -777,114 +777,114 @@ discard block |
||
777 | 777 | |
778 | 778 | // Don't show this message if there is a newer version available. |
779 | 779 | // Potential for confusion, and also not useful for them to know at this point. |
780 | - if ( 'fail' === $type && ! $newer_version_available ) { |
|
781 | - $body .= __( 'An attempt was made, but your site could not be updated automatically.' ) . ' '; |
|
780 | + if ('fail' === $type && !$newer_version_available) { |
|
781 | + $body .= __('An attempt was made, but your site could not be updated automatically.') . ' '; |
|
782 | 782 | } |
783 | 783 | |
784 | - $body .= __( 'Updating is easy and only takes a few moments:' ); |
|
785 | - $body .= "\n" . network_admin_url( 'update-core.php' ); |
|
784 | + $body .= __('Updating is easy and only takes a few moments:'); |
|
785 | + $body .= "\n" . network_admin_url('update-core.php'); |
|
786 | 786 | break; |
787 | 787 | |
788 | 788 | case 'critical': |
789 | - if ( $newer_version_available ) { |
|
789 | + if ($newer_version_available) { |
|
790 | 790 | $body .= sprintf( |
791 | 791 | /* translators: 1: Home URL, 2: WordPress version. */ |
792 | - __( 'Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.' ), |
|
792 | + __('Your site at %1$s experienced a critical failure while trying to update WordPress to version %2$s.'), |
|
793 | 793 | home_url(), |
794 | 794 | $core_update->current |
795 | 795 | ); |
796 | 796 | } else { |
797 | 797 | $body .= sprintf( |
798 | 798 | /* translators: 1: Home URL, 2: WordPress latest version. */ |
799 | - __( 'Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.' ), |
|
799 | + __('Your site at %1$s experienced a critical failure while trying to update to the latest version of WordPress, %2$s.'), |
|
800 | 800 | home_url(), |
801 | 801 | $core_update->current |
802 | 802 | ); |
803 | 803 | } |
804 | 804 | |
805 | - $body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." ); |
|
805 | + $body .= "\n\n" . __("This means your site may be offline or broken. Don't panic; this can be fixed."); |
|
806 | 806 | |
807 | - $body .= "\n\n" . __( "Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:" ); |
|
808 | - $body .= "\n" . network_admin_url( 'update-core.php' ); |
|
807 | + $body .= "\n\n" . __("Please check out your site now. It's possible that everything is working. If it says you need to update, you should do so:"); |
|
808 | + $body .= "\n" . network_admin_url('update-core.php'); |
|
809 | 809 | break; |
810 | 810 | } |
811 | 811 | |
812 | - $critical_support = 'critical' === $type && ! empty( $core_update->support_email ); |
|
813 | - if ( $critical_support ) { |
|
812 | + $critical_support = 'critical' === $type && !empty($core_update->support_email); |
|
813 | + if ($critical_support) { |
|
814 | 814 | // Support offer if available. |
815 | 815 | $body .= "\n\n" . sprintf( |
816 | 816 | /* translators: %s: Support email address. */ |
817 | - __( 'The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working.' ), |
|
817 | + __('The WordPress team is willing to help you. Forward this email to %s and the team will work with you to make sure your site is working.'), |
|
818 | 818 | $core_update->support_email |
819 | 819 | ); |
820 | 820 | } else { |
821 | 821 | // Add a note about the support forums. |
822 | - $body .= "\n\n" . __( 'If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.' ); |
|
823 | - $body .= "\n" . __( 'https://wordpress.org/support/forums/' ); |
|
822 | + $body .= "\n\n" . __('If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.'); |
|
823 | + $body .= "\n" . __('https://wordpress.org/support/forums/'); |
|
824 | 824 | } |
825 | 825 | |
826 | 826 | // Updates are important! |
827 | - if ( 'success' !== $type || $newer_version_available ) { |
|
828 | - $body .= "\n\n" . __( 'Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.' ); |
|
827 | + if ('success' !== $type || $newer_version_available) { |
|
828 | + $body .= "\n\n" . __('Keeping your site updated is important for security. It also makes the internet a safer place for you and your readers.'); |
|
829 | 829 | } |
830 | 830 | |
831 | - if ( $critical_support ) { |
|
832 | - $body .= ' ' . __( "If you reach out to us, we'll also ensure you'll never have this problem again." ); |
|
831 | + if ($critical_support) { |
|
832 | + $body .= ' ' . __("If you reach out to us, we'll also ensure you'll never have this problem again."); |
|
833 | 833 | } |
834 | 834 | |
835 | 835 | // If things are successful and we're now on the latest, mention plugins and themes if any are out of date. |
836 | - if ( 'success' === $type && ! $newer_version_available && ( get_plugin_updates() || get_theme_updates() ) ) { |
|
837 | - $body .= "\n\n" . __( 'You also have some plugins or themes with updates available. Update them now:' ); |
|
836 | + if ('success' === $type && !$newer_version_available && (get_plugin_updates() || get_theme_updates())) { |
|
837 | + $body .= "\n\n" . __('You also have some plugins or themes with updates available. Update them now:'); |
|
838 | 838 | $body .= "\n" . network_admin_url(); |
839 | 839 | } |
840 | 840 | |
841 | - $body .= "\n\n" . __( 'The WordPress Team' ) . "\n"; |
|
841 | + $body .= "\n\n" . __('The WordPress Team') . "\n"; |
|
842 | 842 | |
843 | - if ( 'critical' === $type && is_wp_error( $result ) ) { |
|
843 | + if ('critical' === $type && is_wp_error($result)) { |
|
844 | 844 | $body .= "\n***\n\n"; |
845 | 845 | /* translators: %s: WordPress version. */ |
846 | - $body .= sprintf( __( 'Your site was running version %s.' ), get_bloginfo( 'version' ) ); |
|
847 | - $body .= ' ' . __( 'Some data that describes the error your site encountered has been put together.' ); |
|
848 | - $body .= ' ' . __( 'Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:' ); |
|
846 | + $body .= sprintf(__('Your site was running version %s.'), get_bloginfo('version')); |
|
847 | + $body .= ' ' . __('Some data that describes the error your site encountered has been put together.'); |
|
848 | + $body .= ' ' . __('Your hosting company, support forum volunteers, or a friendly developer may be able to use this information to help you:'); |
|
849 | 849 | |
850 | 850 | // If we had a rollback and we're still critical, then the rollback failed too. |
851 | 851 | // Loop through all errors (the main WP_Error, the update result, the rollback result) for code, data, etc. |
852 | - if ( 'rollback_was_required' === $result->get_error_code() ) { |
|
853 | - $errors = array( $result, $result->get_error_data()->update, $result->get_error_data()->rollback ); |
|
852 | + if ('rollback_was_required' === $result->get_error_code()) { |
|
853 | + $errors = array($result, $result->get_error_data()->update, $result->get_error_data()->rollback); |
|
854 | 854 | } else { |
855 | - $errors = array( $result ); |
|
855 | + $errors = array($result); |
|
856 | 856 | } |
857 | 857 | |
858 | - foreach ( $errors as $error ) { |
|
859 | - if ( ! is_wp_error( $error ) ) { |
|
858 | + foreach ($errors as $error) { |
|
859 | + if (!is_wp_error($error)) { |
|
860 | 860 | continue; |
861 | 861 | } |
862 | 862 | |
863 | 863 | $error_code = $error->get_error_code(); |
864 | 864 | /* translators: %s: Error code. */ |
865 | - $body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code ); |
|
865 | + $body .= "\n\n" . sprintf(__('Error code: %s'), $error_code); |
|
866 | 866 | |
867 | - if ( 'rollback_was_required' === $error_code ) { |
|
867 | + if ('rollback_was_required' === $error_code) { |
|
868 | 868 | continue; |
869 | 869 | } |
870 | 870 | |
871 | - if ( $error->get_error_message() ) { |
|
871 | + if ($error->get_error_message()) { |
|
872 | 872 | $body .= "\n" . $error->get_error_message(); |
873 | 873 | } |
874 | 874 | |
875 | 875 | $error_data = $error->get_error_data(); |
876 | - if ( $error_data ) { |
|
877 | - $body .= "\n" . implode( ', ', (array) $error_data ); |
|
876 | + if ($error_data) { |
|
877 | + $body .= "\n" . implode(', ', (array) $error_data); |
|
878 | 878 | } |
879 | 879 | } |
880 | 880 | |
881 | 881 | $body .= "\n"; |
882 | 882 | } |
883 | 883 | |
884 | - $to = get_site_option( 'admin_email' ); |
|
884 | + $to = get_site_option('admin_email'); |
|
885 | 885 | $headers = ''; |
886 | 886 | |
887 | - $email = compact( 'to', 'subject', 'body', 'headers' ); |
|
887 | + $email = compact('to', 'subject', 'body', 'headers'); |
|
888 | 888 | |
889 | 889 | /** |
890 | 890 | * Filters the email sent following an automatic background core update. |
@@ -905,9 +905,9 @@ discard block |
||
905 | 905 | * @param object $core_update The update offer that was attempted. |
906 | 906 | * @param mixed $result The result for the core update. Can be WP_Error. |
907 | 907 | */ |
908 | - $email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result ); |
|
908 | + $email = apply_filters('auto_core_update_email', $email, $type, $core_update, $result); |
|
909 | 909 | |
910 | - wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
|
910 | + wp_mail($email['to'], wp_specialchars_decode($email['subject']), $email['body'], $email['headers']); |
|
911 | 911 | } |
912 | 912 | |
913 | 913 | |
@@ -918,11 +918,11 @@ discard block |
||
918 | 918 | * |
919 | 919 | * @param array $update_results The results of update tasks. |
920 | 920 | */ |
921 | - protected function after_plugin_theme_update( $update_results ) { |
|
921 | + protected function after_plugin_theme_update($update_results) { |
|
922 | 922 | $successful_updates = array(); |
923 | 923 | $failed_updates = array(); |
924 | 924 | |
925 | - if ( ! empty( $update_results['plugin'] ) ) { |
|
925 | + if (!empty($update_results['plugin'])) { |
|
926 | 926 | /** |
927 | 927 | * Filters whether to send an email following an automatic background plugin update. |
928 | 928 | * |
@@ -932,11 +932,11 @@ discard block |
||
932 | 932 | * @param bool $enabled True if plugin update notifications are enabled, false otherwise. |
933 | 933 | * @param array $update_results The results of plugins update tasks. |
934 | 934 | */ |
935 | - $notifications_enabled = apply_filters( 'auto_plugin_update_send_email', true, $update_results['plugin'] ); |
|
935 | + $notifications_enabled = apply_filters('auto_plugin_update_send_email', true, $update_results['plugin']); |
|
936 | 936 | |
937 | - if ( $notifications_enabled ) { |
|
938 | - foreach ( $update_results['plugin'] as $update_result ) { |
|
939 | - if ( true === $update_result->result ) { |
|
937 | + if ($notifications_enabled) { |
|
938 | + foreach ($update_results['plugin'] as $update_result) { |
|
939 | + if (true === $update_result->result) { |
|
940 | 940 | $successful_updates['plugin'][] = $update_result; |
941 | 941 | } else { |
942 | 942 | $failed_updates['plugin'][] = $update_result; |
@@ -945,7 +945,7 @@ discard block |
||
945 | 945 | } |
946 | 946 | } |
947 | 947 | |
948 | - if ( ! empty( $update_results['theme'] ) ) { |
|
948 | + if (!empty($update_results['theme'])) { |
|
949 | 949 | /** |
950 | 950 | * Filters whether to send an email following an automatic background theme update. |
951 | 951 | * |
@@ -955,11 +955,11 @@ discard block |
||
955 | 955 | * @param bool $enabled True if theme update notifications are enabled, false otherwise. |
956 | 956 | * @param array $update_results The results of theme update tasks. |
957 | 957 | */ |
958 | - $notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] ); |
|
958 | + $notifications_enabled = apply_filters('auto_theme_update_send_email', true, $update_results['theme']); |
|
959 | 959 | |
960 | - if ( $notifications_enabled ) { |
|
961 | - foreach ( $update_results['theme'] as $update_result ) { |
|
962 | - if ( true === $update_result->result ) { |
|
960 | + if ($notifications_enabled) { |
|
961 | + foreach ($update_results['theme'] as $update_result) { |
|
962 | + if (true === $update_result->result) { |
|
963 | 963 | $successful_updates['theme'][] = $update_result; |
964 | 964 | } else { |
965 | 965 | $failed_updates['theme'][] = $update_result; |
@@ -968,16 +968,16 @@ discard block |
||
968 | 968 | } |
969 | 969 | } |
970 | 970 | |
971 | - if ( empty( $successful_updates ) && empty( $failed_updates ) ) { |
|
971 | + if (empty($successful_updates) && empty($failed_updates)) { |
|
972 | 972 | return; |
973 | 973 | } |
974 | 974 | |
975 | - if ( empty( $failed_updates ) ) { |
|
976 | - $this->send_plugin_theme_email( 'success', $successful_updates, $failed_updates ); |
|
977 | - } elseif ( empty( $successful_updates ) ) { |
|
978 | - $this->send_plugin_theme_email( 'fail', $successful_updates, $failed_updates ); |
|
975 | + if (empty($failed_updates)) { |
|
976 | + $this->send_plugin_theme_email('success', $successful_updates, $failed_updates); |
|
977 | + } elseif (empty($successful_updates)) { |
|
978 | + $this->send_plugin_theme_email('fail', $successful_updates, $failed_updates); |
|
979 | 979 | } else { |
980 | - $this->send_plugin_theme_email( 'mixed', $successful_updates, $failed_updates ); |
|
980 | + $this->send_plugin_theme_email('mixed', $successful_updates, $failed_updates); |
|
981 | 981 | } |
982 | 982 | } |
983 | 983 | |
@@ -990,70 +990,70 @@ discard block |
||
990 | 990 | * @param array $successful_updates A list of updates that succeeded. |
991 | 991 | * @param array $failed_updates A list of updates that failed. |
992 | 992 | */ |
993 | - protected function send_plugin_theme_email( $type, $successful_updates, $failed_updates ) { |
|
993 | + protected function send_plugin_theme_email($type, $successful_updates, $failed_updates) { |
|
994 | 994 | // No updates were attempted. |
995 | - if ( empty( $successful_updates ) && empty( $failed_updates ) ) { |
|
995 | + if (empty($successful_updates) && empty($failed_updates)) { |
|
996 | 996 | return; |
997 | 997 | } |
998 | 998 | |
999 | 999 | $unique_failures = false; |
1000 | - $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() ); |
|
1000 | + $past_failure_emails = get_option('auto_plugin_theme_update_emails', array()); |
|
1001 | 1001 | |
1002 | 1002 | /* |
1003 | 1003 | * When only failures have occurred, an email should only be sent if there are unique failures. |
1004 | 1004 | * A failure is considered unique if an email has not been sent for an update attempt failure |
1005 | 1005 | * to a plugin or theme with the same new_version. |
1006 | 1006 | */ |
1007 | - if ( 'fail' === $type ) { |
|
1008 | - foreach ( $failed_updates as $update_type => $failures ) { |
|
1009 | - foreach ( $failures as $failed_update ) { |
|
1010 | - if ( ! isset( $past_failure_emails[ $failed_update->item->{$update_type} ] ) ) { |
|
1007 | + if ('fail' === $type) { |
|
1008 | + foreach ($failed_updates as $update_type => $failures) { |
|
1009 | + foreach ($failures as $failed_update) { |
|
1010 | + if (!isset($past_failure_emails[$failed_update->item->{$update_type}])) { |
|
1011 | 1011 | $unique_failures = true; |
1012 | 1012 | continue; |
1013 | 1013 | } |
1014 | 1014 | |
1015 | 1015 | // Check that the failure represents a new failure based on the new_version. |
1016 | - if ( version_compare( $past_failure_emails[ $failed_update->item->{$update_type} ], $failed_update->item->new_version, '<' ) ) { |
|
1016 | + if (version_compare($past_failure_emails[$failed_update->item->{$update_type}], $failed_update->item->new_version, '<')) { |
|
1017 | 1017 | $unique_failures = true; |
1018 | 1018 | } |
1019 | 1019 | } |
1020 | 1020 | } |
1021 | 1021 | |
1022 | - if ( ! $unique_failures ) { |
|
1022 | + if (!$unique_failures) { |
|
1023 | 1023 | return; |
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
1027 | 1027 | $body = array(); |
1028 | - $successful_plugins = ( ! empty( $successful_updates['plugin'] ) ); |
|
1029 | - $successful_themes = ( ! empty( $successful_updates['theme'] ) ); |
|
1030 | - $failed_plugins = ( ! empty( $failed_updates['plugin'] ) ); |
|
1031 | - $failed_themes = ( ! empty( $failed_updates['theme'] ) ); |
|
1028 | + $successful_plugins = (!empty($successful_updates['plugin'])); |
|
1029 | + $successful_themes = (!empty($successful_updates['theme'])); |
|
1030 | + $failed_plugins = (!empty($failed_updates['plugin'])); |
|
1031 | + $failed_themes = (!empty($failed_updates['theme'])); |
|
1032 | 1032 | |
1033 | - switch ( $type ) { |
|
1033 | + switch ($type) { |
|
1034 | 1034 | case 'success': |
1035 | - if ( $successful_plugins && $successful_themes ) { |
|
1035 | + if ($successful_plugins && $successful_themes) { |
|
1036 | 1036 | /* translators: %s: Site title. */ |
1037 | - $subject = __( '[%s] Some plugins and themes have automatically updated' ); |
|
1037 | + $subject = __('[%s] Some plugins and themes have automatically updated'); |
|
1038 | 1038 | $body[] = sprintf( |
1039 | 1039 | /* translators: %s: Home URL. */ |
1040 | - __( 'Howdy! Some plugins and themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ), |
|
1040 | + __('Howdy! Some plugins and themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.'), |
|
1041 | 1041 | home_url() |
1042 | 1042 | ); |
1043 | - } elseif ( $successful_plugins ) { |
|
1043 | + } elseif ($successful_plugins) { |
|
1044 | 1044 | /* translators: %s: Site title. */ |
1045 | - $subject = __( '[%s] Some plugins were automatically updated' ); |
|
1045 | + $subject = __('[%s] Some plugins were automatically updated'); |
|
1046 | 1046 | $body[] = sprintf( |
1047 | 1047 | /* translators: %s: Home URL. */ |
1048 | - __( 'Howdy! Some plugins have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ), |
|
1048 | + __('Howdy! Some plugins have automatically updated to their latest versions on your site at %s. No further action is needed on your part.'), |
|
1049 | 1049 | home_url() |
1050 | 1050 | ); |
1051 | 1051 | } else { |
1052 | 1052 | /* translators: %s: Site title. */ |
1053 | - $subject = __( '[%s] Some themes were automatically updated' ); |
|
1053 | + $subject = __('[%s] Some themes were automatically updated'); |
|
1054 | 1054 | $body[] = sprintf( |
1055 | 1055 | /* translators: %s: Home URL. */ |
1056 | - __( 'Howdy! Some themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.' ), |
|
1056 | + __('Howdy! Some themes have automatically updated to their latest versions on your site at %s. No further action is needed on your part.'), |
|
1057 | 1057 | home_url() |
1058 | 1058 | ); |
1059 | 1059 | } |
@@ -1061,28 +1061,28 @@ discard block |
||
1061 | 1061 | break; |
1062 | 1062 | case 'fail': |
1063 | 1063 | case 'mixed': |
1064 | - if ( $failed_plugins && $failed_themes ) { |
|
1064 | + if ($failed_plugins && $failed_themes) { |
|
1065 | 1065 | /* translators: %s: Site title. */ |
1066 | - $subject = __( '[%s] Some plugins and themes have failed to update' ); |
|
1066 | + $subject = __('[%s] Some plugins and themes have failed to update'); |
|
1067 | 1067 | $body[] = sprintf( |
1068 | 1068 | /* translators: %s: Home URL. */ |
1069 | - __( 'Howdy! Plugins and themes failed to update on your site at %s.' ), |
|
1069 | + __('Howdy! Plugins and themes failed to update on your site at %s.'), |
|
1070 | 1070 | home_url() |
1071 | 1071 | ); |
1072 | - } elseif ( $failed_plugins ) { |
|
1072 | + } elseif ($failed_plugins) { |
|
1073 | 1073 | /* translators: %s: Site title. */ |
1074 | - $subject = __( '[%s] Some plugins have failed to update' ); |
|
1074 | + $subject = __('[%s] Some plugins have failed to update'); |
|
1075 | 1075 | $body[] = sprintf( |
1076 | 1076 | /* translators: %s: Home URL. */ |
1077 | - __( 'Howdy! Plugins failed to update on your site at %s.' ), |
|
1077 | + __('Howdy! Plugins failed to update on your site at %s.'), |
|
1078 | 1078 | home_url() |
1079 | 1079 | ); |
1080 | 1080 | } else { |
1081 | 1081 | /* translators: %s: Site title. */ |
1082 | - $subject = __( '[%s] Some themes have failed to update' ); |
|
1082 | + $subject = __('[%s] Some themes have failed to update'); |
|
1083 | 1083 | $body[] = sprintf( |
1084 | 1084 | /* translators: %s: Home URL. */ |
1085 | - __( 'Howdy! Themes failed to update on your site at %s.' ), |
|
1085 | + __('Howdy! Themes failed to update on your site at %s.'), |
|
1086 | 1086 | home_url() |
1087 | 1087 | ); |
1088 | 1088 | } |
@@ -1090,20 +1090,20 @@ discard block |
||
1090 | 1090 | break; |
1091 | 1091 | } |
1092 | 1092 | |
1093 | - if ( in_array( $type, array( 'fail', 'mixed' ), true ) ) { |
|
1093 | + if (in_array($type, array('fail', 'mixed'), true)) { |
|
1094 | 1094 | $body[] = "\n"; |
1095 | - $body[] = __( 'Please check your site now. It’s possible that everything is working. If there are updates available, you should update.' ); |
|
1095 | + $body[] = __('Please check your site now. It’s possible that everything is working. If there are updates available, you should update.'); |
|
1096 | 1096 | $body[] = "\n"; |
1097 | 1097 | |
1098 | 1098 | // List failed plugin updates. |
1099 | - if ( ! empty( $failed_updates['plugin'] ) ) { |
|
1100 | - $body[] = __( 'These plugins failed to update:' ); |
|
1099 | + if (!empty($failed_updates['plugin'])) { |
|
1100 | + $body[] = __('These plugins failed to update:'); |
|
1101 | 1101 | |
1102 | - foreach ( $failed_updates['plugin'] as $item ) { |
|
1103 | - if ( $item->item->current_version ) { |
|
1102 | + foreach ($failed_updates['plugin'] as $item) { |
|
1103 | + if ($item->item->current_version) { |
|
1104 | 1104 | $body[] = sprintf( |
1105 | 1105 | /* translators: 1: Plugin name, 2: Current version number, 3: New version number. */ |
1106 | - __( '- %1$s (from version %2$s to %3$s)' ), |
|
1106 | + __('- %1$s (from version %2$s to %3$s)'), |
|
1107 | 1107 | $item->name, |
1108 | 1108 | $item->item->current_version, |
1109 | 1109 | $item->item->new_version |
@@ -1111,27 +1111,27 @@ discard block |
||
1111 | 1111 | } else { |
1112 | 1112 | $body[] = sprintf( |
1113 | 1113 | /* translators: 1: Plugin name, 2: Version number. */ |
1114 | - __( '- %1$s version %2$s' ), |
|
1114 | + __('- %1$s version %2$s'), |
|
1115 | 1115 | $item->name, |
1116 | 1116 | $item->item->new_version |
1117 | 1117 | ); |
1118 | 1118 | } |
1119 | 1119 | |
1120 | - $past_failure_emails[ $item->item->plugin ] = $item->item->new_version; |
|
1120 | + $past_failure_emails[$item->item->plugin] = $item->item->new_version; |
|
1121 | 1121 | } |
1122 | 1122 | |
1123 | 1123 | $body[] = "\n"; |
1124 | 1124 | } |
1125 | 1125 | |
1126 | 1126 | // List failed theme updates. |
1127 | - if ( ! empty( $failed_updates['theme'] ) ) { |
|
1128 | - $body[] = __( 'These themes failed to update:' ); |
|
1127 | + if (!empty($failed_updates['theme'])) { |
|
1128 | + $body[] = __('These themes failed to update:'); |
|
1129 | 1129 | |
1130 | - foreach ( $failed_updates['theme'] as $item ) { |
|
1131 | - if ( $item->item->current_version ) { |
|
1130 | + foreach ($failed_updates['theme'] as $item) { |
|
1131 | + if ($item->item->current_version) { |
|
1132 | 1132 | $body[] = sprintf( |
1133 | 1133 | /* translators: 1: Theme name, 2: Current version number, 3: New version number. */ |
1134 | - __( '- %1$s (from version %2$s to %3$s)' ), |
|
1134 | + __('- %1$s (from version %2$s to %3$s)'), |
|
1135 | 1135 | $item->name, |
1136 | 1136 | $item->item->current_version, |
1137 | 1137 | $item->item->new_version |
@@ -1139,13 +1139,13 @@ discard block |
||
1139 | 1139 | } else { |
1140 | 1140 | $body[] = sprintf( |
1141 | 1141 | /* translators: 1: Theme name, 2: Version number. */ |
1142 | - __( '- %1$s version %2$s' ), |
|
1142 | + __('- %1$s version %2$s'), |
|
1143 | 1143 | $item->name, |
1144 | 1144 | $item->item->new_version |
1145 | 1145 | ); |
1146 | 1146 | } |
1147 | 1147 | |
1148 | - $past_failure_emails[ $item->item->theme ] = $item->item->new_version; |
|
1148 | + $past_failure_emails[$item->item->theme] = $item->item->new_version; |
|
1149 | 1149 | } |
1150 | 1150 | |
1151 | 1151 | $body[] = "\n"; |
@@ -1153,18 +1153,18 @@ discard block |
||
1153 | 1153 | } |
1154 | 1154 | |
1155 | 1155 | // List successful updates. |
1156 | - if ( in_array( $type, array( 'success', 'mixed' ), true ) ) { |
|
1156 | + if (in_array($type, array('success', 'mixed'), true)) { |
|
1157 | 1157 | $body[] = "\n"; |
1158 | 1158 | |
1159 | 1159 | // List successful plugin updates. |
1160 | - if ( ! empty( $successful_updates['plugin'] ) ) { |
|
1161 | - $body[] = __( 'These plugins are now up to date:' ); |
|
1160 | + if (!empty($successful_updates['plugin'])) { |
|
1161 | + $body[] = __('These plugins are now up to date:'); |
|
1162 | 1162 | |
1163 | - foreach ( $successful_updates['plugin'] as $item ) { |
|
1164 | - if ( $item->item->current_version ) { |
|
1163 | + foreach ($successful_updates['plugin'] as $item) { |
|
1164 | + if ($item->item->current_version) { |
|
1165 | 1165 | $body[] = sprintf( |
1166 | 1166 | /* translators: 1: Plugin name, 2: Current version number, 3: New version number. */ |
1167 | - __( '- %1$s (from version %2$s to %3$s)' ), |
|
1167 | + __('- %1$s (from version %2$s to %3$s)'), |
|
1168 | 1168 | $item->name, |
1169 | 1169 | $item->item->current_version, |
1170 | 1170 | $item->item->new_version |
@@ -1172,27 +1172,27 @@ discard block |
||
1172 | 1172 | } else { |
1173 | 1173 | $body[] = sprintf( |
1174 | 1174 | /* translators: 1: Plugin name, 2: Version number. */ |
1175 | - __( '- %1$s version %2$s' ), |
|
1175 | + __('- %1$s version %2$s'), |
|
1176 | 1176 | $item->name, |
1177 | 1177 | $item->item->new_version |
1178 | 1178 | ); |
1179 | 1179 | } |
1180 | 1180 | |
1181 | - unset( $past_failure_emails[ $item->item->plugin ] ); |
|
1181 | + unset($past_failure_emails[$item->item->plugin]); |
|
1182 | 1182 | } |
1183 | 1183 | |
1184 | 1184 | $body[] = "\n"; |
1185 | 1185 | } |
1186 | 1186 | |
1187 | 1187 | // List successful theme updates. |
1188 | - if ( ! empty( $successful_updates['theme'] ) ) { |
|
1189 | - $body[] = __( 'These themes are now up to date:' ); |
|
1188 | + if (!empty($successful_updates['theme'])) { |
|
1189 | + $body[] = __('These themes are now up to date:'); |
|
1190 | 1190 | |
1191 | - foreach ( $successful_updates['theme'] as $item ) { |
|
1192 | - if ( $item->item->current_version ) { |
|
1191 | + foreach ($successful_updates['theme'] as $item) { |
|
1192 | + if ($item->item->current_version) { |
|
1193 | 1193 | $body[] = sprintf( |
1194 | 1194 | /* translators: 1: Theme name, 2: Current version number, 3: New version number. */ |
1195 | - __( '- %1$s (from version %2$s to %3$s)' ), |
|
1195 | + __('- %1$s (from version %2$s to %3$s)'), |
|
1196 | 1196 | $item->name, |
1197 | 1197 | $item->item->current_version, |
1198 | 1198 | $item->item->new_version |
@@ -1200,54 +1200,54 @@ discard block |
||
1200 | 1200 | } else { |
1201 | 1201 | $body[] = sprintf( |
1202 | 1202 | /* translators: 1: Theme name, 2: Version number. */ |
1203 | - __( '- %1$s version %2$s' ), |
|
1203 | + __('- %1$s version %2$s'), |
|
1204 | 1204 | $item->name, |
1205 | 1205 | $item->item->new_version |
1206 | 1206 | ); |
1207 | 1207 | } |
1208 | 1208 | |
1209 | - unset( $past_failure_emails[ $item->item->theme ] ); |
|
1209 | + unset($past_failure_emails[$item->item->theme]); |
|
1210 | 1210 | } |
1211 | 1211 | |
1212 | 1212 | $body[] = "\n"; |
1213 | 1213 | } |
1214 | 1214 | } |
1215 | 1215 | |
1216 | - if ( $failed_plugins ) { |
|
1216 | + if ($failed_plugins) { |
|
1217 | 1217 | $body[] = sprintf( |
1218 | 1218 | /* translators: %s: Plugins screen URL. */ |
1219 | - __( 'To manage plugins on your site, visit the Plugins page: %s' ), |
|
1220 | - admin_url( 'plugins.php' ) |
|
1219 | + __('To manage plugins on your site, visit the Plugins page: %s'), |
|
1220 | + admin_url('plugins.php') |
|
1221 | 1221 | ); |
1222 | 1222 | $body[] = "\n"; |
1223 | 1223 | } |
1224 | 1224 | |
1225 | - if ( $failed_themes ) { |
|
1225 | + if ($failed_themes) { |
|
1226 | 1226 | $body[] = sprintf( |
1227 | 1227 | /* translators: %s: Themes screen URL. */ |
1228 | - __( 'To manage themes on your site, visit the Themes page: %s' ), |
|
1229 | - admin_url( 'themes.php' ) |
|
1228 | + __('To manage themes on your site, visit the Themes page: %s'), |
|
1229 | + admin_url('themes.php') |
|
1230 | 1230 | ); |
1231 | 1231 | $body[] = "\n"; |
1232 | 1232 | } |
1233 | 1233 | |
1234 | 1234 | // Add a note about the support forums. |
1235 | - $body[] = __( 'If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.' ); |
|
1236 | - $body[] = __( 'https://wordpress.org/support/forums/' ); |
|
1237 | - $body[] = "\n" . __( 'The WordPress Team' ); |
|
1235 | + $body[] = __('If you experience any issues or need support, the volunteers in the WordPress.org support forums may be able to help.'); |
|
1236 | + $body[] = __('https://wordpress.org/support/forums/'); |
|
1237 | + $body[] = "\n" . __('The WordPress Team'); |
|
1238 | 1238 | |
1239 | - if ( '' !== get_option( 'blogname' ) ) { |
|
1240 | - $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES ); |
|
1239 | + if ('' !== get_option('blogname')) { |
|
1240 | + $site_title = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES); |
|
1241 | 1241 | } else { |
1242 | - $site_title = parse_url( home_url(), PHP_URL_HOST ); |
|
1242 | + $site_title = parse_url(home_url(), PHP_URL_HOST); |
|
1243 | 1243 | } |
1244 | 1244 | |
1245 | - $body = implode( "\n", $body ); |
|
1246 | - $to = get_site_option( 'admin_email' ); |
|
1247 | - $subject = sprintf( $subject, $site_title ); |
|
1245 | + $body = implode("\n", $body); |
|
1246 | + $to = get_site_option('admin_email'); |
|
1247 | + $subject = sprintf($subject, $site_title); |
|
1248 | 1248 | $headers = ''; |
1249 | 1249 | |
1250 | - $email = compact( 'to', 'subject', 'body', 'headers' ); |
|
1250 | + $email = compact('to', 'subject', 'body', 'headers'); |
|
1251 | 1251 | |
1252 | 1252 | /** |
1253 | 1253 | * Filters the email sent following an automatic background update for plugins and themes. |
@@ -1267,12 +1267,12 @@ discard block |
||
1267 | 1267 | * @param array $successful_updates A list of updates that succeeded. |
1268 | 1268 | * @param array $failed_updates A list of updates that failed. |
1269 | 1269 | */ |
1270 | - $email = apply_filters( 'auto_plugin_theme_update_email', $email, $type, $successful_updates, $failed_updates ); |
|
1270 | + $email = apply_filters('auto_plugin_theme_update_email', $email, $type, $successful_updates, $failed_updates); |
|
1271 | 1271 | |
1272 | - $result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
|
1272 | + $result = wp_mail($email['to'], wp_specialchars_decode($email['subject']), $email['body'], $email['headers']); |
|
1273 | 1273 | |
1274 | - if ( $result ) { |
|
1275 | - update_option( 'auto_plugin_theme_update_emails', $past_failure_emails ); |
|
1274 | + if ($result) { |
|
1275 | + update_option('auto_plugin_theme_update_emails', $past_failure_emails); |
|
1276 | 1276 | } |
1277 | 1277 | } |
1278 | 1278 | |
@@ -1283,26 +1283,26 @@ discard block |
||
1283 | 1283 | */ |
1284 | 1284 | protected function send_debug_email() { |
1285 | 1285 | $update_count = 0; |
1286 | - foreach ( $this->update_results as $type => $updates ) { |
|
1287 | - $update_count += count( $updates ); |
|
1286 | + foreach ($this->update_results as $type => $updates) { |
|
1287 | + $update_count += count($updates); |
|
1288 | 1288 | } |
1289 | 1289 | |
1290 | 1290 | $body = array(); |
1291 | 1291 | $failures = 0; |
1292 | 1292 | |
1293 | 1293 | /* translators: %s: Network home URL. */ |
1294 | - $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) ); |
|
1294 | + $body[] = sprintf(__('WordPress site: %s'), network_home_url('/')); |
|
1295 | 1295 | |
1296 | 1296 | // Core. |
1297 | - if ( isset( $this->update_results['core'] ) ) { |
|
1297 | + if (isset($this->update_results['core'])) { |
|
1298 | 1298 | $result = $this->update_results['core'][0]; |
1299 | 1299 | |
1300 | - if ( $result->result && ! is_wp_error( $result->result ) ) { |
|
1300 | + if ($result->result && !is_wp_error($result->result)) { |
|
1301 | 1301 | /* translators: %s: WordPress version. */ |
1302 | - $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name ); |
|
1302 | + $body[] = sprintf(__('SUCCESS: WordPress was successfully updated to %s'), $result->name); |
|
1303 | 1303 | } else { |
1304 | 1304 | /* translators: %s: WordPress version. */ |
1305 | - $body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name ); |
|
1305 | + $body[] = sprintf(__('FAILED: WordPress failed to update to %s'), $result->name); |
|
1306 | 1306 | $failures++; |
1307 | 1307 | } |
1308 | 1308 | |
@@ -1310,41 +1310,41 @@ discard block |
||
1310 | 1310 | } |
1311 | 1311 | |
1312 | 1312 | // Plugins, Themes, Translations. |
1313 | - foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) { |
|
1314 | - if ( ! isset( $this->update_results[ $type ] ) ) { |
|
1313 | + foreach (array('plugin', 'theme', 'translation') as $type) { |
|
1314 | + if (!isset($this->update_results[$type])) { |
|
1315 | 1315 | continue; |
1316 | 1316 | } |
1317 | 1317 | |
1318 | - $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) ); |
|
1318 | + $success_items = wp_list_filter($this->update_results[$type], array('result' => true)); |
|
1319 | 1319 | |
1320 | - if ( $success_items ) { |
|
1320 | + if ($success_items) { |
|
1321 | 1321 | $messages = array( |
1322 | - 'plugin' => __( 'The following plugins were successfully updated:' ), |
|
1323 | - 'theme' => __( 'The following themes were successfully updated:' ), |
|
1324 | - 'translation' => __( 'The following translations were successfully updated:' ), |
|
1322 | + 'plugin' => __('The following plugins were successfully updated:'), |
|
1323 | + 'theme' => __('The following themes were successfully updated:'), |
|
1324 | + 'translation' => __('The following translations were successfully updated:'), |
|
1325 | 1325 | ); |
1326 | 1326 | |
1327 | - $body[] = $messages[ $type ]; |
|
1328 | - foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) { |
|
1327 | + $body[] = $messages[$type]; |
|
1328 | + foreach (wp_list_pluck($success_items, 'name') as $name) { |
|
1329 | 1329 | /* translators: %s: Name of plugin / theme / translation. */ |
1330 | - $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name ); |
|
1330 | + $body[] = ' * ' . sprintf(__('SUCCESS: %s'), $name); |
|
1331 | 1331 | } |
1332 | 1332 | } |
1333 | 1333 | |
1334 | - if ( $success_items !== $this->update_results[ $type ] ) { |
|
1334 | + if ($success_items !== $this->update_results[$type]) { |
|
1335 | 1335 | // Failed updates. |
1336 | 1336 | $messages = array( |
1337 | - 'plugin' => __( 'The following plugins failed to update:' ), |
|
1338 | - 'theme' => __( 'The following themes failed to update:' ), |
|
1339 | - 'translation' => __( 'The following translations failed to update:' ), |
|
1337 | + 'plugin' => __('The following plugins failed to update:'), |
|
1338 | + 'theme' => __('The following themes failed to update:'), |
|
1339 | + 'translation' => __('The following translations failed to update:'), |
|
1340 | 1340 | ); |
1341 | 1341 | |
1342 | - $body[] = $messages[ $type ]; |
|
1342 | + $body[] = $messages[$type]; |
|
1343 | 1343 | |
1344 | - foreach ( $this->update_results[ $type ] as $item ) { |
|
1345 | - if ( ! $item->result || is_wp_error( $item->result ) ) { |
|
1344 | + foreach ($this->update_results[$type] as $item) { |
|
1345 | + if (!$item->result || is_wp_error($item->result)) { |
|
1346 | 1346 | /* translators: %s: Name of plugin / theme / translation. */ |
1347 | - $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name ); |
|
1347 | + $body[] = ' * ' . sprintf(__('FAILED: %s'), $item->name); |
|
1348 | 1348 | $failures++; |
1349 | 1349 | } |
1350 | 1350 | } |
@@ -1353,13 +1353,13 @@ discard block |
||
1353 | 1353 | $body[] = ''; |
1354 | 1354 | } |
1355 | 1355 | |
1356 | - if ( '' !== get_bloginfo( 'name' ) ) { |
|
1357 | - $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ); |
|
1356 | + if ('' !== get_bloginfo('name')) { |
|
1357 | + $site_title = wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES); |
|
1358 | 1358 | } else { |
1359 | - $site_title = parse_url( home_url(), PHP_URL_HOST ); |
|
1359 | + $site_title = parse_url(home_url(), PHP_URL_HOST); |
|
1360 | 1360 | } |
1361 | 1361 | |
1362 | - if ( $failures ) { |
|
1362 | + if ($failures) { |
|
1363 | 1363 | $body[] = trim( |
1364 | 1364 | __( |
1365 | 1365 | "BETA TESTING? |
@@ -1377,10 +1377,10 @@ discard block |
||
1377 | 1377 | $body[] = ''; |
1378 | 1378 | |
1379 | 1379 | /* translators: Background update failed notification email subject. %s: Site title. */ |
1380 | - $subject = sprintf( __( '[%s] Background Update Failed' ), $site_title ); |
|
1380 | + $subject = sprintf(__('[%s] Background Update Failed'), $site_title); |
|
1381 | 1381 | } else { |
1382 | 1382 | /* translators: Background update finished notification email subject. %s: Site title. */ |
1383 | - $subject = sprintf( __( '[%s] Background Update Finished' ), $site_title ); |
|
1383 | + $subject = sprintf(__('[%s] Background Update Finished'), $site_title); |
|
1384 | 1384 | } |
1385 | 1385 | |
1386 | 1386 | $body[] = trim( |
@@ -1391,42 +1391,42 @@ discard block |
||
1391 | 1391 | ); |
1392 | 1392 | $body[] = ''; |
1393 | 1393 | |
1394 | - foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) { |
|
1395 | - if ( ! isset( $this->update_results[ $type ] ) ) { |
|
1394 | + foreach (array('core', 'plugin', 'theme', 'translation') as $type) { |
|
1395 | + if (!isset($this->update_results[$type])) { |
|
1396 | 1396 | continue; |
1397 | 1397 | } |
1398 | 1398 | |
1399 | - foreach ( $this->update_results[ $type ] as $update ) { |
|
1399 | + foreach ($this->update_results[$type] as $update) { |
|
1400 | 1400 | $body[] = $update->name; |
1401 | - $body[] = str_repeat( '-', strlen( $update->name ) ); |
|
1401 | + $body[] = str_repeat('-', strlen($update->name)); |
|
1402 | 1402 | |
1403 | - foreach ( $update->messages as $message ) { |
|
1404 | - $body[] = ' ' . html_entity_decode( str_replace( '…', '...', $message ) ); |
|
1403 | + foreach ($update->messages as $message) { |
|
1404 | + $body[] = ' ' . html_entity_decode(str_replace('…', '...', $message)); |
|
1405 | 1405 | } |
1406 | 1406 | |
1407 | - if ( is_wp_error( $update->result ) ) { |
|
1408 | - $results = array( 'update' => $update->result ); |
|
1407 | + if (is_wp_error($update->result)) { |
|
1408 | + $results = array('update' => $update->result); |
|
1409 | 1409 | |
1410 | 1410 | // If we rolled back, we want to know an error that occurred then too. |
1411 | - if ( 'rollback_was_required' === $update->result->get_error_code() ) { |
|
1411 | + if ('rollback_was_required' === $update->result->get_error_code()) { |
|
1412 | 1412 | $results = (array) $update->result->get_error_data(); |
1413 | 1413 | } |
1414 | 1414 | |
1415 | - foreach ( $results as $result_type => $result ) { |
|
1416 | - if ( ! is_wp_error( $result ) ) { |
|
1415 | + foreach ($results as $result_type => $result) { |
|
1416 | + if (!is_wp_error($result)) { |
|
1417 | 1417 | continue; |
1418 | 1418 | } |
1419 | 1419 | |
1420 | - if ( 'rollback' === $result_type ) { |
|
1420 | + if ('rollback' === $result_type) { |
|
1421 | 1421 | /* translators: 1: Error code, 2: Error message. */ |
1422 | - $body[] = ' ' . sprintf( __( 'Rollback Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() ); |
|
1422 | + $body[] = ' ' . sprintf(__('Rollback Error: [%1$s] %2$s'), $result->get_error_code(), $result->get_error_message()); |
|
1423 | 1423 | } else { |
1424 | 1424 | /* translators: 1: Error code, 2: Error message. */ |
1425 | - $body[] = ' ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() ); |
|
1425 | + $body[] = ' ' . sprintf(__('Error: [%1$s] %2$s'), $result->get_error_code(), $result->get_error_message()); |
|
1426 | 1426 | } |
1427 | 1427 | |
1428 | - if ( $result->get_error_data() ) { |
|
1429 | - $body[] = ' ' . implode( ', ', (array) $result->get_error_data() ); |
|
1428 | + if ($result->get_error_data()) { |
|
1429 | + $body[] = ' ' . implode(', ', (array) $result->get_error_data()); |
|
1430 | 1430 | } |
1431 | 1431 | } |
1432 | 1432 | } |
@@ -1436,9 +1436,9 @@ discard block |
||
1436 | 1436 | } |
1437 | 1437 | |
1438 | 1438 | $email = array( |
1439 | - 'to' => get_site_option( 'admin_email' ), |
|
1439 | + 'to' => get_site_option('admin_email'), |
|
1440 | 1440 | 'subject' => $subject, |
1441 | - 'body' => implode( "\n", $body ), |
|
1441 | + 'body' => implode("\n", $body), |
|
1442 | 1442 | 'headers' => '', |
1443 | 1443 | ); |
1444 | 1444 | |
@@ -1460,8 +1460,8 @@ discard block |
||
1460 | 1460 | * @param int $failures The number of failures encountered while upgrading. |
1461 | 1461 | * @param mixed $results The results of all attempted updates. |
1462 | 1462 | */ |
1463 | - $email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results ); |
|
1463 | + $email = apply_filters('automatic_updates_debug_email', $email, $failures, $this->update_results); |
|
1464 | 1464 | |
1465 | - wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] ); |
|
1465 | + wp_mail($email['to'], wp_specialchars_decode($email['subject']), $email['body'], $email['headers']); |
|
1466 | 1466 | } |
1467 | 1467 | } |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | |
9 | -if ( is_network_admin() ) { |
|
9 | +if (is_network_admin()) { |
|
10 | 10 | |
11 | 11 | /** |
12 | 12 | * Fires before the administration menu loads in the Network Admin. |
@@ -16,8 +16,8 @@ discard block |
||
16 | 16 | * @private |
17 | 17 | * @since 3.1.0 |
18 | 18 | */ |
19 | - do_action( '_network_admin_menu' ); |
|
20 | -} elseif ( is_user_admin() ) { |
|
19 | + do_action('_network_admin_menu'); |
|
20 | +} elseif (is_user_admin()) { |
|
21 | 21 | |
22 | 22 | /** |
23 | 23 | * Fires before the administration menu loads in the User Admin. |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | * @private |
28 | 28 | * @since 3.1.0 |
29 | 29 | */ |
30 | - do_action( '_user_admin_menu' ); |
|
30 | + do_action('_user_admin_menu'); |
|
31 | 31 | } else { |
32 | 32 | |
33 | 33 | /** |
@@ -38,92 +38,92 @@ discard block |
||
38 | 38 | * @private |
39 | 39 | * @since 2.2.0 |
40 | 40 | */ |
41 | - do_action( '_admin_menu' ); |
|
41 | + do_action('_admin_menu'); |
|
42 | 42 | } |
43 | 43 | |
44 | 44 | // Create list of page plugin hook names. |
45 | -foreach ( $menu as $menu_page ) { |
|
46 | - $pos = strpos( $menu_page[2], '?' ); |
|
47 | - if ( false !== $pos ) { |
|
45 | +foreach ($menu as $menu_page) { |
|
46 | + $pos = strpos($menu_page[2], '?'); |
|
47 | + if (false !== $pos) { |
|
48 | 48 | // Handle post_type=post|page|foo pages. |
49 | - $hook_name = substr( $menu_page[2], 0, $pos ); |
|
50 | - $hook_args = substr( $menu_page[2], $pos + 1 ); |
|
51 | - wp_parse_str( $hook_args, $hook_args ); |
|
49 | + $hook_name = substr($menu_page[2], 0, $pos); |
|
50 | + $hook_args = substr($menu_page[2], $pos + 1); |
|
51 | + wp_parse_str($hook_args, $hook_args); |
|
52 | 52 | // Set the hook name to be the post type. |
53 | - if ( isset( $hook_args['post_type'] ) ) { |
|
53 | + if (isset($hook_args['post_type'])) { |
|
54 | 54 | $hook_name = $hook_args['post_type']; |
55 | 55 | } else { |
56 | - $hook_name = basename( $hook_name, '.php' ); |
|
56 | + $hook_name = basename($hook_name, '.php'); |
|
57 | 57 | } |
58 | - unset( $hook_args ); |
|
58 | + unset($hook_args); |
|
59 | 59 | } else { |
60 | - $hook_name = basename( $menu_page[2], '.php' ); |
|
60 | + $hook_name = basename($menu_page[2], '.php'); |
|
61 | 61 | } |
62 | - $hook_name = sanitize_title( $hook_name ); |
|
62 | + $hook_name = sanitize_title($hook_name); |
|
63 | 63 | |
64 | - if ( isset( $compat[ $hook_name ] ) ) { |
|
65 | - $hook_name = $compat[ $hook_name ]; |
|
66 | - } elseif ( ! $hook_name ) { |
|
64 | + if (isset($compat[$hook_name])) { |
|
65 | + $hook_name = $compat[$hook_name]; |
|
66 | + } elseif (!$hook_name) { |
|
67 | 67 | continue; |
68 | 68 | } |
69 | 69 | |
70 | - $admin_page_hooks[ $menu_page[2] ] = $hook_name; |
|
70 | + $admin_page_hooks[$menu_page[2]] = $hook_name; |
|
71 | 71 | } |
72 | -unset( $menu_page, $compat ); |
|
72 | +unset($menu_page, $compat); |
|
73 | 73 | |
74 | 74 | $_wp_submenu_nopriv = array(); |
75 | 75 | $_wp_menu_nopriv = array(); |
76 | 76 | // Loop over submenus and remove pages for which the user does not have privs. |
77 | -foreach ( $submenu as $parent => $sub ) { |
|
78 | - foreach ( $sub as $index => $data ) { |
|
79 | - if ( ! current_user_can( $data[1] ) ) { |
|
80 | - unset( $submenu[ $parent ][ $index ] ); |
|
81 | - $_wp_submenu_nopriv[ $parent ][ $data[2] ] = true; |
|
77 | +foreach ($submenu as $parent => $sub) { |
|
78 | + foreach ($sub as $index => $data) { |
|
79 | + if (!current_user_can($data[1])) { |
|
80 | + unset($submenu[$parent][$index]); |
|
81 | + $_wp_submenu_nopriv[$parent][$data[2]] = true; |
|
82 | 82 | } |
83 | 83 | } |
84 | - unset( $index, $data ); |
|
84 | + unset($index, $data); |
|
85 | 85 | |
86 | - if ( empty( $submenu[ $parent ] ) ) { |
|
87 | - unset( $submenu[ $parent ] ); |
|
86 | + if (empty($submenu[$parent])) { |
|
87 | + unset($submenu[$parent]); |
|
88 | 88 | } |
89 | 89 | } |
90 | -unset( $sub, $parent ); |
|
90 | +unset($sub, $parent); |
|
91 | 91 | |
92 | 92 | /* |
93 | 93 | * Loop over the top-level menu. |
94 | 94 | * Menus for which the original parent is not accessible due to lack of privileges |
95 | 95 | * will have the next submenu in line be assigned as the new menu parent. |
96 | 96 | */ |
97 | -foreach ( $menu as $id => $data ) { |
|
98 | - if ( empty( $submenu[ $data[2] ] ) ) { |
|
97 | +foreach ($menu as $id => $data) { |
|
98 | + if (empty($submenu[$data[2]])) { |
|
99 | 99 | continue; |
100 | 100 | } |
101 | - $subs = $submenu[ $data[2] ]; |
|
102 | - $first_sub = reset( $subs ); |
|
101 | + $subs = $submenu[$data[2]]; |
|
102 | + $first_sub = reset($subs); |
|
103 | 103 | $old_parent = $data[2]; |
104 | 104 | $new_parent = $first_sub[2]; |
105 | 105 | /* |
106 | 106 | * If the first submenu is not the same as the assigned parent, |
107 | 107 | * make the first submenu the new parent. |
108 | 108 | */ |
109 | - if ( $new_parent != $old_parent ) { |
|
110 | - $_wp_real_parent_file[ $old_parent ] = $new_parent; |
|
111 | - $menu[ $id ][2] = $new_parent; |
|
109 | + if ($new_parent != $old_parent) { |
|
110 | + $_wp_real_parent_file[$old_parent] = $new_parent; |
|
111 | + $menu[$id][2] = $new_parent; |
|
112 | 112 | |
113 | - foreach ( $submenu[ $old_parent ] as $index => $data ) { |
|
114 | - $submenu[ $new_parent ][ $index ] = $submenu[ $old_parent ][ $index ]; |
|
115 | - unset( $submenu[ $old_parent ][ $index ] ); |
|
113 | + foreach ($submenu[$old_parent] as $index => $data) { |
|
114 | + $submenu[$new_parent][$index] = $submenu[$old_parent][$index]; |
|
115 | + unset($submenu[$old_parent][$index]); |
|
116 | 116 | } |
117 | - unset( $submenu[ $old_parent ], $index ); |
|
117 | + unset($submenu[$old_parent], $index); |
|
118 | 118 | |
119 | - if ( isset( $_wp_submenu_nopriv[ $old_parent ] ) ) { |
|
120 | - $_wp_submenu_nopriv[ $new_parent ] = $_wp_submenu_nopriv[ $old_parent ]; |
|
119 | + if (isset($_wp_submenu_nopriv[$old_parent])) { |
|
120 | + $_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent]; |
|
121 | 121 | } |
122 | 122 | } |
123 | 123 | } |
124 | -unset( $id, $data, $subs, $first_sub, $old_parent, $new_parent ); |
|
124 | +unset($id, $data, $subs, $first_sub, $old_parent, $new_parent); |
|
125 | 125 | |
126 | -if ( is_network_admin() ) { |
|
126 | +if (is_network_admin()) { |
|
127 | 127 | |
128 | 128 | /** |
129 | 129 | * Fires before the administration menu loads in the Network Admin. |
@@ -132,8 +132,8 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @param string $context Empty context. |
134 | 134 | */ |
135 | - do_action( 'network_admin_menu', '' ); |
|
136 | -} elseif ( is_user_admin() ) { |
|
135 | + do_action('network_admin_menu', ''); |
|
136 | +} elseif (is_user_admin()) { |
|
137 | 137 | |
138 | 138 | /** |
139 | 139 | * Fires before the administration menu loads in the User Admin. |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * |
143 | 143 | * @param string $context Empty context. |
144 | 144 | */ |
145 | - do_action( 'user_admin_menu', '' ); |
|
145 | + do_action('user_admin_menu', ''); |
|
146 | 146 | } else { |
147 | 147 | |
148 | 148 | /** |
@@ -152,39 +152,39 @@ discard block |
||
152 | 152 | * |
153 | 153 | * @param string $context Empty context. |
154 | 154 | */ |
155 | - do_action( 'admin_menu', '' ); |
|
155 | + do_action('admin_menu', ''); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /* |
159 | 159 | * Remove menus that have no accessible submenus and require privileges |
160 | 160 | * that the user does not have. Run re-parent loop again. |
161 | 161 | */ |
162 | -foreach ( $menu as $id => $data ) { |
|
163 | - if ( ! current_user_can( $data[1] ) ) { |
|
164 | - $_wp_menu_nopriv[ $data[2] ] = true; |
|
162 | +foreach ($menu as $id => $data) { |
|
163 | + if (!current_user_can($data[1])) { |
|
164 | + $_wp_menu_nopriv[$data[2]] = true; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | /* |
168 | 168 | * If there is only one submenu and it is has same destination as the parent, |
169 | 169 | * remove the submenu. |
170 | 170 | */ |
171 | - if ( ! empty( $submenu[ $data[2] ] ) && 1 === count( $submenu[ $data[2] ] ) ) { |
|
172 | - $subs = $submenu[ $data[2] ]; |
|
173 | - $first_sub = reset( $subs ); |
|
174 | - if ( $data[2] == $first_sub[2] ) { |
|
175 | - unset( $submenu[ $data[2] ] ); |
|
171 | + if (!empty($submenu[$data[2]]) && 1 === count($submenu[$data[2]])) { |
|
172 | + $subs = $submenu[$data[2]]; |
|
173 | + $first_sub = reset($subs); |
|
174 | + if ($data[2] == $first_sub[2]) { |
|
175 | + unset($submenu[$data[2]]); |
|
176 | 176 | } |
177 | 177 | } |
178 | 178 | |
179 | 179 | // If submenu is empty... |
180 | - if ( empty( $submenu[ $data[2] ] ) ) { |
|
180 | + if (empty($submenu[$data[2]])) { |
|
181 | 181 | // And user doesn't have privs, remove menu. |
182 | - if ( isset( $_wp_menu_nopriv[ $data[2] ] ) ) { |
|
183 | - unset( $menu[ $id ] ); |
|
182 | + if (isset($_wp_menu_nopriv[$data[2]])) { |
|
183 | + unset($menu[$id]); |
|
184 | 184 | } |
185 | 185 | } |
186 | 186 | } |
187 | -unset( $id, $data, $subs, $first_sub ); |
|
187 | +unset($id, $data, $subs, $first_sub); |
|
188 | 188 | |
189 | 189 | /** |
190 | 190 | * Adds a CSS class to a string. |
@@ -195,8 +195,8 @@ discard block |
||
195 | 195 | * @param string $classes The string to add the CSS class to. |
196 | 196 | * @return string The string with the CSS class added. |
197 | 197 | */ |
198 | -function add_cssclass( $class_to_add, $classes ) { |
|
199 | - if ( empty( $classes ) ) { |
|
198 | +function add_cssclass($class_to_add, $classes) { |
|
199 | + if (empty($classes)) { |
|
200 | 200 | return $class_to_add; |
201 | 201 | } |
202 | 202 | |
@@ -213,37 +213,37 @@ discard block |
||
213 | 213 | * @param array $menu The array of administration menu items. |
214 | 214 | * @return array The array of administration menu items with the CSS classes added. |
215 | 215 | */ |
216 | -function add_menu_classes( $menu ) { |
|
216 | +function add_menu_classes($menu) { |
|
217 | 217 | $first_item = false; |
218 | 218 | $last_order = false; |
219 | - $items_count = count( $menu ); |
|
219 | + $items_count = count($menu); |
|
220 | 220 | $i = 0; |
221 | 221 | |
222 | - foreach ( $menu as $order => $top ) { |
|
222 | + foreach ($menu as $order => $top) { |
|
223 | 223 | $i++; |
224 | 224 | |
225 | - if ( 0 == $order ) { // Dashboard is always shown/single. |
|
226 | - $menu[0][4] = add_cssclass( 'menu-top-first', $top[4] ); |
|
225 | + if (0 == $order) { // Dashboard is always shown/single. |
|
226 | + $menu[0][4] = add_cssclass('menu-top-first', $top[4]); |
|
227 | 227 | $last_order = 0; |
228 | 228 | continue; |
229 | 229 | } |
230 | 230 | |
231 | - if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { // If separator. |
|
231 | + if (0 === strpos($top[2], 'separator') && false !== $last_order) { // If separator. |
|
232 | 232 | $first_item = true; |
233 | - $classes = $menu[ $last_order ][4]; |
|
234 | - $menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes ); |
|
233 | + $classes = $menu[$last_order][4]; |
|
234 | + $menu[$last_order][4] = add_cssclass('menu-top-last', $classes); |
|
235 | 235 | continue; |
236 | 236 | } |
237 | 237 | |
238 | - if ( $first_item ) { |
|
239 | - $classes = $menu[ $order ][4]; |
|
240 | - $menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes ); |
|
238 | + if ($first_item) { |
|
239 | + $classes = $menu[$order][4]; |
|
240 | + $menu[$order][4] = add_cssclass('menu-top-first', $classes); |
|
241 | 241 | $first_item = false; |
242 | 242 | } |
243 | 243 | |
244 | - if ( $i == $items_count ) { // Last item. |
|
245 | - $classes = $menu[ $order ][4]; |
|
246 | - $menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes ); |
|
244 | + if ($i == $items_count) { // Last item. |
|
245 | + $classes = $menu[$order][4]; |
|
246 | + $menu[$order][4] = add_cssclass('menu-top-last', $classes); |
|
247 | 247 | } |
248 | 248 | |
249 | 249 | $last_order = $order; |
@@ -256,10 +256,10 @@ discard block |
||
256 | 256 | * |
257 | 257 | * @param array $menu Associative array of administration menu items. |
258 | 258 | */ |
259 | - return apply_filters( 'add_menu_classes', $menu ); |
|
259 | + return apply_filters('add_menu_classes', $menu); |
|
260 | 260 | } |
261 | 261 | |
262 | -uksort( $menu, 'strnatcasecmp' ); // Make it all pretty. |
|
262 | +uksort($menu, 'strnatcasecmp'); // Make it all pretty. |
|
263 | 263 | |
264 | 264 | /** |
265 | 265 | * Filters whether to enable custom ordering of the administration menu. |
@@ -270,12 +270,12 @@ discard block |
||
270 | 270 | * |
271 | 271 | * @param bool $custom Whether custom ordering is enabled. Default false. |
272 | 272 | */ |
273 | -if ( apply_filters( 'custom_menu_order', false ) ) { |
|
273 | +if (apply_filters('custom_menu_order', false)) { |
|
274 | 274 | $menu_order = array(); |
275 | - foreach ( $menu as $menu_item ) { |
|
275 | + foreach ($menu as $menu_item) { |
|
276 | 276 | $menu_order[] = $menu_item[2]; |
277 | 277 | } |
278 | - unset( $menu_item ); |
|
278 | + unset($menu_item); |
|
279 | 279 | $default_menu_order = $menu_order; |
280 | 280 | |
281 | 281 | /** |
@@ -290,9 +290,9 @@ discard block |
||
290 | 290 | * |
291 | 291 | * @param array $menu_order An ordered array of menu items. |
292 | 292 | */ |
293 | - $menu_order = apply_filters( 'menu_order', $menu_order ); |
|
294 | - $menu_order = array_flip( $menu_order ); |
|
295 | - $default_menu_order = array_flip( $default_menu_order ); |
|
293 | + $menu_order = apply_filters('menu_order', $menu_order); |
|
294 | + $menu_order = array_flip($menu_order); |
|
295 | + $default_menu_order = array_flip($default_menu_order); |
|
296 | 296 | |
297 | 297 | /** |
298 | 298 | * @global array $menu_order |
@@ -302,66 +302,66 @@ discard block |
||
302 | 302 | * @param array $b |
303 | 303 | * @return int |
304 | 304 | */ |
305 | - function sort_menu( $a, $b ) { |
|
305 | + function sort_menu($a, $b) { |
|
306 | 306 | global $menu_order, $default_menu_order; |
307 | 307 | $a = $a[2]; |
308 | 308 | $b = $b[2]; |
309 | - if ( isset( $menu_order[ $a ] ) && ! isset( $menu_order[ $b ] ) ) { |
|
309 | + if (isset($menu_order[$a]) && !isset($menu_order[$b])) { |
|
310 | 310 | return -1; |
311 | - } elseif ( ! isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) { |
|
311 | + } elseif (!isset($menu_order[$a]) && isset($menu_order[$b])) { |
|
312 | 312 | return 1; |
313 | - } elseif ( isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) { |
|
314 | - if ( $menu_order[ $a ] == $menu_order[ $b ] ) { |
|
313 | + } elseif (isset($menu_order[$a]) && isset($menu_order[$b])) { |
|
314 | + if ($menu_order[$a] == $menu_order[$b]) { |
|
315 | 315 | return 0; |
316 | 316 | } |
317 | - return ( $menu_order[ $a ] < $menu_order[ $b ] ) ? -1 : 1; |
|
317 | + return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1; |
|
318 | 318 | } else { |
319 | - return ( $default_menu_order[ $a ] <= $default_menu_order[ $b ] ) ? -1 : 1; |
|
319 | + return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1; |
|
320 | 320 | } |
321 | 321 | } |
322 | 322 | |
323 | - usort( $menu, 'sort_menu' ); |
|
324 | - unset( $menu_order, $default_menu_order ); |
|
323 | + usort($menu, 'sort_menu'); |
|
324 | + unset($menu_order, $default_menu_order); |
|
325 | 325 | } |
326 | 326 | |
327 | 327 | // Prevent adjacent separators. |
328 | 328 | $prev_menu_was_separator = false; |
329 | -foreach ( $menu as $id => $data ) { |
|
330 | - if ( false === stristr( $data[4], 'wp-menu-separator' ) ) { |
|
329 | +foreach ($menu as $id => $data) { |
|
330 | + if (false === stristr($data[4], 'wp-menu-separator')) { |
|
331 | 331 | |
332 | 332 | // This item is not a separator, so falsey the toggler and do nothing. |
333 | 333 | $prev_menu_was_separator = false; |
334 | 334 | } else { |
335 | 335 | |
336 | 336 | // The previous item was a separator, so unset this one. |
337 | - if ( true === $prev_menu_was_separator ) { |
|
338 | - unset( $menu[ $id ] ); |
|
337 | + if (true === $prev_menu_was_separator) { |
|
338 | + unset($menu[$id]); |
|
339 | 339 | } |
340 | 340 | |
341 | 341 | // This item is a separator, so truthy the toggler and move on. |
342 | 342 | $prev_menu_was_separator = true; |
343 | 343 | } |
344 | 344 | } |
345 | -unset( $id, $data, $prev_menu_was_separator ); |
|
345 | +unset($id, $data, $prev_menu_was_separator); |
|
346 | 346 | |
347 | 347 | // Remove the last menu item if it is a separator. |
348 | -$last_menu_key = array_keys( $menu ); |
|
349 | -$last_menu_key = array_pop( $last_menu_key ); |
|
350 | -if ( ! empty( $menu ) && 'wp-menu-separator' === $menu[ $last_menu_key ][4] ) { |
|
351 | - unset( $menu[ $last_menu_key ] ); |
|
348 | +$last_menu_key = array_keys($menu); |
|
349 | +$last_menu_key = array_pop($last_menu_key); |
|
350 | +if (!empty($menu) && 'wp-menu-separator' === $menu[$last_menu_key][4]) { |
|
351 | + unset($menu[$last_menu_key]); |
|
352 | 352 | } |
353 | -unset( $last_menu_key ); |
|
353 | +unset($last_menu_key); |
|
354 | 354 | |
355 | -if ( ! user_can_access_admin_page() ) { |
|
355 | +if (!user_can_access_admin_page()) { |
|
356 | 356 | |
357 | 357 | /** |
358 | 358 | * Fires when access to an admin page is denied. |
359 | 359 | * |
360 | 360 | * @since 2.5.0 |
361 | 361 | */ |
362 | - do_action( 'admin_page_access_denied' ); |
|
362 | + do_action('admin_page_access_denied'); |
|
363 | 363 | |
364 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
364 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
365 | 365 | } |
366 | 366 | |
367 | -$menu = add_menu_classes( $menu ); |
|
367 | +$menu = add_menu_classes($menu); |
@@ -28,38 +28,38 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param array $opt |
30 | 30 | */ |
31 | - public function __construct( $opt = '' ) { |
|
31 | + public function __construct($opt = '') { |
|
32 | 32 | $this->method = 'ftpsockets'; |
33 | 33 | $this->errors = new WP_Error(); |
34 | 34 | |
35 | 35 | // Check if possible to use ftp functions. |
36 | - if ( ! include_once ABSPATH . 'wp-admin/includes/class-ftp.php' ) { |
|
36 | + if (!include_once ABSPATH . 'wp-admin/includes/class-ftp.php') { |
|
37 | 37 | return; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $this->ftp = new ftp(); |
41 | 41 | |
42 | - if ( empty( $opt['port'] ) ) { |
|
42 | + if (empty($opt['port'])) { |
|
43 | 43 | $this->options['port'] = 21; |
44 | 44 | } else { |
45 | 45 | $this->options['port'] = (int) $opt['port']; |
46 | 46 | } |
47 | 47 | |
48 | - if ( empty( $opt['hostname'] ) ) { |
|
49 | - $this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) ); |
|
48 | + if (empty($opt['hostname'])) { |
|
49 | + $this->errors->add('empty_hostname', __('FTP hostname is required')); |
|
50 | 50 | } else { |
51 | 51 | $this->options['hostname'] = $opt['hostname']; |
52 | 52 | } |
53 | 53 | |
54 | 54 | // Check if the options provided are OK. |
55 | - if ( empty( $opt['username'] ) ) { |
|
56 | - $this->errors->add( 'empty_username', __( 'FTP username is required' ) ); |
|
55 | + if (empty($opt['username'])) { |
|
56 | + $this->errors->add('empty_username', __('FTP username is required')); |
|
57 | 57 | } else { |
58 | 58 | $this->options['username'] = $opt['username']; |
59 | 59 | } |
60 | 60 | |
61 | - if ( empty( $opt['password'] ) ) { |
|
62 | - $this->errors->add( 'empty_password', __( 'FTP password is required' ) ); |
|
61 | + if (empty($opt['password'])) { |
|
62 | + $this->errors->add('empty_password', __('FTP password is required')); |
|
63 | 63 | } else { |
64 | 64 | $this->options['password'] = $opt['password']; |
65 | 65 | } |
@@ -73,18 +73,18 @@ discard block |
||
73 | 73 | * @return bool True on success, false on failure. |
74 | 74 | */ |
75 | 75 | public function connect() { |
76 | - if ( ! $this->ftp ) { |
|
76 | + if (!$this->ftp) { |
|
77 | 77 | return false; |
78 | 78 | } |
79 | 79 | |
80 | - $this->ftp->setTimeout( FS_CONNECT_TIMEOUT ); |
|
80 | + $this->ftp->setTimeout(FS_CONNECT_TIMEOUT); |
|
81 | 81 | |
82 | - if ( ! $this->ftp->SetServer( $this->options['hostname'], $this->options['port'] ) ) { |
|
82 | + if (!$this->ftp->SetServer($this->options['hostname'], $this->options['port'])) { |
|
83 | 83 | $this->errors->add( |
84 | 84 | 'connect', |
85 | 85 | sprintf( |
86 | 86 | /* translators: %s: hostname:port */ |
87 | - __( 'Failed to connect to FTP Server %s' ), |
|
87 | + __('Failed to connect to FTP Server %s'), |
|
88 | 88 | $this->options['hostname'] . ':' . $this->options['port'] |
89 | 89 | ) |
90 | 90 | ); |
@@ -92,12 +92,12 @@ discard block |
||
92 | 92 | return false; |
93 | 93 | } |
94 | 94 | |
95 | - if ( ! $this->ftp->connect() ) { |
|
95 | + if (!$this->ftp->connect()) { |
|
96 | 96 | $this->errors->add( |
97 | 97 | 'connect', |
98 | 98 | sprintf( |
99 | 99 | /* translators: %s: hostname:port */ |
100 | - __( 'Failed to connect to FTP Server %s' ), |
|
100 | + __('Failed to connect to FTP Server %s'), |
|
101 | 101 | $this->options['hostname'] . ':' . $this->options['port'] |
102 | 102 | ) |
103 | 103 | ); |
@@ -105,12 +105,12 @@ discard block |
||
105 | 105 | return false; |
106 | 106 | } |
107 | 107 | |
108 | - if ( ! $this->ftp->login( $this->options['username'], $this->options['password'] ) ) { |
|
108 | + if (!$this->ftp->login($this->options['username'], $this->options['password'])) { |
|
109 | 109 | $this->errors->add( |
110 | 110 | 'auth', |
111 | 111 | sprintf( |
112 | 112 | /* translators: %s: Username. */ |
113 | - __( 'Username/Password incorrect for %s' ), |
|
113 | + __('Username/Password incorrect for %s'), |
|
114 | 114 | $this->options['username'] |
115 | 115 | ) |
116 | 116 | ); |
@@ -118,9 +118,9 @@ discard block |
||
118 | 118 | return false; |
119 | 119 | } |
120 | 120 | |
121 | - $this->ftp->SetType( FTP_BINARY ); |
|
122 | - $this->ftp->Passive( true ); |
|
123 | - $this->ftp->setTimeout( FS_TIMEOUT ); |
|
121 | + $this->ftp->SetType(FTP_BINARY); |
|
122 | + $this->ftp->Passive(true); |
|
123 | + $this->ftp->setTimeout(FS_TIMEOUT); |
|
124 | 124 | |
125 | 125 | return true; |
126 | 126 | } |
@@ -134,24 +134,24 @@ discard block |
||
134 | 134 | * @return string|false Read data on success, false if no temporary file could be opened, |
135 | 135 | * or if the file couldn't be retrieved. |
136 | 136 | */ |
137 | - public function get_contents( $file ) { |
|
138 | - if ( ! $this->exists( $file ) ) { |
|
137 | + public function get_contents($file) { |
|
138 | + if (!$this->exists($file)) { |
|
139 | 139 | return false; |
140 | 140 | } |
141 | 141 | |
142 | - $tempfile = wp_tempnam( $file ); |
|
143 | - $temphandle = fopen( $tempfile, 'w+' ); |
|
142 | + $tempfile = wp_tempnam($file); |
|
143 | + $temphandle = fopen($tempfile, 'w+'); |
|
144 | 144 | |
145 | - if ( ! $temphandle ) { |
|
146 | - unlink( $tempfile ); |
|
145 | + if (!$temphandle) { |
|
146 | + unlink($tempfile); |
|
147 | 147 | return false; |
148 | 148 | } |
149 | 149 | |
150 | 150 | mbstring_binary_safe_encoding(); |
151 | 151 | |
152 | - if ( ! $this->ftp->fget( $temphandle, $file ) ) { |
|
153 | - fclose( $temphandle ); |
|
154 | - unlink( $tempfile ); |
|
152 | + if (!$this->ftp->fget($temphandle, $file)) { |
|
153 | + fclose($temphandle); |
|
154 | + unlink($tempfile); |
|
155 | 155 | |
156 | 156 | reset_mbstring_encoding(); |
157 | 157 | |
@@ -160,15 +160,15 @@ discard block |
||
160 | 160 | |
161 | 161 | reset_mbstring_encoding(); |
162 | 162 | |
163 | - fseek( $temphandle, 0 ); // Skip back to the start of the file being written to. |
|
163 | + fseek($temphandle, 0); // Skip back to the start of the file being written to. |
|
164 | 164 | $contents = ''; |
165 | 165 | |
166 | - while ( ! feof( $temphandle ) ) { |
|
167 | - $contents .= fread( $temphandle, 8 * KB_IN_BYTES ); |
|
166 | + while (!feof($temphandle)) { |
|
167 | + $contents .= fread($temphandle, 8 * KB_IN_BYTES); |
|
168 | 168 | } |
169 | 169 | |
170 | - fclose( $temphandle ); |
|
171 | - unlink( $tempfile ); |
|
170 | + fclose($temphandle); |
|
171 | + unlink($tempfile); |
|
172 | 172 | |
173 | 173 | return $contents; |
174 | 174 | } |
@@ -181,8 +181,8 @@ discard block |
||
181 | 181 | * @param string $file Path to the file. |
182 | 182 | * @return array|false File contents in an array on success, false on failure. |
183 | 183 | */ |
184 | - public function get_contents_array( $file ) { |
|
185 | - return explode( "\n", $this->get_contents( $file ) ); |
|
184 | + public function get_contents_array($file) { |
|
185 | + return explode("\n", $this->get_contents($file)); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
@@ -196,39 +196,39 @@ discard block |
||
196 | 196 | * Default false. |
197 | 197 | * @return bool True on success, false on failure. |
198 | 198 | */ |
199 | - public function put_contents( $file, $contents, $mode = false ) { |
|
200 | - $tempfile = wp_tempnam( $file ); |
|
201 | - $temphandle = @fopen( $tempfile, 'w+' ); |
|
199 | + public function put_contents($file, $contents, $mode = false) { |
|
200 | + $tempfile = wp_tempnam($file); |
|
201 | + $temphandle = @fopen($tempfile, 'w+'); |
|
202 | 202 | |
203 | - if ( ! $temphandle ) { |
|
204 | - unlink( $tempfile ); |
|
203 | + if (!$temphandle) { |
|
204 | + unlink($tempfile); |
|
205 | 205 | return false; |
206 | 206 | } |
207 | 207 | |
208 | 208 | // The FTP class uses string functions internally during file download/upload. |
209 | 209 | mbstring_binary_safe_encoding(); |
210 | 210 | |
211 | - $bytes_written = fwrite( $temphandle, $contents ); |
|
211 | + $bytes_written = fwrite($temphandle, $contents); |
|
212 | 212 | |
213 | - if ( false === $bytes_written || strlen( $contents ) !== $bytes_written ) { |
|
214 | - fclose( $temphandle ); |
|
215 | - unlink( $tempfile ); |
|
213 | + if (false === $bytes_written || strlen($contents) !== $bytes_written) { |
|
214 | + fclose($temphandle); |
|
215 | + unlink($tempfile); |
|
216 | 216 | |
217 | 217 | reset_mbstring_encoding(); |
218 | 218 | |
219 | 219 | return false; |
220 | 220 | } |
221 | 221 | |
222 | - fseek( $temphandle, 0 ); // Skip back to the start of the file being written to. |
|
222 | + fseek($temphandle, 0); // Skip back to the start of the file being written to. |
|
223 | 223 | |
224 | - $ret = $this->ftp->fput( $file, $temphandle ); |
|
224 | + $ret = $this->ftp->fput($file, $temphandle); |
|
225 | 225 | |
226 | 226 | reset_mbstring_encoding(); |
227 | 227 | |
228 | - fclose( $temphandle ); |
|
229 | - unlink( $tempfile ); |
|
228 | + fclose($temphandle); |
|
229 | + unlink($tempfile); |
|
230 | 230 | |
231 | - $this->chmod( $file, $mode ); |
|
231 | + $this->chmod($file, $mode); |
|
232 | 232 | |
233 | 233 | return $ret; |
234 | 234 | } |
@@ -243,8 +243,8 @@ discard block |
||
243 | 243 | public function cwd() { |
244 | 244 | $cwd = $this->ftp->pwd(); |
245 | 245 | |
246 | - if ( $cwd ) { |
|
247 | - $cwd = trailingslashit( $cwd ); |
|
246 | + if ($cwd) { |
|
247 | + $cwd = trailingslashit($cwd); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | return $cwd; |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | * @param string $dir The new current directory. |
259 | 259 | * @return bool True on success, false on failure. |
260 | 260 | */ |
261 | - public function chdir( $dir ) { |
|
262 | - return $this->ftp->chdir( $dir ); |
|
261 | + public function chdir($dir) { |
|
262 | + return $this->ftp->chdir($dir); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -274,11 +274,11 @@ discard block |
||
274 | 274 | * Default false. |
275 | 275 | * @return bool True on success, false on failure. |
276 | 276 | */ |
277 | - public function chmod( $file, $mode = false, $recursive = false ) { |
|
278 | - if ( ! $mode ) { |
|
279 | - if ( $this->is_file( $file ) ) { |
|
277 | + public function chmod($file, $mode = false, $recursive = false) { |
|
278 | + if (!$mode) { |
|
279 | + if ($this->is_file($file)) { |
|
280 | 280 | $mode = FS_CHMOD_FILE; |
281 | - } elseif ( $this->is_dir( $file ) ) { |
|
281 | + } elseif ($this->is_dir($file)) { |
|
282 | 282 | $mode = FS_CHMOD_DIR; |
283 | 283 | } else { |
284 | 284 | return false; |
@@ -286,16 +286,16 @@ discard block |
||
286 | 286 | } |
287 | 287 | |
288 | 288 | // chmod any sub-objects if recursive. |
289 | - if ( $recursive && $this->is_dir( $file ) ) { |
|
290 | - $filelist = $this->dirlist( $file ); |
|
289 | + if ($recursive && $this->is_dir($file)) { |
|
290 | + $filelist = $this->dirlist($file); |
|
291 | 291 | |
292 | - foreach ( (array) $filelist as $filename => $filemeta ) { |
|
293 | - $this->chmod( $file . '/' . $filename, $mode, $recursive ); |
|
292 | + foreach ((array) $filelist as $filename => $filemeta) { |
|
293 | + $this->chmod($file . '/' . $filename, $mode, $recursive); |
|
294 | 294 | } |
295 | 295 | } |
296 | 296 | |
297 | 297 | // chmod the file or directory. |
298 | - return $this->ftp->chmod( $file, $mode ); |
|
298 | + return $this->ftp->chmod($file, $mode); |
|
299 | 299 | } |
300 | 300 | |
301 | 301 | /** |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | * @param string $file Path to the file. |
307 | 307 | * @return string|false Username of the owner on success, false on failure. |
308 | 308 | */ |
309 | - public function owner( $file ) { |
|
310 | - $dir = $this->dirlist( $file ); |
|
309 | + public function owner($file) { |
|
310 | + $dir = $this->dirlist($file); |
|
311 | 311 | |
312 | - return $dir[ $file ]['owner']; |
|
312 | + return $dir[$file]['owner']; |
|
313 | 313 | } |
314 | 314 | |
315 | 315 | /** |
@@ -320,10 +320,10 @@ discard block |
||
320 | 320 | * @param string $file Path to the file. |
321 | 321 | * @return string Mode of the file (the last 3 digits). |
322 | 322 | */ |
323 | - public function getchmod( $file ) { |
|
324 | - $dir = $this->dirlist( $file ); |
|
323 | + public function getchmod($file) { |
|
324 | + $dir = $this->dirlist($file); |
|
325 | 325 | |
326 | - return $dir[ $file ]['permsn']; |
|
326 | + return $dir[$file]['permsn']; |
|
327 | 327 | } |
328 | 328 | |
329 | 329 | /** |
@@ -334,10 +334,10 @@ discard block |
||
334 | 334 | * @param string $file Path to the file. |
335 | 335 | * @return string|false The group on success, false on failure. |
336 | 336 | */ |
337 | - public function group( $file ) { |
|
338 | - $dir = $this->dirlist( $file ); |
|
337 | + public function group($file) { |
|
338 | + $dir = $this->dirlist($file); |
|
339 | 339 | |
340 | - return $dir[ $file ]['group']; |
|
340 | + return $dir[$file]['group']; |
|
341 | 341 | } |
342 | 342 | |
343 | 343 | /** |
@@ -353,18 +353,18 @@ discard block |
||
353 | 353 | * 0755 for dirs. Default false. |
354 | 354 | * @return bool True on success, false on failure. |
355 | 355 | */ |
356 | - public function copy( $source, $destination, $overwrite = false, $mode = false ) { |
|
357 | - if ( ! $overwrite && $this->exists( $destination ) ) { |
|
356 | + public function copy($source, $destination, $overwrite = false, $mode = false) { |
|
357 | + if (!$overwrite && $this->exists($destination)) { |
|
358 | 358 | return false; |
359 | 359 | } |
360 | 360 | |
361 | - $content = $this->get_contents( $source ); |
|
361 | + $content = $this->get_contents($source); |
|
362 | 362 | |
363 | - if ( false === $content ) { |
|
363 | + if (false === $content) { |
|
364 | 364 | return false; |
365 | 365 | } |
366 | 366 | |
367 | - return $this->put_contents( $destination, $content, $mode ); |
|
367 | + return $this->put_contents($destination, $content, $mode); |
|
368 | 368 | } |
369 | 369 | |
370 | 370 | /** |
@@ -378,8 +378,8 @@ discard block |
||
378 | 378 | * Default false. |
379 | 379 | * @return bool True on success, false on failure. |
380 | 380 | */ |
381 | - public function move( $source, $destination, $overwrite = false ) { |
|
382 | - return $this->ftp->rename( $source, $destination ); |
|
381 | + public function move($source, $destination, $overwrite = false) { |
|
382 | + return $this->ftp->rename($source, $destination); |
|
383 | 383 | } |
384 | 384 | |
385 | 385 | /** |
@@ -394,20 +394,20 @@ discard block |
||
394 | 394 | * Default false. |
395 | 395 | * @return bool True on success, false on failure. |
396 | 396 | */ |
397 | - public function delete( $file, $recursive = false, $type = false ) { |
|
398 | - if ( empty( $file ) ) { |
|
397 | + public function delete($file, $recursive = false, $type = false) { |
|
398 | + if (empty($file)) { |
|
399 | 399 | return false; |
400 | 400 | } |
401 | 401 | |
402 | - if ( 'f' === $type || $this->is_file( $file ) ) { |
|
403 | - return $this->ftp->delete( $file ); |
|
402 | + if ('f' === $type || $this->is_file($file)) { |
|
403 | + return $this->ftp->delete($file); |
|
404 | 404 | } |
405 | 405 | |
406 | - if ( ! $recursive ) { |
|
407 | - return $this->ftp->rmdir( $file ); |
|
406 | + if (!$recursive) { |
|
407 | + return $this->ftp->rmdir($file); |
|
408 | 408 | } |
409 | 409 | |
410 | - return $this->ftp->mdel( $file ); |
|
410 | + return $this->ftp->mdel($file); |
|
411 | 411 | } |
412 | 412 | |
413 | 413 | /** |
@@ -418,14 +418,14 @@ discard block |
||
418 | 418 | * @param string $file Path to file or directory. |
419 | 419 | * @return bool Whether $file exists or not. |
420 | 420 | */ |
421 | - public function exists( $file ) { |
|
422 | - $list = $this->ftp->nlist( $file ); |
|
421 | + public function exists($file) { |
|
422 | + $list = $this->ftp->nlist($file); |
|
423 | 423 | |
424 | - if ( empty( $list ) && $this->is_dir( $file ) ) { |
|
424 | + if (empty($list) && $this->is_dir($file)) { |
|
425 | 425 | return true; // File is an empty directory. |
426 | 426 | } |
427 | 427 | |
428 | - return ! empty( $list ); // Empty list = no file, so invert. |
|
428 | + return !empty($list); // Empty list = no file, so invert. |
|
429 | 429 | // Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server. |
430 | 430 | } |
431 | 431 | |
@@ -437,12 +437,12 @@ discard block |
||
437 | 437 | * @param string $file File path. |
438 | 438 | * @return bool Whether $file is a file. |
439 | 439 | */ |
440 | - public function is_file( $file ) { |
|
441 | - if ( $this->is_dir( $file ) ) { |
|
440 | + public function is_file($file) { |
|
441 | + if ($this->is_dir($file)) { |
|
442 | 442 | return false; |
443 | 443 | } |
444 | 444 | |
445 | - if ( $this->exists( $file ) ) { |
|
445 | + if ($this->exists($file)) { |
|
446 | 446 | return true; |
447 | 447 | } |
448 | 448 | |
@@ -457,11 +457,11 @@ discard block |
||
457 | 457 | * @param string $path Directory path. |
458 | 458 | * @return bool Whether $path is a directory. |
459 | 459 | */ |
460 | - public function is_dir( $path ) { |
|
460 | + public function is_dir($path) { |
|
461 | 461 | $cwd = $this->cwd(); |
462 | 462 | |
463 | - if ( $this->chdir( $path ) ) { |
|
464 | - $this->chdir( $cwd ); |
|
463 | + if ($this->chdir($path)) { |
|
464 | + $this->chdir($cwd); |
|
465 | 465 | return true; |
466 | 466 | } |
467 | 467 | |
@@ -476,7 +476,7 @@ discard block |
||
476 | 476 | * @param string $file Path to file. |
477 | 477 | * @return bool Whether $file is readable. |
478 | 478 | */ |
479 | - public function is_readable( $file ) { |
|
479 | + public function is_readable($file) { |
|
480 | 480 | return true; |
481 | 481 | } |
482 | 482 | |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * @param string $file Path to file or directory. |
489 | 489 | * @return bool Whether $file is writable. |
490 | 490 | */ |
491 | - public function is_writable( $file ) { |
|
491 | + public function is_writable($file) { |
|
492 | 492 | return true; |
493 | 493 | } |
494 | 494 | |
@@ -500,7 +500,7 @@ discard block |
||
500 | 500 | * @param string $file Path to file. |
501 | 501 | * @return int|false Unix timestamp representing last access time, false on failure. |
502 | 502 | */ |
503 | - public function atime( $file ) { |
|
503 | + public function atime($file) { |
|
504 | 504 | return false; |
505 | 505 | } |
506 | 506 | |
@@ -512,8 +512,8 @@ discard block |
||
512 | 512 | * @param string $file Path to file. |
513 | 513 | * @return int|false Unix timestamp representing modification time, false on failure. |
514 | 514 | */ |
515 | - public function mtime( $file ) { |
|
516 | - return $this->ftp->mdtm( $file ); |
|
515 | + public function mtime($file) { |
|
516 | + return $this->ftp->mdtm($file); |
|
517 | 517 | } |
518 | 518 | |
519 | 519 | /** |
@@ -524,8 +524,8 @@ discard block |
||
524 | 524 | * @param string $file Path to file. |
525 | 525 | * @return int|false Size of the file in bytes on success, false on failure. |
526 | 526 | */ |
527 | - public function size( $file ) { |
|
528 | - return $this->ftp->filesize( $file ); |
|
527 | + public function size($file) { |
|
528 | + return $this->ftp->filesize($file); |
|
529 | 529 | } |
530 | 530 | |
531 | 531 | /** |
@@ -542,7 +542,7 @@ discard block |
||
542 | 542 | * Default 0. |
543 | 543 | * @return bool True on success, false on failure. |
544 | 544 | */ |
545 | - public function touch( $file, $time = 0, $atime = 0 ) { |
|
545 | + public function touch($file, $time = 0, $atime = 0) { |
|
546 | 546 | return false; |
547 | 547 | } |
548 | 548 | |
@@ -560,22 +560,22 @@ discard block |
||
560 | 560 | * Default false. |
561 | 561 | * @return bool True on success, false on failure. |
562 | 562 | */ |
563 | - public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) { |
|
564 | - $path = untrailingslashit( $path ); |
|
563 | + public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) { |
|
564 | + $path = untrailingslashit($path); |
|
565 | 565 | |
566 | - if ( empty( $path ) ) { |
|
566 | + if (empty($path)) { |
|
567 | 567 | return false; |
568 | 568 | } |
569 | 569 | |
570 | - if ( ! $this->ftp->mkdir( $path ) ) { |
|
570 | + if (!$this->ftp->mkdir($path)) { |
|
571 | 571 | return false; |
572 | 572 | } |
573 | 573 | |
574 | - if ( ! $chmod ) { |
|
574 | + if (!$chmod) { |
|
575 | 575 | $chmod = FS_CHMOD_DIR; |
576 | 576 | } |
577 | 577 | |
578 | - $this->chmod( $path, $chmod ); |
|
578 | + $this->chmod($path, $chmod); |
|
579 | 579 | |
580 | 580 | return true; |
581 | 581 | } |
@@ -590,8 +590,8 @@ discard block |
||
590 | 590 | * Default false. |
591 | 591 | * @return bool True on success, false on failure. |
592 | 592 | */ |
593 | - public function rmdir( $path, $recursive = false ) { |
|
594 | - return $this->delete( $path, $recursive ); |
|
593 | + public function rmdir($path, $recursive = false) { |
|
594 | + return $this->delete($path, $recursive); |
|
595 | 595 | } |
596 | 596 | |
597 | 597 | /** |
@@ -619,19 +619,19 @@ discard block |
||
619 | 619 | * @type mixed $files If a directory and `$recursive` is true, contains another array of files. |
620 | 620 | * } |
621 | 621 | */ |
622 | - public function dirlist( $path = '.', $include_hidden = true, $recursive = false ) { |
|
623 | - if ( $this->is_file( $path ) ) { |
|
624 | - $limit_file = basename( $path ); |
|
625 | - $path = dirname( $path ) . '/'; |
|
622 | + public function dirlist($path = '.', $include_hidden = true, $recursive = false) { |
|
623 | + if ($this->is_file($path)) { |
|
624 | + $limit_file = basename($path); |
|
625 | + $path = dirname($path) . '/'; |
|
626 | 626 | } else { |
627 | 627 | $limit_file = false; |
628 | 628 | } |
629 | 629 | |
630 | 630 | mbstring_binary_safe_encoding(); |
631 | 631 | |
632 | - $list = $this->ftp->dirlist( $path ); |
|
632 | + $list = $this->ftp->dirlist($path); |
|
633 | 633 | |
634 | - if ( empty( $list ) && ! $this->exists( $path ) ) { |
|
634 | + if (empty($list) && !$this->exists($path)) { |
|
635 | 635 | |
636 | 636 | reset_mbstring_encoding(); |
637 | 637 | |
@@ -640,37 +640,37 @@ discard block |
||
640 | 640 | |
641 | 641 | $ret = array(); |
642 | 642 | |
643 | - foreach ( $list as $struc ) { |
|
643 | + foreach ($list as $struc) { |
|
644 | 644 | |
645 | - if ( '.' === $struc['name'] || '..' === $struc['name'] ) { |
|
645 | + if ('.' === $struc['name'] || '..' === $struc['name']) { |
|
646 | 646 | continue; |
647 | 647 | } |
648 | 648 | |
649 | - if ( ! $include_hidden && '.' === $struc['name'][0] ) { |
|
649 | + if (!$include_hidden && '.' === $struc['name'][0]) { |
|
650 | 650 | continue; |
651 | 651 | } |
652 | 652 | |
653 | - if ( $limit_file && $struc['name'] !== $limit_file ) { |
|
653 | + if ($limit_file && $struc['name'] !== $limit_file) { |
|
654 | 654 | continue; |
655 | 655 | } |
656 | 656 | |
657 | - if ( 'd' === $struc['type'] ) { |
|
658 | - if ( $recursive ) { |
|
659 | - $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive ); |
|
657 | + if ('d' === $struc['type']) { |
|
658 | + if ($recursive) { |
|
659 | + $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive); |
|
660 | 660 | } else { |
661 | 661 | $struc['files'] = array(); |
662 | 662 | } |
663 | 663 | } |
664 | 664 | |
665 | 665 | // Replace symlinks formatted as "source -> target" with just the source name. |
666 | - if ( $struc['islink'] ) { |
|
667 | - $struc['name'] = preg_replace( '/(\s*->\s*.*)$/', '', $struc['name'] ); |
|
666 | + if ($struc['islink']) { |
|
667 | + $struc['name'] = preg_replace('/(\s*->\s*.*)$/', '', $struc['name']); |
|
668 | 668 | } |
669 | 669 | |
670 | 670 | // Add the octal representation of the file permissions. |
671 | - $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] ); |
|
671 | + $struc['permsn'] = $this->getnumchmodfromh($struc['perms']); |
|
672 | 672 | |
673 | - $ret[ $struc['name'] ] = $struc; |
|
673 | + $ret[$struc['name']] = $struc; |
|
674 | 674 | } |
675 | 675 | |
676 | 676 | reset_mbstring_encoding(); |
@@ -35,14 +35,14 @@ discard block |
||
35 | 35 | * |
36 | 36 | * @param array $args An associative array of arguments. |
37 | 37 | */ |
38 | - public function __construct( $args = array() ) { |
|
38 | + public function __construct($args = array()) { |
|
39 | 39 | global $post_type, $taxonomy, $action, $tax; |
40 | 40 | |
41 | 41 | parent::__construct( |
42 | 42 | array( |
43 | 43 | 'plural' => 'tags', |
44 | 44 | 'singular' => 'tag', |
45 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
45 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
46 | 46 | ) |
47 | 47 | ); |
48 | 48 | |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | $post_type = $this->screen->post_type; |
51 | 51 | $taxonomy = $this->screen->taxonomy; |
52 | 52 | |
53 | - if ( empty( $taxonomy ) ) { |
|
53 | + if (empty($taxonomy)) { |
|
54 | 54 | $taxonomy = 'post_tag'; |
55 | 55 | } |
56 | 56 | |
57 | - if ( ! taxonomy_exists( $taxonomy ) ) { |
|
58 | - wp_die( __( 'Invalid taxonomy.' ) ); |
|
57 | + if (!taxonomy_exists($taxonomy)) { |
|
58 | + wp_die(__('Invalid taxonomy.')); |
|
59 | 59 | } |
60 | 60 | |
61 | - $tax = get_taxonomy( $taxonomy ); |
|
61 | + $tax = get_taxonomy($taxonomy); |
|
62 | 62 | |
63 | 63 | // @todo Still needed? Maybe just the show_ui part. |
64 | - if ( empty( $post_type ) || ! in_array( $post_type, get_post_types( array( 'show_ui' => true ) ), true ) ) { |
|
64 | + if (empty($post_type) || !in_array($post_type, get_post_types(array('show_ui' => true)), true)) { |
|
65 | 65 | $post_type = 'post'; |
66 | 66 | } |
67 | 67 | |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | * @return bool |
72 | 72 | */ |
73 | 73 | public function ajax_user_can() { |
74 | - return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms ); |
|
74 | + return current_user_can(get_taxonomy($this->screen->taxonomy)->cap->manage_terms); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | /** |
@@ -79,9 +79,9 @@ discard block |
||
79 | 79 | public function prepare_items() { |
80 | 80 | $taxonomy = $this->screen->taxonomy; |
81 | 81 | |
82 | - $tags_per_page = $this->get_items_per_page( "edit_{$taxonomy}_per_page" ); |
|
82 | + $tags_per_page = $this->get_items_per_page("edit_{$taxonomy}_per_page"); |
|
83 | 83 | |
84 | - if ( 'post_tag' === $taxonomy ) { |
|
84 | + if ('post_tag' === $taxonomy) { |
|
85 | 85 | /** |
86 | 86 | * Filters the number of terms displayed per page for the Tags list table. |
87 | 87 | * |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | * |
90 | 90 | * @param int $tags_per_page Number of tags to be displayed. Default 20. |
91 | 91 | */ |
92 | - $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page ); |
|
92 | + $tags_per_page = apply_filters('edit_tags_per_page', $tags_per_page); |
|
93 | 93 | |
94 | 94 | /** |
95 | 95 | * Filters the number of terms displayed per page for the Tags list table. |
@@ -99,8 +99,8 @@ discard block |
||
99 | 99 | * |
100 | 100 | * @param int $tags_per_page Number of tags to be displayed. Default 20. |
101 | 101 | */ |
102 | - $tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' ); |
|
103 | - } elseif ( 'category' === $taxonomy ) { |
|
102 | + $tags_per_page = apply_filters_deprecated('tagsperpage', array($tags_per_page), '2.8.0', 'edit_tags_per_page'); |
|
103 | + } elseif ('category' === $taxonomy) { |
|
104 | 104 | /** |
105 | 105 | * Filters the number of terms displayed per page for the Categories list table. |
106 | 106 | * |
@@ -108,10 +108,10 @@ discard block |
||
108 | 108 | * |
109 | 109 | * @param int $tags_per_page Number of categories to be displayed. Default 20. |
110 | 110 | */ |
111 | - $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page ); |
|
111 | + $tags_per_page = apply_filters('edit_categories_per_page', $tags_per_page); |
|
112 | 112 | } |
113 | 113 | |
114 | - $search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : ''; |
|
114 | + $search = !empty($_REQUEST['s']) ? trim(wp_unslash($_REQUEST['s'])) : ''; |
|
115 | 115 | |
116 | 116 | $args = array( |
117 | 117 | 'taxonomy' => $taxonomy, |
@@ -121,26 +121,26 @@ discard block |
||
121 | 121 | 'hide_empty' => 0, |
122 | 122 | ); |
123 | 123 | |
124 | - if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
125 | - $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) ); |
|
124 | + if (!empty($_REQUEST['orderby'])) { |
|
125 | + $args['orderby'] = trim(wp_unslash($_REQUEST['orderby'])); |
|
126 | 126 | } |
127 | 127 | |
128 | - if ( ! empty( $_REQUEST['order'] ) ) { |
|
129 | - $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) ); |
|
128 | + if (!empty($_REQUEST['order'])) { |
|
129 | + $args['order'] = trim(wp_unslash($_REQUEST['order'])); |
|
130 | 130 | } |
131 | 131 | |
132 | - $args['offset'] = ( $args['page'] - 1 ) * $args['number']; |
|
132 | + $args['offset'] = ($args['page'] - 1) * $args['number']; |
|
133 | 133 | |
134 | 134 | // Save the values because 'number' and 'offset' can be subsequently overridden. |
135 | 135 | $this->callback_args = $args; |
136 | 136 | |
137 | - if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) { |
|
137 | + if (is_taxonomy_hierarchical($taxonomy) && !isset($args['orderby'])) { |
|
138 | 138 | // We'll need the full set of terms then. |
139 | 139 | $args['number'] = 0; |
140 | 140 | $args['offset'] = $args['number']; |
141 | 141 | } |
142 | 142 | |
143 | - $this->items = get_terms( $args ); |
|
143 | + $this->items = get_terms($args); |
|
144 | 144 | |
145 | 145 | $this->set_pagination_args( |
146 | 146 | array( |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | /** |
159 | 159 | */ |
160 | 160 | public function no_items() { |
161 | - echo get_taxonomy( $this->screen->taxonomy )->labels->not_found; |
|
161 | + echo get_taxonomy($this->screen->taxonomy)->labels->not_found; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | /** |
@@ -167,8 +167,8 @@ discard block |
||
167 | 167 | protected function get_bulk_actions() { |
168 | 168 | $actions = array(); |
169 | 169 | |
170 | - if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) ) { |
|
171 | - $actions['delete'] = __( 'Delete' ); |
|
170 | + if (current_user_can(get_taxonomy($this->screen->taxonomy)->cap->delete_terms)) { |
|
171 | + $actions['delete'] = __('Delete'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | return $actions; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | * @return string |
179 | 179 | */ |
180 | 180 | public function current_action() { |
181 | - if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && 'delete' === $_REQUEST['action'] ) { |
|
181 | + if (isset($_REQUEST['action']) && isset($_REQUEST['delete_tags']) && 'delete' === $_REQUEST['action']) { |
|
182 | 182 | return 'bulk-delete'; |
183 | 183 | } |
184 | 184 | |
@@ -191,15 +191,15 @@ discard block |
||
191 | 191 | public function get_columns() { |
192 | 192 | $columns = array( |
193 | 193 | 'cb' => '<input type="checkbox" />', |
194 | - 'name' => _x( 'Name', 'term name' ), |
|
195 | - 'description' => __( 'Description' ), |
|
196 | - 'slug' => __( 'Slug' ), |
|
194 | + 'name' => _x('Name', 'term name'), |
|
195 | + 'description' => __('Description'), |
|
196 | + 'slug' => __('Slug'), |
|
197 | 197 | ); |
198 | 198 | |
199 | - if ( 'link_category' === $this->screen->taxonomy ) { |
|
200 | - $columns['links'] = __( 'Links' ); |
|
199 | + if ('link_category' === $this->screen->taxonomy) { |
|
200 | + $columns['links'] = __('Links'); |
|
201 | 201 | } else { |
202 | - $columns['posts'] = _x( 'Count', 'Number/count of items' ); |
|
202 | + $columns['posts'] = _x('Count', 'Number/count of items'); |
|
203 | 203 | } |
204 | 204 | |
205 | 205 | return $columns; |
@@ -229,28 +229,28 @@ discard block |
||
229 | 229 | // Convert it to table rows. |
230 | 230 | $count = 0; |
231 | 231 | |
232 | - if ( empty( $this->items ) || ! is_array( $this->items ) ) { |
|
232 | + if (empty($this->items) || !is_array($this->items)) { |
|
233 | 233 | echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">'; |
234 | 234 | $this->no_items(); |
235 | 235 | echo '</td></tr>'; |
236 | 236 | return; |
237 | 237 | } |
238 | 238 | |
239 | - if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $this->callback_args['orderby'] ) ) { |
|
240 | - if ( ! empty( $this->callback_args['search'] ) ) {// Ignore children on searches. |
|
239 | + if (is_taxonomy_hierarchical($taxonomy) && !isset($this->callback_args['orderby'])) { |
|
240 | + if (!empty($this->callback_args['search'])) {// Ignore children on searches. |
|
241 | 241 | $children = array(); |
242 | 242 | } else { |
243 | - $children = _get_term_hierarchy( $taxonomy ); |
|
243 | + $children = _get_term_hierarchy($taxonomy); |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /* |
247 | 247 | * Some funky recursion to get the job done (paging & parents mainly) is contained within. |
248 | 248 | * Skip it for non-hierarchical taxonomies for performance sake. |
249 | 249 | */ |
250 | - $this->_rows( $taxonomy, $this->items, $children, $offset, $number, $count ); |
|
250 | + $this->_rows($taxonomy, $this->items, $children, $offset, $number, $count); |
|
251 | 251 | } else { |
252 | - foreach ( $this->items as $term ) { |
|
253 | - $this->single_row( $term ); |
|
252 | + foreach ($this->items as $term) { |
|
253 | + $this->single_row($term); |
|
254 | 254 | } |
255 | 255 | } |
256 | 256 | } |
@@ -265,60 +265,60 @@ discard block |
||
265 | 265 | * @param int $parent_term |
266 | 266 | * @param int $level |
267 | 267 | */ |
268 | - private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent_term = 0, $level = 0 ) { |
|
268 | + private function _rows($taxonomy, $terms, &$children, $start, $per_page, &$count, $parent_term = 0, $level = 0) { |
|
269 | 269 | |
270 | 270 | $end = $start + $per_page; |
271 | 271 | |
272 | - foreach ( $terms as $key => $term ) { |
|
272 | + foreach ($terms as $key => $term) { |
|
273 | 273 | |
274 | - if ( $count >= $end ) { |
|
274 | + if ($count >= $end) { |
|
275 | 275 | break; |
276 | 276 | } |
277 | 277 | |
278 | - if ( $term->parent !== $parent_term && empty( $_REQUEST['s'] ) ) { |
|
278 | + if ($term->parent !== $parent_term && empty($_REQUEST['s'])) { |
|
279 | 279 | continue; |
280 | 280 | } |
281 | 281 | |
282 | 282 | // If the page starts in a subtree, print the parents. |
283 | - if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { |
|
283 | + if ($count === $start && $term->parent > 0 && empty($_REQUEST['s'])) { |
|
284 | 284 | $my_parents = array(); |
285 | 285 | $parent_ids = array(); |
286 | 286 | $p = $term->parent; |
287 | 287 | |
288 | - while ( $p ) { |
|
289 | - $my_parent = get_term( $p, $taxonomy ); |
|
288 | + while ($p) { |
|
289 | + $my_parent = get_term($p, $taxonomy); |
|
290 | 290 | $my_parents[] = $my_parent; |
291 | 291 | $p = $my_parent->parent; |
292 | 292 | |
293 | - if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops. |
|
293 | + if (in_array($p, $parent_ids, true)) { // Prevent parent loops. |
|
294 | 294 | break; |
295 | 295 | } |
296 | 296 | |
297 | 297 | $parent_ids[] = $p; |
298 | 298 | } |
299 | 299 | |
300 | - unset( $parent_ids ); |
|
300 | + unset($parent_ids); |
|
301 | 301 | |
302 | - $num_parents = count( $my_parents ); |
|
302 | + $num_parents = count($my_parents); |
|
303 | 303 | |
304 | - while ( $my_parent = array_pop( $my_parents ) ) { |
|
304 | + while ($my_parent = array_pop($my_parents)) { |
|
305 | 305 | echo "\t"; |
306 | - $this->single_row( $my_parent, $level - $num_parents ); |
|
306 | + $this->single_row($my_parent, $level - $num_parents); |
|
307 | 307 | $num_parents--; |
308 | 308 | } |
309 | 309 | } |
310 | 310 | |
311 | - if ( $count >= $start ) { |
|
311 | + if ($count >= $start) { |
|
312 | 312 | echo "\t"; |
313 | - $this->single_row( $term, $level ); |
|
313 | + $this->single_row($term, $level); |
|
314 | 314 | } |
315 | 315 | |
316 | 316 | ++$count; |
317 | 317 | |
318 | - unset( $terms[ $key ] ); |
|
318 | + unset($terms[$key]); |
|
319 | 319 | |
320 | - if ( isset( $children[ $term->term_id ] ) && empty( $_REQUEST['s'] ) ) { |
|
321 | - $this->_rows( $taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1 ); |
|
320 | + if (isset($children[$term->term_id]) && empty($_REQUEST['s'])) { |
|
321 | + $this->_rows($taxonomy, $terms, $children, $start, $per_page, $count, $term->term_id, $level + 1); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | } |
@@ -328,21 +328,21 @@ discard block |
||
328 | 328 | * @param WP_Term $tag Term object. |
329 | 329 | * @param int $level |
330 | 330 | */ |
331 | - public function single_row( $tag, $level = 0 ) { |
|
331 | + public function single_row($tag, $level = 0) { |
|
332 | 332 | global $taxonomy; |
333 | - $tag = sanitize_term( $tag, $taxonomy ); |
|
333 | + $tag = sanitize_term($tag, $taxonomy); |
|
334 | 334 | |
335 | 335 | $this->level = $level; |
336 | 336 | |
337 | - if ( $tag->parent ) { |
|
338 | - $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) ); |
|
337 | + if ($tag->parent) { |
|
338 | + $count = count(get_ancestors($tag->term_id, $taxonomy, 'taxonomy')); |
|
339 | 339 | $level = 'level-' . $count; |
340 | 340 | } else { |
341 | 341 | $level = 'level-0'; |
342 | 342 | } |
343 | 343 | |
344 | 344 | echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">'; |
345 | - $this->single_row_columns( $tag ); |
|
345 | + $this->single_row_columns($tag); |
|
346 | 346 | echo '</tr>'; |
347 | 347 | } |
348 | 348 | |
@@ -352,17 +352,17 @@ discard block |
||
352 | 352 | * @param WP_Term $item Term object. |
353 | 353 | * @return string |
354 | 354 | */ |
355 | - public function column_cb( $item ) { |
|
355 | + public function column_cb($item) { |
|
356 | 356 | // Restores the more descriptive, specific name for use within this method. |
357 | 357 | $tag = $item; |
358 | 358 | |
359 | - if ( current_user_can( 'delete_term', $tag->term_id ) ) { |
|
359 | + if (current_user_can('delete_term', $tag->term_id)) { |
|
360 | 360 | return sprintf( |
361 | 361 | '<label class="screen-reader-text" for="cb-select-%1$s">%2$s</label>' . |
362 | 362 | '<input type="checkbox" name="delete_tags[]" value="%1$s" id="cb-select-%1$s" />', |
363 | 363 | $tag->term_id, |
364 | 364 | /* translators: %s: Taxonomy term name. */ |
365 | - sprintf( __( 'Select %s' ), $tag->name ) |
|
365 | + sprintf(__('Select %s'), $tag->name) |
|
366 | 366 | ); |
367 | 367 | } |
368 | 368 | |
@@ -373,10 +373,10 @@ discard block |
||
373 | 373 | * @param WP_Term $tag Term object. |
374 | 374 | * @return string |
375 | 375 | */ |
376 | - public function column_name( $tag ) { |
|
376 | + public function column_name($tag) { |
|
377 | 377 | $taxonomy = $this->screen->taxonomy; |
378 | 378 | |
379 | - $pad = str_repeat( '— ', max( 0, $this->level ) ); |
|
379 | + $pad = str_repeat('— ', max(0, $this->level)); |
|
380 | 380 | |
381 | 381 | /** |
382 | 382 | * Filters display of the term name in the terms list table. |
@@ -391,25 +391,25 @@ discard block |
||
391 | 391 | * @param string $pad_tag_name The term name, padded if not top-level. |
392 | 392 | * @param WP_Term $tag Term object. |
393 | 393 | */ |
394 | - $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag ); |
|
394 | + $name = apply_filters('term_name', $pad . ' ' . $tag->name, $tag); |
|
395 | 395 | |
396 | - $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' ); |
|
396 | + $qe_data = get_term($tag->term_id, $taxonomy, OBJECT, 'edit'); |
|
397 | 397 | |
398 | 398 | $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; |
399 | 399 | |
400 | - $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ); |
|
400 | + $edit_link = get_edit_term_link($tag, $taxonomy, $this->screen->post_type); |
|
401 | 401 | |
402 | - if ( $edit_link ) { |
|
402 | + if ($edit_link) { |
|
403 | 403 | $edit_link = add_query_arg( |
404 | 404 | 'wp_http_referer', |
405 | - urlencode( wp_unslash( $uri ) ), |
|
405 | + urlencode(wp_unslash($uri)), |
|
406 | 406 | $edit_link |
407 | 407 | ); |
408 | - $name = sprintf( |
|
408 | + $name = sprintf( |
|
409 | 409 | '<a class="row-title" href="%s" aria-label="%s">%s</a>', |
410 | - esc_url( $edit_link ), |
|
410 | + esc_url($edit_link), |
|
411 | 411 | /* translators: %s: Taxonomy term name. */ |
412 | - esc_attr( sprintf( __( '“%s” (Edit)' ), $tag->name ) ), |
|
412 | + esc_attr(sprintf(__('“%s” (Edit)'), $tag->name)), |
|
413 | 413 | $name |
414 | 414 | ); |
415 | 415 | } |
@@ -423,7 +423,7 @@ discard block |
||
423 | 423 | $out .= '<div class="name">' . $qe_data->name . '</div>'; |
424 | 424 | |
425 | 425 | /** This filter is documented in wp-admin/edit-tag-form.php */ |
426 | - $out .= '<div class="slug">' . apply_filters( 'editable_slug', $qe_data->slug, $qe_data ) . '</div>'; |
|
426 | + $out .= '<div class="slug">' . apply_filters('editable_slug', $qe_data->slug, $qe_data) . '</div>'; |
|
427 | 427 | $out .= '<div class="parent">' . $qe_data->parent . '</div></div>'; |
428 | 428 | |
429 | 429 | return $out; |
@@ -452,58 +452,58 @@ discard block |
||
452 | 452 | * @return string Row actions output for terms, or an empty string |
453 | 453 | * if the current column is not the primary column. |
454 | 454 | */ |
455 | - protected function handle_row_actions( $item, $column_name, $primary ) { |
|
456 | - if ( $primary !== $column_name ) { |
|
455 | + protected function handle_row_actions($item, $column_name, $primary) { |
|
456 | + if ($primary !== $column_name) { |
|
457 | 457 | return ''; |
458 | 458 | } |
459 | 459 | |
460 | 460 | // Restores the more descriptive, specific name for use within this method. |
461 | 461 | $tag = $item; |
462 | 462 | $taxonomy = $this->screen->taxonomy; |
463 | - $tax = get_taxonomy( $taxonomy ); |
|
463 | + $tax = get_taxonomy($taxonomy); |
|
464 | 464 | $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; |
465 | 465 | |
466 | 466 | $edit_link = add_query_arg( |
467 | 467 | 'wp_http_referer', |
468 | - urlencode( wp_unslash( $uri ) ), |
|
469 | - get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ) |
|
468 | + urlencode(wp_unslash($uri)), |
|
469 | + get_edit_term_link($tag, $taxonomy, $this->screen->post_type) |
|
470 | 470 | ); |
471 | 471 | |
472 | 472 | $actions = array(); |
473 | 473 | |
474 | - if ( current_user_can( 'edit_term', $tag->term_id ) ) { |
|
474 | + if (current_user_can('edit_term', $tag->term_id)) { |
|
475 | 475 | $actions['edit'] = sprintf( |
476 | 476 | '<a href="%s" aria-label="%s">%s</a>', |
477 | - esc_url( $edit_link ), |
|
477 | + esc_url($edit_link), |
|
478 | 478 | /* translators: %s: Taxonomy term name. */ |
479 | - esc_attr( sprintf( __( 'Edit “%s”' ), $tag->name ) ), |
|
480 | - __( 'Edit' ) |
|
479 | + esc_attr(sprintf(__('Edit “%s”'), $tag->name)), |
|
480 | + __('Edit') |
|
481 | 481 | ); |
482 | 482 | $actions['inline hide-if-no-js'] = sprintf( |
483 | 483 | '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>', |
484 | 484 | /* translators: %s: Taxonomy term name. */ |
485 | - esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $tag->name ) ), |
|
486 | - __( 'Quick Edit' ) |
|
485 | + esc_attr(sprintf(__('Quick edit “%s” inline'), $tag->name)), |
|
486 | + __('Quick Edit') |
|
487 | 487 | ); |
488 | 488 | } |
489 | 489 | |
490 | - if ( current_user_can( 'delete_term', $tag->term_id ) ) { |
|
490 | + if (current_user_can('delete_term', $tag->term_id)) { |
|
491 | 491 | $actions['delete'] = sprintf( |
492 | 492 | '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>', |
493 | - wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ), |
|
493 | + wp_nonce_url("edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id), |
|
494 | 494 | /* translators: %s: Taxonomy term name. */ |
495 | - esc_attr( sprintf( __( 'Delete “%s”' ), $tag->name ) ), |
|
496 | - __( 'Delete' ) |
|
495 | + esc_attr(sprintf(__('Delete “%s”'), $tag->name)), |
|
496 | + __('Delete') |
|
497 | 497 | ); |
498 | 498 | } |
499 | 499 | |
500 | - if ( is_taxonomy_viewable( $tax ) ) { |
|
500 | + if (is_taxonomy_viewable($tax)) { |
|
501 | 501 | $actions['view'] = sprintf( |
502 | 502 | '<a href="%s" aria-label="%s">%s</a>', |
503 | - get_term_link( $tag ), |
|
503 | + get_term_link($tag), |
|
504 | 504 | /* translators: %s: Taxonomy term name. */ |
505 | - esc_attr( sprintf( __( 'View “%s” archive' ), $tag->name ) ), |
|
506 | - __( 'View' ) |
|
505 | + esc_attr(sprintf(__('View “%s” archive'), $tag->name)), |
|
506 | + __('View') |
|
507 | 507 | ); |
508 | 508 | } |
509 | 509 | |
@@ -518,7 +518,7 @@ discard block |
||
518 | 518 | * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
519 | 519 | * @param WP_Term $tag Term object. |
520 | 520 | */ |
521 | - $actions = apply_filters( 'tag_row_actions', $actions, $tag ); |
|
521 | + $actions = apply_filters('tag_row_actions', $actions, $tag); |
|
522 | 522 | |
523 | 523 | /** |
524 | 524 | * Filters the action links displayed for each term in the terms list table. |
@@ -536,20 +536,20 @@ discard block |
||
536 | 536 | * 'Edit', 'Quick Edit', 'Delete', and 'View'. |
537 | 537 | * @param WP_Term $tag Term object. |
538 | 538 | */ |
539 | - $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag ); |
|
539 | + $actions = apply_filters("{$taxonomy}_row_actions", $actions, $tag); |
|
540 | 540 | |
541 | - return $this->row_actions( $actions ); |
|
541 | + return $this->row_actions($actions); |
|
542 | 542 | } |
543 | 543 | |
544 | 544 | /** |
545 | 545 | * @param WP_Term $tag Term object. |
546 | 546 | * @return string |
547 | 547 | */ |
548 | - public function column_description( $tag ) { |
|
549 | - if ( $tag->description ) { |
|
548 | + public function column_description($tag) { |
|
549 | + if ($tag->description) { |
|
550 | 550 | return $tag->description; |
551 | 551 | } else { |
552 | - return '<span aria-hidden="true">—</span><span class="screen-reader-text">' . __( 'No description' ) . '</span>'; |
|
552 | + return '<span aria-hidden="true">—</span><span class="screen-reader-text">' . __('No description') . '</span>'; |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | |
@@ -557,27 +557,27 @@ discard block |
||
557 | 557 | * @param WP_Term $tag Term object. |
558 | 558 | * @return string |
559 | 559 | */ |
560 | - public function column_slug( $tag ) { |
|
560 | + public function column_slug($tag) { |
|
561 | 561 | /** This filter is documented in wp-admin/edit-tag-form.php */ |
562 | - return apply_filters( 'editable_slug', $tag->slug, $tag ); |
|
562 | + return apply_filters('editable_slug', $tag->slug, $tag); |
|
563 | 563 | } |
564 | 564 | |
565 | 565 | /** |
566 | 566 | * @param WP_Term $tag Term object. |
567 | 567 | * @return string |
568 | 568 | */ |
569 | - public function column_posts( $tag ) { |
|
570 | - $count = number_format_i18n( $tag->count ); |
|
569 | + public function column_posts($tag) { |
|
570 | + $count = number_format_i18n($tag->count); |
|
571 | 571 | |
572 | - $tax = get_taxonomy( $this->screen->taxonomy ); |
|
572 | + $tax = get_taxonomy($this->screen->taxonomy); |
|
573 | 573 | |
574 | - $ptype_object = get_post_type_object( $this->screen->post_type ); |
|
575 | - if ( ! $ptype_object->show_ui ) { |
|
574 | + $ptype_object = get_post_type_object($this->screen->post_type); |
|
575 | + if (!$ptype_object->show_ui) { |
|
576 | 576 | return $count; |
577 | 577 | } |
578 | 578 | |
579 | - if ( $tax->query_var ) { |
|
580 | - $args = array( $tax->query_var => $tag->slug ); |
|
579 | + if ($tax->query_var) { |
|
580 | + $args = array($tax->query_var => $tag->slug); |
|
581 | 581 | } else { |
582 | 582 | $args = array( |
583 | 583 | 'taxonomy' => $tax->name, |
@@ -585,25 +585,25 @@ discard block |
||
585 | 585 | ); |
586 | 586 | } |
587 | 587 | |
588 | - if ( 'post' !== $this->screen->post_type ) { |
|
588 | + if ('post' !== $this->screen->post_type) { |
|
589 | 589 | $args['post_type'] = $this->screen->post_type; |
590 | 590 | } |
591 | 591 | |
592 | - if ( 'attachment' === $this->screen->post_type ) { |
|
593 | - return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>"; |
|
592 | + if ('attachment' === $this->screen->post_type) { |
|
593 | + return "<a href='" . esc_url(add_query_arg($args, 'upload.php')) . "'>$count</a>"; |
|
594 | 594 | } |
595 | 595 | |
596 | - return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>"; |
|
596 | + return "<a href='" . esc_url(add_query_arg($args, 'edit.php')) . "'>$count</a>"; |
|
597 | 597 | } |
598 | 598 | |
599 | 599 | /** |
600 | 600 | * @param WP_Term $tag Term object. |
601 | 601 | * @return string |
602 | 602 | */ |
603 | - public function column_links( $tag ) { |
|
604 | - $count = number_format_i18n( $tag->count ); |
|
603 | + public function column_links($tag) { |
|
604 | + $count = number_format_i18n($tag->count); |
|
605 | 605 | |
606 | - if ( $count ) { |
|
606 | + if ($count) { |
|
607 | 607 | $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>"; |
608 | 608 | } |
609 | 609 | |
@@ -617,7 +617,7 @@ discard block |
||
617 | 617 | * @param string $column_name Name of the column. |
618 | 618 | * @return string |
619 | 619 | */ |
620 | - public function column_default( $item, $column_name ) { |
|
620 | + public function column_default($item, $column_name) { |
|
621 | 621 | /** |
622 | 622 | * Filters the displayed columns in the terms list table. |
623 | 623 | * |
@@ -635,7 +635,7 @@ discard block |
||
635 | 635 | * @param string $column_name Name of the column. |
636 | 636 | * @param int $term_id Term ID. |
637 | 637 | */ |
638 | - return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id ); |
|
638 | + return apply_filters("manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id); |
|
639 | 639 | } |
640 | 640 | |
641 | 641 | /** |
@@ -644,9 +644,9 @@ discard block |
||
644 | 644 | * @since 3.1.0 |
645 | 645 | */ |
646 | 646 | public function inline_edit() { |
647 | - $tax = get_taxonomy( $this->screen->taxonomy ); |
|
647 | + $tax = get_taxonomy($this->screen->taxonomy); |
|
648 | 648 | |
649 | - if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
649 | + if (!current_user_can($tax->cap->edit_terms)) { |
|
650 | 650 | return; |
651 | 651 | } |
652 | 652 | ?> |
@@ -659,16 +659,16 @@ discard block |
||
659 | 659 | <div class="inline-edit-wrapper"> |
660 | 660 | |
661 | 661 | <fieldset> |
662 | - <legend class="inline-edit-legend"><?php _e( 'Quick Edit' ); ?></legend> |
|
662 | + <legend class="inline-edit-legend"><?php _e('Quick Edit'); ?></legend> |
|
663 | 663 | <div class="inline-edit-col"> |
664 | 664 | <label> |
665 | - <span class="title"><?php _ex( 'Name', 'term name' ); ?></span> |
|
665 | + <span class="title"><?php _ex('Name', 'term name'); ?></span> |
|
666 | 666 | <span class="input-text-wrap"><input type="text" name="name" class="ptitle" value="" /></span> |
667 | 667 | </label> |
668 | 668 | |
669 | - <?php if ( ! global_terms_enabled() ) : ?> |
|
669 | + <?php if (!global_terms_enabled()) : ?> |
|
670 | 670 | <label> |
671 | - <span class="title"><?php _e( 'Slug' ); ?></span> |
|
671 | + <span class="title"><?php _e('Slug'); ?></span> |
|
672 | 672 | <span class="input-text-wrap"><input type="text" name="slug" class="ptitle" value="" /></span> |
673 | 673 | </label> |
674 | 674 | <?php endif; ?> |
@@ -684,26 +684,26 @@ discard block |
||
684 | 684 | 'posts' => true, |
685 | 685 | ); |
686 | 686 | |
687 | - list( $columns ) = $this->get_column_info(); |
|
687 | + list($columns) = $this->get_column_info(); |
|
688 | 688 | |
689 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
690 | - if ( isset( $core_columns[ $column_name ] ) ) { |
|
689 | + foreach ($columns as $column_name => $column_display_name) { |
|
690 | + if (isset($core_columns[$column_name])) { |
|
691 | 691 | continue; |
692 | 692 | } |
693 | 693 | |
694 | 694 | /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ |
695 | - do_action( 'quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy ); |
|
695 | + do_action('quick_edit_custom_box', $column_name, 'edit-tags', $this->screen->taxonomy); |
|
696 | 696 | } |
697 | 697 | ?> |
698 | 698 | |
699 | 699 | <div class="inline-edit-save submit"> |
700 | 700 | <button type="button" class="save button button-primary"><?php echo $tax->labels->update_item; ?></button> |
701 | - <button type="button" class="cancel button"><?php _e( 'Cancel' ); ?></button> |
|
701 | + <button type="button" class="cancel button"><?php _e('Cancel'); ?></button> |
|
702 | 702 | <span class="spinner"></span> |
703 | 703 | |
704 | - <?php wp_nonce_field( 'taxinlineeditnonce', '_inline_edit', false ); ?> |
|
705 | - <input type="hidden" name="taxonomy" value="<?php echo esc_attr( $this->screen->taxonomy ); ?>" /> |
|
706 | - <input type="hidden" name="post_type" value="<?php echo esc_attr( $this->screen->post_type ); ?>" /> |
|
704 | + <?php wp_nonce_field('taxinlineeditnonce', '_inline_edit', false); ?> |
|
705 | + <input type="hidden" name="taxonomy" value="<?php echo esc_attr($this->screen->taxonomy); ?>" /> |
|
706 | + <input type="hidden" name="post_type" value="<?php echo esc_attr($this->screen->post_type); ?>" /> |
|
707 | 707 | |
708 | 708 | <div class="notice notice-error notice-alt inline hidden"> |
709 | 709 | <p class="error"></p> |