Passed
Push — main ( 3c103b...7fe1f6 )
by TARIQ
44:23
created
brighty/wp-admin/includes/misc.php 2 patches
Indentation   +979 added lines, -979 removed lines patch added patch discarded remove patch
@@ -14,21 +14,21 @@  discard block
 block discarded – undo
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 );
18
-
19
-	/**
20
-	 * Filters whether Apache and mod_rewrite are present.
21
-	 *
22
-	 * This filter was previously used to force URL rewriting for other servers,
23
-	 * like nginx. Use the {@see 'got_url_rewrite'} filter in got_url_rewrite() instead.
24
-	 *
25
-	 * @since 2.5.0
26
-	 *
27
-	 * @see got_url_rewrite()
28
-	 *
29
-	 * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
30
-	 */
31
-	return apply_filters( 'got_rewrite', $got_rewrite );
17
+    $got_rewrite = apache_mod_loaded( 'mod_rewrite', true );
18
+
19
+    /**
20
+     * Filters whether Apache and mod_rewrite are present.
21
+     *
22
+     * This filter was previously used to force URL rewriting for other servers,
23
+     * like nginx. Use the {@see 'got_url_rewrite'} filter in got_url_rewrite() instead.
24
+     *
25
+     * @since 2.5.0
26
+     *
27
+     * @see got_url_rewrite()
28
+     *
29
+     * @param bool $got_rewrite Whether Apache and mod_rewrite are present.
30
+     */
31
+    return apply_filters( 'got_rewrite', $got_rewrite );
32 32
 }
33 33
 
34 34
 /**
@@ -43,16 +43,16 @@  discard block
 block discarded – undo
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() );
47
-
48
-	/**
49
-	 * Filters whether URL rewriting is available.
50
-	 *
51
-	 * @since 3.7.0
52
-	 *
53
-	 * @param bool $got_url_rewrite Whether URL rewriting is available.
54
-	 */
55
-	return apply_filters( 'got_url_rewrite', $got_url_rewrite );
46
+    $got_url_rewrite = ( got_mod_rewrite() || $GLOBALS['is_nginx'] || iis7_supports_permalinks() );
47
+
48
+    /**
49
+     * Filters whether URL rewriting is available.
50
+     *
51
+     * @since 3.7.0
52
+     *
53
+     * @param bool $got_url_rewrite Whether URL rewriting is available.
54
+     */
55
+    return apply_filters( 'got_url_rewrite', $got_url_rewrite );
56 56
 }
57 57
 
58 58
 /**
@@ -65,35 +65,35 @@  discard block
 block discarded – undo
65 65
  * @return string[] An array of strings from a file (.htaccess) from between BEGIN and END markers.
66 66
  */
67 67
 function extract_from_markers( $filename, $marker ) {
68
-	$result = array();
68
+    $result = array();
69 69
 
70
-	if ( ! file_exists( $filename ) ) {
71
-		return $result;
72
-	}
70
+    if ( ! file_exists( $filename ) ) {
71
+        return $result;
72
+    }
73 73
 
74
-	$markerdata = explode( "\n", implode( '', file( $filename ) ) );
74
+    $markerdata = explode( "\n", implode( '', file( $filename ) ) );
75 75
 
76
-	$state = false;
76
+    $state = false;
77 77
 
78
-	foreach ( $markerdata as $markerline ) {
79
-		if ( false !== strpos( $markerline, '# END ' . $marker ) ) {
80
-			$state = false;
81
-		}
78
+    foreach ( $markerdata as $markerline ) {
79
+        if ( false !== strpos( $markerline, '# END ' . $marker ) ) {
80
+            $state = false;
81
+        }
82 82
 
83
-		if ( $state ) {
84
-			if ( '#' === substr( $markerline, 0, 1 ) ) {
85
-				continue;
86
-			}
83
+        if ( $state ) {
84
+            if ( '#' === substr( $markerline, 0, 1 ) ) {
85
+                continue;
86
+            }
87 87
 
88
-			$result[] = $markerline;
89
-		}
88
+            $result[] = $markerline;
89
+        }
90 90
 
91
-		if ( false !== strpos( $markerline, '# BEGIN ' . $marker ) ) {
92
-			$state = true;
93
-		}
94
-	}
91
+        if ( false !== strpos( $markerline, '# BEGIN ' . $marker ) ) {
92
+            $state = true;
93
+        }
94
+    }
95 95
 
96
-	return $result;
96
+    return $result;
97 97
 }
98 98
 
99 99
 /**
@@ -111,139 +111,139 @@  discard block
 block discarded – undo
111 111
  * @return bool True on write success, false on failure.
112 112
  */
113 113
 function insert_with_markers( $filename, $marker, $insertion ) {
114
-	if ( ! file_exists( $filename ) ) {
115
-		if ( ! is_writable( dirname( $filename ) ) ) {
116
-			return false;
117
-		}
118
-
119
-		if ( ! touch( $filename ) ) {
120
-			return false;
121
-		}
122
-
123
-		// Make sure the file is created with a minimum set of permissions.
124
-		$perms = fileperms( $filename );
125
-
126
-		if ( $perms ) {
127
-			chmod( $filename, $perms | 0644 );
128
-		}
129
-	} elseif ( ! is_writable( $filename ) ) {
130
-		return false;
131
-	}
132
-
133
-	if ( ! is_array( $insertion ) ) {
134
-		$insertion = explode( "\n", $insertion );
135
-	}
136
-
137
-	$switched_locale = switch_to_locale( get_locale() );
138
-
139
-	$instructions = sprintf(
140
-		/* translators: 1: Marker. */
141
-		__(
142
-			'The directives (lines) between "BEGIN %1$s" and "END %1$s" are
114
+    if ( ! file_exists( $filename ) ) {
115
+        if ( ! is_writable( dirname( $filename ) ) ) {
116
+            return false;
117
+        }
118
+
119
+        if ( ! touch( $filename ) ) {
120
+            return false;
121
+        }
122
+
123
+        // Make sure the file is created with a minimum set of permissions.
124
+        $perms = fileperms( $filename );
125
+
126
+        if ( $perms ) {
127
+            chmod( $filename, $perms | 0644 );
128
+        }
129
+    } elseif ( ! is_writable( $filename ) ) {
130
+        return false;
131
+    }
132
+
133
+    if ( ! is_array( $insertion ) ) {
134
+        $insertion = explode( "\n", $insertion );
135
+    }
136
+
137
+    $switched_locale = switch_to_locale( get_locale() );
138
+
139
+    $instructions = sprintf(
140
+        /* translators: 1: Marker. */
141
+        __(
142
+            'The directives (lines) between "BEGIN %1$s" and "END %1$s" are
143 143
 dynamically generated, and should only be modified via WordPress filters.
144 144
 Any changes to the directives between these markers will be overwritten.'
145
-		),
146
-		$marker
147
-	);
148
-
149
-	$instructions = explode( "\n", $instructions );
150
-
151
-	foreach ( $instructions as $line => $text ) {
152
-		$instructions[ $line ] = '# ' . $text;
153
-	}
154
-
155
-	/**
156
-	 * Filters the inline instructions inserted before the dynamically generated content.
157
-	 *
158
-	 * @since 5.3.0
159
-	 *
160
-	 * @param string[] $instructions Array of lines with inline instructions.
161
-	 * @param string   $marker       The marker being inserted.
162
-	 */
163
-	$instructions = apply_filters( 'insert_with_markers_inline_instructions', $instructions, $marker );
164
-
165
-	if ( $switched_locale ) {
166
-		restore_previous_locale();
167
-	}
168
-
169
-	$insertion = array_merge( $instructions, $insertion );
170
-
171
-	$start_marker = "# BEGIN {$marker}";
172
-	$end_marker   = "# END {$marker}";
173
-
174
-	$fp = fopen( $filename, 'r+' );
175
-
176
-	if ( ! $fp ) {
177
-		return false;
178
-	}
179
-
180
-	// Attempt to get a lock. If the filesystem supports locking, this will block until the lock is acquired.
181
-	flock( $fp, LOCK_EX );
182
-
183
-	$lines = array();
184
-
185
-	while ( ! feof( $fp ) ) {
186
-		$lines[] = rtrim( fgets( $fp ), "\r\n" );
187
-	}
188
-
189
-	// Split out the existing file into the preceding lines, and those that appear after the marker.
190
-	$pre_lines        = array();
191
-	$post_lines       = array();
192
-	$existing_lines   = array();
193
-	$found_marker     = false;
194
-	$found_end_marker = false;
195
-
196
-	foreach ( $lines as $line ) {
197
-		if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) {
198
-			$found_marker = true;
199
-			continue;
200
-		} elseif ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) {
201
-			$found_end_marker = true;
202
-			continue;
203
-		}
204
-
205
-		if ( ! $found_marker ) {
206
-			$pre_lines[] = $line;
207
-		} elseif ( $found_marker && $found_end_marker ) {
208
-			$post_lines[] = $line;
209
-		} else {
210
-			$existing_lines[] = $line;
211
-		}
212
-	}
213
-
214
-	// Check to see if there was a change.
215
-	if ( $existing_lines === $insertion ) {
216
-		flock( $fp, LOCK_UN );
217
-		fclose( $fp );
218
-
219
-		return true;
220
-	}
221
-
222
-	// Generate the new file data.
223
-	$new_file_data = implode(
224
-		"\n",
225
-		array_merge(
226
-			$pre_lines,
227
-			array( $start_marker ),
228
-			$insertion,
229
-			array( $end_marker ),
230
-			$post_lines
231
-		)
232
-	);
233
-
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 );
237
-
238
-	if ( $bytes ) {
239
-		ftruncate( $fp, ftell( $fp ) );
240
-	}
241
-
242
-	fflush( $fp );
243
-	flock( $fp, LOCK_UN );
244
-	fclose( $fp );
245
-
246
-	return (bool) $bytes;
145
+        ),
146
+        $marker
147
+    );
148
+
149
+    $instructions = explode( "\n", $instructions );
150
+
151
+    foreach ( $instructions as $line => $text ) {
152
+        $instructions[ $line ] = '# ' . $text;
153
+    }
154
+
155
+    /**
156
+     * Filters the inline instructions inserted before the dynamically generated content.
157
+     *
158
+     * @since 5.3.0
159
+     *
160
+     * @param string[] $instructions Array of lines with inline instructions.
161
+     * @param string   $marker       The marker being inserted.
162
+     */
163
+    $instructions = apply_filters( 'insert_with_markers_inline_instructions', $instructions, $marker );
164
+
165
+    if ( $switched_locale ) {
166
+        restore_previous_locale();
167
+    }
168
+
169
+    $insertion = array_merge( $instructions, $insertion );
170
+
171
+    $start_marker = "# BEGIN {$marker}";
172
+    $end_marker   = "# END {$marker}";
173
+
174
+    $fp = fopen( $filename, 'r+' );
175
+
176
+    if ( ! $fp ) {
177
+        return false;
178
+    }
179
+
180
+    // Attempt to get a lock. If the filesystem supports locking, this will block until the lock is acquired.
181
+    flock( $fp, LOCK_EX );
182
+
183
+    $lines = array();
184
+
185
+    while ( ! feof( $fp ) ) {
186
+        $lines[] = rtrim( fgets( $fp ), "\r\n" );
187
+    }
188
+
189
+    // Split out the existing file into the preceding lines, and those that appear after the marker.
190
+    $pre_lines        = array();
191
+    $post_lines       = array();
192
+    $existing_lines   = array();
193
+    $found_marker     = false;
194
+    $found_end_marker = false;
195
+
196
+    foreach ( $lines as $line ) {
197
+        if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) {
198
+            $found_marker = true;
199
+            continue;
200
+        } elseif ( ! $found_end_marker && false !== strpos( $line, $end_marker ) ) {
201
+            $found_end_marker = true;
202
+            continue;
203
+        }
204
+
205
+        if ( ! $found_marker ) {
206
+            $pre_lines[] = $line;
207
+        } elseif ( $found_marker && $found_end_marker ) {
208
+            $post_lines[] = $line;
209
+        } else {
210
+            $existing_lines[] = $line;
211
+        }
212
+    }
213
+
214
+    // Check to see if there was a change.
215
+    if ( $existing_lines === $insertion ) {
216
+        flock( $fp, LOCK_UN );
217
+        fclose( $fp );
218
+
219
+        return true;
220
+    }
221
+
222
+    // Generate the new file data.
223
+    $new_file_data = implode(
224
+        "\n",
225
+        array_merge(
226
+            $pre_lines,
227
+            array( $start_marker ),
228
+            $insertion,
229
+            array( $end_marker ),
230
+            $post_lines
231
+        )
232
+    );
233
+
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 );
237
+
238
+    if ( $bytes ) {
239
+        ftruncate( $fp, ftell( $fp ) );
240
+    }
241
+
242
+    fflush( $fp );
243
+    flock( $fp, LOCK_UN );
244
+    fclose( $fp );
245
+
246
+    return (bool) $bytes;
247 247
 }
248 248
 
249 249
 /**
@@ -259,33 +259,33 @@  discard block
 block discarded – undo
259 259
  * @return bool|null True on write success, false on failure. Null in multisite.
260 260
  */
261 261
 function save_mod_rewrite_rules() {
262
-	global $wp_rewrite;
262
+    global $wp_rewrite;
263 263
 
264
-	if ( is_multisite() ) {
265
-		return;
266
-	}
264
+    if ( is_multisite() ) {
265
+        return;
266
+    }
267 267
 
268
-	// Ensure get_home_path() is declared.
269
-	require_once ABSPATH . 'wp-admin/includes/file.php';
268
+    // Ensure get_home_path() is declared.
269
+    require_once ABSPATH . 'wp-admin/includes/file.php';
270 270
 
271
-	$home_path     = get_home_path();
272
-	$htaccess_file = $home_path . '.htaccess';
271
+    $home_path     = get_home_path();
272
+    $htaccess_file = $home_path . '.htaccess';
273 273
 
274
-	/*
274
+    /*
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 )
280
-	) {
281
-		if ( got_mod_rewrite() ) {
282
-			$rules = explode( "\n", $wp_rewrite->mod_rewrite_rules() );
278
+    if ( ! file_exists( $htaccess_file ) && is_writable( $home_path ) && $wp_rewrite->using_mod_rewrite_permalinks()
279
+        || is_writable( $htaccess_file )
280
+    ) {
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 );
285
-		}
286
-	}
284
+            return insert_with_markers( $htaccess_file, 'WordPress', $rules );
285
+        }
286
+    }
287 287
 
288
-	return false;
288
+    return false;
289 289
 }
290 290
 
291 291
 /**
@@ -299,33 +299,33 @@  discard block
 block discarded – undo
299 299
  * @return bool|null True on write success, false on failure. Null in multisite.
300 300
  */
301 301
 function iis7_save_url_rewrite_rules() {
302
-	global $wp_rewrite;
302
+    global $wp_rewrite;
303 303
 
304
-	if ( is_multisite() ) {
305
-		return;
306
-	}
304
+    if ( is_multisite() ) {
305
+        return;
306
+    }
307 307
 
308
-	// Ensure get_home_path() is declared.
309
-	require_once ABSPATH . 'wp-admin/includes/file.php';
308
+    // Ensure get_home_path() is declared.
309
+    require_once ABSPATH . 'wp-admin/includes/file.php';
310 310
 
311
-	$home_path       = get_home_path();
312
-	$web_config_file = $home_path . 'web.config';
311
+    $home_path       = get_home_path();
312
+    $web_config_file = $home_path . 'web.config';
313 313
 
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 ) )
318
-	) {
319
-		$rule = $wp_rewrite->iis7_url_rewrite_rules( false );
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 ) )
318
+    ) {
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 );
323
-		} else {
324
-			return iis7_delete_rewrite_rule( $web_config_file );
325
-		}
326
-	}
321
+        if ( ! empty( $rule ) ) {
322
+            return iis7_add_rewrite_rule( $web_config_file, $rule );
323
+        } else {
324
+            return iis7_delete_rewrite_rule( $web_config_file );
325
+        }
326
+    }
327 327
 
328
-	return false;
328
+    return false;
329 329
 }
330 330
 
331 331
 /**
@@ -336,22 +336,22 @@  discard block
 block discarded – undo
336 336
  * @param string $file
337 337
  */
338 338
 function update_recently_edited( $file ) {
339
-	$oldfiles = (array) get_option( 'recently_edited' );
340
-
341
-	if ( $oldfiles ) {
342
-		$oldfiles   = array_reverse( $oldfiles );
343
-		$oldfiles[] = $file;
344
-		$oldfiles   = array_reverse( $oldfiles );
345
-		$oldfiles   = array_unique( $oldfiles );
346
-
347
-		if ( 5 < count( $oldfiles ) ) {
348
-			array_pop( $oldfiles );
349
-		}
350
-	} else {
351
-		$oldfiles[] = $file;
352
-	}
353
-
354
-	update_option( 'recently_edited', $oldfiles );
339
+    $oldfiles = (array) get_option( 'recently_edited' );
340
+
341
+    if ( $oldfiles ) {
342
+        $oldfiles   = array_reverse( $oldfiles );
343
+        $oldfiles[] = $file;
344
+        $oldfiles   = array_reverse( $oldfiles );
345
+        $oldfiles   = array_unique( $oldfiles );
346
+
347
+        if ( 5 < count( $oldfiles ) ) {
348
+            array_pop( $oldfiles );
349
+        }
350
+    } else {
351
+        $oldfiles[] = $file;
352
+    }
353
+
354
+    update_option( 'recently_edited', $oldfiles );
355 355
 }
356 356
 
357 357
 /**
@@ -364,20 +364,20 @@  discard block
 block discarded – undo
364 364
  * @return array Tree structure for listing theme files.
365 365
  */
366 366
 function wp_make_theme_file_tree( $allowed_files ) {
367
-	$tree_list = array();
367
+    $tree_list = array();
368 368
 
369
-	foreach ( $allowed_files as $file_name => $absolute_filename ) {
370
-		$list     = explode( '/', $file_name );
371
-		$last_dir = &$tree_list;
369
+    foreach ( $allowed_files as $file_name => $absolute_filename ) {
370
+        $list     = explode( '/', $file_name );
371
+        $last_dir = &$tree_list;
372 372
 
373
-		foreach ( $list as $dir ) {
374
-			$last_dir =& $last_dir[ $dir ];
375
-		}
373
+        foreach ( $list as $dir ) {
374
+            $last_dir =& $last_dir[ $dir ];
375
+        }
376 376
 
377
-		$last_dir = $file_name;
378
-	}
377
+        $last_dir = $file_name;
378
+    }
379 379
 
380
-	return $tree_list;
380
+    return $tree_list;
381 381
 }
382 382
 
383 383
 /**
@@ -396,20 +396,20 @@  discard block
 block discarded – undo
396 396
  * @param int          $index The aria-posinset for the current iteration.
397 397
  */
398 398
 function wp_print_theme_file_tree( $tree, $level = 2, $size = 1, $index = 1 ) {
399
-	global $relative_file, $stylesheet;
399
+    global $relative_file, $stylesheet;
400 400
 
401
-	if ( is_array( $tree ) ) {
402
-		$index = 0;
403
-		$size  = count( $tree );
401
+    if ( is_array( $tree ) ) {
402
+        $index = 0;
403
+        $size  = count( $tree );
404 404
 
405
-		foreach ( $tree as $label => $theme_file ) :
406
-			$index++;
405
+        foreach ( $tree as $label => $theme_file ) :
406
+            $index++;
407 407
 
408
-			if ( ! is_array( $theme_file ) ) {
409
-				wp_print_theme_file_tree( $theme_file, $level, $index, $size );
410
-				continue;
411
-			}
412
-			?>
408
+            if ( ! is_array( $theme_file ) ) {
409
+                wp_print_theme_file_tree( $theme_file, $level, $index, $size );
410
+                continue;
411
+            }
412
+            ?>
413 413
 			<li role="treeitem" aria-expanded="true" tabindex="-1"
414 414
 				aria-level="<?php echo esc_attr( $level ); ?>"
415 415
 				aria-setsize="<?php echo esc_attr( $size ); ?>"
@@ -418,17 +418,17 @@  discard block
 block discarded – undo
418 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
-		endforeach;
422
-	} else {
423
-		$filename = $tree;
424
-		$url      = add_query_arg(
425
-			array(
426
-				'file'  => rawurlencode( $tree ),
427
-				'theme' => rawurlencode( $stylesheet ),
428
-			),
429
-			self_admin_url( 'theme-editor.php' )
430
-		);
431
-		?>
421
+        endforeach;
422
+    } else {
423
+        $filename = $tree;
424
+        $url      = add_query_arg(
425
+            array(
426
+                'file'  => rawurlencode( $tree ),
427
+                'theme' => rawurlencode( $stylesheet ),
428
+            ),
429
+            self_admin_url( 'theme-editor.php' )
430
+        );
431
+        ?>
432 432
 		<li role="none" class="<?php echo esc_attr( $relative_file === $filename ? 'current-file' : '' ); ?>">
433 433
 			<a role="treeitem" tabindex="<?php echo esc_attr( $relative_file === $filename ? '0' : '-1' ); ?>"
434 434
 				href="<?php echo esc_url( $url ); ?>"
@@ -436,22 +436,22 @@  discard block
 block discarded – undo
436 436
 				aria-setsize="<?php echo esc_attr( $size ); ?>"
437 437
 				aria-posinset="<?php echo esc_attr( $index ); ?>">
438 438
 				<?php
439
-				$file_description = esc_html( get_file_description( $filename ) );
440
-
441
-				if ( $file_description !== $filename && wp_basename( $filename ) !== $file_description ) {
442
-					$file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>';
443
-				}
444
-
445
-				if ( $relative_file === $filename ) {
446
-					echo '<span class="notice notice-info">' . $file_description . '</span>';
447
-				} else {
448
-					echo $file_description;
449
-				}
450
-				?>
439
+                $file_description = esc_html( get_file_description( $filename ) );
440
+
441
+                if ( $file_description !== $filename && wp_basename( $filename ) !== $file_description ) {
442
+                    $file_description .= '<br /><span class="nonessential">(' . esc_html( $filename ) . ')</span>';
443
+                }
444
+
445
+                if ( $relative_file === $filename ) {
446
+                    echo '<span class="notice notice-info">' . $file_description . '</span>';
447
+                } else {
448
+                    echo $file_description;
449
+                }
450
+                ?>
451 451
 			</a>
452 452
 		</li>
453 453
 		<?php
454
-	}
454
+    }
455 455
 }
456 456
 
457 457
 /**
@@ -464,20 +464,20 @@  discard block
 block discarded – undo
464 464
  * @return array Tree structure for listing plugin files.
465 465
  */
466 466
 function wp_make_plugin_file_tree( $plugin_editable_files ) {
467
-	$tree_list = array();
467
+    $tree_list = array();
468 468
 
469
-	foreach ( $plugin_editable_files as $plugin_file ) {
470
-		$list     = explode( '/', preg_replace( '#^.+?/#', '', $plugin_file ) );
471
-		$last_dir = &$tree_list;
469
+    foreach ( $plugin_editable_files as $plugin_file ) {
470
+        $list     = explode( '/', preg_replace( '#^.+?/#', '', $plugin_file ) );
471
+        $last_dir = &$tree_list;
472 472
 
473
-		foreach ( $list as $dir ) {
474
-			$last_dir =& $last_dir[ $dir ];
475
-		}
473
+        foreach ( $list as $dir ) {
474
+            $last_dir =& $last_dir[ $dir ];
475
+        }
476 476
 
477
-		$last_dir = $plugin_file;
478
-	}
477
+        $last_dir = $plugin_file;
478
+    }
479 479
 
480
-	return $tree_list;
480
+    return $tree_list;
481 481
 }
482 482
 
483 483
 /**
@@ -493,20 +493,20 @@  discard block
 block discarded – undo
493 493
  * @param int          $index The aria-posinset for the current iteration.
494 494
  */
495 495
 function wp_print_plugin_file_tree( $tree, $label = '', $level = 2, $size = 1, $index = 1 ) {
496
-	global $file, $plugin;
496
+    global $file, $plugin;
497 497
 
498
-	if ( is_array( $tree ) ) {
499
-		$index = 0;
500
-		$size  = count( $tree );
498
+    if ( is_array( $tree ) ) {
499
+        $index = 0;
500
+        $size  = count( $tree );
501 501
 
502
-		foreach ( $tree as $label => $plugin_file ) :
503
-			$index++;
502
+        foreach ( $tree as $label => $plugin_file ) :
503
+            $index++;
504 504
 
505
-			if ( ! is_array( $plugin_file ) ) {
506
-				wp_print_plugin_file_tree( $plugin_file, $label, $level, $index, $size );
507
-				continue;
508
-			}
509
-			?>
505
+            if ( ! is_array( $plugin_file ) ) {
506
+                wp_print_plugin_file_tree( $plugin_file, $label, $level, $index, $size );
507
+                continue;
508
+            }
509
+            ?>
510 510
 			<li role="treeitem" aria-expanded="true" tabindex="-1"
511 511
 				aria-level="<?php echo esc_attr( $level ); ?>"
512 512
 				aria-setsize="<?php echo esc_attr( $size ); ?>"
@@ -515,16 +515,16 @@  discard block
 block discarded – undo
515 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
-		endforeach;
519
-	} else {
520
-		$url = add_query_arg(
521
-			array(
522
-				'file'   => rawurlencode( $tree ),
523
-				'plugin' => rawurlencode( $plugin ),
524
-			),
525
-			self_admin_url( 'plugin-editor.php' )
526
-		);
527
-		?>
518
+        endforeach;
519
+    } else {
520
+        $url = add_query_arg(
521
+            array(
522
+                'file'   => rawurlencode( $tree ),
523
+                'plugin' => rawurlencode( $plugin ),
524
+            ),
525
+            self_admin_url( 'plugin-editor.php' )
526
+        );
527
+        ?>
528 528
 		<li role="none" class="<?php echo esc_attr( $file === $tree ? 'current-file' : '' ); ?>">
529 529
 			<a role="treeitem" tabindex="<?php echo esc_attr( $file === $tree ? '0' : '-1' ); ?>"
530 530
 				href="<?php echo esc_url( $url ); ?>"
@@ -532,16 +532,16 @@  discard block
 block discarded – undo
532 532
 				aria-setsize="<?php echo esc_attr( $size ); ?>"
533 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>';
537
-				} else {
538
-					echo esc_html( $label );
539
-				}
540
-				?>
535
+                if ( $file === $tree ) {
536
+                    echo '<span class="notice notice-info">' . esc_html( $label ) . '</span>';
537
+                } else {
538
+                    echo esc_html( $label );
539
+                }
540
+                ?>
541 541
 			</a>
542 542
 		</li>
543 543
 		<?php
544
-	}
544
+    }
545 545
 }
546 546
 
547 547
 /**
@@ -553,15 +553,15 @@  discard block
 block discarded – undo
553 553
  * @param string $value
554 554
  */
555 555
 function update_home_siteurl( $old_value, $value ) {
556
-	if ( wp_installing() ) {
557
-		return;
558
-	}
559
-
560
-	if ( is_multisite() && ms_is_switched() ) {
561
-		delete_option( 'rewrite_rules' );
562
-	} else {
563
-		flush_rewrite_rules();
564
-	}
556
+    if ( wp_installing() ) {
557
+        return;
558
+    }
559
+
560
+    if ( is_multisite() && ms_is_switched() ) {
561
+        delete_option( 'rewrite_rules' );
562
+    } else {
563
+        flush_rewrite_rules();
564
+    }
565 565
 }
566 566
 
567 567
 
@@ -577,17 +577,17 @@  discard block
 block discarded – undo
577 577
  * @param array $vars An array of globals to reset.
578 578
  */
579 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
-			} else {
585
-				$GLOBALS[ $var ] = $_GET[ $var ];
586
-			}
587
-		} else {
588
-			$GLOBALS[ $var ] = $_POST[ $var ];
589
-		}
590
-	}
580
+    foreach ( $vars as $var ) {
581
+        if ( empty( $_POST[ $var ] ) ) {
582
+            if ( empty( $_GET[ $var ] ) ) {
583
+                $GLOBALS[ $var ] = '';
584
+            } else {
585
+                $GLOBALS[ $var ] = $_GET[ $var ];
586
+            }
587
+        } else {
588
+            $GLOBALS[ $var ] = $_POST[ $var ];
589
+        }
590
+    }
591 591
 }
592 592
 
593 593
 /**
@@ -598,17 +598,17 @@  discard block
 block discarded – undo
598 598
  * @param string|WP_Error $message
599 599
  */
600 600
 function show_message( $message ) {
601
-	if ( is_wp_error( $message ) ) {
602
-		if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) {
603
-			$message = $message->get_error_message() . ': ' . $message->get_error_data();
604
-		} else {
605
-			$message = $message->get_error_message();
606
-		}
607
-	}
608
-
609
-	echo "<p>$message</p>\n";
610
-	wp_ob_end_flush_all();
611
-	flush();
601
+    if ( is_wp_error( $message ) ) {
602
+        if ( $message->get_error_data() && is_string( $message->get_error_data() ) ) {
603
+            $message = $message->get_error_message() . ': ' . $message->get_error_data();
604
+        } else {
605
+            $message = $message->get_error_message();
606
+        }
607
+    }
608
+
609
+    echo "<p>$message</p>\n";
610
+    wp_ob_end_flush_all();
611
+    flush();
612 612
 }
613 613
 
614 614
 /**
@@ -618,62 +618,62 @@  discard block
 block discarded – undo
618 618
  * @return array
619 619
  */
620 620
 function wp_doc_link_parse( $content ) {
621
-	if ( ! is_string( $content ) || empty( $content ) ) {
622
-		return array();
623
-	}
624
-
625
-	if ( ! function_exists( 'token_get_all' ) ) {
626
-		return array();
627
-	}
628
-
629
-	$tokens           = token_get_all( $content );
630
-	$count            = count( $tokens );
631
-	$functions        = array();
632
-	$ignore_functions = array();
633
-
634
-	for ( $t = 0; $t < $count - 2; $t++ ) {
635
-		if ( ! is_array( $tokens[ $t ] ) ) {
636
-			continue;
637
-		}
638
-
639
-		if ( T_STRING === $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) {
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] )
643
-			) {
644
-				$ignore_functions[] = $tokens[ $t ][1];
645
-			}
646
-
647
-			// Add this to our stack of unique references.
648
-			$functions[] = $tokens[ $t ][1];
649
-		}
650
-	}
651
-
652
-	$functions = array_unique( $functions );
653
-	sort( $functions );
654
-
655
-	/**
656
-	 * Filters the list of functions and classes to be ignored from the documentation lookup.
657
-	 *
658
-	 * @since 2.8.0
659
-	 *
660
-	 * @param string[] $ignore_functions Array of names of functions and classes to be ignored.
661
-	 */
662
-	$ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
663
-
664
-	$ignore_functions = array_unique( $ignore_functions );
665
-
666
-	$out = array();
667
-
668
-	foreach ( $functions as $function ) {
669
-		if ( in_array( $function, $ignore_functions, true ) ) {
670
-			continue;
671
-		}
672
-
673
-		$out[] = $function;
674
-	}
675
-
676
-	return $out;
621
+    if ( ! is_string( $content ) || empty( $content ) ) {
622
+        return array();
623
+    }
624
+
625
+    if ( ! function_exists( 'token_get_all' ) ) {
626
+        return array();
627
+    }
628
+
629
+    $tokens           = token_get_all( $content );
630
+    $count            = count( $tokens );
631
+    $functions        = array();
632
+    $ignore_functions = array();
633
+
634
+    for ( $t = 0; $t < $count - 2; $t++ ) {
635
+        if ( ! is_array( $tokens[ $t ] ) ) {
636
+            continue;
637
+        }
638
+
639
+        if ( T_STRING === $tokens[ $t ][0] && ( '(' === $tokens[ $t + 1 ] || '(' === $tokens[ $t + 2 ] ) ) {
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] )
643
+            ) {
644
+                $ignore_functions[] = $tokens[ $t ][1];
645
+            }
646
+
647
+            // Add this to our stack of unique references.
648
+            $functions[] = $tokens[ $t ][1];
649
+        }
650
+    }
651
+
652
+    $functions = array_unique( $functions );
653
+    sort( $functions );
654
+
655
+    /**
656
+     * Filters the list of functions and classes to be ignored from the documentation lookup.
657
+     *
658
+     * @since 2.8.0
659
+     *
660
+     * @param string[] $ignore_functions Array of names of functions and classes to be ignored.
661
+     */
662
+    $ignore_functions = apply_filters( 'documentation_ignore_functions', $ignore_functions );
663
+
664
+    $ignore_functions = array_unique( $ignore_functions );
665
+
666
+    $out = array();
667
+
668
+    foreach ( $functions as $function ) {
669
+        if ( in_array( $function, $ignore_functions, true ) ) {
670
+            continue;
671
+        }
672
+
673
+        $out[] = $function;
674
+    }
675
+
676
+    return $out;
677 677
 }
678 678
 
679 679
 /**
@@ -682,122 +682,122 @@  discard block
 block discarded – undo
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'] ) ) {
686
-		return;
687
-	}
688
-
689
-	check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
690
-
691
-	$user = wp_get_current_user();
692
-
693
-	if ( ! $user ) {
694
-		return;
695
-	}
696
-
697
-	$option = $_POST['wp_screen_options']['option'];
698
-	$value  = $_POST['wp_screen_options']['value'];
699
-
700
-	if ( sanitize_key( $option ) !== $option ) {
701
-		return;
702
-	}
703
-
704
-	$map_option = $option;
705
-	$type       = str_replace( 'edit_', '', $map_option );
706
-	$type       = str_replace( '_per_page', '', $type );
707
-
708
-	if ( in_array( $type, get_taxonomies(), true ) ) {
709
-		$map_option = 'edit_tags_per_page';
710
-	} elseif ( in_array( $type, get_post_types(), true ) ) {
711
-		$map_option = 'edit_per_page';
712
-	} else {
713
-		$option = str_replace( '-', '_', $option );
714
-	}
715
-
716
-	switch ( $map_option ) {
717
-		case 'edit_per_page':
718
-		case 'users_per_page':
719
-		case 'edit_comments_per_page':
720
-		case 'upload_per_page':
721
-		case 'edit_tags_per_page':
722
-		case 'plugins_per_page':
723
-		case 'export_personal_data_requests_per_page':
724
-		case 'remove_personal_data_requests_per_page':
725
-			// Network admin.
726
-		case 'sites_network_per_page':
727
-		case 'users_network_per_page':
728
-		case 'site_users_network_per_page':
729
-		case 'plugins_network_per_page':
730
-		case 'themes_network_per_page':
731
-		case 'site_themes_network_per_page':
732
-			$value = (int) $value;
733
-
734
-			if ( $value < 1 || $value > 999 ) {
735
-				return;
736
-			}
737
-
738
-			break;
739
-
740
-		default:
741
-			$screen_option = false;
742
-
743
-			if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
744
-				/**
745
-				 * Filters a screen option value before it is set.
746
-				 *
747
-				 * The filter can also be used to modify non-standard [items]_per_page
748
-				 * settings. See the parent function for a full list of standard options.
749
-				 *
750
-				 * Returning false from the filter will skip saving the current option.
751
-				 *
752
-				 * @since 2.8.0
753
-				 * @since 5.4.2 Only applied to options ending with '_page',
754
-				 *              or the 'layout_columns' option.
755
-				 *
756
-				 * @see set_screen_options()
757
-				 *
758
-				 * @param mixed  $screen_option The value to save instead of the option value.
759
-				 *                              Default false (to skip saving the current option).
760
-				 * @param string $option        The option name.
761
-				 * @param int    $value         The option value.
762
-				 */
763
-				$screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
764
-			}
765
-
766
-			/**
767
-			 * Filters a screen option value before it is set.
768
-			 *
769
-			 * The dynamic portion of the hook name, `$option`, refers to the option name.
770
-			 *
771
-			 * Returning false from the filter will skip saving the current option.
772
-			 *
773
-			 * @since 5.4.2
774
-			 *
775
-			 * @see set_screen_options()
776
-			 *
777
-			 * @param mixed   $screen_option The value to save instead of the option value.
778
-			 *                               Default false (to skip saving the current option).
779
-			 * @param string  $option        The option name.
780
-			 * @param int     $value         The option value.
781
-			 */
782
-			$value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
783
-
784
-			if ( false === $value ) {
785
-				return;
786
-			}
787
-
788
-			break;
789
-	}
790
-
791
-	update_user_meta( $user->ID, $option, $value );
792
-
793
-	$url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() );
794
-
795
-	if ( isset( $_POST['mode'] ) ) {
796
-		$url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url );
797
-	}
798
-
799
-	wp_safe_redirect( $url );
800
-	exit;
685
+    if ( ! isset( $_POST['wp_screen_options'] ) || ! is_array( $_POST['wp_screen_options'] ) ) {
686
+        return;
687
+    }
688
+
689
+    check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' );
690
+
691
+    $user = wp_get_current_user();
692
+
693
+    if ( ! $user ) {
694
+        return;
695
+    }
696
+
697
+    $option = $_POST['wp_screen_options']['option'];
698
+    $value  = $_POST['wp_screen_options']['value'];
699
+
700
+    if ( sanitize_key( $option ) !== $option ) {
701
+        return;
702
+    }
703
+
704
+    $map_option = $option;
705
+    $type       = str_replace( 'edit_', '', $map_option );
706
+    $type       = str_replace( '_per_page', '', $type );
707
+
708
+    if ( in_array( $type, get_taxonomies(), true ) ) {
709
+        $map_option = 'edit_tags_per_page';
710
+    } elseif ( in_array( $type, get_post_types(), true ) ) {
711
+        $map_option = 'edit_per_page';
712
+    } else {
713
+        $option = str_replace( '-', '_', $option );
714
+    }
715
+
716
+    switch ( $map_option ) {
717
+        case 'edit_per_page':
718
+        case 'users_per_page':
719
+        case 'edit_comments_per_page':
720
+        case 'upload_per_page':
721
+        case 'edit_tags_per_page':
722
+        case 'plugins_per_page':
723
+        case 'export_personal_data_requests_per_page':
724
+        case 'remove_personal_data_requests_per_page':
725
+            // Network admin.
726
+        case 'sites_network_per_page':
727
+        case 'users_network_per_page':
728
+        case 'site_users_network_per_page':
729
+        case 'plugins_network_per_page':
730
+        case 'themes_network_per_page':
731
+        case 'site_themes_network_per_page':
732
+            $value = (int) $value;
733
+
734
+            if ( $value < 1 || $value > 999 ) {
735
+                return;
736
+            }
737
+
738
+            break;
739
+
740
+        default:
741
+            $screen_option = false;
742
+
743
+            if ( '_page' === substr( $option, -5 ) || 'layout_columns' === $option ) {
744
+                /**
745
+                 * Filters a screen option value before it is set.
746
+                 *
747
+                 * The filter can also be used to modify non-standard [items]_per_page
748
+                 * settings. See the parent function for a full list of standard options.
749
+                 *
750
+                 * Returning false from the filter will skip saving the current option.
751
+                 *
752
+                 * @since 2.8.0
753
+                 * @since 5.4.2 Only applied to options ending with '_page',
754
+                 *              or the 'layout_columns' option.
755
+                 *
756
+                 * @see set_screen_options()
757
+                 *
758
+                 * @param mixed  $screen_option The value to save instead of the option value.
759
+                 *                              Default false (to skip saving the current option).
760
+                 * @param string $option        The option name.
761
+                 * @param int    $value         The option value.
762
+                 */
763
+                $screen_option = apply_filters( 'set-screen-option', $screen_option, $option, $value ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
764
+            }
765
+
766
+            /**
767
+             * Filters a screen option value before it is set.
768
+             *
769
+             * The dynamic portion of the hook name, `$option`, refers to the option name.
770
+             *
771
+             * Returning false from the filter will skip saving the current option.
772
+             *
773
+             * @since 5.4.2
774
+             *
775
+             * @see set_screen_options()
776
+             *
777
+             * @param mixed   $screen_option The value to save instead of the option value.
778
+             *                               Default false (to skip saving the current option).
779
+             * @param string  $option        The option name.
780
+             * @param int     $value         The option value.
781
+             */
782
+            $value = apply_filters( "set_screen_option_{$option}", $screen_option, $option, $value );
783
+
784
+            if ( false === $value ) {
785
+                return;
786
+            }
787
+
788
+            break;
789
+    }
790
+
791
+    update_user_meta( $user->ID, $option, $value );
792
+
793
+    $url = remove_query_arg( array( 'pagenum', 'apage', 'paged' ), wp_get_referer() );
794
+
795
+    if ( isset( $_POST['mode'] ) ) {
796
+        $url = add_query_arg( array( 'mode' => $_POST['mode'] ), $url );
797
+    }
798
+
799
+    wp_safe_redirect( $url );
800
+    exit;
801 801
 }
802 802
 
803 803
 /**
@@ -809,28 +809,28 @@  discard block
 block discarded – undo
809 809
  * @return bool
810 810
  */
811 811
 function iis7_rewrite_rule_exists( $filename ) {
812
-	if ( ! file_exists( $filename ) ) {
813
-		return false;
814
-	}
812
+    if ( ! file_exists( $filename ) ) {
813
+        return false;
814
+    }
815 815
 
816
-	if ( ! class_exists( 'DOMDocument', false ) ) {
817
-		return false;
818
-	}
816
+    if ( ! class_exists( 'DOMDocument', false ) ) {
817
+        return false;
818
+    }
819 819
 
820
-	$doc = new DOMDocument();
820
+    $doc = new DOMDocument();
821 821
 
822
-	if ( $doc->load( $filename ) === false ) {
823
-		return false;
824
-	}
822
+    if ( $doc->load( $filename ) === false ) {
823
+        return false;
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 ) {
830
-		return false;
831
-	}
829
+    if ( 0 === $rules->length ) {
830
+        return false;
831
+    }
832 832
 
833
-	return true;
833
+    return true;
834 834
 }
835 835
 
836 836
 /**
@@ -842,34 +842,34 @@  discard block
 block discarded – undo
842 842
  * @return bool
843 843
  */
844 844
 function iis7_delete_rewrite_rule( $filename ) {
845
-	// If configuration file does not exist then rules also do not exist, so there is nothing to delete.
846
-	if ( ! file_exists( $filename ) ) {
847
-		return true;
848
-	}
849
-
850
-	if ( ! class_exists( 'DOMDocument', false ) ) {
851
-		return false;
852
-	}
853
-
854
-	$doc                     = new DOMDocument();
855
-	$doc->preserveWhiteSpace = false;
856
-
857
-	if ( $doc->load( $filename ) === false ) {
858
-		return false;
859
-	}
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\')]' );
863
-
864
-	if ( $rules->length > 0 ) {
865
-		$child  = $rules->item( 0 );
866
-		$parent = $child->parentNode;
867
-		$parent->removeChild( $child );
868
-		$doc->formatOutput = true;
869
-		saveDomDocument( $doc, $filename );
870
-	}
871
-
872
-	return true;
845
+    // If configuration file does not exist then rules also do not exist, so there is nothing to delete.
846
+    if ( ! file_exists( $filename ) ) {
847
+        return true;
848
+    }
849
+
850
+    if ( ! class_exists( 'DOMDocument', false ) ) {
851
+        return false;
852
+    }
853
+
854
+    $doc                     = new DOMDocument();
855
+    $doc->preserveWhiteSpace = false;
856
+
857
+    if ( $doc->load( $filename ) === false ) {
858
+        return false;
859
+    }
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\')]' );
863
+
864
+    if ( $rules->length > 0 ) {
865
+        $child  = $rules->item( 0 );
866
+        $parent = $child->parentNode;
867
+        $parent->removeChild( $child );
868
+        $doc->formatOutput = true;
869
+        saveDomDocument( $doc, $filename );
870
+    }
871
+
872
+    return true;
873 873
 }
874 874
 
875 875
 /**
@@ -882,82 +882,82 @@  discard block
 block discarded – undo
882 882
  * @return bool
883 883
  */
884 884
 function iis7_add_rewrite_rule( $filename, $rewrite_rule ) {
885
-	if ( ! class_exists( 'DOMDocument', false ) ) {
886
-		return false;
887
-	}
888
-
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 );
894
-	}
895
-
896
-	$doc                     = new DOMDocument();
897
-	$doc->preserveWhiteSpace = false;
898
-
899
-	if ( $doc->load( $filename ) === false ) {
900
-		return false;
901
-	}
902
-
903
-	$xpath = new DOMXPath( $doc );
904
-
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\')]' );
907
-
908
-	if ( $wordpress_rules->length > 0 ) {
909
-		return true;
910
-	}
911
-
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' );
914
-
915
-	if ( $xml_nodes->length > 0 ) {
916
-		$rules_node = $xml_nodes->item( 0 );
917
-	} else {
918
-		$rules_node = $doc->createElement( 'rules' );
919
-
920
-		$xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite' );
921
-
922
-		if ( $xml_nodes->length > 0 ) {
923
-			$rewrite_node = $xml_nodes->item( 0 );
924
-			$rewrite_node->appendChild( $rules_node );
925
-		} else {
926
-			$rewrite_node = $doc->createElement( 'rewrite' );
927
-			$rewrite_node->appendChild( $rules_node );
928
-
929
-			$xml_nodes = $xpath->query( '/configuration/system.webServer' );
930
-
931
-			if ( $xml_nodes->length > 0 ) {
932
-				$system_web_server_node = $xml_nodes->item( 0 );
933
-				$system_web_server_node->appendChild( $rewrite_node );
934
-			} else {
935
-				$system_web_server_node = $doc->createElement( 'system.webServer' );
936
-				$system_web_server_node->appendChild( $rewrite_node );
937
-
938
-				$xml_nodes = $xpath->query( '/configuration' );
939
-
940
-				if ( $xml_nodes->length > 0 ) {
941
-					$config_node = $xml_nodes->item( 0 );
942
-					$config_node->appendChild( $system_web_server_node );
943
-				} else {
944
-					$config_node = $doc->createElement( 'configuration' );
945
-					$doc->appendChild( $config_node );
946
-					$config_node->appendChild( $system_web_server_node );
947
-				}
948
-			}
949
-		}
950
-	}
951
-
952
-	$rule_fragment = $doc->createDocumentFragment();
953
-	$rule_fragment->appendXML( $rewrite_rule );
954
-	$rules_node->appendChild( $rule_fragment );
955
-
956
-	$doc->encoding     = 'UTF-8';
957
-	$doc->formatOutput = true;
958
-	saveDomDocument( $doc, $filename );
959
-
960
-	return true;
885
+    if ( ! class_exists( 'DOMDocument', false ) ) {
886
+        return false;
887
+    }
888
+
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 );
894
+    }
895
+
896
+    $doc                     = new DOMDocument();
897
+    $doc->preserveWhiteSpace = false;
898
+
899
+    if ( $doc->load( $filename ) === false ) {
900
+        return false;
901
+    }
902
+
903
+    $xpath = new DOMXPath( $doc );
904
+
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\')]' );
907
+
908
+    if ( $wordpress_rules->length > 0 ) {
909
+        return true;
910
+    }
911
+
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' );
914
+
915
+    if ( $xml_nodes->length > 0 ) {
916
+        $rules_node = $xml_nodes->item( 0 );
917
+    } else {
918
+        $rules_node = $doc->createElement( 'rules' );
919
+
920
+        $xml_nodes = $xpath->query( '/configuration/system.webServer/rewrite' );
921
+
922
+        if ( $xml_nodes->length > 0 ) {
923
+            $rewrite_node = $xml_nodes->item( 0 );
924
+            $rewrite_node->appendChild( $rules_node );
925
+        } else {
926
+            $rewrite_node = $doc->createElement( 'rewrite' );
927
+            $rewrite_node->appendChild( $rules_node );
928
+
929
+            $xml_nodes = $xpath->query( '/configuration/system.webServer' );
930
+
931
+            if ( $xml_nodes->length > 0 ) {
932
+                $system_web_server_node = $xml_nodes->item( 0 );
933
+                $system_web_server_node->appendChild( $rewrite_node );
934
+            } else {
935
+                $system_web_server_node = $doc->createElement( 'system.webServer' );
936
+                $system_web_server_node->appendChild( $rewrite_node );
937
+
938
+                $xml_nodes = $xpath->query( '/configuration' );
939
+
940
+                if ( $xml_nodes->length > 0 ) {
941
+                    $config_node = $xml_nodes->item( 0 );
942
+                    $config_node->appendChild( $system_web_server_node );
943
+                } else {
944
+                    $config_node = $doc->createElement( 'configuration' );
945
+                    $doc->appendChild( $config_node );
946
+                    $config_node->appendChild( $system_web_server_node );
947
+                }
948
+            }
949
+        }
950
+    }
951
+
952
+    $rule_fragment = $doc->createDocumentFragment();
953
+    $rule_fragment->appendXML( $rewrite_rule );
954
+    $rules_node->appendChild( $rule_fragment );
955
+
956
+    $doc->encoding     = 'UTF-8';
957
+    $doc->formatOutput = true;
958
+    saveDomDocument( $doc, $filename );
959
+
960
+    return true;
961 961
 }
962 962
 
963 963
 /**
@@ -969,12 +969,12 @@  discard block
 block discarded – undo
969 969
  * @param string      $filename
970 970
  */
971 971
 function saveDomDocument( $doc, $filename ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
972
-	$config = $doc->saveXML();
973
-	$config = preg_replace( "/([^\r])\n/", "$1\r\n", $config );
972
+    $config = $doc->saveXML();
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
 /**
@@ -987,37 +987,37 @@  discard block
 block discarded – undo
987 987
  * @param int $user_id User ID.
988 988
  */
989 989
 function admin_color_scheme_picker( $user_id ) {
990
-	global $_wp_admin_css_colors;
991
-
992
-	ksort( $_wp_admin_css_colors );
993
-
994
-	if ( isset( $_wp_admin_css_colors['fresh'] ) ) {
995
-		// Set Default ('fresh') and Light should go first.
996
-		$_wp_admin_css_colors = array_filter(
997
-			array_merge(
998
-				array(
999
-					'fresh'  => '',
1000
-					'light'  => '',
1001
-					'modern' => '',
1002
-				),
1003
-				$_wp_admin_css_colors
1004
-			)
1005
-		);
1006
-	}
1007
-
1008
-	$current_color = get_user_option( 'admin_color', $user_id );
1009
-
1010
-	if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) {
1011
-		$current_color = 'fresh';
1012
-	}
1013
-	?>
990
+    global $_wp_admin_css_colors;
991
+
992
+    ksort( $_wp_admin_css_colors );
993
+
994
+    if ( isset( $_wp_admin_css_colors['fresh'] ) ) {
995
+        // Set Default ('fresh') and Light should go first.
996
+        $_wp_admin_css_colors = array_filter(
997
+            array_merge(
998
+                array(
999
+                    'fresh'  => '',
1000
+                    'light'  => '',
1001
+                    'modern' => '',
1002
+                ),
1003
+                $_wp_admin_css_colors
1004
+            )
1005
+        );
1006
+    }
1007
+
1008
+    $current_color = get_user_option( 'admin_color', $user_id );
1009
+
1010
+    if ( empty( $current_color ) || ! isset( $_wp_admin_css_colors[ $current_color ] ) ) {
1011
+        $current_color = 'fresh';
1012
+    }
1013
+    ?>
1014 1014
 	<fieldset id="color-picker" class="scheme-list">
1015 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 1021
 			<div class="color-option <?php echo ( $color === $current_color ) ? 'selected' : ''; ?>">
1022 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 1023
 				<input type="hidden" class="css_url" value="<?php echo esc_url( $color_info->url ); ?>" />
@@ -1026,19 +1026,19 @@  discard block
 block discarded – undo
1026 1026
 				<table class="color-palette">
1027 1027
 					<tr>
1028 1028
 					<?php
1029
-					foreach ( $color_info->colors as $html_color ) {
1030
-						?>
1029
+                    foreach ( $color_info->colors as $html_color ) {
1030
+                        ?>
1031 1031
 						<td style="background-color: <?php echo esc_attr( $html_color ); ?>">&nbsp;</td>
1032 1032
 						<?php
1033
-					}
1034
-					?>
1033
+                    }
1034
+                    ?>
1035 1035
 					</tr>
1036 1036
 				</table>
1037 1037
 			</div>
1038 1038
 			<?php
1039 1039
 
1040
-		endforeach;
1041
-		?>
1040
+        endforeach;
1041
+        ?>
1042 1042
 	</fieldset>
1043 1043
 	<?php
1044 1044
 }
@@ -1048,29 +1048,29 @@  discard block
 block discarded – undo
1048 1048
  * @global array $_wp_admin_css_colors
1049 1049
  */
1050 1050
 function wp_color_scheme_settings() {
1051
-	global $_wp_admin_css_colors;
1052
-
1053
-	$color_scheme = get_user_option( 'admin_color' );
1054
-
1055
-	// It's possible to have a color scheme set that is no longer registered.
1056
-	if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) {
1057
-		$color_scheme = 'fresh';
1058
-	}
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 ) ) {
1063
-		$icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
1064
-	} else {
1065
-		// Fall back to the default set of icon colors if the default scheme is missing.
1066
-		$icon_colors = array(
1067
-			'base'    => '#a7aaad',
1068
-			'focus'   => '#72aee6',
1069
-			'current' => '#fff',
1070
-		);
1071
-	}
1072
-
1073
-	echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
1051
+    global $_wp_admin_css_colors;
1052
+
1053
+    $color_scheme = get_user_option( 'admin_color' );
1054
+
1055
+    // It's possible to have a color scheme set that is no longer registered.
1056
+    if ( empty( $_wp_admin_css_colors[ $color_scheme ] ) ) {
1057
+        $color_scheme = 'fresh';
1058
+    }
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 ) ) {
1063
+        $icon_colors = $_wp_admin_css_colors['fresh']->icon_colors;
1064
+    } else {
1065
+        // Fall back to the default set of icon colors if the default scheme is missing.
1066
+        $icon_colors = array(
1067
+            'base'    => '#a7aaad',
1068
+            'focus'   => '#72aee6',
1069
+            'current' => '#fff',
1070
+        );
1071
+    }
1072
+
1073
+    echo '<script type="text/javascript">var _wpColorScheme = ' . wp_json_encode( array( 'icons' => $icon_colors ) ) . ";</script>\n";
1074 1074
 }
1075 1075
 
1076 1076
 /**
@@ -1079,20 +1079,20 @@  discard block
 block discarded – undo
1079 1079
  * @since 5.5.0
1080 1080
  */
1081 1081
 function wp_admin_viewport_meta() {
1082
-	/**
1083
-	 * Filters the viewport meta in the admin.
1084
-	 *
1085
-	 * @since 5.5.0
1086
-	 *
1087
-	 * @param string $viewport_meta The viewport meta.
1088
-	 */
1089
-	$viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' );
1090
-
1091
-	if ( empty( $viewport_meta ) ) {
1092
-		return;
1093
-	}
1094
-
1095
-	echo '<meta name="viewport" content="' . esc_attr( $viewport_meta ) . '">';
1082
+    /**
1083
+     * Filters the viewport meta in the admin.
1084
+     *
1085
+     * @since 5.5.0
1086
+     *
1087
+     * @param string $viewport_meta The viewport meta.
1088
+     */
1089
+    $viewport_meta = apply_filters( 'admin_viewport_meta', 'width=device-width,initial-scale=1.0' );
1090
+
1091
+    if ( empty( $viewport_meta ) ) {
1092
+        return;
1093
+    }
1094
+
1095
+    echo '<meta name="viewport" content="' . esc_attr( $viewport_meta ) . '">';
1096 1096
 }
1097 1097
 
1098 1098
 /**
@@ -1106,7 +1106,7 @@  discard block
 block discarded – undo
1106 1106
  * @return string Filtered viewport meta.
1107 1107
  */
1108 1108
 function _customizer_mobile_viewport_meta( $viewport_meta ) {
1109
-	return trim( $viewport_meta, ',' ) . ',minimum-scale=0.5,maximum-scale=1.2';
1109
+    return trim( $viewport_meta, ',' ) . ',minimum-scale=0.5,maximum-scale=1.2';
1110 1110
 }
1111 1111
 
1112 1112
 /**
@@ -1120,44 +1120,44 @@  discard block
 block discarded – undo
1120 1120
  * @return array The Heartbeat response.
1121 1121
  */
1122 1122
 function wp_check_locked_posts( $response, $data, $screen_id ) {
1123
-	$checked = array();
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 ) {
1130
-				continue;
1131
-			}
1129
+            if ( ! $post_id ) {
1130
+                continue;
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 ) ) {
1139
-					$send = array(
1140
-						'name' => $user->display_name,
1141
-						/* translators: %s: User's display name. */
1142
-						'text' => sprintf( __( '%s is currently editing' ), $user->display_name ),
1143
-					);
1138
+                if ( $user && current_user_can( 'edit_post', $post_id ) ) {
1139
+                    $send = array(
1140
+                        'name' => $user->display_name,
1141
+                        /* translators: %s: User's display name. */
1142
+                        'text' => sprintf( __( '%s is currently editing' ), $user->display_name ),
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 ) );
1148
-					}
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
+                    }
1149 1149
 
1150
-					$checked[ $key ] = $send;
1151
-				}
1152
-			}
1153
-		}
1154
-	}
1150
+                    $checked[ $key ] = $send;
1151
+                }
1152
+            }
1153
+        }
1154
+    }
1155 1155
 
1156
-	if ( ! empty( $checked ) ) {
1157
-		$response['wp-check-locked-posts'] = $checked;
1158
-	}
1156
+    if ( ! empty( $checked ) ) {
1157
+        $response['wp-check-locked-posts'] = $checked;
1158
+    }
1159 1159
 
1160
-	return $response;
1160
+    return $response;
1161 1161
 }
1162 1162
 
1163 1163
 /**
@@ -1171,48 +1171,48 @@  discard block
 block discarded – undo
1171 1171
  * @return array The Heartbeat response.
1172 1172
  */
1173 1173
 function wp_refresh_post_lock( $response, $data, $screen_id ) {
1174
-	if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) {
1175
-		$received = $data['wp-refresh-post-lock'];
1176
-		$send     = array();
1174
+    if ( array_key_exists( 'wp-refresh-post-lock', $data ) ) {
1175
+        $received = $data['wp-refresh-post-lock'];
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 ) {
1181
-			return $response;
1182
-		}
1180
+        if ( ! $post_id ) {
1181
+            return $response;
1182
+        }
1183 1183
 
1184
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
1185
-			return $response;
1186
-		}
1184
+        if ( ! current_user_can( 'edit_post', $post_id ) ) {
1185
+            return $response;
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 ) {
1192
-			$error = array(
1193
-				'name' => $user->display_name,
1194
-				/* translators: %s: User's display name. */
1195
-				'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ),
1196
-			);
1191
+        if ( $user ) {
1192
+            $error = array(
1193
+                'name' => $user->display_name,
1194
+                /* translators: %s: User's display name. */
1195
+                'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ),
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 ) );
1201
-			}
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
+            }
1202 1202
 
1203
-			$send['lock_error'] = $error;
1204
-		} else {
1205
-			$new_lock = wp_set_post_lock( $post_id );
1203
+            $send['lock_error'] = $error;
1204
+        } else {
1205
+            $new_lock = wp_set_post_lock( $post_id );
1206 1206
 
1207
-			if ( $new_lock ) {
1208
-				$send['new_lock'] = implode( ':', $new_lock );
1209
-			}
1210
-		}
1207
+            if ( $new_lock ) {
1208
+                $send['new_lock'] = implode( ':', $new_lock );
1209
+            }
1210
+        }
1211 1211
 
1212
-		$response['wp-refresh-post-lock'] = $send;
1213
-	}
1212
+        $response['wp-refresh-post-lock'] = $send;
1213
+    }
1214 1214
 
1215
-	return $response;
1215
+    return $response;
1216 1216
 }
1217 1217
 
1218 1218
 /**
@@ -1226,33 +1226,33 @@  discard block
 block discarded – undo
1226 1226
  * @return array The Heartbeat response.
1227 1227
  */
1228 1228
 function wp_refresh_post_nonces( $response, $data, $screen_id ) {
1229
-	if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) {
1230
-		$received = $data['wp-refresh-post-nonces'];
1229
+    if ( array_key_exists( 'wp-refresh-post-nonces', $data ) ) {
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 ) {
1237
-			return $response;
1238
-		}
1236
+        if ( ! $post_id ) {
1237
+            return $response;
1238
+        }
1239 1239
 
1240
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
1241
-			return $response;
1242
-		}
1240
+        if ( ! current_user_can( 'edit_post', $post_id ) ) {
1241
+            return $response;
1242
+        }
1243 1243
 
1244
-		$response['wp-refresh-post-nonces'] = array(
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 ),
1251
-			),
1252
-		);
1253
-	}
1254
-
1255
-	return $response;
1244
+        $response['wp-refresh-post-nonces'] = array(
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 ),
1251
+            ),
1252
+        );
1253
+    }
1254
+
1255
+    return $response;
1256 1256
 }
1257 1257
 
1258 1258
 /**
@@ -1264,13 +1264,13 @@  discard block
 block discarded – undo
1264 1264
  * @return array The Heartbeat response.
1265 1265
  */
1266 1266
 function wp_refresh_heartbeat_nonces( $response ) {
1267
-	// Refresh the Rest API nonce.
1268
-	$response['rest_nonce'] = wp_create_nonce( 'wp_rest' );
1267
+    // Refresh the Rest API nonce.
1268
+    $response['rest_nonce'] = wp_create_nonce( 'wp_rest' );
1269 1269
 
1270
-	// Refresh the Heartbeat nonce.
1271
-	$response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' );
1270
+    // Refresh the Heartbeat nonce.
1271
+    $response['heartbeat_nonce'] = wp_create_nonce( 'heartbeat-nonce' );
1272 1272
 
1273
-	return $response;
1273
+    return $response;
1274 1274
 }
1275 1275
 
1276 1276
 /**
@@ -1284,13 +1284,13 @@  discard block
 block discarded – undo
1284 1284
  * @return array Filtered Heartbeat settings.
1285 1285
  */
1286 1286
 function wp_heartbeat_set_suspension( $settings ) {
1287
-	global $pagenow;
1287
+    global $pagenow;
1288 1288
 
1289
-	if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
1290
-		$settings['suspension'] = 'disable';
1291
-	}
1289
+    if ( 'post.php' === $pagenow || 'post-new.php' === $pagenow ) {
1290
+        $settings['suspension'] = 'disable';
1291
+    }
1292 1292
 
1293
-	return $settings;
1293
+    return $settings;
1294 1294
 }
1295 1295
 
1296 1296
 /**
@@ -1303,31 +1303,31 @@  discard block
 block discarded – undo
1303 1303
  * @return array The Heartbeat response.
1304 1304
  */
1305 1305
 function heartbeat_autosave( $response, $data ) {
1306
-	if ( ! empty( $data['wp_autosave'] ) ) {
1307
-		$saved = wp_autosave( $data['wp_autosave'] );
1308
-
1309
-		if ( is_wp_error( $saved ) ) {
1310
-			$response['wp_autosave'] = array(
1311
-				'success' => false,
1312
-				'message' => $saved->get_error_message(),
1313
-			);
1314
-		} elseif ( empty( $saved ) ) {
1315
-			$response['wp_autosave'] = array(
1316
-				'success' => false,
1317
-				'message' => __( 'Error while saving.' ),
1318
-			);
1319
-		} else {
1320
-			/* translators: Draft saved date format, see https://www.php.net/manual/datetime.format.php */
1321
-			$draft_saved_date_format = __( 'g:i:s a' );
1322
-			$response['wp_autosave'] = array(
1323
-				'success' => true,
1324
-				/* translators: %s: Date and time. */
1325
-				'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ),
1326
-			);
1327
-		}
1328
-	}
1329
-
1330
-	return $response;
1306
+    if ( ! empty( $data['wp_autosave'] ) ) {
1307
+        $saved = wp_autosave( $data['wp_autosave'] );
1308
+
1309
+        if ( is_wp_error( $saved ) ) {
1310
+            $response['wp_autosave'] = array(
1311
+                'success' => false,
1312
+                'message' => $saved->get_error_message(),
1313
+            );
1314
+        } elseif ( empty( $saved ) ) {
1315
+            $response['wp_autosave'] = array(
1316
+                'success' => false,
1317
+                'message' => __( 'Error while saving.' ),
1318
+            );
1319
+        } else {
1320
+            /* translators: Draft saved date format, see https://www.php.net/manual/datetime.format.php */
1321
+            $draft_saved_date_format = __( 'g:i:s a' );
1322
+            $response['wp_autosave'] = array(
1323
+                'success' => true,
1324
+                /* translators: %s: Date and time. */
1325
+                'message' => sprintf( __( 'Draft saved at %s.' ), date_i18n( $draft_saved_date_format ) ),
1326
+            );
1327
+        }
1328
+    }
1329
+
1330
+    return $response;
1331 1331
 }
1332 1332
 
1333 1333
 /**
@@ -1339,16 +1339,16 @@  discard block
 block discarded – undo
1339 1339
  * @since 4.2.0
1340 1340
  */
1341 1341
 function wp_admin_canonical_url() {
1342
-	$removable_query_args = wp_removable_query_args();
1342
+    $removable_query_args = wp_removable_query_args();
1343 1343
 
1344
-	if ( empty( $removable_query_args ) ) {
1345
-		return;
1346
-	}
1344
+    if ( empty( $removable_query_args ) ) {
1345
+        return;
1346
+    }
1347 1347
 
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 );
1351
-	?>
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 );
1351
+    ?>
1352 1352
 	<link id="wp-admin-canonical" rel="canonical" href="<?php echo esc_url( $filtered_url ); ?>" />
1353 1353
 	<script>
1354 1354
 		if ( window.history.replaceState ) {
@@ -1364,21 +1364,21 @@  discard block
 block discarded – undo
1364 1364
  * @since 4.9.0
1365 1365
  */
1366 1366
 function wp_admin_headers() {
1367
-	$policy = 'strict-origin-when-cross-origin';
1368
-
1369
-	/**
1370
-	 * Filters the admin referrer policy header value.
1371
-	 *
1372
-	 * @since 4.9.0
1373
-	 * @since 4.9.5 The default value was changed to 'strict-origin-when-cross-origin'.
1374
-	 *
1375
-	 * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
1376
-	 *
1377
-	 * @param string $policy The admin referrer policy header value. Default 'strict-origin-when-cross-origin'.
1378
-	 */
1379
-	$policy = apply_filters( 'admin_referrer_policy', $policy );
1380
-
1381
-	header( sprintf( 'Referrer-Policy: %s', $policy ) );
1367
+    $policy = 'strict-origin-when-cross-origin';
1368
+
1369
+    /**
1370
+     * Filters the admin referrer policy header value.
1371
+     *
1372
+     * @since 4.9.0
1373
+     * @since 4.9.5 The default value was changed to 'strict-origin-when-cross-origin'.
1374
+     *
1375
+     * @link https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy
1376
+     *
1377
+     * @param string $policy The admin referrer policy header value. Default 'strict-origin-when-cross-origin'.
1378
+     */
1379
+    $policy = apply_filters( 'admin_referrer_policy', $policy );
1380
+
1381
+    header( sprintf( 'Referrer-Policy: %s', $policy ) );
1382 1382
 }
1383 1383
 
1384 1384
 /**
@@ -1390,7 +1390,7 @@  discard block
 block discarded – undo
1390 1390
  * @since 4.6.0
1391 1391
  */
1392 1392
 function wp_page_reload_on_back_button_js() {
1393
-	?>
1393
+    ?>
1394 1394
 	<script>
1395 1395
 		if ( typeof performance !== 'undefined' && performance.navigation && performance.navigation.type === 2 ) {
1396 1396
 			document.location.reload( true );
@@ -1411,22 +1411,22 @@  discard block
 block discarded – undo
1411 1411
  * @param string $value     The proposed new site admin email address.
1412 1412
  */
1413 1413
 function update_option_new_admin_email( $old_value, $value ) {
1414
-	if ( get_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
1415
-		return;
1416
-	}
1414
+    if ( get_option( 'admin_email' ) === $value || ! is_email( $value ) ) {
1415
+        return;
1416
+    }
1417 1417
 
1418
-	$hash            = md5( $value . time() . wp_rand() );
1419
-	$new_admin_email = array(
1420
-		'hash'     => $hash,
1421
-		'newemail' => $value,
1422
-	);
1423
-	update_option( 'adminhash', $new_admin_email );
1418
+    $hash            = md5( $value . time() . wp_rand() );
1419
+    $new_admin_email = array(
1420
+        'hash'     => $hash,
1421
+        'newemail' => $value,
1422
+    );
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
-	/* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1428
-	$email_text = __(
1429
-		'Howdy ###USERNAME###,
1427
+    /* translators: Do not translate USERNAME, ADMIN_URL, EMAIL, SITENAME, SITEURL: those are placeholders. */
1428
+    $email_text = __(
1429
+        'Howdy ###USERNAME###,
1430 1430
 
1431 1431
 Someone with administrator capabilities recently requested to have the
1432 1432
 administration email address changed on this site:
@@ -1443,57 +1443,57 @@  discard block
 block discarded – undo
1443 1443
 Regards,
1444 1444
 All at ###SITENAME###
1445 1445
 ###SITEURL###'
1446
-	);
1447
-
1448
-	/**
1449
-	 * Filters the text of the email sent when a change of site admin email address is attempted.
1450
-	 *
1451
-	 * The following strings have a special meaning and will get replaced dynamically:
1452
-	 * ###USERNAME###  The current user's username.
1453
-	 * ###ADMIN_URL### The link to click on to confirm the email change.
1454
-	 * ###EMAIL###     The proposed new site admin email address.
1455
-	 * ###SITENAME###  The name of the site.
1456
-	 * ###SITEURL###   The URL to the site.
1457
-	 *
1458
-	 * @since MU (3.0.0)
1459
-	 * @since 4.9.0 This filter is no longer Multisite specific.
1460
-	 *
1461
-	 * @param string $email_text      Text in the email.
1462
-	 * @param array  $new_admin_email {
1463
-	 *     Data relating to the new site admin email address.
1464
-	 *
1465
-	 *     @type string $hash     The secure hash used in the confirmation link URL.
1466
-	 *     @type string $newemail The proposed new site admin email address.
1467
-	 * }
1468
-	 */
1469
-	$content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
1470
-
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 );
1480
-	} else {
1481
-		$site_title = parse_url( home_url(), PHP_URL_HOST );
1482
-	}
1483
-
1484
-	wp_mail(
1485
-		$value,
1486
-		sprintf(
1487
-			/* translators: New admin email address notification email subject. %s: Site title. */
1488
-			__( '[%s] New Admin Email Address' ),
1489
-			$site_title
1490
-		),
1491
-		$content
1492
-	);
1493
-
1494
-	if ( $switched_locale ) {
1495
-		restore_previous_locale();
1496
-	}
1446
+    );
1447
+
1448
+    /**
1449
+     * Filters the text of the email sent when a change of site admin email address is attempted.
1450
+     *
1451
+     * The following strings have a special meaning and will get replaced dynamically:
1452
+     * ###USERNAME###  The current user's username.
1453
+     * ###ADMIN_URL### The link to click on to confirm the email change.
1454
+     * ###EMAIL###     The proposed new site admin email address.
1455
+     * ###SITENAME###  The name of the site.
1456
+     * ###SITEURL###   The URL to the site.
1457
+     *
1458
+     * @since MU (3.0.0)
1459
+     * @since 4.9.0 This filter is no longer Multisite specific.
1460
+     *
1461
+     * @param string $email_text      Text in the email.
1462
+     * @param array  $new_admin_email {
1463
+     *     Data relating to the new site admin email address.
1464
+     *
1465
+     *     @type string $hash     The secure hash used in the confirmation link URL.
1466
+     *     @type string $newemail The proposed new site admin email address.
1467
+     * }
1468
+     */
1469
+    $content = apply_filters( 'new_admin_email_content', $email_text, $new_admin_email );
1470
+
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 );
1480
+    } else {
1481
+        $site_title = parse_url( home_url(), PHP_URL_HOST );
1482
+    }
1483
+
1484
+    wp_mail(
1485
+        $value,
1486
+        sprintf(
1487
+            /* translators: New admin email address notification email subject. %s: Site title. */
1488
+            __( '[%s] New Admin Email Address' ),
1489
+            $site_title
1490
+        ),
1491
+        $content
1492
+    );
1493
+
1494
+    if ( $switched_locale ) {
1495
+        restore_previous_locale();
1496
+    }
1497 1497
 }
1498 1498
 
1499 1499
 /**
@@ -1508,12 +1508,12 @@  discard block
 block discarded – undo
1508 1508
  * @return string Page title.
1509 1509
  */
1510 1510
 function _wp_privacy_settings_filter_draft_page_titles( $title, $page ) {
1511
-	if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) {
1512
-		/* translators: %s: Page title. */
1513
-		$title = sprintf( __( '%s (Draft)' ), $title );
1514
-	}
1511
+    if ( 'draft' === $page->post_status && 'privacy' === get_current_screen()->id ) {
1512
+        /* translators: %s: Page title. */
1513
+        $title = sprintf( __( '%s (Draft)' ), $title );
1514
+    }
1515 1515
 
1516
-	return $title;
1516
+    return $title;
1517 1517
 }
1518 1518
 
1519 1519
 /**
@@ -1525,58 +1525,58 @@  discard block
 block discarded – undo
1525 1525
  * @return array|false Array of PHP version data. False on failure.
1526 1526
  */
1527 1527
 function wp_check_php_version() {
1528
-	$version = phpversion();
1529
-	$key     = md5( $version );
1530
-
1531
-	$response = get_site_transient( 'php_check_' . $key );
1532
-
1533
-	if ( false === $response ) {
1534
-		$url = 'http://api.wordpress.org/core/serve-happy/1.0/';
1535
-
1536
-		if ( wp_http_supports( array( 'ssl' ) ) ) {
1537
-			$url = set_url_scheme( $url, 'https' );
1538
-		}
1539
-
1540
-		$url = add_query_arg( 'php_version', $version, $url );
1541
-
1542
-		$response = wp_remote_get( $url );
1543
-
1544
-		if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
1545
-			return false;
1546
-		}
1547
-
1548
-		/**
1549
-		 * Response should be an array with:
1550
-		 *  'recommended_version' - string - The PHP version recommended by WordPress.
1551
-		 *  'is_supported' - boolean - Whether the PHP version is actively supported.
1552
-		 *  'is_secure' - boolean - Whether the PHP version receives security updates.
1553
-		 *  'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress.
1554
-		 */
1555
-		$response = json_decode( wp_remote_retrieve_body( $response ), true );
1556
-
1557
-		if ( ! is_array( $response ) ) {
1558
-			return false;
1559
-		}
1560
-
1561
-		set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );
1562
-	}
1563
-
1564
-	if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) {
1565
-		/**
1566
-		 * Filters whether the active PHP version is considered acceptable by WordPress.
1567
-		 *
1568
-		 * Returning false will trigger a PHP version warning to show up in the admin dashboard to administrators.
1569
-		 *
1570
-		 * This filter is only run if the wordpress.org Serve Happy API considers the PHP version acceptable, ensuring
1571
-		 * that this filter can only make this check stricter, but not loosen it.
1572
-		 *
1573
-		 * @since 5.1.1
1574
-		 *
1575
-		 * @param bool   $is_acceptable Whether the PHP version is considered acceptable. Default true.
1576
-		 * @param string $version       PHP version checked.
1577
-		 */
1578
-		$response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version );
1579
-	}
1580
-
1581
-	return $response;
1528
+    $version = phpversion();
1529
+    $key     = md5( $version );
1530
+
1531
+    $response = get_site_transient( 'php_check_' . $key );
1532
+
1533
+    if ( false === $response ) {
1534
+        $url = 'http://api.wordpress.org/core/serve-happy/1.0/';
1535
+
1536
+        if ( wp_http_supports( array( 'ssl' ) ) ) {
1537
+            $url = set_url_scheme( $url, 'https' );
1538
+        }
1539
+
1540
+        $url = add_query_arg( 'php_version', $version, $url );
1541
+
1542
+        $response = wp_remote_get( $url );
1543
+
1544
+        if ( is_wp_error( $response ) || 200 !== wp_remote_retrieve_response_code( $response ) ) {
1545
+            return false;
1546
+        }
1547
+
1548
+        /**
1549
+         * Response should be an array with:
1550
+         *  'recommended_version' - string - The PHP version recommended by WordPress.
1551
+         *  'is_supported' - boolean - Whether the PHP version is actively supported.
1552
+         *  'is_secure' - boolean - Whether the PHP version receives security updates.
1553
+         *  'is_acceptable' - boolean - Whether the PHP version is still acceptable for WordPress.
1554
+         */
1555
+        $response = json_decode( wp_remote_retrieve_body( $response ), true );
1556
+
1557
+        if ( ! is_array( $response ) ) {
1558
+            return false;
1559
+        }
1560
+
1561
+        set_site_transient( 'php_check_' . $key, $response, WEEK_IN_SECONDS );
1562
+    }
1563
+
1564
+    if ( isset( $response['is_acceptable'] ) && $response['is_acceptable'] ) {
1565
+        /**
1566
+         * Filters whether the active PHP version is considered acceptable by WordPress.
1567
+         *
1568
+         * Returning false will trigger a PHP version warning to show up in the admin dashboard to administrators.
1569
+         *
1570
+         * This filter is only run if the wordpress.org Serve Happy API considers the PHP version acceptable, ensuring
1571
+         * that this filter can only make this check stricter, but not loosen it.
1572
+         *
1573
+         * @since 5.1.1
1574
+         *
1575
+         * @param bool   $is_acceptable Whether the PHP version is considered acceptable. Default true.
1576
+         * @param string $version       PHP version checked.
1577
+         */
1578
+        $response['is_acceptable'] = (bool) apply_filters( 'wp_is_php_version_acceptable', true, $version );
1579
+    }
1580
+
1581
+    return $response;
1582 1582
 }
Please login to merge, or discard this patch.
Spacing   +360 added lines, -360 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 ); ?>">&nbsp;</td>
1031
+						<td style="background-color: <?php echo esc_attr($html_color); ?>">&nbsp;</td>
1032 1032
 						<?php
1033 1033
 					}
1034 1034
 					?>
@@ -1050,16 +1050,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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;
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-wp-ms-sites-list-table.php 2 patches
Indentation   +717 added lines, -717 removed lines patch added patch discarded remove patch
@@ -17,738 +17,738 @@
 block discarded – undo
17 17
  */
18 18
 class WP_MS_Sites_List_Table extends WP_List_Table {
19 19
 
20
-	/**
21
-	 * Site status list.
22
-	 *
23
-	 * @since 4.3.0
24
-	 * @var array
25
-	 */
26
-	public $status_list;
27
-
28
-	/**
29
-	 * Constructor.
30
-	 *
31
-	 * @since 3.1.0
32
-	 *
33
-	 * @see WP_List_Table::__construct() for more information on default arguments.
34
-	 *
35
-	 * @param array $args An associative array of arguments.
36
-	 */
37
-	public function __construct( $args = array() ) {
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' ) ),
43
-		);
44
-
45
-		parent::__construct(
46
-			array(
47
-				'plural' => 'sites',
48
-				'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
49
-			)
50
-		);
51
-	}
52
-
53
-	/**
54
-	 * @return bool
55
-	 */
56
-	public function ajax_user_can() {
57
-		return current_user_can( 'manage_sites' );
58
-	}
59
-
60
-	/**
61
-	 * Prepares the list of sites for display.
62
-	 *
63
-	 * @since 3.1.0
64
-	 *
65
-	 * @global string $mode List table view mode.
66
-	 * @global string $s
67
-	 * @global wpdb   $wpdb WordPress database abstraction object.
68
-	 */
69
-	public function prepare_items() {
70
-		global $mode, $s, $wpdb;
71
-
72
-		if ( ! empty( $_REQUEST['mode'] ) ) {
73
-			$mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
74
-			set_user_setting( 'sites_list_mode', $mode );
75
-		} else {
76
-			$mode = get_user_setting( 'sites_list_mode', 'list' );
77
-		}
78
-
79
-		$per_page = $this->get_items_per_page( 'sites_network_per_page' );
80
-
81
-		$pagenum = $this->get_pagenum();
82
-
83
-		$s    = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
84
-		$wild = '';
85
-		if ( false !== strpos( $s, '*' ) ) {
86
-			$wild = '*';
87
-			$s    = trim( $s, '*' );
88
-		}
89
-
90
-		/*
20
+    /**
21
+     * Site status list.
22
+     *
23
+     * @since 4.3.0
24
+     * @var array
25
+     */
26
+    public $status_list;
27
+
28
+    /**
29
+     * Constructor.
30
+     *
31
+     * @since 3.1.0
32
+     *
33
+     * @see WP_List_Table::__construct() for more information on default arguments.
34
+     *
35
+     * @param array $args An associative array of arguments.
36
+     */
37
+    public function __construct( $args = array() ) {
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' ) ),
43
+        );
44
+
45
+        parent::__construct(
46
+            array(
47
+                'plural' => 'sites',
48
+                'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
49
+            )
50
+        );
51
+    }
52
+
53
+    /**
54
+     * @return bool
55
+     */
56
+    public function ajax_user_can() {
57
+        return current_user_can( 'manage_sites' );
58
+    }
59
+
60
+    /**
61
+     * Prepares the list of sites for display.
62
+     *
63
+     * @since 3.1.0
64
+     *
65
+     * @global string $mode List table view mode.
66
+     * @global string $s
67
+     * @global wpdb   $wpdb WordPress database abstraction object.
68
+     */
69
+    public function prepare_items() {
70
+        global $mode, $s, $wpdb;
71
+
72
+        if ( ! empty( $_REQUEST['mode'] ) ) {
73
+            $mode = 'excerpt' === $_REQUEST['mode'] ? 'excerpt' : 'list';
74
+            set_user_setting( 'sites_list_mode', $mode );
75
+        } else {
76
+            $mode = get_user_setting( 'sites_list_mode', 'list' );
77
+        }
78
+
79
+        $per_page = $this->get_items_per_page( 'sites_network_per_page' );
80
+
81
+        $pagenum = $this->get_pagenum();
82
+
83
+        $s    = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
84
+        $wild = '';
85
+        if ( false !== strpos( $s, '*' ) ) {
86
+            $wild = '*';
87
+            $s    = trim( $s, '*' );
88
+        }
89
+
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'] ) ) {
96
-				$_GET['orderby']     = '';
97
-				$_REQUEST['orderby'] = '';
98
-			}
99
-			if ( ! isset( $_REQUEST['order'] ) ) {
100
-				$_GET['order']     = 'DESC';
101
-				$_REQUEST['order'] = 'DESC';
102
-			}
103
-		}
104
-
105
-		$args = array(
106
-			'number'     => (int) $per_page,
107
-			'offset'     => (int) ( ( $pagenum - 1 ) * $per_page ),
108
-			'network_id' => get_current_network_id(),
109
-		);
110
-
111
-		if ( empty( $s ) ) {
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 ) ) {
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 );
120
-
121
-			if ( $reg_blog_ids ) {
122
-				$args['site__in'] = $reg_blog_ids;
123
-			}
124
-		} elseif ( is_numeric( $s ) && empty( $wild ) ) {
125
-			$args['ID'] = $s;
126
-		} else {
127
-			$args['search'] = $s;
128
-
129
-			if ( ! is_subdomain_install() ) {
130
-				$args['search_columns'] = array( 'path' );
131
-			}
132
-		}
133
-
134
-		$order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : '';
135
-		if ( 'registered' === $order_by ) {
136
-			// 'registered' is a valid field name.
137
-		} elseif ( 'lastupdated' === $order_by ) {
138
-			$order_by = 'last_updated';
139
-		} elseif ( 'blogname' === $order_by ) {
140
-			if ( is_subdomain_install() ) {
141
-				$order_by = 'domain';
142
-			} else {
143
-				$order_by = 'path';
144
-			}
145
-		} elseif ( 'blog_id' === $order_by ) {
146
-			$order_by = 'id';
147
-		} elseif ( ! $order_by ) {
148
-			$order_by = false;
149
-		}
150
-
151
-		$args['orderby'] = $order_by;
152
-
153
-		if ( $order_by ) {
154
-			$args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC';
155
-		}
156
-
157
-		if ( wp_is_large_network() ) {
158
-			$args['no_found_rows'] = true;
159
-		} else {
160
-			$args['no_found_rows'] = false;
161
-		}
162
-
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;
167
-		}
168
-
169
-		/**
170
-		 * Filters the arguments for the site query in the sites list table.
171
-		 *
172
-		 * @since 4.6.0
173
-		 *
174
-		 * @param array $args An array of get_sites() arguments.
175
-		 */
176
-		$args = apply_filters( 'ms_sites_list_table_query_args', $args );
177
-
178
-		$_sites = get_sites( $args );
179
-		if ( is_array( $_sites ) ) {
180
-			update_site_cache( $_sites );
181
-
182
-			$this->items = array_slice( $_sites, 0, $per_page );
183
-		}
184
-
185
-		$total_sites = get_sites(
186
-			array_merge(
187
-				$args,
188
-				array(
189
-					'count'  => true,
190
-					'offset' => 0,
191
-					'number' => 0,
192
-				)
193
-			)
194
-		);
195
-
196
-		$this->set_pagination_args(
197
-			array(
198
-				'total_items' => $total_sites,
199
-				'per_page'    => $per_page,
200
-			)
201
-		);
202
-	}
203
-
204
-	/**
205
-	 */
206
-	public function no_items() {
207
-		_e( 'No sites found.' );
208
-	}
209
-
210
-	/**
211
-	 * Gets links to filter sites by status.
212
-	 *
213
-	 * @since 5.3.0
214
-	 *
215
-	 * @return array
216
-	 */
217
-	protected function get_views() {
218
-		$counts = wp_count_sites();
219
-
220
-		$statuses = array(
221
-			/* translators: %s: Number of sites. */
222
-			'all'      => _nx_noop(
223
-				'All <span class="count">(%s)</span>',
224
-				'All <span class="count">(%s)</span>',
225
-				'sites'
226
-			),
227
-
228
-			/* translators: %s: Number of sites. */
229
-			'public'   => _n_noop(
230
-				'Public <span class="count">(%s)</span>',
231
-				'Public <span class="count">(%s)</span>'
232
-			),
233
-
234
-			/* translators: %s: Number of sites. */
235
-			'archived' => _n_noop(
236
-				'Archived <span class="count">(%s)</span>',
237
-				'Archived <span class="count">(%s)</span>'
238
-			),
239
-
240
-			/* translators: %s: Number of sites. */
241
-			'mature'   => _n_noop(
242
-				'Mature <span class="count">(%s)</span>',
243
-				'Mature <span class="count">(%s)</span>'
244
-			),
245
-
246
-			/* translators: %s: Number of sites. */
247
-			'spam'     => _nx_noop(
248
-				'Spam <span class="count">(%s)</span>',
249
-				'Spam <span class="count">(%s)</span>',
250
-				'sites'
251
-			),
252
-
253
-			/* translators: %s: Number of sites. */
254
-			'deleted'  => _n_noop(
255
-				'Deleted <span class="count">(%s)</span>',
256
-				'Deleted <span class="count">(%s)</span>'
257
-			),
258
-		);
259
-
260
-		$view_links       = array();
261
-		$requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
262
-		$url              = 'sites.php';
263
-
264
-		foreach ( $statuses as $status => $label_count ) {
265
-			$current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status )
266
-				? ' class="current" aria-current="page"'
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 );
271
-
272
-				$view_links[ $status ] = sprintf(
273
-					'<a href="%1$s"%2$s>%3$s</a>',
274
-					esc_url( $full_url ),
275
-					$current_link_attributes,
276
-					$label
277
-				);
278
-			}
279
-		}
280
-
281
-		return $view_links;
282
-	}
283
-
284
-	/**
285
-	 * @return array
286
-	 */
287
-	protected function get_bulk_actions() {
288
-		$actions = array();
289
-		if ( current_user_can( 'delete_sites' ) ) {
290
-			$actions['delete'] = __( 'Delete' );
291
-		}
292
-		$actions['spam']    = _x( 'Mark as spam', 'site' );
293
-		$actions['notspam'] = _x( 'Not spam', 'site' );
294
-
295
-		return $actions;
296
-	}
297
-
298
-	/**
299
-	 * @global string $mode List table view mode.
300
-	 *
301
-	 * @param string $which The location of the pagination nav markup: 'top' or 'bottom'.
302
-	 */
303
-	protected function pagination( $which ) {
304
-		global $mode;
305
-
306
-		parent::pagination( $which );
307
-
308
-		if ( 'top' === $which ) {
309
-			$this->view_switcher( $mode );
310
-		}
311
-	}
312
-
313
-	/**
314
-	 * Extra controls to be displayed between bulk actions and pagination.
315
-	 *
316
-	 * @since 5.3.0
317
-	 *
318
-	 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
319
-	 */
320
-	protected function extra_tablenav( $which ) {
321
-		?>
94
+        if ( ! $s && wp_is_large_network() ) {
95
+            if ( ! isset( $_REQUEST['orderby'] ) ) {
96
+                $_GET['orderby']     = '';
97
+                $_REQUEST['orderby'] = '';
98
+            }
99
+            if ( ! isset( $_REQUEST['order'] ) ) {
100
+                $_GET['order']     = 'DESC';
101
+                $_REQUEST['order'] = 'DESC';
102
+            }
103
+        }
104
+
105
+        $args = array(
106
+            'number'     => (int) $per_page,
107
+            'offset'     => (int) ( ( $pagenum - 1 ) * $per_page ),
108
+            'network_id' => get_current_network_id(),
109
+        );
110
+
111
+        if ( empty( $s ) ) {
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 ) ) {
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 );
120
+
121
+            if ( $reg_blog_ids ) {
122
+                $args['site__in'] = $reg_blog_ids;
123
+            }
124
+        } elseif ( is_numeric( $s ) && empty( $wild ) ) {
125
+            $args['ID'] = $s;
126
+        } else {
127
+            $args['search'] = $s;
128
+
129
+            if ( ! is_subdomain_install() ) {
130
+                $args['search_columns'] = array( 'path' );
131
+            }
132
+        }
133
+
134
+        $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : '';
135
+        if ( 'registered' === $order_by ) {
136
+            // 'registered' is a valid field name.
137
+        } elseif ( 'lastupdated' === $order_by ) {
138
+            $order_by = 'last_updated';
139
+        } elseif ( 'blogname' === $order_by ) {
140
+            if ( is_subdomain_install() ) {
141
+                $order_by = 'domain';
142
+            } else {
143
+                $order_by = 'path';
144
+            }
145
+        } elseif ( 'blog_id' === $order_by ) {
146
+            $order_by = 'id';
147
+        } elseif ( ! $order_by ) {
148
+            $order_by = false;
149
+        }
150
+
151
+        $args['orderby'] = $order_by;
152
+
153
+        if ( $order_by ) {
154
+            $args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? 'DESC' : 'ASC';
155
+        }
156
+
157
+        if ( wp_is_large_network() ) {
158
+            $args['no_found_rows'] = true;
159
+        } else {
160
+            $args['no_found_rows'] = false;
161
+        }
162
+
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;
167
+        }
168
+
169
+        /**
170
+         * Filters the arguments for the site query in the sites list table.
171
+         *
172
+         * @since 4.6.0
173
+         *
174
+         * @param array $args An array of get_sites() arguments.
175
+         */
176
+        $args = apply_filters( 'ms_sites_list_table_query_args', $args );
177
+
178
+        $_sites = get_sites( $args );
179
+        if ( is_array( $_sites ) ) {
180
+            update_site_cache( $_sites );
181
+
182
+            $this->items = array_slice( $_sites, 0, $per_page );
183
+        }
184
+
185
+        $total_sites = get_sites(
186
+            array_merge(
187
+                $args,
188
+                array(
189
+                    'count'  => true,
190
+                    'offset' => 0,
191
+                    'number' => 0,
192
+                )
193
+            )
194
+        );
195
+
196
+        $this->set_pagination_args(
197
+            array(
198
+                'total_items' => $total_sites,
199
+                'per_page'    => $per_page,
200
+            )
201
+        );
202
+    }
203
+
204
+    /**
205
+     */
206
+    public function no_items() {
207
+        _e( 'No sites found.' );
208
+    }
209
+
210
+    /**
211
+     * Gets links to filter sites by status.
212
+     *
213
+     * @since 5.3.0
214
+     *
215
+     * @return array
216
+     */
217
+    protected function get_views() {
218
+        $counts = wp_count_sites();
219
+
220
+        $statuses = array(
221
+            /* translators: %s: Number of sites. */
222
+            'all'      => _nx_noop(
223
+                'All <span class="count">(%s)</span>',
224
+                'All <span class="count">(%s)</span>',
225
+                'sites'
226
+            ),
227
+
228
+            /* translators: %s: Number of sites. */
229
+            'public'   => _n_noop(
230
+                'Public <span class="count">(%s)</span>',
231
+                'Public <span class="count">(%s)</span>'
232
+            ),
233
+
234
+            /* translators: %s: Number of sites. */
235
+            'archived' => _n_noop(
236
+                'Archived <span class="count">(%s)</span>',
237
+                'Archived <span class="count">(%s)</span>'
238
+            ),
239
+
240
+            /* translators: %s: Number of sites. */
241
+            'mature'   => _n_noop(
242
+                'Mature <span class="count">(%s)</span>',
243
+                'Mature <span class="count">(%s)</span>'
244
+            ),
245
+
246
+            /* translators: %s: Number of sites. */
247
+            'spam'     => _nx_noop(
248
+                'Spam <span class="count">(%s)</span>',
249
+                'Spam <span class="count">(%s)</span>',
250
+                'sites'
251
+            ),
252
+
253
+            /* translators: %s: Number of sites. */
254
+            'deleted'  => _n_noop(
255
+                'Deleted <span class="count">(%s)</span>',
256
+                'Deleted <span class="count">(%s)</span>'
257
+            ),
258
+        );
259
+
260
+        $view_links       = array();
261
+        $requested_status = isset( $_REQUEST['status'] ) ? wp_unslash( trim( $_REQUEST['status'] ) ) : '';
262
+        $url              = 'sites.php';
263
+
264
+        foreach ( $statuses as $status => $label_count ) {
265
+            $current_link_attributes = $requested_status === $status || ( '' === $requested_status && 'all' === $status )
266
+                ? ' class="current" aria-current="page"'
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 );
271
+
272
+                $view_links[ $status ] = sprintf(
273
+                    '<a href="%1$s"%2$s>%3$s</a>',
274
+                    esc_url( $full_url ),
275
+                    $current_link_attributes,
276
+                    $label
277
+                );
278
+            }
279
+        }
280
+
281
+        return $view_links;
282
+    }
283
+
284
+    /**
285
+     * @return array
286
+     */
287
+    protected function get_bulk_actions() {
288
+        $actions = array();
289
+        if ( current_user_can( 'delete_sites' ) ) {
290
+            $actions['delete'] = __( 'Delete' );
291
+        }
292
+        $actions['spam']    = _x( 'Mark as spam', 'site' );
293
+        $actions['notspam'] = _x( 'Not spam', 'site' );
294
+
295
+        return $actions;
296
+    }
297
+
298
+    /**
299
+     * @global string $mode List table view mode.
300
+     *
301
+     * @param string $which The location of the pagination nav markup: 'top' or 'bottom'.
302
+     */
303
+    protected function pagination( $which ) {
304
+        global $mode;
305
+
306
+        parent::pagination( $which );
307
+
308
+        if ( 'top' === $which ) {
309
+            $this->view_switcher( $mode );
310
+        }
311
+    }
312
+
313
+    /**
314
+     * Extra controls to be displayed between bulk actions and pagination.
315
+     *
316
+     * @since 5.3.0
317
+     *
318
+     * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
319
+     */
320
+    protected function extra_tablenav( $which ) {
321
+        ?>
322 322
 		<div class="alignleft actions">
323 323
 		<?php
324
-		if ( 'top' === $which ) {
325
-			ob_start();
326
-
327
-			/**
328
-			 * Fires before the Filter button on the MS sites list table.
329
-			 *
330
-			 * @since 5.3.0
331
-			 *
332
-			 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
333
-			 */
334
-			do_action( 'restrict_manage_sites', $which );
335
-
336
-			$output = ob_get_clean();
337
-
338
-			if ( ! empty( $output ) ) {
339
-				echo $output;
340
-				submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'site-query-submit' ) );
341
-			}
342
-		}
343
-		?>
324
+        if ( 'top' === $which ) {
325
+            ob_start();
326
+
327
+            /**
328
+             * Fires before the Filter button on the MS sites list table.
329
+             *
330
+             * @since 5.3.0
331
+             *
332
+             * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
333
+             */
334
+            do_action( 'restrict_manage_sites', $which );
335
+
336
+            $output = ob_get_clean();
337
+
338
+            if ( ! empty( $output ) ) {
339
+                echo $output;
340
+                submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'site-query-submit' ) );
341
+            }
342
+        }
343
+        ?>
344 344
 		</div>
345 345
 		<?php
346
-		/**
347
-		 * Fires immediately following the closing "actions" div in the tablenav for the
348
-		 * MS sites list table.
349
-		 *
350
-		 * @since 5.3.0
351
-		 *
352
-		 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
353
-		 */
354
-		do_action( 'manage_sites_extra_tablenav', $which );
355
-	}
356
-
357
-	/**
358
-	 * @return array
359
-	 */
360
-	public function get_columns() {
361
-		$sites_columns = array(
362
-			'cb'          => '<input type="checkbox" />',
363
-			'blogname'    => __( 'URL' ),
364
-			'lastupdated' => __( 'Last Updated' ),
365
-			'registered'  => _x( 'Registered', 'site' ),
366
-			'users'       => __( 'Users' ),
367
-		);
368
-
369
-		if ( has_filter( 'wpmublogsaction' ) ) {
370
-			$sites_columns['plugins'] = __( 'Actions' );
371
-		}
372
-
373
-		/**
374
-		 * Filters the displayed site columns in Sites list table.
375
-		 *
376
-		 * @since MU (3.0.0)
377
-		 *
378
-		 * @param string[] $sites_columns An array of displayed site columns. Default 'cb',
379
-		 *                               'blogname', 'lastupdated', 'registered', 'users'.
380
-		 */
381
-		return apply_filters( 'wpmu_blogs_columns', $sites_columns );
382
-	}
383
-
384
-	/**
385
-	 * @return array
386
-	 */
387
-	protected function get_sortable_columns() {
388
-		return array(
389
-			'blogname'    => 'blogname',
390
-			'lastupdated' => 'lastupdated',
391
-			'registered'  => 'blog_id',
392
-		);
393
-	}
394
-
395
-	/**
396
-	 * Handles the checkbox column output.
397
-	 *
398
-	 * @since 4.3.0
399
-	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
400
-	 *
401
-	 * @param array $item Current site.
402
-	 */
403
-	public function column_cb( $item ) {
404
-		// Restores the more descriptive, specific name for use within this method.
405
-		$blog = $item;
406
-
407
-		if ( ! is_main_site( $blog['blog_id'] ) ) :
408
-			$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
409
-			?>
346
+        /**
347
+         * Fires immediately following the closing "actions" div in the tablenav for the
348
+         * MS sites list table.
349
+         *
350
+         * @since 5.3.0
351
+         *
352
+         * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
353
+         */
354
+        do_action( 'manage_sites_extra_tablenav', $which );
355
+    }
356
+
357
+    /**
358
+     * @return array
359
+     */
360
+    public function get_columns() {
361
+        $sites_columns = array(
362
+            'cb'          => '<input type="checkbox" />',
363
+            'blogname'    => __( 'URL' ),
364
+            'lastupdated' => __( 'Last Updated' ),
365
+            'registered'  => _x( 'Registered', 'site' ),
366
+            'users'       => __( 'Users' ),
367
+        );
368
+
369
+        if ( has_filter( 'wpmublogsaction' ) ) {
370
+            $sites_columns['plugins'] = __( 'Actions' );
371
+        }
372
+
373
+        /**
374
+         * Filters the displayed site columns in Sites list table.
375
+         *
376
+         * @since MU (3.0.0)
377
+         *
378
+         * @param string[] $sites_columns An array of displayed site columns. Default 'cb',
379
+         *                               'blogname', 'lastupdated', 'registered', 'users'.
380
+         */
381
+        return apply_filters( 'wpmu_blogs_columns', $sites_columns );
382
+    }
383
+
384
+    /**
385
+     * @return array
386
+     */
387
+    protected function get_sortable_columns() {
388
+        return array(
389
+            'blogname'    => 'blogname',
390
+            'lastupdated' => 'lastupdated',
391
+            'registered'  => 'blog_id',
392
+        );
393
+    }
394
+
395
+    /**
396
+     * Handles the checkbox column output.
397
+     *
398
+     * @since 4.3.0
399
+     * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
400
+     *
401
+     * @param array $item Current site.
402
+     */
403
+    public function column_cb( $item ) {
404
+        // Restores the more descriptive, specific name for use within this method.
405
+        $blog = $item;
406
+
407
+        if ( ! is_main_site( $blog['blog_id'] ) ) :
408
+            $blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
409
+            ?>
410 410
 			<label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>">
411 411
 				<?php
412
-				/* translators: %s: Site URL. */
413
-				printf( __( 'Select %s' ), $blogname );
414
-				?>
412
+                /* translators: %s: Site URL. */
413
+                printf( __( 'Select %s' ), $blogname );
414
+                ?>
415 415
 			</label>
416 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
-		endif;
419
-	}
420
-
421
-	/**
422
-	 * Handles the ID column output.
423
-	 *
424
-	 * @since 4.4.0
425
-	 *
426
-	 * @param array $blog Current site.
427
-	 */
428
-	public function column_id( $blog ) {
429
-		echo $blog['blog_id'];
430
-	}
431
-
432
-	/**
433
-	 * Handles the site name column output.
434
-	 *
435
-	 * @since 4.3.0
436
-	 *
437
-	 * @global string $mode List table view mode.
438
-	 *
439
-	 * @param array $blog Current site.
440
-	 */
441
-	public function column_blogname( $blog ) {
442
-		global $mode;
443
-
444
-		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
445
-
446
-		?>
418
+        endif;
419
+    }
420
+
421
+    /**
422
+     * Handles the ID column output.
423
+     *
424
+     * @since 4.4.0
425
+     *
426
+     * @param array $blog Current site.
427
+     */
428
+    public function column_id( $blog ) {
429
+        echo $blog['blog_id'];
430
+    }
431
+
432
+    /**
433
+     * Handles the site name column output.
434
+     *
435
+     * @since 4.3.0
436
+     *
437
+     * @global string $mode List table view mode.
438
+     *
439
+     * @param array $blog Current site.
440
+     */
441
+    public function column_blogname( $blog ) {
442
+        global $mode;
443
+
444
+        $blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
445
+
446
+        ?>
447 447
 		<strong>
448 448
 			<a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname; ?></a>
449 449
 			<?php $this->site_states( $blog ); ?>
450 450
 		</strong>
451 451
 		<?php
452
-		if ( 'list' !== $mode ) {
453
-			switch_to_blog( $blog['blog_id'] );
454
-			echo '<p>';
455
-			printf(
456
-				/* translators: 1: Site title, 2: Site tagline. */
457
-				__( '%1$s &#8211; %2$s' ),
458
-				get_option( 'blogname' ),
459
-				'<em>' . get_option( 'blogdescription' ) . '</em>'
460
-			);
461
-			echo '</p>';
462
-			restore_current_blog();
463
-		}
464
-	}
465
-
466
-	/**
467
-	 * Handles the lastupdated column output.
468
-	 *
469
-	 * @since 4.3.0
470
-	 *
471
-	 * @global string $mode List table view mode.
472
-	 *
473
-	 * @param array $blog Current site.
474
-	 */
475
-	public function column_lastupdated( $blog ) {
476
-		global $mode;
477
-
478
-		if ( 'list' === $mode ) {
479
-			$date = __( 'Y/m/d' );
480
-		} else {
481
-			$date = __( 'Y/m/d g:i:s a' );
482
-		}
483
-
484
-		echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
485
-	}
486
-
487
-	/**
488
-	 * Handles the registered column output.
489
-	 *
490
-	 * @since 4.3.0
491
-	 *
492
-	 * @global string $mode List table view mode.
493
-	 *
494
-	 * @param array $blog Current site.
495
-	 */
496
-	public function column_registered( $blog ) {
497
-		global $mode;
498
-
499
-		if ( 'list' === $mode ) {
500
-			$date = __( 'Y/m/d' );
501
-		} else {
502
-			$date = __( 'Y/m/d g:i:s a' );
503
-		}
504
-
505
-		if ( '0000-00-00 00:00:00' === $blog['registered'] ) {
506
-			echo '&#x2014;';
507
-		} else {
508
-			echo mysql2date( $date, $blog['registered'] );
509
-		}
510
-	}
511
-
512
-	/**
513
-	 * Handles the users column output.
514
-	 *
515
-	 * @since 4.3.0
516
-	 *
517
-	 * @param array $blog Current site.
518
-	 */
519
-	public function column_users( $blog ) {
520
-		$user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' );
521
-		if ( ! $user_count ) {
522
-			$blog_users = new WP_User_Query(
523
-				array(
524
-					'blog_id'     => $blog['blog_id'],
525
-					'fields'      => 'ID',
526
-					'number'      => 1,
527
-					'count_total' => true,
528
-				)
529
-			);
530
-			$user_count = $blog_users->get_total();
531
-			wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS );
532
-		}
533
-
534
-		printf(
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 )
538
-		);
539
-	}
540
-
541
-	/**
542
-	 * Handles the plugins column output.
543
-	 *
544
-	 * @since 4.3.0
545
-	 *
546
-	 * @param array $blog Current site.
547
-	 */
548
-	public function column_plugins( $blog ) {
549
-		if ( has_filter( 'wpmublogsaction' ) ) {
550
-			/**
551
-			 * Fires inside the auxiliary 'Actions' column of the Sites list table.
552
-			 *
553
-			 * By default this column is hidden unless something is hooked to the action.
554
-			 *
555
-			 * @since MU (3.0.0)
556
-			 *
557
-			 * @param int $blog_id The site ID.
558
-			 */
559
-			do_action( 'wpmublogsaction', $blog['blog_id'] );
560
-		}
561
-	}
562
-
563
-	/**
564
-	 * Handles output for the default column.
565
-	 *
566
-	 * @since 4.3.0
567
-	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
568
-	 *
569
-	 * @param array  $item        Current site.
570
-	 * @param string $column_name Current column name.
571
-	 */
572
-	public function column_default( $item, $column_name ) {
573
-		/**
574
-		 * Fires for each registered custom column in the Sites list table.
575
-		 *
576
-		 * @since 3.1.0
577
-		 *
578
-		 * @param string $column_name The name of the column to display.
579
-		 * @param int    $blog_id     The site ID.
580
-		 */
581
-		do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] );
582
-	}
583
-
584
-	/**
585
-	 * @global string $mode List table view mode.
586
-	 */
587
-	public function display_rows() {
588
-		foreach ( $this->items as $blog ) {
589
-			$blog  = $blog->to_array();
590
-			$class = '';
591
-			reset( $this->status_list );
592
-
593
-			foreach ( $this->status_list as $status => $col ) {
594
-				if ( 1 == $blog[ $status ] ) {
595
-					$class = " class='{$col[0]}'";
596
-				}
597
-			}
598
-
599
-			echo "<tr{$class}>";
600
-
601
-			$this->single_row_columns( $blog );
602
-
603
-			echo '</tr>';
604
-		}
605
-	}
606
-
607
-	/**
608
-	 * Maybe output comma-separated site states.
609
-	 *
610
-	 * @since 5.3.0
611
-	 *
612
-	 * @param array $site
613
-	 */
614
-	protected function site_states( $site ) {
615
-		$site_states = array();
616
-
617
-		// $site is still an array, so get the object.
618
-		$_site = WP_Site::get_instance( $site['blog_id'] );
619
-
620
-		if ( is_main_site( $_site->id ) ) {
621
-			$site_states['main'] = __( 'Main' );
622
-		}
623
-
624
-		reset( $this->status_list );
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];
630
-			}
631
-		}
632
-
633
-		/**
634
-		 * Filters the default site display states for items in the Sites list table.
635
-		 *
636
-		 * @since 5.3.0
637
-		 *
638
-		 * @param string[] $site_states An array of site states. Default 'Main',
639
-		 *                              'Archived', 'Mature', 'Spam', 'Deleted'.
640
-		 * @param WP_Site  $site        The current site object.
641
-		 */
642
-		$site_states = apply_filters( 'display_site_states', $site_states, $_site );
643
-
644
-		if ( ! empty( $site_states ) ) {
645
-			$state_count = count( $site_states );
646
-
647
-			$i = 0;
648
-
649
-			echo ' &mdash; ';
650
-
651
-			foreach ( $site_states as $state ) {
652
-				++$i;
653
-
654
-				$sep = ( $i < $state_count ) ? ', ' : '';
655
-
656
-				echo "<span class='post-state'>{$state}{$sep}</span>";
657
-			}
658
-		}
659
-	}
660
-
661
-	/**
662
-	 * Gets the name of the default primary column.
663
-	 *
664
-	 * @since 4.3.0
665
-	 *
666
-	 * @return string Name of the default primary column, in this case, 'blogname'.
667
-	 */
668
-	protected function get_default_primary_column_name() {
669
-		return 'blogname';
670
-	}
671
-
672
-	/**
673
-	 * Generates and displays row action links.
674
-	 *
675
-	 * @since 4.3.0
676
-	 * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
677
-	 *
678
-	 * @param array  $item        Site being acted upon.
679
-	 * @param string $column_name Current column name.
680
-	 * @param string $primary     Primary column name.
681
-	 * @return string Row actions output for sites in Multisite, or an empty string
682
-	 *                if the current column is not the primary column.
683
-	 */
684
-	protected function handle_row_actions( $item, $column_name, $primary ) {
685
-		if ( $primary !== $column_name ) {
686
-			return '';
687
-		}
688
-
689
-		// Restores the more descriptive, specific name for use within this method.
690
-		$blog     = $item;
691
-		$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
692
-
693
-		// Preordered.
694
-		$actions = array(
695
-			'edit'       => '',
696
-			'backend'    => '',
697
-			'activate'   => '',
698
-			'deactivate' => '',
699
-			'archive'    => '',
700
-			'unarchive'  => '',
701
-			'spam'       => '',
702
-			'unspam'     => '',
703
-			'delete'     => '',
704
-			'visit'      => '',
705
-		);
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&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>';
712
-			} else {
713
-				$actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
714
-			}
715
-
716
-			if ( '1' == $blog['archived'] ) {
717
-				$actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>';
718
-			} else {
719
-				$actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>';
720
-			}
721
-
722
-			if ( '1' == $blog['spam'] ) {
723
-				$actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>';
724
-			} else {
725
-				$actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>';
726
-			}
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&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a>';
730
-			}
731
-		}
732
-
733
-		$actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>';
734
-
735
-		/**
736
-		 * Filters the action links displayed for each site in the Sites list table.
737
-		 *
738
-		 * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
739
-		 * default for each site. The site's status determines whether to show the
740
-		 * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
741
-		 * 'Not Spam' or 'Spam' link for each site.
742
-		 *
743
-		 * @since 3.1.0
744
-		 *
745
-		 * @param string[] $actions  An array of action links to be displayed.
746
-		 * @param int      $blog_id  The site ID.
747
-		 * @param string   $blogname Site path, formatted depending on whether it is a sub-domain
748
-		 *                           or subdirectory multisite installation.
749
-		 */
750
-		$actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
751
-
752
-		return $this->row_actions( $actions );
753
-	}
452
+        if ( 'list' !== $mode ) {
453
+            switch_to_blog( $blog['blog_id'] );
454
+            echo '<p>';
455
+            printf(
456
+                /* translators: 1: Site title, 2: Site tagline. */
457
+                __( '%1$s &#8211; %2$s' ),
458
+                get_option( 'blogname' ),
459
+                '<em>' . get_option( 'blogdescription' ) . '</em>'
460
+            );
461
+            echo '</p>';
462
+            restore_current_blog();
463
+        }
464
+    }
465
+
466
+    /**
467
+     * Handles the lastupdated column output.
468
+     *
469
+     * @since 4.3.0
470
+     *
471
+     * @global string $mode List table view mode.
472
+     *
473
+     * @param array $blog Current site.
474
+     */
475
+    public function column_lastupdated( $blog ) {
476
+        global $mode;
477
+
478
+        if ( 'list' === $mode ) {
479
+            $date = __( 'Y/m/d' );
480
+        } else {
481
+            $date = __( 'Y/m/d g:i:s a' );
482
+        }
483
+
484
+        echo ( '0000-00-00 00:00:00' === $blog['last_updated'] ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] );
485
+    }
486
+
487
+    /**
488
+     * Handles the registered column output.
489
+     *
490
+     * @since 4.3.0
491
+     *
492
+     * @global string $mode List table view mode.
493
+     *
494
+     * @param array $blog Current site.
495
+     */
496
+    public function column_registered( $blog ) {
497
+        global $mode;
498
+
499
+        if ( 'list' === $mode ) {
500
+            $date = __( 'Y/m/d' );
501
+        } else {
502
+            $date = __( 'Y/m/d g:i:s a' );
503
+        }
504
+
505
+        if ( '0000-00-00 00:00:00' === $blog['registered'] ) {
506
+            echo '&#x2014;';
507
+        } else {
508
+            echo mysql2date( $date, $blog['registered'] );
509
+        }
510
+    }
511
+
512
+    /**
513
+     * Handles the users column output.
514
+     *
515
+     * @since 4.3.0
516
+     *
517
+     * @param array $blog Current site.
518
+     */
519
+    public function column_users( $blog ) {
520
+        $user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' );
521
+        if ( ! $user_count ) {
522
+            $blog_users = new WP_User_Query(
523
+                array(
524
+                    'blog_id'     => $blog['blog_id'],
525
+                    'fields'      => 'ID',
526
+                    'number'      => 1,
527
+                    'count_total' => true,
528
+                )
529
+            );
530
+            $user_count = $blog_users->get_total();
531
+            wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS );
532
+        }
533
+
534
+        printf(
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 )
538
+        );
539
+    }
540
+
541
+    /**
542
+     * Handles the plugins column output.
543
+     *
544
+     * @since 4.3.0
545
+     *
546
+     * @param array $blog Current site.
547
+     */
548
+    public function column_plugins( $blog ) {
549
+        if ( has_filter( 'wpmublogsaction' ) ) {
550
+            /**
551
+             * Fires inside the auxiliary 'Actions' column of the Sites list table.
552
+             *
553
+             * By default this column is hidden unless something is hooked to the action.
554
+             *
555
+             * @since MU (3.0.0)
556
+             *
557
+             * @param int $blog_id The site ID.
558
+             */
559
+            do_action( 'wpmublogsaction', $blog['blog_id'] );
560
+        }
561
+    }
562
+
563
+    /**
564
+     * Handles output for the default column.
565
+     *
566
+     * @since 4.3.0
567
+     * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
568
+     *
569
+     * @param array  $item        Current site.
570
+     * @param string $column_name Current column name.
571
+     */
572
+    public function column_default( $item, $column_name ) {
573
+        /**
574
+         * Fires for each registered custom column in the Sites list table.
575
+         *
576
+         * @since 3.1.0
577
+         *
578
+         * @param string $column_name The name of the column to display.
579
+         * @param int    $blog_id     The site ID.
580
+         */
581
+        do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] );
582
+    }
583
+
584
+    /**
585
+     * @global string $mode List table view mode.
586
+     */
587
+    public function display_rows() {
588
+        foreach ( $this->items as $blog ) {
589
+            $blog  = $blog->to_array();
590
+            $class = '';
591
+            reset( $this->status_list );
592
+
593
+            foreach ( $this->status_list as $status => $col ) {
594
+                if ( 1 == $blog[ $status ] ) {
595
+                    $class = " class='{$col[0]}'";
596
+                }
597
+            }
598
+
599
+            echo "<tr{$class}>";
600
+
601
+            $this->single_row_columns( $blog );
602
+
603
+            echo '</tr>';
604
+        }
605
+    }
606
+
607
+    /**
608
+     * Maybe output comma-separated site states.
609
+     *
610
+     * @since 5.3.0
611
+     *
612
+     * @param array $site
613
+     */
614
+    protected function site_states( $site ) {
615
+        $site_states = array();
616
+
617
+        // $site is still an array, so get the object.
618
+        $_site = WP_Site::get_instance( $site['blog_id'] );
619
+
620
+        if ( is_main_site( $_site->id ) ) {
621
+            $site_states['main'] = __( 'Main' );
622
+        }
623
+
624
+        reset( $this->status_list );
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];
630
+            }
631
+        }
632
+
633
+        /**
634
+         * Filters the default site display states for items in the Sites list table.
635
+         *
636
+         * @since 5.3.0
637
+         *
638
+         * @param string[] $site_states An array of site states. Default 'Main',
639
+         *                              'Archived', 'Mature', 'Spam', 'Deleted'.
640
+         * @param WP_Site  $site        The current site object.
641
+         */
642
+        $site_states = apply_filters( 'display_site_states', $site_states, $_site );
643
+
644
+        if ( ! empty( $site_states ) ) {
645
+            $state_count = count( $site_states );
646
+
647
+            $i = 0;
648
+
649
+            echo ' &mdash; ';
650
+
651
+            foreach ( $site_states as $state ) {
652
+                ++$i;
653
+
654
+                $sep = ( $i < $state_count ) ? ', ' : '';
655
+
656
+                echo "<span class='post-state'>{$state}{$sep}</span>";
657
+            }
658
+        }
659
+    }
660
+
661
+    /**
662
+     * Gets the name of the default primary column.
663
+     *
664
+     * @since 4.3.0
665
+     *
666
+     * @return string Name of the default primary column, in this case, 'blogname'.
667
+     */
668
+    protected function get_default_primary_column_name() {
669
+        return 'blogname';
670
+    }
671
+
672
+    /**
673
+     * Generates and displays row action links.
674
+     *
675
+     * @since 4.3.0
676
+     * @since 5.9.0 Renamed `$blog` to `$item` to match parent class for PHP 8 named parameter support.
677
+     *
678
+     * @param array  $item        Site being acted upon.
679
+     * @param string $column_name Current column name.
680
+     * @param string $primary     Primary column name.
681
+     * @return string Row actions output for sites in Multisite, or an empty string
682
+     *                if the current column is not the primary column.
683
+     */
684
+    protected function handle_row_actions( $item, $column_name, $primary ) {
685
+        if ( $primary !== $column_name ) {
686
+            return '';
687
+        }
688
+
689
+        // Restores the more descriptive, specific name for use within this method.
690
+        $blog     = $item;
691
+        $blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
692
+
693
+        // Preordered.
694
+        $actions = array(
695
+            'edit'       => '',
696
+            'backend'    => '',
697
+            'activate'   => '',
698
+            'deactivate' => '',
699
+            'archive'    => '',
700
+            'unarchive'  => '',
701
+            'spam'       => '',
702
+            'unspam'     => '',
703
+            'delete'     => '',
704
+            'visit'      => '',
705
+        );
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&amp;action2=activateblog&amp;id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>';
712
+            } else {
713
+                $actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>';
714
+            }
715
+
716
+            if ( '1' == $blog['archived'] ) {
717
+                $actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>';
718
+            } else {
719
+                $actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>';
720
+            }
721
+
722
+            if ( '1' == $blog['spam'] ) {
723
+                $actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>';
724
+            } else {
725
+                $actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>';
726
+            }
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&amp;action2=deleteblog&amp;id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a>';
730
+            }
731
+        }
732
+
733
+        $actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>';
734
+
735
+        /**
736
+         * Filters the action links displayed for each site in the Sites list table.
737
+         *
738
+         * The 'Edit', 'Dashboard', 'Delete', and 'Visit' links are displayed by
739
+         * default for each site. The site's status determines whether to show the
740
+         * 'Activate' or 'Deactivate' link, 'Unarchive' or 'Archive' links, and
741
+         * 'Not Spam' or 'Spam' link for each site.
742
+         *
743
+         * @since 3.1.0
744
+         *
745
+         * @param string[] $actions  An array of action links to be displayed.
746
+         * @param int      $blog_id  The site ID.
747
+         * @param string   $blogname Site path, formatted depending on whether it is a sub-domain
748
+         *                           or subdirectory multisite installation.
749
+         */
750
+        $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname );
751
+
752
+        return $this->row_actions( $actions );
753
+    }
754 754
 }
Please login to merge, or discard this patch.
Spacing   +153 added lines, -153 removed lines patch added patch discarded remove patch
@@ -34,18 +34,18 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 &#8211; %2$s' ),
458
-				get_option( 'blogname' ),
459
-				'<em>' . get_option( 'blogdescription' ) . '</em>'
457
+				__('%1$s &#8211; %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
 block discarded – undo
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
 block discarded – undo
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 '&#x2014;';
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 ' &mdash; ';
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
 block discarded – undo
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
 block discarded – undo
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&amp;action2=activateblog&amp;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&amp;action2=activateblog&amp;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&amp;action2=deactivateblog&amp;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&amp;action2=deactivateblog&amp;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&amp;action2=unarchiveblog&amp;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&amp;action2=unarchiveblog&amp;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&amp;action2=archiveblog&amp;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&amp;action2=archiveblog&amp;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&amp;action2=unspamblog&amp;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&amp;action2=unspamblog&amp;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&amp;action2=spamblog&amp;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&amp;action2=spamblog&amp;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&amp;action2=deleteblog&amp;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&amp;action2=deleteblog&amp;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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
brighty/wp-admin/includes/deprecated.php 3 patches
Indentation   +628 added lines, -628 removed lines patch added patch discarded remove patch
@@ -18,9 +18,9 @@  discard block
 block discarded – undo
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
-	wp_tiny_mce();
23
+    wp_tiny_mce();
24 24
 }
25 25
 
26 26
 /**
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
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
 /**
@@ -48,8 +48,8 @@  discard block
 block discarded – undo
48 48
  * @return array Shrunk dimensions (width, height).
49 49
  */
50 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 );
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
 /**
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
  * @return array Shrunk dimensions (width, height).
65 65
  */
66 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 );
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
 /**
@@ -82,9 +82,9 @@  discard block
 block discarded – undo
82 82
  * @param array $popular_ids      Unused.
83 83
  */
84 84
 function dropdown_categories( $default_category = 0, $category_parent = 0, $popular_ids = array() ) {
85
-	_deprecated_function( __FUNCTION__, '2.6.0', 'wp_category_checklist()' );
86
-	global $post_ID;
87
-	wp_category_checklist( $post_ID );
85
+    _deprecated_function( __FUNCTION__, '2.6.0', 'wp_category_checklist()' );
86
+    global $post_ID;
87
+    wp_category_checklist( $post_ID );
88 88
 }
89 89
 
90 90
 /**
@@ -99,9 +99,9 @@  discard block
 block discarded – undo
99 99
  * @param int $default_link_category Unused.
100 100
  */
101 101
 function dropdown_link_categories( $default_link_category = 0 ) {
102
-	_deprecated_function( __FUNCTION__, '2.6.0', 'wp_link_category_checklist()' );
103
-	global $link_id;
104
-	wp_link_category_checklist( $link_id );
102
+    _deprecated_function( __FUNCTION__, '2.6.0', 'wp_link_category_checklist()' );
103
+    global $link_id;
104
+    wp_link_category_checklist( $link_id );
105 105
 }
106 106
 
107 107
 /**
@@ -115,9 +115,9 @@  discard block
 block discarded – undo
115 115
  * @return string Full filesystem path to edit.
116 116
  */
117 117
 function get_real_file_to_edit( $file ) {
118
-	_deprecated_function( __FUNCTION__, '2.9.0' );
118
+    _deprecated_function( __FUNCTION__, '2.9.0' );
119 119
 
120
-	return WP_CONTENT_DIR . $file;
120
+    return WP_CONTENT_DIR . $file;
121 121
 }
122 122
 
123 123
 /**
@@ -135,25 +135,25 @@  discard block
 block discarded – undo
135 135
  * @return void|false Void on success, false if no categories were found.
136 136
  */
137 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
-
142
-	if ( $categories ) {
143
-		foreach ( $categories as $category ) {
144
-			if ( $current_cat != $category->term_id && $category_parent == $category->parent) {
145
-				$pad = str_repeat( '&#8211; ', $level );
146
-				$category->name = esc_html( $category->name );
147
-				echo "\n\t<option value='$category->term_id'";
148
-				if ( $current_parent == $category->term_id )
149
-					echo " selected='selected'";
150
-				echo ">$pad$category->name</option>";
151
-				wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories );
152
-			}
153
-		}
154
-	} else {
155
-		return false;
156
-	}
138
+    _deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' );
139
+    if (!$categories )
140
+        $categories = get_categories( array('hide_empty' => 0) );
141
+
142
+    if ( $categories ) {
143
+        foreach ( $categories as $category ) {
144
+            if ( $current_cat != $category->term_id && $category_parent == $category->parent) {
145
+                $pad = str_repeat( '&#8211; ', $level );
146
+                $category->name = esc_html( $category->name );
147
+                echo "\n\t<option value='$category->term_id'";
148
+                if ( $current_parent == $category->term_id )
149
+                    echo " selected='selected'";
150
+                echo ">$pad$category->name</option>";
151
+                wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories );
152
+            }
153
+        }
154
+    } else {
155
+        return false;
156
+    }
157 157
 }
158 158
 
159 159
 /**
@@ -170,8 +170,8 @@  discard block
 block discarded – undo
170 170
  * @param callable $sanitize_callback Optional. A callback function that sanitizes the option's value.
171 171
  */
172 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 );
173
+    _deprecated_function( __FUNCTION__, '3.0.0', 'register_setting()' );
174
+    register_setting( $option_group, $option_name, $sanitize_callback );
175 175
 }
176 176
 
177 177
 /**
@@ -186,8 +186,8 @@  discard block
 block discarded – undo
186 186
  * @param callable $sanitize_callback Optional. Deprecated.
187 187
  */
188 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 );
189
+    _deprecated_function( __FUNCTION__, '3.0.0', 'unregister_setting()' );
190
+    unregister_setting( $option_group, $option_name, $sanitize_callback );
191 191
 }
192 192
 
193 193
 /**
@@ -199,7 +199,7 @@  discard block
 block discarded – undo
199 199
  * @param string $filename
200 200
 **/
201 201
 function codepress_get_lang( $filename ) {
202
-	_deprecated_function( __FUNCTION__, '3.0.0' );
202
+    _deprecated_function( __FUNCTION__, '3.0.0' );
203 203
 }
204 204
 
205 205
 /**
@@ -209,7 +209,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
-	global $wpdb;
238
-	if ( !is_multisite() )
239
-		$level_key = $wpdb->get_blog_prefix() . 'user_level';
240
-	else
241
-		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
237
+    global $wpdb;
238
+    if ( !is_multisite() )
239
+        $level_key = $wpdb->get_blog_prefix() . 'user_level';
240
+    else
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
 /**
@@ -254,20 +254,20 @@  discard block
 block discarded – undo
254 254
  * @return array|false List of editable authors. False if no editable users.
255 255
  */
256 256
 function get_editable_authors( $user_id ) {
257
-	_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
257
+    _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
258 258
 
259
-	global $wpdb;
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 ) {
264
-		return false;
265
-	} else {
266
-		$editable = join(',', $editable);
267
-		$authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
268
-	}
263
+    if ( !$editable ) {
264
+        return false;
265
+    } else {
266
+        $editable = join(',', $editable);
267
+        $authors = $wpdb->get_results( "SELECT * FROM $wpdb->users WHERE ID IN ($editable) ORDER BY display_name" );
268
+    }
269 269
 
270
-	return apply_filters('get_editable_authors', $authors);
270
+    return apply_filters('get_editable_authors', $authors);
271 271
 }
272 272
 
273 273
 /**
@@ -282,31 +282,31 @@  discard block
 block discarded – undo
282 282
  * @return array Array of editable user IDs, empty array otherwise.
283 283
  */
284 284
 function get_editable_user_ids( $user_id, $exclude_zeros = true, $post_type = 'post' ) {
285
-	_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
285
+    _deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
286 286
 
287
-	global $wpdb;
287
+    global $wpdb;
288 288
 
289
-	if ( ! $user = get_userdata( $user_id ) )
290
-		return array();
291
-	$post_type_obj = get_post_type_object($post_type);
289
+    if ( ! $user = get_userdata( $user_id ) )
290
+        return array();
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 )
295
-			return array($user->ID);
296
-		else
297
-			return array();
298
-	}
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
+            return array($user->ID);
296
+        else
297
+            return array();
298
+    }
299 299
 
300
-	if ( !is_multisite() )
301
-		$level_key = $wpdb->get_blog_prefix() . 'user_level';
302
-	else
303
-		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
300
+    if ( !is_multisite() )
301
+        $level_key = $wpdb->get_blog_prefix() . 'user_level';
302
+    else
303
+        $level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
304 304
 
305
-	$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
306
-	if ( $exclude_zeros )
307
-		$query .= " AND meta_value != '0'";
305
+    $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
306
+    if ( $exclude_zeros )
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,16 +317,16 @@  discard block
 block discarded – undo
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
-	global $wpdb;
322
+    global $wpdb;
323 323
 
324
-	if ( !is_multisite() )
325
-		$level_key = $wpdb->get_blog_prefix() . 'user_level';
326
-	else
327
-		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
324
+    if ( !is_multisite() )
325
+        $level_key = $wpdb->get_blog_prefix() . 'user_level';
326
+    else
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 332
 if ( ! class_exists( 'WP_User_Search', false ) ) :
@@ -338,337 +338,337 @@  discard block
 block discarded – undo
338 338
  */
339 339
 class WP_User_Search {
340 340
 
341
-	/**
342
-	 * {@internal Missing Description}}
343
-	 *
344
-	 * @since 2.1.0
345
-	 * @access private
346
-	 * @var mixed
347
-	 */
348
-	var $results;
349
-
350
-	/**
351
-	 * {@internal Missing Description}}
352
-	 *
353
-	 * @since 2.1.0
354
-	 * @access private
355
-	 * @var string
356
-	 */
357
-	var $search_term;
358
-
359
-	/**
360
-	 * Page number.
361
-	 *
362
-	 * @since 2.1.0
363
-	 * @access private
364
-	 * @var int
365
-	 */
366
-	var $page;
367
-
368
-	/**
369
-	 * Role name that users have.
370
-	 *
371
-	 * @since 2.5.0
372
-	 * @access private
373
-	 * @var string
374
-	 */
375
-	var $role;
376
-
377
-	/**
378
-	 * Raw page number.
379
-	 *
380
-	 * @since 2.1.0
381
-	 * @access private
382
-	 * @var int|bool
383
-	 */
384
-	var $raw_page;
385
-
386
-	/**
387
-	 * Amount of users to display per page.
388
-	 *
389
-	 * @since 2.1.0
390
-	 * @access public
391
-	 * @var int
392
-	 */
393
-	var $users_per_page = 50;
394
-
395
-	/**
396
-	 * {@internal Missing Description}}
397
-	 *
398
-	 * @since 2.1.0
399
-	 * @access private
400
-	 * @var int
401
-	 */
402
-	var $first_user;
403
-
404
-	/**
405
-	 * {@internal Missing Description}}
406
-	 *
407
-	 * @since 2.1.0
408
-	 * @access private
409
-	 * @var int
410
-	 */
411
-	var $last_user;
412
-
413
-	/**
414
-	 * {@internal Missing Description}}
415
-	 *
416
-	 * @since 2.1.0
417
-	 * @access private
418
-	 * @var string
419
-	 */
420
-	var $query_limit;
421
-
422
-	/**
423
-	 * {@internal Missing Description}}
424
-	 *
425
-	 * @since 3.0.0
426
-	 * @access private
427
-	 * @var string
428
-	 */
429
-	var $query_orderby;
430
-
431
-	/**
432
-	 * {@internal Missing Description}}
433
-	 *
434
-	 * @since 3.0.0
435
-	 * @access private
436
-	 * @var string
437
-	 */
438
-	var $query_from;
439
-
440
-	/**
441
-	 * {@internal Missing Description}}
442
-	 *
443
-	 * @since 3.0.0
444
-	 * @access private
445
-	 * @var string
446
-	 */
447
-	var $query_where;
448
-
449
-	/**
450
-	 * {@internal Missing Description}}
451
-	 *
452
-	 * @since 2.1.0
453
-	 * @access private
454
-	 * @var int
455
-	 */
456
-	var $total_users_for_query = 0;
457
-
458
-	/**
459
-	 * {@internal Missing Description}}
460
-	 *
461
-	 * @since 2.1.0
462
-	 * @access private
463
-	 * @var bool
464
-	 */
465
-	var $too_many_total_users = false;
466
-
467
-	/**
468
-	 * {@internal Missing Description}}
469
-	 *
470
-	 * @since 2.1.0
471
-	 * @access private
472
-	 * @var WP_Error
473
-	 */
474
-	var $search_errors;
475
-
476
-	/**
477
-	 * {@internal Missing Description}}
478
-	 *
479
-	 * @since 2.7.0
480
-	 * @access private
481
-	 * @var string
482
-	 */
483
-	var $paging_text;
484
-
485
-	/**
486
-	 * PHP5 Constructor - Sets up the object properties.
487
-	 *
488
-	 * @since 2.1.0
489
-	 *
490
-	 * @param string $search_term Search terms string.
491
-	 * @param int $page Optional. Page ID.
492
-	 * @param string $role Role name.
493
-	 * @return WP_User_Search
494
-	 */
495
-	function __construct( $search_term = '', $page = '', $role = '' ) {
496
-		_deprecated_function( __FUNCTION__, '3.1.0', 'WP_User_Query' );
497
-
498
-		$this->search_term = wp_unslash( $search_term );
499
-		$this->raw_page = ( '' == $page ) ? false : (int) $page;
500
-		$this->page = ( '' == $page ) ? 1 : (int) $page;
501
-		$this->role = $role;
502
-
503
-		$this->prepare_query();
504
-		$this->query();
505
-		$this->do_paging();
506
-	}
507
-
508
-	/**
509
-	 * PHP4 Constructor - Sets up the object properties.
510
-	 *
511
-	 * @since 2.1.0
512
-	 *
513
-	 * @param string $search_term Search terms string.
514
-	 * @param int $page Optional. Page ID.
515
-	 * @param string $role Role name.
516
-	 * @return WP_User_Search
517
-	 */
518
-	public function WP_User_Search( $search_term = '', $page = '', $role = '' ) {
519
-		self::__construct( $search_term, $page, $role );
520
-	}
521
-
522
-	/**
523
-	 * Prepares the user search query (legacy).
524
-	 *
525
-	 * @since 2.1.0
526
-	 * @access public
527
-	 */
528
-	public function prepare_query() {
529
-		global $wpdb;
530
-		$this->first_user = ($this->page - 1) * $this->users_per_page;
531
-
532
-		$this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
533
-		$this->query_orderby = ' ORDER BY user_login';
534
-
535
-		$search_sql = '';
536
-		if ( $this->search_term ) {
537
-			$searches = array();
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) . '%' );
541
-			$search_sql .= implode(' OR ', $searches);
542
-			$search_sql .= ')';
543
-		}
544
-
545
-		$this->query_from = " FROM $wpdb->users";
546
-		$this->query_where = " WHERE 1=1 $search_sql";
547
-
548
-		if ( $this->role ) {
549
-			$this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
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() ) {
552
-			$level_key = $wpdb->prefix . 'capabilities'; // WPMU site admins don't have user_levels.
553
-			$this->query_from .= ", $wpdb->usermeta";
554
-			$this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
555
-		}
556
-
557
-		do_action_ref_array( 'pre_user_search', array( &$this ) );
558
-	}
559
-
560
-	/**
561
-	 * Executes the user search query.
562
-	 *
563
-	 * @since 2.1.0
564
-	 * @access public
565
-	 */
566
-	public function query() {
567
-		global $wpdb;
568
-
569
-		$this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
570
-
571
-		if ( $this->results )
572
-			$this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // No limit.
573
-		else
574
-			$this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
575
-	}
576
-
577
-	/**
578
-	 * Prepares variables for use in templates.
579
-	 *
580
-	 * @since 2.1.0
581
-	 * @access public
582
-	 */
583
-	function prepare_vars_for_template_usage() {}
584
-
585
-	/**
586
-	 * Handles paging for the user search query.
587
-	 *
588
-	 * @since 2.1.0
589
-	 * @access public
590
-	 */
591
-	public function do_paging() {
592
-		if ( $this->total_users_for_query > $this->users_per_page ) { // Have to page the results.
593
-			$args = array();
594
-			if ( ! empty($this->search_term) )
595
-				$args['usersearch'] = urlencode($this->search_term);
596
-			if ( ! empty($this->role) )
597
-				$args['role'] = urlencode($this->role);
598
-
599
-			$this->paging_text = paginate_links( array(
600
-				'total' => ceil($this->total_users_for_query / $this->users_per_page),
601
-				'current' => $this->page,
602
-				'base' => 'users.php?%_%',
603
-				'format' => 'userspage=%#%',
604
-				'add_args' => $args
605
-			) );
606
-			if ( $this->paging_text ) {
607
-				$this->paging_text = sprintf(
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&#8211;%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
-					$this->paging_text
614
-				);
615
-			}
616
-		}
617
-	}
618
-
619
-	/**
620
-	 * Retrieves the user search query results.
621
-	 *
622
-	 * @since 2.1.0
623
-	 * @access public
624
-	 *
625
-	 * @return array
626
-	 */
627
-	public function get_results() {
628
-		return (array) $this->results;
629
-	}
630
-
631
-	/**
632
-	 * Displaying paging text.
633
-	 *
634
-	 * @see do_paging() Builds paging text.
635
-	 *
636
-	 * @since 2.1.0
637
-	 * @access public
638
-	 */
639
-	function page_links() {
640
-		echo $this->paging_text;
641
-	}
642
-
643
-	/**
644
-	 * Whether paging is enabled.
645
-	 *
646
-	 * @see do_paging() Builds paging text.
647
-	 *
648
-	 * @since 2.1.0
649
-	 * @access public
650
-	 *
651
-	 * @return bool
652
-	 */
653
-	function results_are_paged() {
654
-		if ( $this->paging_text )
655
-			return true;
656
-		return false;
657
-	}
658
-
659
-	/**
660
-	 * Whether there are search terms.
661
-	 *
662
-	 * @since 2.1.0
663
-	 * @access public
664
-	 *
665
-	 * @return bool
666
-	 */
667
-	function is_search() {
668
-		if ( $this->search_term )
669
-			return true;
670
-		return false;
671
-	}
341
+    /**
342
+     * {@internal Missing Description}}
343
+     *
344
+     * @since 2.1.0
345
+     * @access private
346
+     * @var mixed
347
+     */
348
+    var $results;
349
+
350
+    /**
351
+     * {@internal Missing Description}}
352
+     *
353
+     * @since 2.1.0
354
+     * @access private
355
+     * @var string
356
+     */
357
+    var $search_term;
358
+
359
+    /**
360
+     * Page number.
361
+     *
362
+     * @since 2.1.0
363
+     * @access private
364
+     * @var int
365
+     */
366
+    var $page;
367
+
368
+    /**
369
+     * Role name that users have.
370
+     *
371
+     * @since 2.5.0
372
+     * @access private
373
+     * @var string
374
+     */
375
+    var $role;
376
+
377
+    /**
378
+     * Raw page number.
379
+     *
380
+     * @since 2.1.0
381
+     * @access private
382
+     * @var int|bool
383
+     */
384
+    var $raw_page;
385
+
386
+    /**
387
+     * Amount of users to display per page.
388
+     *
389
+     * @since 2.1.0
390
+     * @access public
391
+     * @var int
392
+     */
393
+    var $users_per_page = 50;
394
+
395
+    /**
396
+     * {@internal Missing Description}}
397
+     *
398
+     * @since 2.1.0
399
+     * @access private
400
+     * @var int
401
+     */
402
+    var $first_user;
403
+
404
+    /**
405
+     * {@internal Missing Description}}
406
+     *
407
+     * @since 2.1.0
408
+     * @access private
409
+     * @var int
410
+     */
411
+    var $last_user;
412
+
413
+    /**
414
+     * {@internal Missing Description}}
415
+     *
416
+     * @since 2.1.0
417
+     * @access private
418
+     * @var string
419
+     */
420
+    var $query_limit;
421
+
422
+    /**
423
+     * {@internal Missing Description}}
424
+     *
425
+     * @since 3.0.0
426
+     * @access private
427
+     * @var string
428
+     */
429
+    var $query_orderby;
430
+
431
+    /**
432
+     * {@internal Missing Description}}
433
+     *
434
+     * @since 3.0.0
435
+     * @access private
436
+     * @var string
437
+     */
438
+    var $query_from;
439
+
440
+    /**
441
+     * {@internal Missing Description}}
442
+     *
443
+     * @since 3.0.0
444
+     * @access private
445
+     * @var string
446
+     */
447
+    var $query_where;
448
+
449
+    /**
450
+     * {@internal Missing Description}}
451
+     *
452
+     * @since 2.1.0
453
+     * @access private
454
+     * @var int
455
+     */
456
+    var $total_users_for_query = 0;
457
+
458
+    /**
459
+     * {@internal Missing Description}}
460
+     *
461
+     * @since 2.1.0
462
+     * @access private
463
+     * @var bool
464
+     */
465
+    var $too_many_total_users = false;
466
+
467
+    /**
468
+     * {@internal Missing Description}}
469
+     *
470
+     * @since 2.1.0
471
+     * @access private
472
+     * @var WP_Error
473
+     */
474
+    var $search_errors;
475
+
476
+    /**
477
+     * {@internal Missing Description}}
478
+     *
479
+     * @since 2.7.0
480
+     * @access private
481
+     * @var string
482
+     */
483
+    var $paging_text;
484
+
485
+    /**
486
+     * PHP5 Constructor - Sets up the object properties.
487
+     *
488
+     * @since 2.1.0
489
+     *
490
+     * @param string $search_term Search terms string.
491
+     * @param int $page Optional. Page ID.
492
+     * @param string $role Role name.
493
+     * @return WP_User_Search
494
+     */
495
+    function __construct( $search_term = '', $page = '', $role = '' ) {
496
+        _deprecated_function( __FUNCTION__, '3.1.0', 'WP_User_Query' );
497
+
498
+        $this->search_term = wp_unslash( $search_term );
499
+        $this->raw_page = ( '' == $page ) ? false : (int) $page;
500
+        $this->page = ( '' == $page ) ? 1 : (int) $page;
501
+        $this->role = $role;
502
+
503
+        $this->prepare_query();
504
+        $this->query();
505
+        $this->do_paging();
506
+    }
507
+
508
+    /**
509
+     * PHP4 Constructor - Sets up the object properties.
510
+     *
511
+     * @since 2.1.0
512
+     *
513
+     * @param string $search_term Search terms string.
514
+     * @param int $page Optional. Page ID.
515
+     * @param string $role Role name.
516
+     * @return WP_User_Search
517
+     */
518
+    public function WP_User_Search( $search_term = '', $page = '', $role = '' ) {
519
+        self::__construct( $search_term, $page, $role );
520
+    }
521
+
522
+    /**
523
+     * Prepares the user search query (legacy).
524
+     *
525
+     * @since 2.1.0
526
+     * @access public
527
+     */
528
+    public function prepare_query() {
529
+        global $wpdb;
530
+        $this->first_user = ($this->page - 1) * $this->users_per_page;
531
+
532
+        $this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
533
+        $this->query_orderby = ' ORDER BY user_login';
534
+
535
+        $search_sql = '';
536
+        if ( $this->search_term ) {
537
+            $searches = array();
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) . '%' );
541
+            $search_sql .= implode(' OR ', $searches);
542
+            $search_sql .= ')';
543
+        }
544
+
545
+        $this->query_from = " FROM $wpdb->users";
546
+        $this->query_where = " WHERE 1=1 $search_sql";
547
+
548
+        if ( $this->role ) {
549
+            $this->query_from .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id";
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() ) {
552
+            $level_key = $wpdb->prefix . 'capabilities'; // WPMU site admins don't have user_levels.
553
+            $this->query_from .= ", $wpdb->usermeta";
554
+            $this->query_where .= " AND $wpdb->users.ID = $wpdb->usermeta.user_id AND meta_key = '{$level_key}'";
555
+        }
556
+
557
+        do_action_ref_array( 'pre_user_search', array( &$this ) );
558
+    }
559
+
560
+    /**
561
+     * Executes the user search query.
562
+     *
563
+     * @since 2.1.0
564
+     * @access public
565
+     */
566
+    public function query() {
567
+        global $wpdb;
568
+
569
+        $this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
570
+
571
+        if ( $this->results )
572
+            $this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // No limit.
573
+        else
574
+            $this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
575
+    }
576
+
577
+    /**
578
+     * Prepares variables for use in templates.
579
+     *
580
+     * @since 2.1.0
581
+     * @access public
582
+     */
583
+    function prepare_vars_for_template_usage() {}
584
+
585
+    /**
586
+     * Handles paging for the user search query.
587
+     *
588
+     * @since 2.1.0
589
+     * @access public
590
+     */
591
+    public function do_paging() {
592
+        if ( $this->total_users_for_query > $this->users_per_page ) { // Have to page the results.
593
+            $args = array();
594
+            if ( ! empty($this->search_term) )
595
+                $args['usersearch'] = urlencode($this->search_term);
596
+            if ( ! empty($this->role) )
597
+                $args['role'] = urlencode($this->role);
598
+
599
+            $this->paging_text = paginate_links( array(
600
+                'total' => ceil($this->total_users_for_query / $this->users_per_page),
601
+                'current' => $this->page,
602
+                'base' => 'users.php?%_%',
603
+                'format' => 'userspage=%#%',
604
+                'add_args' => $args
605
+            ) );
606
+            if ( $this->paging_text ) {
607
+                $this->paging_text = sprintf(
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&#8211;%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
+                    $this->paging_text
614
+                );
615
+            }
616
+        }
617
+    }
618
+
619
+    /**
620
+     * Retrieves the user search query results.
621
+     *
622
+     * @since 2.1.0
623
+     * @access public
624
+     *
625
+     * @return array
626
+     */
627
+    public function get_results() {
628
+        return (array) $this->results;
629
+    }
630
+
631
+    /**
632
+     * Displaying paging text.
633
+     *
634
+     * @see do_paging() Builds paging text.
635
+     *
636
+     * @since 2.1.0
637
+     * @access public
638
+     */
639
+    function page_links() {
640
+        echo $this->paging_text;
641
+    }
642
+
643
+    /**
644
+     * Whether paging is enabled.
645
+     *
646
+     * @see do_paging() Builds paging text.
647
+     *
648
+     * @since 2.1.0
649
+     * @access public
650
+     *
651
+     * @return bool
652
+     */
653
+    function results_are_paged() {
654
+        if ( $this->paging_text )
655
+            return true;
656
+        return false;
657
+    }
658
+
659
+    /**
660
+     * Whether there are search terms.
661
+     *
662
+     * @since 2.1.0
663
+     * @access public
664
+     *
665
+     * @return bool
666
+     */
667
+    function is_search() {
668
+        if ( $this->search_term )
669
+            return true;
670
+        return false;
671
+    }
672 672
 }
673 673
 endif;
674 674
 
@@ -687,27 +687,27 @@  discard block
 block discarded – undo
687 687
  * @return array List of posts from others.
688 688
  */
689 689
 function get_others_unpublished_posts( $user_id, $type = 'any' ) {
690
-	_deprecated_function( __FUNCTION__, '3.1.0' );
690
+    _deprecated_function( __FUNCTION__, '3.1.0' );
691 691
 
692
-	global $wpdb;
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')) )
697
-		$type_sql = " post_status = '$type' ";
698
-	else
699
-		$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
696
+    if ( in_array($type, array('draft', 'pending')) )
697
+        $type_sql = " post_status = '$type' ";
698
+    else
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 ) {
704
-		$other_unpubs = '';
705
-	} else {
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) );
708
-	}
703
+    if ( !$editable ) {
704
+        $other_unpubs = '';
705
+    } else {
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) );
708
+    }
709 709
 
710
-	return apply_filters('get_others_drafts', $other_unpubs);
710
+    return apply_filters('get_others_drafts', $other_unpubs);
711 711
 }
712 712
 
713 713
 /**
@@ -720,9 +720,9 @@  discard block
 block discarded – undo
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
-	return get_others_unpublished_posts($user_id, 'draft');
725
+    return get_others_unpublished_posts($user_id, 'draft');
726 726
 }
727 727
 
728 728
 /**
@@ -735,9 +735,9 @@  discard block
 block discarded – undo
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
-	return get_others_unpublished_posts($user_id, 'pending');
740
+    return get_others_unpublished_posts($user_id, 'pending');
741 741
 }
742 742
 
743 743
 /**
@@ -748,8 +748,8 @@  discard block
 block discarded – undo
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()' );
752
-	wp_dashboard_quick_press();
751
+    _deprecated_function( __FUNCTION__, '3.2.0', 'wp_dashboard_quick_press()' );
752
+    wp_dashboard_quick_press();
753 753
 }
754 754
 
755 755
 /**
@@ -760,23 +760,23 @@  discard block
 block discarded – undo
760 760
  * @see wp_editor()
761 761
  */
762 762
 function wp_tiny_mce( $teeny = false, $settings = false ) {
763
-	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
763
+    _deprecated_function( __FUNCTION__, '3.3.0', 'wp_editor()' );
764 764
 
765
-	static $num = 1;
765
+    static $num = 1;
766 766
 
767
-	if ( ! class_exists( '_WP_Editors', false ) )
768
-		require_once ABSPATH . WPINC . '/class-wp-editor.php';
767
+    if ( ! class_exists( '_WP_Editors', false ) )
768
+        require_once ABSPATH . WPINC . '/class-wp-editor.php';
769 769
 
770
-	$editor_id = 'content' . $num++;
770
+    $editor_id = 'content' . $num++;
771 771
 
772
-	$set = array(
773
-		'teeny' => $teeny,
774
-		'tinymce' => $settings ? $settings : true,
775
-		'quicktags' => false
776
-	);
772
+    $set = array(
773
+        'teeny' => $teeny,
774
+        'tinymce' => $settings ? $settings : true,
775
+        'quicktags' => false
776
+    );
777 777
 
778
-	$set = _WP_Editors::parse_settings($editor_id, $set);
779
-	_WP_Editors::editor_settings($editor_id, $set);
778
+    $set = _WP_Editors::parse_settings($editor_id, $set);
779
+    _WP_Editors::editor_settings($editor_id, $set);
780 780
 }
781 781
 
782 782
 /**
@@ -786,7 +786,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 /**
@@ -817,16 +817,16 @@  discard block
 block discarded – undo
817 817
  * @see WP_Screen::render_screen_layout()
818 818
  */
819 819
 function screen_layout( $screen ) {
820
-	_deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );
820
+    _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_screen_layout()' );
821 821
 
822
-	$current_screen = get_current_screen();
822
+    $current_screen = get_current_screen();
823 823
 
824
-	if ( ! $current_screen )
825
-		return '';
824
+    if ( ! $current_screen )
825
+        return '';
826 826
 
827
-	ob_start();
828
-	$current_screen->render_screen_layout();
829
-	return ob_get_clean();
827
+    ob_start();
828
+    $current_screen->render_screen_layout();
829
+    return ob_get_clean();
830 830
 }
831 831
 
832 832
 /**
@@ -837,16 +837,16 @@  discard block
 block discarded – undo
837 837
  * @see WP_Screen::render_per_page_options()
838 838
  */
839 839
 function screen_options( $screen ) {
840
-	_deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
840
+    _deprecated_function( __FUNCTION__, '3.3.0', '$current_screen->render_per_page_options()' );
841 841
 
842
-	$current_screen = get_current_screen();
842
+    $current_screen = get_current_screen();
843 843
 
844
-	if ( ! $current_screen )
845
-		return '';
844
+    if ( ! $current_screen )
845
+        return '';
846 846
 
847
-	ob_start();
848
-	$current_screen->render_per_page_options();
849
-	return ob_get_clean();
847
+    ob_start();
848
+    $current_screen->render_per_page_options();
849
+    return ob_get_clean();
850 850
 }
851 851
 
852 852
 /**
@@ -857,8 +857,8 @@  discard block
 block discarded – undo
857 857
  * @see WP_Screen::render_screen_meta()
858 858
  */
859 859
 function screen_meta( $screen ) {
860
-	$current_screen = get_current_screen();
861
-	$current_screen->render_screen_meta();
860
+    $current_screen = get_current_screen();
861
+    $current_screen->render_screen_meta();
862 862
 }
863 863
 
864 864
 /**
@@ -869,7 +869,7 @@  discard block
 block discarded – undo
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,8 +881,8 @@  discard block
 block discarded – undo
881 881
  * @return null|string
882 882
  */
883 883
 function media_upload_image() {
884
-	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
885
-	return wp_media_upload_handler();
884
+    _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
885
+    return wp_media_upload_handler();
886 886
 }
887 887
 
888 888
 /**
@@ -894,8 +894,8 @@  discard block
 block discarded – undo
894 894
  * @return null|string
895 895
  */
896 896
 function media_upload_audio() {
897
-	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
898
-	return wp_media_upload_handler();
897
+    _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
898
+    return wp_media_upload_handler();
899 899
 }
900 900
 
901 901
 /**
@@ -907,8 +907,8 @@  discard block
 block discarded – undo
907 907
  * @return null|string
908 908
  */
909 909
 function media_upload_video() {
910
-	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
911
-	return wp_media_upload_handler();
910
+    _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
911
+    return wp_media_upload_handler();
912 912
 }
913 913
 
914 914
 /**
@@ -920,8 +920,8 @@  discard block
 block discarded – undo
920 920
  * @return null|string
921 921
  */
922 922
 function media_upload_file() {
923
-	_deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
924
-	return wp_media_upload_handler();
923
+    _deprecated_function( __FUNCTION__, '3.3.0', 'wp_media_upload_handler()' );
924
+    return wp_media_upload_handler();
925 925
 }
926 926
 
927 927
 /**
@@ -933,8 +933,8 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 /**
@@ -990,12 +990,12 @@  discard block
 block discarded – undo
990 990
  * @param string    $help   The content of an 'Overview' help tab.
991 991
  */
992 992
 function add_contextual_help( $screen, $help ) {
993
-	_deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
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,16 +1008,16 @@  discard block
 block discarded – undo
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
-	$wp_themes = array();
1016
-	foreach ( $themes as $theme ) {
1017
-		$wp_themes[ $theme->get('Name') ] = $theme;
1018
-	}
1015
+    $wp_themes = array();
1016
+    foreach ( $themes as $theme ) {
1017
+        $wp_themes[ $theme->get('Name') ] = $theme;
1018
+    }
1019 1019
 
1020
-	return $wp_themes;
1020
+    return $wp_themes;
1021 1021
 }
1022 1022
 
1023 1023
 /**
@@ -1030,19 +1030,19 @@  discard block
 block discarded – undo
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 ) );
1036
-	$broken = array();
1037
-	foreach ( $themes as $theme ) {
1038
-		$name = $theme->get('Name');
1039
-		$broken[ $name ] = array(
1040
-			'Name' => $name,
1041
-			'Title' => $name,
1042
-			'Description' => $theme->errors()->get_error_message(),
1043
-		);
1044
-	}
1045
-	return $broken;
1035
+    $themes = wp_get_themes( array( 'errors' => true ) );
1036
+    $broken = array();
1037
+    foreach ( $themes as $theme ) {
1038
+        $name = $theme->get('Name');
1039
+        $broken[ $name ] = array(
1040
+            'Name' => $name,
1041
+            'Title' => $name,
1042
+            'Description' => $theme->errors()->get_error_message(),
1043
+        );
1044
+    }
1045
+    return $broken;
1046 1046
 }
1047 1047
 
1048 1048
 /**
@@ -1055,9 +1055,9 @@  discard block
 block discarded – undo
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
-	return wp_get_theme();
1060
+    return wp_get_theme();
1061 1061
 }
1062 1062
 
1063 1063
 /**
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
  * @deprecated 3.5.0
1069 1069
  */
1070 1070
 function _insert_into_post_button( $type ) {
1071
-	_deprecated_function( __FUNCTION__, '3.5.0' );
1071
+    _deprecated_function( __FUNCTION__, '3.5.0' );
1072 1072
 }
1073 1073
 
1074 1074
 /**
@@ -1079,7 +1079,7 @@  discard block
 block discarded – undo
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
 /**
@@ -1093,9 +1093,9 @@  discard block
 block discarded – undo
1093 1093
  * @return WP_Post
1094 1094
  */
1095 1095
 function get_post_to_edit( $id ) {
1096
-	_deprecated_function( __FUNCTION__, '3.5.0', 'get_post()' );
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,11 +1108,11 @@  discard block
 block discarded – undo
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
-	$page = get_default_post_to_edit();
1114
-	$page->post_type = 'page';
1115
-	return $page;
1113
+    $page = get_default_post_to_edit();
1114
+    $page->post_type = 'page';
1115
+    return $page;
1116 1116
 }
1117 1117
 
1118 1118
 /**
@@ -1128,8 +1128,8 @@  discard block
 block discarded – undo
1128 1128
  * @return string Thumbnail path on success, Error string on failure.
1129 1129
  */
1130 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 ) );
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
 block discarded – undo
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,14 +1155,14 @@  discard block
 block discarded – undo
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) )
1161
-		add_filter('update_feedback', $feedback);
1160
+    if ( !empty($feedback) )
1161
+        add_filter('update_feedback', $feedback);
1162 1162
 
1163
-	require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1164
-	$upgrader = new Core_Upgrader();
1165
-	return $upgrader->upgrade($current);
1163
+    require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1164
+    $upgrader = new Core_Upgrader();
1165
+    return $upgrader->upgrade($current);
1166 1166
 
1167 1167
 }
1168 1168
 
@@ -1178,14 +1178,14 @@  discard block
 block discarded – undo
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) )
1184
-		add_filter('update_feedback', $feedback);
1183
+    if ( !empty($feedback) )
1184
+        add_filter('update_feedback', $feedback);
1185 1185
 
1186
-	require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1187
-	$upgrader = new Plugin_Upgrader();
1188
-	return $upgrader->upgrade($plugin);
1186
+    require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1187
+    $upgrader = new Plugin_Upgrader();
1188
+    return $upgrader->upgrade($plugin);
1189 1189
 }
1190 1190
 
1191 1191
 /**
@@ -1200,14 +1200,14 @@  discard block
 block discarded – undo
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) )
1206
-		add_filter('update_feedback', $feedback);
1205
+    if ( !empty($feedback) )
1206
+        add_filter('update_feedback', $feedback);
1207 1207
 
1208
-	require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1209
-	$upgrader = new Theme_Upgrader();
1210
-	return $upgrader->upgrade($theme);
1208
+    require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1209
+    $upgrader = new Theme_Upgrader();
1210
+    return $upgrader->upgrade($theme);
1211 1211
 }
1212 1212
 
1213 1213
 /**
@@ -1219,7 +1219,7 @@  discard block
 block discarded – undo
1219 1219
  * @param int|bool $id
1220 1220
  */
1221 1221
 function the_attachment_links( $id = false ) {
1222
-	_deprecated_function( __FUNCTION__, '3.7.0' );
1222
+    _deprecated_function( __FUNCTION__, '3.7.0' );
1223 1223
 }
1224 1224
 
1225 1225
 /**
@@ -1229,8 +1229,8 @@  discard block
 block discarded – undo
1229 1229
  * @deprecated 3.8.0
1230 1230
  */
1231 1231
 function screen_icon() {
1232
-	_deprecated_function( __FUNCTION__, '3.8.0' );
1233
-	echo get_screen_icon();
1232
+    _deprecated_function( __FUNCTION__, '3.8.0' );
1233
+    echo get_screen_icon();
1234 1234
 }
1235 1235
 
1236 1236
 /**
@@ -1242,8 +1242,8 @@  discard block
 block discarded – undo
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' );
1246
-	return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
1245
+    _deprecated_function( __FUNCTION__, '3.8.0' );
1246
+    return '<!-- Screen icons are no longer used as of WordPress 3.8. -->';
1247 1247
 }
1248 1248
 
1249 1249
 /**
@@ -1321,76 +1321,76 @@  discard block
 block discarded – undo
1321 1321
  * @param array  $args Array of arguments for this RSS feed.
1322 1322
  */
1323 1323
 function wp_dashboard_plugins_output( $rss, $args = array() ) {
1324
-	_deprecated_function( __FUNCTION__, '4.8.0' );
1324
+    _deprecated_function( __FUNCTION__, '4.8.0' );
1325 1325
 
1326
-	// Plugin feeds plus link to install them.
1327
-	$popular = fetch_feed( $args['url']['popular'] );
1326
+    // Plugin feeds plus link to install them.
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 );
1332
-	}
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
+    }
1333 1333
 
1334
-	echo '<ul>';
1334
+    echo '<ul>';
1335 1335
 
1336
-	foreach ( array( $popular ) as $feed ) {
1337
-		if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1338
-			continue;
1336
+    foreach ( array( $popular ) as $feed ) {
1337
+        if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1338
+            continue;
1339 1339
 
1340
-		$items = $feed->get_items(0, 5);
1340
+        $items = $feed->get_items(0, 5);
1341 1341
 
1342
-		// Pick a random, non-installed plugin.
1343
-		while ( true ) {
1344
-			// Abort this foreach loop iteration if there's no plugins left of this type.
1345
-			if ( 0 === count($items) )
1346
-				continue 2;
1342
+        // Pick a random, non-installed plugin.
1343
+        while ( true ) {
1344
+            // Abort this foreach loop iteration if there's no plugins left of this type.
1345
+            if ( 0 === count($items) )
1346
+                continue 2;
1347 1347
 
1348
-			$item_key = array_rand($items);
1349
-			$item = $items[$item_key];
1348
+            $item_key = array_rand($items);
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
-			$link = esc_url($link);
1354
-			if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1355
-				$slug = $matches[1];
1356
-			else {
1357
-				unset( $items[$item_key] );
1358
-				continue;
1359
-			}
1353
+            $link = esc_url($link);
1354
+            if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1355
+                $slug = $matches[1];
1356
+            else {
1357
+                unset( $items[$item_key] );
1358
+                continue;
1359
+            }
1360 1360
 
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] );
1366
-					continue 2;
1367
-				}
1368
-			}
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] );
1366
+                    continue 2;
1367
+                }
1368
+            }
1369 1369
 
1370
-			// If we get to this point, then the random plugin isn't installed and we can stop the while().
1371
-			break;
1372
-		}
1370
+            // If we get to this point, then the random plugin isn't installed and we can stop the while().
1371
+            break;
1372
+        }
1373 1373
 
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:' ) )
1376
-			unset($items[$item_key]);
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:' ) )
1376
+            unset($items[$item_key]);
1377 1377
 
1378
-		if ( !isset($items[$item_key]) )
1379
-			continue;
1378
+        if ( !isset($items[$item_key]) )
1379
+            continue;
1380 1380
 
1381
-		$raw_title = $item->get_title();
1381
+        $raw_title = $item->get_title();
1382 1382
 
1383
-		$ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
1384
-		echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
1385
-			'&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
1386
-			/* translators: %s: Plugin name. */
1387
-			esc_attr( sprintf( _x( 'Install %s', 'plugin' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
1383
+        $ilink = wp_nonce_url('plugin-install.php?tab=plugin-information&plugin=' . $slug, 'install-plugin_' . $slug) . '&amp;TB_iframe=true&amp;width=600&amp;height=800';
1384
+        echo '<li class="dashboard-news-plugin"><span>' . __( 'Popular Plugin' ) . ':</span> ' . esc_html( $raw_title ) .
1385
+            '&nbsp;<a href="' . $ilink . '" class="thickbox open-plugin-details-modal" aria-label="' .
1386
+            /* translators: %s: Plugin name. */
1387
+            esc_attr( sprintf( _x( 'Install %s', 'plugin' ), $raw_title ) ) . '">(' . __( 'Install' ) . ')</a></li>';
1388 1388
 
1389
-		$feed->__destruct();
1390
-		unset( $feed );
1391
-	}
1389
+        $feed->__destruct();
1390
+        unset( $feed );
1391
+    }
1392 1392
 
1393
-	echo '</ul>';
1393
+    echo '</ul>';
1394 1394
 }
1395 1395
 
1396 1396
 /**
@@ -1404,7 +1404,7 @@  discard block
 block discarded – undo
1404 1404
  * @param int $new_ID
1405 1405
  */
1406 1406
 function _relocate_children( $old_ID, $new_ID ) {
1407
-	_deprecated_function( __FUNCTION__, '3.9.0' );
1407
+    _deprecated_function( __FUNCTION__, '3.9.0' );
1408 1408
 }
1409 1409
 
1410 1410
 /**
@@ -1431,13 +1431,13 @@  discard block
 block discarded – undo
1431 1431
  * @return string The resulting page's hook_suffix.
1432 1432
  */
1433 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()' );
1434
+    _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
1435 1435
 
1436
-	global $_wp_last_object_menu;
1436
+    global $_wp_last_object_menu;
1437 1437
 
1438
-	$_wp_last_object_menu++;
1438
+    $_wp_last_object_menu++;
1439 1439
 
1440
-	return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_object_menu);
1440
+    return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_object_menu);
1441 1441
 }
1442 1442
 
1443 1443
 /**
@@ -1464,13 +1464,13 @@  discard block
 block discarded – undo
1464 1464
  * @return string The resulting page's hook_suffix.
1465 1465
  */
1466 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()' );
1467
+    _deprecated_function( __FUNCTION__, '4.5.0', 'add_menu_page()' );
1468 1468
 
1469
-	global $_wp_last_utility_menu;
1469
+    global $_wp_last_utility_menu;
1470 1470
 
1471
-	$_wp_last_utility_menu++;
1471
+    $_wp_last_utility_menu++;
1472 1472
 
1473
-	return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_utility_menu);
1473
+    return add_menu_page($page_title, $menu_title, $capability, $menu_slug, $callback, $icon_url, $_wp_last_utility_menu);
1474 1474
 }
1475 1475
 
1476 1476
 /**
@@ -1489,13 +1489,13 @@  discard block
 block discarded – undo
1489 1489
  * @global bool $is_chrome
1490 1490
  */
1491 1491
 function post_form_autocomplete_off() {
1492
-	global $is_safari, $is_chrome;
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 ) {
1497
-		echo ' autocomplete="off"';
1498
-	}
1496
+    if ( $is_safari || $is_chrome ) {
1497
+        echo ' autocomplete="off"';
1498
+    }
1499 1499
 }
1500 1500
 
1501 1501
 /**
@@ -1505,7 +1505,7 @@  discard block
 block discarded – undo
1505 1505
  * @deprecated 4.9.0
1506 1506
  */
1507 1507
 function options_permalink_add_js() {
1508
-	?>
1508
+    ?>
1509 1509
 	<script type="text/javascript">
1510 1510
 		jQuery( function() {
1511 1511
 			jQuery('.permalink-structure input:radio').change(function() {
@@ -1528,15 +1528,15 @@  discard block
 block discarded – undo
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' ) {
1535
-			$args['screen'] = 'export-personal-data';
1536
-		}
1534
+        if ( ! isset( $args['screen'] ) || $args['screen'] === 'export_personal_data' ) {
1535
+            $args['screen'] = 'export-personal-data';
1536
+        }
1537 1537
 
1538
-		parent::__construct( $args );
1539
-	}
1538
+        parent::__construct( $args );
1539
+    }
1540 1540
 }
1541 1541
 
1542 1542
 /**
@@ -1546,15 +1546,15 @@  discard block
 block discarded – undo
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' ) {
1553
-			$args['screen'] = 'erase-personal-data';
1554
-		}
1552
+        if ( ! isset( $args['screen'] ) || $args['screen'] === 'remove_personal_data' ) {
1553
+            $args['screen'] = 'erase-personal-data';
1554
+        }
1555 1555
 
1556
-		parent::__construct( $args );
1557
-	}
1556
+        parent::__construct( $args );
1557
+    }
1558 1558
 }
1559 1559
 
1560 1560
 /**
@@ -1565,7 +1565,7 @@  discard block
 block discarded – undo
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
 /**
@@ -1580,7 +1580,7 @@  discard block
 block discarded – undo
1580 1580
  * @return array Attachment post object converted to an array.
1581 1581
  */
1582 1582
 function image_attachment_fields_to_save( $post, $attachment ) {
1583
-	_deprecated_function( __FUNCTION__, '6.0.0' );
1583
+    _deprecated_function( __FUNCTION__, '6.0.0' );
1584 1584
 
1585
-	return $post;
1585
+    return $post;
1586 1586
 }
Please login to merge, or discard this patch.
Spacing   +195 added lines, -195 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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( '&#8211; ', $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('&#8211; ', $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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&#8211;%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&#8211;%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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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) . '&amp;TB_iframe=true&amp;width=600&amp;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
 			'&nbsp;<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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +98 added lines, -67 removed lines patch added patch discarded remove patch
@@ -136,8 +136,9 @@  discard block
 block discarded – undo
136 136
  */
137 137
 function wp_dropdown_cats( $current_cat = 0, $current_parent = 0, $category_parent = 0, $level = 0, $categories = 0 ) {
138 138
 	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_dropdown_categories()' );
139
-	if (!$categories )
140
-		$categories = get_categories( array('hide_empty' => 0) );
139
+	if (!$categories ) {
140
+			$categories = get_categories( array('hide_empty' => 0) );
141
+	}
141 142
 
142 143
 	if ( $categories ) {
143 144
 		foreach ( $categories as $category ) {
@@ -145,8 +146,9 @@  discard block
 block discarded – undo
145 146
 				$pad = str_repeat( '&#8211; ', $level );
146 147
 				$category->name = esc_html( $category->name );
147 148
 				echo "\n\t<option value='$category->term_id'";
148
-				if ( $current_parent == $category->term_id )
149
-					echo " selected='selected'";
149
+				if ( $current_parent == $category->term_id ) {
150
+									echo " selected='selected'";
151
+				}
150 152
 				echo ">$pad$category->name</option>";
151 153
 				wp_dropdown_cats( $current_cat, $current_parent, $category->term_id, $level +1, $categories );
152 154
 			}
@@ -235,10 +237,12 @@  discard block
 block discarded – undo
235 237
 	_deprecated_function( __FUNCTION__, '3.1.0', 'get_users()' );
236 238
 
237 239
 	global $wpdb;
238
-	if ( !is_multisite() )
239
-		$level_key = $wpdb->get_blog_prefix() . 'user_level';
240
-	else
241
-		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
240
+	if ( !is_multisite() ) {
241
+			$level_key = $wpdb->get_blog_prefix() . 'user_level';
242
+	} else {
243
+			$level_key = $wpdb->get_blog_prefix() . 'capabilities';
244
+	}
245
+	// WPMU site admins don't have user_levels.
242 246
 
243 247
 	return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
244 248
 }
@@ -286,25 +290,30 @@  discard block
 block discarded – undo
286 290
 
287 291
 	global $wpdb;
288 292
 
289
-	if ( ! $user = get_userdata( $user_id ) )
290
-		return array();
293
+	if ( ! $user = get_userdata( $user_id ) ) {
294
+			return array();
295
+	}
291 296
 	$post_type_obj = get_post_type_object($post_type);
292 297
 
293 298
 	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
-			return array($user->ID);
296
-		else
297
-			return array();
299
+		if ( $user->has_cap($post_type_obj->cap->edit_posts) || ! $exclude_zeros ) {
300
+					return array($user->ID);
301
+		} else {
302
+					return array();
303
+		}
298 304
 	}
299 305
 
300
-	if ( !is_multisite() )
301
-		$level_key = $wpdb->get_blog_prefix() . 'user_level';
302
-	else
303
-		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
306
+	if ( !is_multisite() ) {
307
+			$level_key = $wpdb->get_blog_prefix() . 'user_level';
308
+	} else {
309
+			$level_key = $wpdb->get_blog_prefix() . 'capabilities';
310
+	}
311
+	// WPMU site admins don't have user_levels.
304 312
 
305 313
 	$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
306
-	if ( $exclude_zeros )
307
-		$query .= " AND meta_value != '0'";
314
+	if ( $exclude_zeros ) {
315
+			$query .= " AND meta_value != '0'";
316
+	}
308 317
 
309 318
 	return $wpdb->get_col( $query );
310 319
 }
@@ -321,10 +330,12 @@  discard block
 block discarded – undo
321 330
 
322 331
 	global $wpdb;
323 332
 
324
-	if ( !is_multisite() )
325
-		$level_key = $wpdb->get_blog_prefix() . 'user_level';
326
-	else
327
-		$level_key = $wpdb->get_blog_prefix() . 'capabilities'; // WPMU site admins don't have user_levels.
333
+	if ( !is_multisite() ) {
334
+			$level_key = $wpdb->get_blog_prefix() . 'user_level';
335
+	} else {
336
+			$level_key = $wpdb->get_blog_prefix() . 'capabilities';
337
+	}
338
+	// WPMU site admins don't have user_levels.
328 339
 
329 340
 	return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
330 341
 }
@@ -536,8 +547,9 @@  discard block
 block discarded – undo
536 547
 		if ( $this->search_term ) {
537 548
 			$searches = array();
538 549
 			$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) . '%' );
550
+			foreach ( array('user_login', 'user_nicename', 'user_email', 'user_url', 'display_name') as $col ) {
551
+							$searches[] = $wpdb->prepare( $col . ' LIKE %s', '%' . like_escape($this->search_term) . '%' );
552
+			}
541 553
 			$search_sql .= implode(' OR ', $searches);
542 554
 			$search_sql .= ')';
543 555
 		}
@@ -568,10 +580,13 @@  discard block
 block discarded – undo
568 580
 
569 581
 		$this->results = $wpdb->get_col("SELECT DISTINCT($wpdb->users.ID)" . $this->query_from . $this->query_where . $this->query_orderby . $this->query_limit);
570 582
 
571
-		if ( $this->results )
572
-			$this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where); // No limit.
573
-		else
574
-			$this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
583
+		if ( $this->results ) {
584
+					$this->total_users_for_query = $wpdb->get_var("SELECT COUNT(DISTINCT($wpdb->users.ID))" . $this->query_from . $this->query_where);
585
+		}
586
+		// No limit.
587
+		else {
588
+					$this->search_errors = new WP_Error('no_matching_users_found', __('No users found.'));
589
+		}
575 590
 	}
576 591
 
577 592
 	/**
@@ -591,10 +606,12 @@  discard block
 block discarded – undo
591 606
 	public function do_paging() {
592 607
 		if ( $this->total_users_for_query > $this->users_per_page ) { // Have to page the results.
593 608
 			$args = array();
594
-			if ( ! empty($this->search_term) )
595
-				$args['usersearch'] = urlencode($this->search_term);
596
-			if ( ! empty($this->role) )
597
-				$args['role'] = urlencode($this->role);
609
+			if ( ! empty($this->search_term) ) {
610
+							$args['usersearch'] = urlencode($this->search_term);
611
+			}
612
+			if ( ! empty($this->role) ) {
613
+							$args['role'] = urlencode($this->role);
614
+			}
598 615
 
599 616
 			$this->paging_text = paginate_links( array(
600 617
 				'total' => ceil($this->total_users_for_query / $this->users_per_page),
@@ -651,8 +668,9 @@  discard block
 block discarded – undo
651 668
 	 * @return bool
652 669
 	 */
653 670
 	function results_are_paged() {
654
-		if ( $this->paging_text )
655
-			return true;
671
+		if ( $this->paging_text ) {
672
+					return true;
673
+		}
656 674
 		return false;
657 675
 	}
658 676
 
@@ -665,8 +683,9 @@  discard block
 block discarded – undo
665 683
 	 * @return bool
666 684
 	 */
667 685
 	function is_search() {
668
-		if ( $this->search_term )
669
-			return true;
686
+		if ( $this->search_term ) {
687
+					return true;
688
+		}
670 689
 		return false;
671 690
 	}
672 691
 }
@@ -693,10 +712,11 @@  discard block
 block discarded – undo
693 712
 
694 713
 	$editable = get_editable_user_ids( $user_id );
695 714
 
696
-	if ( in_array($type, array('draft', 'pending')) )
697
-		$type_sql = " post_status = '$type' ";
698
-	else
699
-		$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
715
+	if ( in_array($type, array('draft', 'pending')) ) {
716
+			$type_sql = " post_status = '$type' ";
717
+	} else {
718
+			$type_sql = " ( post_status = 'draft' OR post_status = 'pending' ) ";
719
+	}
700 720
 
701 721
 	$dir = ( 'pending' == $type ) ? 'ASC' : 'DESC';
702 722
 
@@ -764,8 +784,9 @@  discard block
 block discarded – undo
764 784
 
765 785
 	static $num = 1;
766 786
 
767
-	if ( ! class_exists( '_WP_Editors', false ) )
768
-		require_once ABSPATH . WPINC . '/class-wp-editor.php';
787
+	if ( ! class_exists( '_WP_Editors', false ) ) {
788
+			require_once ABSPATH . WPINC . '/class-wp-editor.php';
789
+	}
769 790
 
770 791
 	$editor_id = 'content' . $num++;
771 792
 
@@ -821,8 +842,9 @@  discard block
 block discarded – undo
821 842
 
822 843
 	$current_screen = get_current_screen();
823 844
 
824
-	if ( ! $current_screen )
825
-		return '';
845
+	if ( ! $current_screen ) {
846
+			return '';
847
+	}
826 848
 
827 849
 	ob_start();
828 850
 	$current_screen->render_screen_layout();
@@ -841,8 +863,9 @@  discard block
 block discarded – undo
841 863
 
842 864
 	$current_screen = get_current_screen();
843 865
 
844
-	if ( ! $current_screen )
845
-		return '';
866
+	if ( ! $current_screen ) {
867
+			return '';
868
+	}
846 869
 
847 870
 	ob_start();
848 871
 	$current_screen->render_per_page_options();
@@ -992,8 +1015,9 @@  discard block
 block discarded – undo
992 1015
 function add_contextual_help( $screen, $help ) {
993 1016
 	_deprecated_function( __FUNCTION__, '3.3.0', 'get_current_screen()->add_help_tab()' );
994 1017
 
995
-	if ( is_string( $screen ) )
996
-		$screen = convert_to_screen( $screen );
1018
+	if ( is_string( $screen ) ) {
1019
+			$screen = convert_to_screen( $screen );
1020
+	}
997 1021
 
998 1022
 	WP_Screen::add_old_compat_help( $screen, $help );
999 1023
 }
@@ -1157,8 +1181,9 @@  discard block
 block discarded – undo
1157 1181
 function wp_update_core($current, $feedback = '') {
1158 1182
 	_deprecated_function( __FUNCTION__, '3.7.0', 'new Core_Upgrader();' );
1159 1183
 
1160
-	if ( !empty($feedback) )
1161
-		add_filter('update_feedback', $feedback);
1184
+	if ( !empty($feedback) ) {
1185
+			add_filter('update_feedback', $feedback);
1186
+	}
1162 1187
 
1163 1188
 	require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1164 1189
 	$upgrader = new Core_Upgrader();
@@ -1180,8 +1205,9 @@  discard block
 block discarded – undo
1180 1205
 function wp_update_plugin($plugin, $feedback = '') {
1181 1206
 	_deprecated_function( __FUNCTION__, '3.7.0', 'new Plugin_Upgrader();' );
1182 1207
 
1183
-	if ( !empty($feedback) )
1184
-		add_filter('update_feedback', $feedback);
1208
+	if ( !empty($feedback) ) {
1209
+			add_filter('update_feedback', $feedback);
1210
+	}
1185 1211
 
1186 1212
 	require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1187 1213
 	$upgrader = new Plugin_Upgrader();
@@ -1202,8 +1228,9 @@  discard block
 block discarded – undo
1202 1228
 function wp_update_theme($theme, $feedback = '') {
1203 1229
 	_deprecated_function( __FUNCTION__, '3.7.0', 'new Theme_Upgrader();' );
1204 1230
 
1205
-	if ( !empty($feedback) )
1206
-		add_filter('update_feedback', $feedback);
1231
+	if ( !empty($feedback) ) {
1232
+			add_filter('update_feedback', $feedback);
1233
+	}
1207 1234
 
1208 1235
 	require ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
1209 1236
 	$upgrader = new Theme_Upgrader();
@@ -1334,16 +1361,18 @@  discard block
 block discarded – undo
1334 1361
 	echo '<ul>';
1335 1362
 
1336 1363
 	foreach ( array( $popular ) as $feed ) {
1337
-		if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() )
1338
-			continue;
1364
+		if ( is_wp_error( $feed ) || ! $feed->get_item_quantity() ) {
1365
+					continue;
1366
+		}
1339 1367
 
1340 1368
 		$items = $feed->get_items(0, 5);
1341 1369
 
1342 1370
 		// Pick a random, non-installed plugin.
1343 1371
 		while ( true ) {
1344 1372
 			// Abort this foreach loop iteration if there's no plugins left of this type.
1345
-			if ( 0 === count($items) )
1346
-				continue 2;
1373
+			if ( 0 === count($items) ) {
1374
+							continue 2;
1375
+			}
1347 1376
 
1348 1377
 			$item_key = array_rand($items);
1349 1378
 			$item = $items[$item_key];
@@ -1351,9 +1380,9 @@  discard block
 block discarded – undo
1351 1380
 			list($link, $frag) = explode( '#', $item->get_link() );
1352 1381
 
1353 1382
 			$link = esc_url($link);
1354
-			if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) )
1355
-				$slug = $matches[1];
1356
-			else {
1383
+			if ( preg_match( '|/([^/]+?)/?$|', $link, $matches ) ) {
1384
+							$slug = $matches[1];
1385
+			} else {
1357 1386
 				unset( $items[$item_key] );
1358 1387
 				continue;
1359 1388
 			}
@@ -1372,11 +1401,13 @@  discard block
 block discarded – undo
1372 1401
 		}
1373 1402
 
1374 1403
 		// Eliminate some common badly formed plugin descriptions.
1375
-		while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) )
1376
-			unset($items[$item_key]);
1404
+		while ( ( null !== $item_key = array_rand($items) ) && false !== strpos( $items[$item_key]->get_description(), 'Plugin Name:' ) ) {
1405
+					unset($items[$item_key]);
1406
+		}
1377 1407
 
1378
-		if ( !isset($items[$item_key]) )
1379
-			continue;
1408
+		if ( !isset($items[$item_key]) ) {
1409
+					continue;
1410
+		}
1380 1411
 
1381 1412
 		$raw_title = $item->get_title();
1382 1413
 
Please login to merge, or discard this patch.
brighty/wp-admin/includes/update.php 2 patches
Indentation   +761 added lines, -761 removed lines patch added patch discarded remove patch
@@ -14,14 +14,14 @@  discard block
 block discarded – undo
14 14
  * @return object|array|false The response from the API on success, false on failure.
15 15
  */
16 16
 function get_preferred_from_update_core() {
17
-	$updates = get_core_updates();
18
-	if ( ! is_array( $updates ) ) {
19
-		return false;
20
-	}
21
-	if ( empty( $updates ) ) {
22
-		return (object) array( 'response' => 'latest' );
23
-	}
24
-	return $updates[0];
17
+    $updates = get_core_updates();
18
+    if ( ! is_array( $updates ) ) {
19
+        return false;
20
+    }
21
+    if ( empty( $updates ) ) {
22
+        return (object) array( 'response' => 'latest' );
23
+    }
24
+    return $updates[0];
25 25
 }
26 26
 
27 27
 /**
@@ -34,45 +34,45 @@  discard block
 block discarded – undo
34 34
  * @return array|false Array of the update objects on success, false on failure.
35 35
  */
36 36
 function get_core_updates( $options = array() ) {
37
-	$options   = array_merge(
38
-		array(
39
-			'available' => true,
40
-			'dismissed' => false,
41
-		),
42
-		$options
43
-	);
44
-	$dismissed = get_site_option( 'dismissed_update_core' );
45
-
46
-	if ( ! is_array( $dismissed ) ) {
47
-		$dismissed = array();
48
-	}
49
-
50
-	$from_api = get_site_transient( 'update_core' );
51
-
52
-	if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) {
53
-		return false;
54
-	}
55
-
56
-	$updates = $from_api->updates;
57
-	$result  = array();
58
-	foreach ( $updates as $update ) {
59
-		if ( 'autoupdate' === $update->response ) {
60
-			continue;
61
-		}
62
-
63
-		if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) {
64
-			if ( $options['dismissed'] ) {
65
-				$update->dismissed = true;
66
-				$result[]          = $update;
67
-			}
68
-		} else {
69
-			if ( $options['available'] ) {
70
-				$update->dismissed = false;
71
-				$result[]          = $update;
72
-			}
73
-		}
74
-	}
75
-	return $result;
37
+    $options   = array_merge(
38
+        array(
39
+            'available' => true,
40
+            'dismissed' => false,
41
+        ),
42
+        $options
43
+    );
44
+    $dismissed = get_site_option( 'dismissed_update_core' );
45
+
46
+    if ( ! is_array( $dismissed ) ) {
47
+        $dismissed = array();
48
+    }
49
+
50
+    $from_api = get_site_transient( 'update_core' );
51
+
52
+    if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) {
53
+        return false;
54
+    }
55
+
56
+    $updates = $from_api->updates;
57
+    $result  = array();
58
+    foreach ( $updates as $update ) {
59
+        if ( 'autoupdate' === $update->response ) {
60
+            continue;
61
+        }
62
+
63
+        if ( array_key_exists( $update->current . '|' . $update->locale, $dismissed ) ) {
64
+            if ( $options['dismissed'] ) {
65
+                $update->dismissed = true;
66
+                $result[]          = $update;
67
+            }
68
+        } else {
69
+            if ( $options['available'] ) {
70
+                $update->dismissed = false;
71
+                $result[]          = $update;
72
+            }
73
+        }
74
+    }
75
+    return $result;
76 76
 }
77 77
 
78 78
 /**
@@ -85,29 +85,29 @@  discard block
 block discarded – undo
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 ) ) {
90
-		return false;
91
-	}
92
-
93
-	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
94
-
95
-	$auto_update = false;
96
-	$upgrader    = new WP_Automatic_Updater;
97
-	foreach ( $updates->updates as $update ) {
98
-		if ( 'autoupdate' !== $update->response ) {
99
-			continue;
100
-		}
101
-
102
-		if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) {
103
-			continue;
104
-		}
105
-
106
-		if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) {
107
-			$auto_update = $update;
108
-		}
109
-	}
110
-	return $auto_update;
88
+    $updates = get_site_transient( 'update_core' );
89
+    if ( ! $updates || empty( $updates->updates ) ) {
90
+        return false;
91
+    }
92
+
93
+    require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
94
+
95
+    $auto_update = false;
96
+    $upgrader    = new WP_Automatic_Updater;
97
+    foreach ( $updates->updates as $update ) {
98
+        if ( 'autoupdate' !== $update->response ) {
99
+            continue;
100
+        }
101
+
102
+        if ( ! $upgrader->should_update( 'core', $update, ABSPATH ) ) {
103
+            continue;
104
+        }
105
+
106
+        if ( ! $auto_update || version_compare( $update->current, $auto_update->current, '>' ) ) {
107
+            $auto_update = $update;
108
+        }
109
+    }
110
+    return $auto_update;
111 111
 }
112 112
 
113 113
 /**
@@ -120,43 +120,43 @@  discard block
 block discarded – undo
120 120
  * @return array|false An array of checksums on success, false on failure.
121 121
  */
122 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
-	$url      = $http_url;
125
-
126
-	$ssl = wp_http_supports( array( 'ssl' ) );
127
-	if ( $ssl ) {
128
-		$url = set_url_scheme( $url, 'https' );
129
-	}
130
-
131
-	$options = array(
132
-		'timeout' => wp_doing_cron() ? 30 : 3,
133
-	);
134
-
135
-	$response = wp_remote_get( $url, $options );
136
-	if ( $ssl && is_wp_error( $response ) ) {
137
-		trigger_error(
138
-			sprintf(
139
-				/* translators: %s: Support forums URL. */
140
-				__( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;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
-			headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
144
-		);
145
-		$response = wp_remote_get( $http_url, $options );
146
-	}
147
-
148
-	if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
149
-		return false;
150
-	}
151
-
152
-	$body = trim( wp_remote_retrieve_body( $response ) );
153
-	$body = json_decode( $body, true );
154
-
155
-	if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) ) {
156
-		return false;
157
-	}
158
-
159
-	return $body['checksums'];
123
+    $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), '', '&' );
124
+    $url      = $http_url;
125
+
126
+    $ssl = wp_http_supports( array( 'ssl' ) );
127
+    if ( $ssl ) {
128
+        $url = set_url_scheme( $url, 'https' );
129
+    }
130
+
131
+    $options = array(
132
+        'timeout' => wp_doing_cron() ? 30 : 3,
133
+    );
134
+
135
+    $response = wp_remote_get( $url, $options );
136
+    if ( $ssl && is_wp_error( $response ) ) {
137
+        trigger_error(
138
+            sprintf(
139
+                /* translators: %s: Support forums URL. */
140
+                __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;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
+            headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE
144
+        );
145
+        $response = wp_remote_get( $http_url, $options );
146
+    }
147
+
148
+    if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) {
149
+        return false;
150
+    }
151
+
152
+    $body = trim( wp_remote_retrieve_body( $response ) );
153
+    $body = json_decode( $body, true );
154
+
155
+    if ( ! is_array( $body ) || ! isset( $body['checksums'] ) || ! is_array( $body['checksums'] ) ) {
156
+        return false;
157
+    }
158
+
159
+    return $body['checksums'];
160 160
 }
161 161
 
162 162
 /**
@@ -168,9 +168,9 @@  discard block
 block discarded – undo
168 168
  * @return bool
169 169
  */
170 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 );
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
 /**
@@ -183,15 +183,15 @@  discard block
 block discarded – undo
183 183
  * @return bool
184 184
  */
185 185
 function undismiss_core_update( $version, $locale ) {
186
-	$dismissed = get_site_option( 'dismissed_update_core' );
187
-	$key       = $version . '|' . $locale;
186
+    $dismissed = get_site_option( 'dismissed_update_core' );
187
+    $key       = $version . '|' . $locale;
188 188
 
189
-	if ( ! isset( $dismissed[ $key ] ) ) {
190
-		return false;
191
-	}
189
+    if ( ! isset( $dismissed[ $key ] ) ) {
190
+        return false;
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
 /**
@@ -204,19 +204,19 @@  discard block
 block discarded – undo
204 204
  * @return object|false The core update offering on success, false on failure.
205 205
  */
206 206
 function find_core_update( $version, $locale ) {
207
-	$from_api = get_site_transient( 'update_core' );
208
-
209
-	if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) {
210
-		return false;
211
-	}
212
-
213
-	$updates = $from_api->updates;
214
-	foreach ( $updates as $update ) {
215
-		if ( $update->current == $version && $update->locale == $locale ) {
216
-			return $update;
217
-		}
218
-	}
219
-	return false;
207
+    $from_api = get_site_transient( 'update_core' );
208
+
209
+    if ( ! isset( $from_api->updates ) || ! is_array( $from_api->updates ) ) {
210
+        return false;
211
+    }
212
+
213
+    $updates = $from_api->updates;
214
+    foreach ( $updates as $update ) {
215
+        if ( $update->current == $version && $update->locale == $locale ) {
216
+            return $update;
217
+        }
218
+    }
219
+    return false;
220 220
 }
221 221
 
222 222
 /**
@@ -226,52 +226,52 @@  discard block
 block discarded – undo
226 226
  * @return string
227 227
  */
228 228
 function core_update_footer( $msg = '' ) {
229
-	if ( ! current_user_can( 'update_core' ) ) {
230
-		/* translators: %s: WordPress version. */
231
-		return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
232
-	}
233
-
234
-	$cur = get_preferred_from_update_core();
235
-	if ( ! is_object( $cur ) ) {
236
-		$cur = new stdClass;
237
-	}
238
-
239
-	if ( ! isset( $cur->current ) ) {
240
-		$cur->current = '';
241
-	}
242
-
243
-	if ( ! isset( $cur->response ) ) {
244
-		$cur->response = '';
245
-	}
246
-
247
-	// Include an unmodified $wp_version.
248
-	require ABSPATH . WPINC . '/version.php';
249
-
250
-	$is_development_version = preg_match( '/alpha|beta|RC/', $wp_version );
251
-
252
-	if ( $is_development_version ) {
253
-		return sprintf(
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' )
258
-		);
259
-	}
260
-
261
-	switch ( $cur->response ) {
262
-		case 'upgrade':
263
-			return sprintf(
264
-				'<strong><a href="%s">%s</a></strong>',
265
-				network_admin_url( 'update-core.php' ),
266
-				/* translators: %s: WordPress version. */
267
-				sprintf( __( 'Get Version %s' ), $cur->current )
268
-			);
269
-
270
-		case 'latest':
271
-		default:
272
-			/* translators: %s: WordPress version. */
273
-			return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
274
-	}
229
+    if ( ! current_user_can( 'update_core' ) ) {
230
+        /* translators: %s: WordPress version. */
231
+        return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
232
+    }
233
+
234
+    $cur = get_preferred_from_update_core();
235
+    if ( ! is_object( $cur ) ) {
236
+        $cur = new stdClass;
237
+    }
238
+
239
+    if ( ! isset( $cur->current ) ) {
240
+        $cur->current = '';
241
+    }
242
+
243
+    if ( ! isset( $cur->response ) ) {
244
+        $cur->response = '';
245
+    }
246
+
247
+    // Include an unmodified $wp_version.
248
+    require ABSPATH . WPINC . '/version.php';
249
+
250
+    $is_development_version = preg_match( '/alpha|beta|RC/', $wp_version );
251
+
252
+    if ( $is_development_version ) {
253
+        return sprintf(
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' )
258
+        );
259
+    }
260
+
261
+    switch ( $cur->response ) {
262
+        case 'upgrade':
263
+            return sprintf(
264
+                '<strong><a href="%s">%s</a></strong>',
265
+                network_admin_url( 'update-core.php' ),
266
+                /* translators: %s: WordPress version. */
267
+                sprintf( __( 'Get Version %s' ), $cur->current )
268
+            );
269
+
270
+        case 'latest':
271
+        default:
272
+            /* translators: %s: WordPress version. */
273
+            return sprintf( __( 'Version %s' ), get_bloginfo( 'version', 'display' ) );
274
+    }
275 275
 }
276 276
 
277 277
 /**
@@ -281,47 +281,47 @@  discard block
 block discarded – undo
281 281
  * @return void|false
282 282
  */
283 283
 function update_nag() {
284
-	global $pagenow;
285
-
286
-	if ( is_multisite() && ! current_user_can( 'update_core' ) ) {
287
-		return false;
288
-	}
289
-
290
-	if ( 'update-core.php' === $pagenow ) {
291
-		return;
292
-	}
293
-
294
-	$cur = get_preferred_from_update_core();
295
-
296
-	if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) {
297
-		return false;
298
-	}
299
-
300
-	$version_url = sprintf(
301
-		/* translators: %s: WordPress version. */
302
-		esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
303
-		sanitize_title( $cur->current )
304
-	);
305
-
306
-	if ( current_user_can( 'update_core' ) ) {
307
-		$msg = sprintf(
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>.' ),
310
-			$version_url,
311
-			$cur->current,
312
-			network_admin_url( 'update-core.php' ),
313
-			esc_attr__( 'Please update WordPress now' )
314
-		);
315
-	} else {
316
-		$msg = sprintf(
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.' ),
319
-			$version_url,
320
-			$cur->current
321
-		);
322
-	}
323
-
324
-	echo "<div class='update-nag notice notice-warning inline'>$msg</div>";
284
+    global $pagenow;
285
+
286
+    if ( is_multisite() && ! current_user_can( 'update_core' ) ) {
287
+        return false;
288
+    }
289
+
290
+    if ( 'update-core.php' === $pagenow ) {
291
+        return;
292
+    }
293
+
294
+    $cur = get_preferred_from_update_core();
295
+
296
+    if ( ! isset( $cur->response ) || 'upgrade' !== $cur->response ) {
297
+        return false;
298
+    }
299
+
300
+    $version_url = sprintf(
301
+        /* translators: %s: WordPress version. */
302
+        esc_url( __( 'https://wordpress.org/support/wordpress-version/version-%s/' ) ),
303
+        sanitize_title( $cur->current )
304
+    );
305
+
306
+    if ( current_user_can( 'update_core' ) ) {
307
+        $msg = sprintf(
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>.' ),
310
+            $version_url,
311
+            $cur->current,
312
+            network_admin_url( 'update-core.php' ),
313
+            esc_attr__( 'Please update WordPress now' )
314
+        );
315
+    } else {
316
+        $msg = sprintf(
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.' ),
319
+            $version_url,
320
+            $cur->current
321
+        );
322
+    }
323
+
324
+    echo "<div class='update-nag notice notice-warning inline'>$msg</div>";
325 325
 }
326 326
 
327 327
 /**
@@ -330,43 +330,43 @@  discard block
 block discarded – undo
330 330
  * @since 2.5.0
331 331
  */
332 332
 function update_right_now_message() {
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 );
336
-	}
337
-
338
-	$msg = '';
339
-
340
-	if ( current_user_can( 'update_core' ) ) {
341
-		$cur = get_preferred_from_update_core();
342
-
343
-		if ( isset( $cur->response ) && 'upgrade' === $cur->response ) {
344
-			$msg .= sprintf(
345
-				'<a href="%s" class="button" aria-describedby="wp-version">%s</a> ',
346
-				network_admin_url( 'update-core.php' ),
347
-				/* translators: %s: WordPress version number, or 'Latest' string. */
348
-				sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )
349
-			);
350
-		}
351
-	}
352
-
353
-	/* translators: 1: Version number, 2: Theme name. */
354
-	$content = __( 'WordPress %1$s running %2$s theme.' );
355
-
356
-	/**
357
-	 * Filters the text displayed in the 'At a Glance' dashboard widget.
358
-	 *
359
-	 * Prior to 3.8.0, the widget was named 'Right Now'.
360
-	 *
361
-	 * @since 4.4.0
362
-	 *
363
-	 * @param string $content Default text.
364
-	 */
365
-	$content = apply_filters( 'update_right_now_text', $content );
366
-
367
-	$msg .= sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name );
368
-
369
-	echo "<p id='wp-version-message'>$msg</p>";
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 );
336
+    }
337
+
338
+    $msg = '';
339
+
340
+    if ( current_user_can( 'update_core' ) ) {
341
+        $cur = get_preferred_from_update_core();
342
+
343
+        if ( isset( $cur->response ) && 'upgrade' === $cur->response ) {
344
+            $msg .= sprintf(
345
+                '<a href="%s" class="button" aria-describedby="wp-version">%s</a> ',
346
+                network_admin_url( 'update-core.php' ),
347
+                /* translators: %s: WordPress version number, or 'Latest' string. */
348
+                sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )
349
+            );
350
+        }
351
+    }
352
+
353
+    /* translators: 1: Version number, 2: Theme name. */
354
+    $content = __( 'WordPress %1$s running %2$s theme.' );
355
+
356
+    /**
357
+     * Filters the text displayed in the 'At a Glance' dashboard widget.
358
+     *
359
+     * Prior to 3.8.0, the widget was named 'Right Now'.
360
+     *
361
+     * @since 4.4.0
362
+     *
363
+     * @param string $content Default text.
364
+     */
365
+    $content = apply_filters( 'update_right_now_text', $content );
366
+
367
+    $msg .= sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name );
368
+
369
+    echo "<p id='wp-version-message'>$msg</p>";
370 370
 }
371 371
 
372 372
 /**
@@ -375,34 +375,34 @@  discard block
 block discarded – undo
375 375
  * @return array
376 376
  */
377 377
 function get_plugin_updates() {
378
-	$all_plugins     = get_plugins();
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 ];
385
-		}
386
-	}
387
-
388
-	return $upgrade_plugins;
378
+    $all_plugins     = get_plugins();
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 ];
385
+        }
386
+    }
387
+
388
+    return $upgrade_plugins;
389 389
 }
390 390
 
391 391
 /**
392 392
  * @since 2.9.0
393 393
  */
394 394
 function wp_plugin_update_rows() {
395
-	if ( ! current_user_can( 'update_plugins' ) ) {
396
-		return;
397
-	}
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 );
404
-		}
405
-	}
395
+    if ( ! current_user_can( 'update_plugins' ) ) {
396
+        return;
397
+    }
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 );
404
+        }
405
+    }
406 406
 }
407 407
 
408 408
 /**
@@ -415,173 +415,173 @@  discard block
 block discarded – undo
415 415
  * @return void|false
416 416
  */
417 417
 function wp_plugin_update_row( $file, $plugin_data ) {
418
-	$current = get_site_transient( 'update_plugins' );
419
-	if ( ! isset( $current->response[ $file ] ) ) {
420
-		return false;
421
-	}
422
-
423
-	$response = $current->response[ $file ];
424
-
425
-	$plugins_allowedtags = array(
426
-		'a'       => array(
427
-			'href'  => array(),
428
-			'title' => array(),
429
-		),
430
-		'abbr'    => array( 'title' => array() ),
431
-		'acronym' => array( 'title' => array() ),
432
-		'code'    => array(),
433
-		'em'      => array(),
434
-		'strong'  => array(),
435
-	);
436
-
437
-	$plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
438
-	$plugin_slug = isset( $response->slug ) ? $response->slug : $response->id;
439
-
440
-	if ( isset( $response->slug ) ) {
441
-		$details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&section=changelog' );
442
-	} elseif ( isset( $response->url ) ) {
443
-		$details_url = $response->url;
444
-	} else {
445
-		$details_url = $plugin_data['PluginURI'];
446
-	}
447
-
448
-	$details_url = add_query_arg(
449
-		array(
450
-			'TB_iframe' => 'true',
451
-			'width'     => 600,
452
-			'height'    => 800,
453
-		),
454
-		$details_url
455
-	);
456
-
457
-	/** @var WP_Plugins_List_Table $wp_list_table */
458
-	$wp_list_table = _get_list_table(
459
-		'WP_Plugins_List_Table',
460
-		array(
461
-			'screen' => get_current_screen(),
462
-		)
463
-	);
464
-
465
-	if ( is_network_admin() || ! is_multisite() ) {
466
-		if ( is_network_admin() ) {
467
-			$active_class = is_plugin_active_for_network( $file ) ? ' active' : '';
468
-		} else {
469
-			$active_class = is_plugin_active( $file ) ? ' active' : '';
470
-		}
471
-
472
-		$requires_php   = isset( $response->requires_php ) ? $response->requires_php : null;
473
-		$compatible_php = is_php_version_compatible( $requires_php );
474
-		$notice_type    = $compatible_php ? 'notice-warning' : 'notice-error';
475
-
476
-		printf(
477
-			'<tr class="plugin-update-tr%s" id="%s" data-slug="%s" data-plugin="%s">' .
478
-			'<td colspan="%s" class="plugin-update colspanchange">' .
479
-			'<div class="update-message notice inline %s notice-alt"><p>',
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() ),
485
-			$notice_type
486
-		);
487
-
488
-		if ( ! current_user_can( 'update_plugins' ) ) {
489
-			printf(
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>.' ),
492
-				$plugin_name,
493
-				esc_url( $details_url ),
494
-				sprintf(
495
-					'class="thickbox open-plugin-details-modal" aria-label="%s"',
496
-					/* translators: 1: Plugin name, 2: Version number. */
497
-					esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
498
-				),
499
-				esc_attr( $response->new_version )
500
-			);
501
-		} elseif ( empty( $response->package ) ) {
502
-			printf(
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>' ),
505
-				$plugin_name,
506
-				esc_url( $details_url ),
507
-				sprintf(
508
-					'class="thickbox open-plugin-details-modal" aria-label="%s"',
509
-					/* translators: 1: Plugin name, 2: Version number. */
510
-					esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
511
-				),
512
-				esc_attr( $response->new_version )
513
-			);
514
-		} else {
515
-			if ( $compatible_php ) {
516
-				printf(
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>.' ),
519
-					$plugin_name,
520
-					esc_url( $details_url ),
521
-					sprintf(
522
-						'class="thickbox open-plugin-details-modal" aria-label="%s"',
523
-						/* translators: 1: Plugin name, 2: Version number. */
524
-						esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
525
-					),
526
-					esc_attr( $response->new_version ),
527
-					wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ),
528
-					sprintf(
529
-						'class="update-link" aria-label="%s"',
530
-						/* translators: %s: Plugin name. */
531
-						esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $plugin_name ) )
532
-					)
533
-				);
534
-			} else {
535
-				printf(
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>.' ),
538
-					$plugin_name,
539
-					esc_url( $details_url ),
540
-					sprintf(
541
-						'class="thickbox open-plugin-details-modal" aria-label="%s"',
542
-						/* translators: 1: Plugin name, 2: Version number. */
543
-						esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
544
-					),
545
-					esc_attr( $response->new_version ),
546
-					esc_url( wp_get_update_php_url() )
547
-				);
548
-				wp_update_php_annotation( '<br><em>', '</em>' );
549
-			}
550
-		}
551
-
552
-		/**
553
-		 * Fires at the end of the update message container in each
554
-		 * row of the plugins list table.
555
-		 *
556
-		 * The dynamic portion of the hook name, `$file`, refers to the path
557
-		 * of the plugin's primary file relative to the plugins directory.
558
-		 *
559
-		 * @since 2.8.0
560
-		 *
561
-		 * @param array  $plugin_data An array of plugin metadata. See get_plugin_data()
562
-		 *                            and the {@see 'plugin_row_meta'} filter for the list
563
-		 *                            of possible values.
564
-		 * @param object $response {
565
-		 *     An object of metadata about the available plugin update.
566
-		 *
567
-		 *     @type string   $id           Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
568
-		 *     @type string   $slug         Plugin slug.
569
-		 *     @type string   $plugin       Plugin basename.
570
-		 *     @type string   $new_version  New plugin version.
571
-		 *     @type string   $url          Plugin URL.
572
-		 *     @type string   $package      Plugin update package URL.
573
-		 *     @type string[] $icons        An array of plugin icon URLs.
574
-		 *     @type string[] $banners      An array of plugin banner URLs.
575
-		 *     @type string[] $banners_rtl  An array of plugin RTL banner URLs.
576
-		 *     @type string   $requires     The version of WordPress which the plugin requires.
577
-		 *     @type string   $tested       The version of WordPress the plugin is tested against.
578
-		 *     @type string   $requires_php The version of PHP which the plugin requires.
579
-		 * }
580
-		 */
581
-		do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
582
-
583
-		echo '</p></div></td></tr>';
584
-	}
418
+    $current = get_site_transient( 'update_plugins' );
419
+    if ( ! isset( $current->response[ $file ] ) ) {
420
+        return false;
421
+    }
422
+
423
+    $response = $current->response[ $file ];
424
+
425
+    $plugins_allowedtags = array(
426
+        'a'       => array(
427
+            'href'  => array(),
428
+            'title' => array(),
429
+        ),
430
+        'abbr'    => array( 'title' => array() ),
431
+        'acronym' => array( 'title' => array() ),
432
+        'code'    => array(),
433
+        'em'      => array(),
434
+        'strong'  => array(),
435
+    );
436
+
437
+    $plugin_name = wp_kses( $plugin_data['Name'], $plugins_allowedtags );
438
+    $plugin_slug = isset( $response->slug ) ? $response->slug : $response->id;
439
+
440
+    if ( isset( $response->slug ) ) {
441
+        $details_url = self_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_slug . '&section=changelog' );
442
+    } elseif ( isset( $response->url ) ) {
443
+        $details_url = $response->url;
444
+    } else {
445
+        $details_url = $plugin_data['PluginURI'];
446
+    }
447
+
448
+    $details_url = add_query_arg(
449
+        array(
450
+            'TB_iframe' => 'true',
451
+            'width'     => 600,
452
+            'height'    => 800,
453
+        ),
454
+        $details_url
455
+    );
456
+
457
+    /** @var WP_Plugins_List_Table $wp_list_table */
458
+    $wp_list_table = _get_list_table(
459
+        'WP_Plugins_List_Table',
460
+        array(
461
+            'screen' => get_current_screen(),
462
+        )
463
+    );
464
+
465
+    if ( is_network_admin() || ! is_multisite() ) {
466
+        if ( is_network_admin() ) {
467
+            $active_class = is_plugin_active_for_network( $file ) ? ' active' : '';
468
+        } else {
469
+            $active_class = is_plugin_active( $file ) ? ' active' : '';
470
+        }
471
+
472
+        $requires_php   = isset( $response->requires_php ) ? $response->requires_php : null;
473
+        $compatible_php = is_php_version_compatible( $requires_php );
474
+        $notice_type    = $compatible_php ? 'notice-warning' : 'notice-error';
475
+
476
+        printf(
477
+            '<tr class="plugin-update-tr%s" id="%s" data-slug="%s" data-plugin="%s">' .
478
+            '<td colspan="%s" class="plugin-update colspanchange">' .
479
+            '<div class="update-message notice inline %s notice-alt"><p>',
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() ),
485
+            $notice_type
486
+        );
487
+
488
+        if ( ! current_user_can( 'update_plugins' ) ) {
489
+            printf(
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>.' ),
492
+                $plugin_name,
493
+                esc_url( $details_url ),
494
+                sprintf(
495
+                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
496
+                    /* translators: 1: Plugin name, 2: Version number. */
497
+                    esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
498
+                ),
499
+                esc_attr( $response->new_version )
500
+            );
501
+        } elseif ( empty( $response->package ) ) {
502
+            printf(
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>' ),
505
+                $plugin_name,
506
+                esc_url( $details_url ),
507
+                sprintf(
508
+                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
509
+                    /* translators: 1: Plugin name, 2: Version number. */
510
+                    esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
511
+                ),
512
+                esc_attr( $response->new_version )
513
+            );
514
+        } else {
515
+            if ( $compatible_php ) {
516
+                printf(
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>.' ),
519
+                    $plugin_name,
520
+                    esc_url( $details_url ),
521
+                    sprintf(
522
+                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
523
+                        /* translators: 1: Plugin name, 2: Version number. */
524
+                        esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
525
+                    ),
526
+                    esc_attr( $response->new_version ),
527
+                    wp_nonce_url( self_admin_url( 'update.php?action=upgrade-plugin&plugin=' ) . $file, 'upgrade-plugin_' . $file ),
528
+                    sprintf(
529
+                        'class="update-link" aria-label="%s"',
530
+                        /* translators: %s: Plugin name. */
531
+                        esc_attr( sprintf( _x( 'Update %s now', 'plugin' ), $plugin_name ) )
532
+                    )
533
+                );
534
+            } else {
535
+                printf(
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>.' ),
538
+                    $plugin_name,
539
+                    esc_url( $details_url ),
540
+                    sprintf(
541
+                        'class="thickbox open-plugin-details-modal" aria-label="%s"',
542
+                        /* translators: 1: Plugin name, 2: Version number. */
543
+                        esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $plugin_name, $response->new_version ) )
544
+                    ),
545
+                    esc_attr( $response->new_version ),
546
+                    esc_url( wp_get_update_php_url() )
547
+                );
548
+                wp_update_php_annotation( '<br><em>', '</em>' );
549
+            }
550
+        }
551
+
552
+        /**
553
+         * Fires at the end of the update message container in each
554
+         * row of the plugins list table.
555
+         *
556
+         * The dynamic portion of the hook name, `$file`, refers to the path
557
+         * of the plugin's primary file relative to the plugins directory.
558
+         *
559
+         * @since 2.8.0
560
+         *
561
+         * @param array  $plugin_data An array of plugin metadata. See get_plugin_data()
562
+         *                            and the {@see 'plugin_row_meta'} filter for the list
563
+         *                            of possible values.
564
+         * @param object $response {
565
+         *     An object of metadata about the available plugin update.
566
+         *
567
+         *     @type string   $id           Plugin ID, e.g. `w.org/plugins/[plugin-name]`.
568
+         *     @type string   $slug         Plugin slug.
569
+         *     @type string   $plugin       Plugin basename.
570
+         *     @type string   $new_version  New plugin version.
571
+         *     @type string   $url          Plugin URL.
572
+         *     @type string   $package      Plugin update package URL.
573
+         *     @type string[] $icons        An array of plugin icon URLs.
574
+         *     @type string[] $banners      An array of plugin banner URLs.
575
+         *     @type string[] $banners_rtl  An array of plugin RTL banner URLs.
576
+         *     @type string   $requires     The version of WordPress which the plugin requires.
577
+         *     @type string   $tested       The version of WordPress the plugin is tested against.
578
+         *     @type string   $requires_php The version of PHP which the plugin requires.
579
+         * }
580
+         */
581
+        do_action( "in_plugin_update_message-{$file}", $plugin_data, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
582
+
583
+        echo '</p></div></td></tr>';
584
+    }
585 585
 }
586 586
 
587 587
 /**
@@ -590,37 +590,37 @@  discard block
 block discarded – undo
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 ) ) {
596
-		return array();
597
-	}
595
+    if ( ! isset( $current->response ) ) {
596
+        return array();
597
+    }
598 598
 
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;
603
-	}
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;
603
+    }
604 604
 
605
-	return $update_themes;
605
+    return $update_themes;
606 606
 }
607 607
 
608 608
 /**
609 609
  * @since 3.1.0
610 610
  */
611 611
 function wp_theme_update_rows() {
612
-	if ( ! current_user_can( 'update_themes' ) ) {
613
-		return;
614
-	}
615
-
616
-	$themes = get_site_transient( 'update_themes' );
617
-	if ( isset( $themes->response ) && is_array( $themes->response ) ) {
618
-		$themes = array_keys( $themes->response );
619
-
620
-		foreach ( $themes as $theme ) {
621
-			add_action( "after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2 );
622
-		}
623
-	}
612
+    if ( ! current_user_can( 'update_themes' ) ) {
613
+        return;
614
+    }
615
+
616
+    $themes = get_site_transient( 'update_themes' );
617
+    if ( isset( $themes->response ) && is_array( $themes->response ) ) {
618
+        $themes = array_keys( $themes->response );
619
+
620
+        foreach ( $themes as $theme ) {
621
+            add_action( "after_theme_row_{$theme}", 'wp_theme_update_row', 10, 2 );
622
+        }
623
+    }
624 624
 }
625 625
 
626 626
 /**
@@ -633,171 +633,171 @@  discard block
 block discarded – undo
633 633
  * @return void|false
634 634
  */
635 635
 function wp_theme_update_row( $theme_key, $theme ) {
636
-	$current = get_site_transient( 'update_themes' );
637
-
638
-	if ( ! isset( $current->response[ $theme_key ] ) ) {
639
-		return false;
640
-	}
641
-
642
-	$response = $current->response[ $theme_key ];
643
-
644
-	$details_url = add_query_arg(
645
-		array(
646
-			'TB_iframe' => 'true',
647
-			'width'     => 1024,
648
-			'height'    => 800,
649
-		),
650
-		$current->response[ $theme_key ]['url']
651
-	);
652
-
653
-	/** @var WP_MS_Themes_List_Table $wp_list_table */
654
-	$wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
655
-
656
-	$active = $theme->is_allowed( 'network' ) ? ' active' : '';
657
-
658
-	$requires_wp  = isset( $response['requires'] ) ? $response['requires'] : null;
659
-	$requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null;
660
-
661
-	$compatible_wp  = is_wp_version_compatible( $requires_wp );
662
-	$compatible_php = is_php_version_compatible( $requires_php );
663
-
664
-	printf(
665
-		'<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' .
666
-		'<td colspan="%s" class="plugin-update colspanchange">' .
667
-		'<div class="update-message notice inline notice-warning notice-alt"><p>',
668
-		$active,
669
-		esc_attr( $theme->get_stylesheet() . '-update' ),
670
-		esc_attr( $theme->get_stylesheet() ),
671
-		$wp_list_table->get_column_count()
672
-	);
673
-
674
-	if ( $compatible_wp && $compatible_php ) {
675
-		if ( ! current_user_can( 'update_themes' ) ) {
676
-			printf(
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>.' ),
679
-				$theme['Name'],
680
-				esc_url( $details_url ),
681
-				sprintf(
682
-					'class="thickbox open-plugin-details-modal" aria-label="%s"',
683
-					/* translators: 1: Theme name, 2: Version number. */
684
-					esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
685
-				),
686
-				$response['new_version']
687
-			);
688
-		} elseif ( empty( $response['package'] ) ) {
689
-			printf(
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>' ),
692
-				$theme['Name'],
693
-				esc_url( $details_url ),
694
-				sprintf(
695
-					'class="thickbox open-plugin-details-modal" aria-label="%s"',
696
-					/* translators: 1: Theme name, 2: Version number. */
697
-					esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
698
-				),
699
-				$response['new_version']
700
-			);
701
-		} else {
702
-			printf(
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>.' ),
705
-				$theme['Name'],
706
-				esc_url( $details_url ),
707
-				sprintf(
708
-					'class="thickbox open-plugin-details-modal" aria-label="%s"',
709
-					/* translators: 1: Theme name, 2: Version number. */
710
-					esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
711
-				),
712
-				$response['new_version'],
713
-				wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ),
714
-				sprintf(
715
-					'class="update-link" aria-label="%s"',
716
-					/* translators: %s: Theme name. */
717
-					esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme['Name'] ) )
718
-				)
719
-			);
720
-		}
721
-	} else {
722
-		if ( ! $compatible_wp && ! $compatible_php ) {
723
-			printf(
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.' ),
726
-				$theme['Name']
727
-			);
728
-			if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
729
-				printf(
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() )
734
-				);
735
-				wp_update_php_annotation( '</p><p><em>', '</em>' );
736
-			} elseif ( current_user_can( 'update_core' ) ) {
737
-				printf(
738
-					/* translators: %s: URL to WordPress Updates screen. */
739
-					' ' . __( '<a href="%s">Please update WordPress</a>.' ),
740
-					self_admin_url( 'update-core.php' )
741
-				);
742
-			} elseif ( current_user_can( 'update_php' ) ) {
743
-				printf(
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() )
747
-				);
748
-				wp_update_php_annotation( '</p><p><em>', '</em>' );
749
-			}
750
-		} elseif ( ! $compatible_wp ) {
751
-			printf(
752
-				/* translators: %s: Theme name. */
753
-				__( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
754
-				$theme['Name']
755
-			);
756
-			if ( current_user_can( 'update_core' ) ) {
757
-				printf(
758
-					/* translators: %s: URL to WordPress Updates screen. */
759
-					' ' . __( '<a href="%s">Please update WordPress</a>.' ),
760
-					self_admin_url( 'update-core.php' )
761
-				);
762
-			}
763
-		} elseif ( ! $compatible_php ) {
764
-			printf(
765
-				/* translators: %s: Theme name. */
766
-				__( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
767
-				$theme['Name']
768
-			);
769
-			if ( current_user_can( 'update_php' ) ) {
770
-				printf(
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() )
774
-				);
775
-				wp_update_php_annotation( '</p><p><em>', '</em>' );
776
-			}
777
-		}
778
-	}
779
-
780
-	/**
781
-	 * Fires at the end of the update message container in each
782
-	 * row of the themes list table.
783
-	 *
784
-	 * The dynamic portion of the hook name, `$theme_key`, refers to
785
-	 * the theme slug as found in the WordPress.org themes repository.
786
-	 *
787
-	 * @since 3.1.0
788
-	 *
789
-	 * @param WP_Theme $theme    The WP_Theme object.
790
-	 * @param array    $response {
791
-	 *     An array of metadata about the available theme update.
792
-	 *
793
-	 *     @type string $new_version New theme version.
794
-	 *     @type string $url         Theme URL.
795
-	 *     @type string $package     Theme update package URL.
796
-	 * }
797
-	 */
798
-	do_action( "in_theme_update_message-{$theme_key}", $theme, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
799
-
800
-	echo '</p></div></td></tr>';
636
+    $current = get_site_transient( 'update_themes' );
637
+
638
+    if ( ! isset( $current->response[ $theme_key ] ) ) {
639
+        return false;
640
+    }
641
+
642
+    $response = $current->response[ $theme_key ];
643
+
644
+    $details_url = add_query_arg(
645
+        array(
646
+            'TB_iframe' => 'true',
647
+            'width'     => 1024,
648
+            'height'    => 800,
649
+        ),
650
+        $current->response[ $theme_key ]['url']
651
+    );
652
+
653
+    /** @var WP_MS_Themes_List_Table $wp_list_table */
654
+    $wp_list_table = _get_list_table( 'WP_MS_Themes_List_Table' );
655
+
656
+    $active = $theme->is_allowed( 'network' ) ? ' active' : '';
657
+
658
+    $requires_wp  = isset( $response['requires'] ) ? $response['requires'] : null;
659
+    $requires_php = isset( $response['requires_php'] ) ? $response['requires_php'] : null;
660
+
661
+    $compatible_wp  = is_wp_version_compatible( $requires_wp );
662
+    $compatible_php = is_php_version_compatible( $requires_php );
663
+
664
+    printf(
665
+        '<tr class="plugin-update-tr%s" id="%s" data-slug="%s">' .
666
+        '<td colspan="%s" class="plugin-update colspanchange">' .
667
+        '<div class="update-message notice inline notice-warning notice-alt"><p>',
668
+        $active,
669
+        esc_attr( $theme->get_stylesheet() . '-update' ),
670
+        esc_attr( $theme->get_stylesheet() ),
671
+        $wp_list_table->get_column_count()
672
+    );
673
+
674
+    if ( $compatible_wp && $compatible_php ) {
675
+        if ( ! current_user_can( 'update_themes' ) ) {
676
+            printf(
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>.' ),
679
+                $theme['Name'],
680
+                esc_url( $details_url ),
681
+                sprintf(
682
+                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
683
+                    /* translators: 1: Theme name, 2: Version number. */
684
+                    esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
685
+                ),
686
+                $response['new_version']
687
+            );
688
+        } elseif ( empty( $response['package'] ) ) {
689
+            printf(
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>' ),
692
+                $theme['Name'],
693
+                esc_url( $details_url ),
694
+                sprintf(
695
+                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
696
+                    /* translators: 1: Theme name, 2: Version number. */
697
+                    esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
698
+                ),
699
+                $response['new_version']
700
+            );
701
+        } else {
702
+            printf(
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>.' ),
705
+                $theme['Name'],
706
+                esc_url( $details_url ),
707
+                sprintf(
708
+                    'class="thickbox open-plugin-details-modal" aria-label="%s"',
709
+                    /* translators: 1: Theme name, 2: Version number. */
710
+                    esc_attr( sprintf( __( 'View %1$s version %2$s details' ), $theme['Name'], $response['new_version'] ) )
711
+                ),
712
+                $response['new_version'],
713
+                wp_nonce_url( self_admin_url( 'update.php?action=upgrade-theme&theme=' ) . $theme_key, 'upgrade-theme_' . $theme_key ),
714
+                sprintf(
715
+                    'class="update-link" aria-label="%s"',
716
+                    /* translators: %s: Theme name. */
717
+                    esc_attr( sprintf( _x( 'Update %s now', 'theme' ), $theme['Name'] ) )
718
+                )
719
+            );
720
+        }
721
+    } else {
722
+        if ( ! $compatible_wp && ! $compatible_php ) {
723
+            printf(
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.' ),
726
+                $theme['Name']
727
+            );
728
+            if ( current_user_can( 'update_core' ) && current_user_can( 'update_php' ) ) {
729
+                printf(
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() )
734
+                );
735
+                wp_update_php_annotation( '</p><p><em>', '</em>' );
736
+            } elseif ( current_user_can( 'update_core' ) ) {
737
+                printf(
738
+                    /* translators: %s: URL to WordPress Updates screen. */
739
+                    ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
740
+                    self_admin_url( 'update-core.php' )
741
+                );
742
+            } elseif ( current_user_can( 'update_php' ) ) {
743
+                printf(
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() )
747
+                );
748
+                wp_update_php_annotation( '</p><p><em>', '</em>' );
749
+            }
750
+        } elseif ( ! $compatible_wp ) {
751
+            printf(
752
+                /* translators: %s: Theme name. */
753
+                __( 'There is a new version of %s available, but it does not work with your version of WordPress.' ),
754
+                $theme['Name']
755
+            );
756
+            if ( current_user_can( 'update_core' ) ) {
757
+                printf(
758
+                    /* translators: %s: URL to WordPress Updates screen. */
759
+                    ' ' . __( '<a href="%s">Please update WordPress</a>.' ),
760
+                    self_admin_url( 'update-core.php' )
761
+                );
762
+            }
763
+        } elseif ( ! $compatible_php ) {
764
+            printf(
765
+                /* translators: %s: Theme name. */
766
+                __( 'There is a new version of %s available, but it does not work with your version of PHP.' ),
767
+                $theme['Name']
768
+            );
769
+            if ( current_user_can( 'update_php' ) ) {
770
+                printf(
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() )
774
+                );
775
+                wp_update_php_annotation( '</p><p><em>', '</em>' );
776
+            }
777
+        }
778
+    }
779
+
780
+    /**
781
+     * Fires at the end of the update message container in each
782
+     * row of the themes list table.
783
+     *
784
+     * The dynamic portion of the hook name, `$theme_key`, refers to
785
+     * the theme slug as found in the WordPress.org themes repository.
786
+     *
787
+     * @since 3.1.0
788
+     *
789
+     * @param WP_Theme $theme    The WP_Theme object.
790
+     * @param array    $response {
791
+     *     An array of metadata about the available theme update.
792
+     *
793
+     *     @type string $new_version New theme version.
794
+     *     @type string $url         Theme URL.
795
+     *     @type string $package     Theme update package URL.
796
+     * }
797
+     */
798
+    do_action( "in_theme_update_message-{$theme_key}", $theme, $response ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
799
+
800
+    echo '</p></div></td></tr>';
801 801
 }
802 802
 
803 803
 /**
@@ -807,13 +807,13 @@  discard block
 block discarded – undo
807 807
  * @return void|false
808 808
  */
809 809
 function maintenance_nag() {
810
-	// Include an unmodified $wp_version.
811
-	require ABSPATH . WPINC . '/version.php';
812
-	global $upgrading;
813
-	$nag = isset( $upgrading );
814
-	if ( ! $nag ) {
815
-		$failed = get_site_option( 'auto_core_update_failed' );
816
-		/*
810
+    // Include an unmodified $wp_version.
811
+    require ABSPATH . WPINC . '/version.php';
812
+    global $upgrading;
813
+    $nag = isset( $upgrading );
814
+    if ( ! $nag ) {
815
+        $failed = get_site_option( 'auto_core_update_failed' );
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.
819 819
 		 * This is serious enough to err on the side of nagging.
@@ -823,27 +823,27 @@  discard block
 block discarded – undo
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 ) ) {
828
-			$nag = true;
829
-		}
830
-	}
831
-
832
-	if ( ! $nag ) {
833
-		return false;
834
-	}
835
-
836
-	if ( current_user_can( 'update_core' ) ) {
837
-		$msg = sprintf(
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>.' ),
840
-			'update-core.php'
841
-		);
842
-	} else {
843
-		$msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' );
844
-	}
845
-
846
-	echo "<div class='update-nag notice notice-warning inline'>$msg</div>";
826
+        $comparison = ! empty( $failed['critical'] ) ? '>=' : '>';
827
+        if ( isset( $failed['attempted'] ) && version_compare( $failed['attempted'], $wp_version, $comparison ) ) {
828
+            $nag = true;
829
+        }
830
+    }
831
+
832
+    if ( ! $nag ) {
833
+        return false;
834
+    }
835
+
836
+    if ( current_user_can( 'update_core' ) ) {
837
+        $msg = sprintf(
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>.' ),
840
+            'update-core.php'
841
+        );
842
+    } else {
843
+        $msg = __( 'An automated WordPress update has failed to complete! Please notify the site administrator.' );
844
+    }
845
+
846
+    echo "<div class='update-nag notice notice-warning inline'>$msg</div>";
847 847
 }
848 848
 
849 849
 /**
@@ -863,7 +863,7 @@  discard block
 block discarded – undo
863 863
  * @since 4.6.0
864 864
  */
865 865
 function wp_print_admin_notice_templates() {
866
-	?>
866
+    ?>
867 867
 	<script id="tmpl-wp-updates-admin-notice" type="text/html">
868 868
 		<div <# if ( data.id ) { #>id="{{ data.id }}"<# } #> class="notice {{ data.className }}"><p>{{{ data.message }}}</p></div>
869 869
 	</script>
@@ -874,26 +874,26 @@  discard block
 block discarded – undo
874 874
 					<# if ( 1 === data.successes ) { #>
875 875
 						<# if ( 'plugin' === data.type ) { #>
876 876
 							<?php
877
-							/* translators: %s: Number of plugins. */
878
-							printf( __( '%s plugin successfully updated.' ), '{{ data.successes }}' );
879
-							?>
877
+                            /* translators: %s: Number of plugins. */
878
+                            printf( __( '%s plugin successfully updated.' ), '{{ data.successes }}' );
879
+                            ?>
880 880
 						<# } else { #>
881 881
 							<?php
882
-							/* translators: %s: Number of themes. */
883
-							printf( __( '%s theme successfully updated.' ), '{{ data.successes }}' );
884
-							?>
882
+                            /* translators: %s: Number of themes. */
883
+                            printf( __( '%s theme successfully updated.' ), '{{ data.successes }}' );
884
+                            ?>
885 885
 						<# } #>
886 886
 					<# } else { #>
887 887
 						<# if ( 'plugin' === data.type ) { #>
888 888
 							<?php
889
-							/* translators: %s: Number of plugins. */
890
-							printf( __( '%s plugins successfully updated.' ), '{{ data.successes }}' );
891
-							?>
889
+                            /* translators: %s: Number of plugins. */
890
+                            printf( __( '%s plugins successfully updated.' ), '{{ data.successes }}' );
891
+                            ?>
892 892
 						<# } else { #>
893 893
 							<?php
894
-							/* translators: %s: Number of themes. */
895
-							printf( __( '%s themes successfully updated.' ), '{{ data.successes }}' );
896
-							?>
894
+                            /* translators: %s: Number of themes. */
895
+                            printf( __( '%s themes successfully updated.' ), '{{ data.successes }}' );
896
+                            ?>
897 897
 						<# } #>
898 898
 					<# } #>
899 899
 				<# } #>
@@ -901,14 +901,14 @@  discard block
 block discarded – undo
901 901
 					<button class="button-link bulk-action-errors-collapsed" aria-expanded="false">
902 902
 						<# if ( 1 === data.errors ) { #>
903 903
 							<?php
904
-							/* translators: %s: Number of failed updates. */
905
-							printf( __( '%s update failed.' ), '{{ data.errors }}' );
906
-							?>
904
+                            /* translators: %s: Number of failed updates. */
905
+                            printf( __( '%s update failed.' ), '{{ data.errors }}' );
906
+                            ?>
907 907
 						<# } else { #>
908 908
 							<?php
909
-							/* translators: %s: Number of failed updates. */
910
-							printf( __( '%s updates failed.' ), '{{ data.errors }}' );
911
-							?>
909
+                            /* translators: %s: Number of failed updates. */
910
+                            printf( __( '%s updates failed.' ), '{{ data.errors }}' );
911
+                            ?>
912 912
 						<# } #>
913 913
 						<span class="screen-reader-text"><?php _e( 'Show more details' ); ?></span>
914 914
 						<span class="toggle-indicator" aria-hidden="true"></span>
@@ -955,7 +955,7 @@  discard block
 block discarded – undo
955 955
  * @since 4.6.0
956 956
  */
957 957
 function wp_print_update_row_templates() {
958
-	?>
958
+    ?>
959 959
 	<script id="tmpl-item-update-row" type="text/template">
960 960
 		<tr class="plugin-update-tr update" id="{{ data.slug }}-update" data-slug="{{ data.slug }}" <# if ( data.plugin ) { #>data-plugin="{{ data.plugin }}"<# } #>>
961 961
 			<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
@@ -968,20 +968,20 @@  discard block
 block discarded – undo
968 968
 			<td colspan="{{ data.colspan }}" class="plugin-update colspanchange">
969 969
 				<# if ( data.plugin ) { #>
970 970
 					<?php
971
-					printf(
972
-						/* translators: %s: Plugin name. */
973
-						_x( '%s was successfully deleted.', 'plugin' ),
974
-						'<strong>{{{ data.name }}}</strong>'
975
-					);
976
-					?>
971
+                    printf(
972
+                        /* translators: %s: Plugin name. */
973
+                        _x( '%s was successfully deleted.', 'plugin' ),
974
+                        '<strong>{{{ data.name }}}</strong>'
975
+                    );
976
+                    ?>
977 977
 				<# } else { #>
978 978
 					<?php
979
-					printf(
980
-						/* translators: %s: Theme name. */
981
-						_x( '%s was successfully deleted.', 'theme' ),
982
-						'<strong>{{{ data.name }}}</strong>'
983
-					);
984
-					?>
979
+                    printf(
980
+                        /* translators: %s: Theme name. */
981
+                        _x( '%s was successfully deleted.', 'theme' ),
982
+                        '<strong>{{{ data.name }}}</strong>'
983
+                    );
984
+                    ?>
985 985
 				<# } #>
986 986
 			</td>
987 987
 		</tr>
@@ -995,24 +995,24 @@  discard block
 block discarded – undo
995 995
  * @since 5.2.0
996 996
  */
997 997
 function wp_recovery_mode_nag() {
998
-	if ( ! wp_is_recovery_mode() ) {
999
-		return;
1000
-	}
998
+    if ( ! wp_is_recovery_mode() ) {
999
+        return;
1000
+    }
1001 1001
 
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 );
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 );
1005 1005
 
1006
-	?>
1006
+    ?>
1007 1007
 	<div class="notice notice-info">
1008 1008
 		<p>
1009 1009
 			<?php
1010
-			printf(
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 )
1014
-			);
1015
-			?>
1010
+            printf(
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 )
1014
+            );
1015
+            ?>
1016 1016
 		</p>
1017 1017
 	</div>
1018 1018
 	<?php
@@ -1027,35 +1027,35 @@  discard block
 block discarded – undo
1027 1027
  * @return bool True if auto-updates are enabled for `$type`, false otherwise.
1028 1028
  */
1029 1029
 function wp_is_auto_update_enabled_for_type( $type ) {
1030
-	if ( ! class_exists( 'WP_Automatic_Updater' ) ) {
1031
-		require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php';
1032
-	}
1033
-
1034
-	$updater = new WP_Automatic_Updater();
1035
-	$enabled = ! $updater->is_disabled();
1036
-
1037
-	switch ( $type ) {
1038
-		case 'plugin':
1039
-			/**
1040
-			 * Filters whether plugins auto-update is enabled.
1041
-			 *
1042
-			 * @since 5.5.0
1043
-			 *
1044
-			 * @param bool $enabled True if plugins auto-update is enabled, false otherwise.
1045
-			 */
1046
-			return apply_filters( 'plugins_auto_update_enabled', $enabled );
1047
-		case 'theme':
1048
-			/**
1049
-			 * Filters whether themes auto-update is enabled.
1050
-			 *
1051
-			 * @since 5.5.0
1052
-			 *
1053
-			 * @param bool $enabled True if themes auto-update is enabled, false otherwise.
1054
-			 */
1055
-			return apply_filters( 'themes_auto_update_enabled', $enabled );
1056
-	}
1057
-
1058
-	return false;
1030
+    if ( ! class_exists( 'WP_Automatic_Updater' ) ) {
1031
+        require_once ABSPATH . 'wp-admin/includes/class-wp-automatic-updater.php';
1032
+    }
1033
+
1034
+    $updater = new WP_Automatic_Updater();
1035
+    $enabled = ! $updater->is_disabled();
1036
+
1037
+    switch ( $type ) {
1038
+        case 'plugin':
1039
+            /**
1040
+             * Filters whether plugins auto-update is enabled.
1041
+             *
1042
+             * @since 5.5.0
1043
+             *
1044
+             * @param bool $enabled True if plugins auto-update is enabled, false otherwise.
1045
+             */
1046
+            return apply_filters( 'plugins_auto_update_enabled', $enabled );
1047
+        case 'theme':
1048
+            /**
1049
+             * Filters whether themes auto-update is enabled.
1050
+             *
1051
+             * @since 5.5.0
1052
+             *
1053
+             * @param bool $enabled True if themes auto-update is enabled, false otherwise.
1054
+             */
1055
+            return apply_filters( 'themes_auto_update_enabled', $enabled );
1056
+    }
1057
+
1058
+    return false;
1059 1059
 }
1060 1060
 
1061 1061
 /**
@@ -1070,8 +1070,8 @@  discard block
 block discarded – undo
1070 1070
  * @return bool True if auto-updates are forced for `$item`, false otherwise.
1071 1071
  */
1072 1072
 function wp_is_auto_update_forced_for_item( $type, $update, $item ) {
1073
-	/** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
1074
-	return apply_filters( "auto_update_{$type}", $update, $item );
1073
+    /** This filter is documented in wp-admin/includes/class-wp-automatic-updater.php */
1074
+    return apply_filters( "auto_update_{$type}", $update, $item );
1075 1075
 }
1076 1076
 
1077 1077
 /**
@@ -1082,31 +1082,31 @@  discard block
 block discarded – undo
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' );
1086
-
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.' );
1090
-	} else {
1091
-		$time_to_next_update = human_time_diff( (int) $next_update_time );
1092
-
1093
-		// See if cron is overdue.
1094
-		$overdue = ( time() - $next_update_time ) > 0;
1095
-
1096
-		if ( $overdue ) {
1097
-			$message = sprintf(
1098
-				/* translators: %s: Duration that WP-Cron has been overdue. */
1099
-				__( 'Automatic update overdue by %s. There may be a problem with WP-Cron.' ),
1100
-				$time_to_next_update
1101
-			);
1102
-		} else {
1103
-			$message = sprintf(
1104
-				/* translators: %s: Time until the next update. */
1105
-				__( 'Automatic update scheduled in %s.' ),
1106
-				$time_to_next_update
1107
-			);
1108
-		}
1109
-	}
1110
-
1111
-	return $message;
1085
+    $next_update_time = wp_next_scheduled( 'wp_version_check' );
1086
+
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.' );
1090
+    } else {
1091
+        $time_to_next_update = human_time_diff( (int) $next_update_time );
1092
+
1093
+        // See if cron is overdue.
1094
+        $overdue = ( time() - $next_update_time ) > 0;
1095
+
1096
+        if ( $overdue ) {
1097
+            $message = sprintf(
1098
+                /* translators: %s: Duration that WP-Cron has been overdue. */
1099
+                __( 'Automatic update overdue by %s. There may be a problem with WP-Cron.' ),
1100
+                $time_to_next_update
1101
+            );
1102
+        } else {
1103
+            $message = sprintf(
1104
+                /* translators: %s: Time until the next update. */
1105
+                __( 'Automatic update scheduled in %s.' ),
1106
+                $time_to_next_update
1107
+            );
1108
+        }
1109
+    }
1110
+
1111
+    return $message;
1112 1112
 }
Please login to merge, or discard this patch.
Spacing   +242 added lines, -242 removed lines patch added patch discarded remove patch
@@ -15,11 +15,11 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&#8217;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&#8217;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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 . '&section=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 . '&section=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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 		}
Please login to merge, or discard this patch.
brighty/wp-admin/includes/network.php 3 patches
Indentation   +392 added lines, -392 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
  * @return string|false Base domain if network exists, otherwise false.
18 18
  */
19 19
 function network_domain_check() {
20
-	global $wpdb;
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" );
25
-	}
26
-	return false;
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
+    }
26
+    return false;
27 27
 }
28 28
 
29 29
 /**
@@ -33,12 +33,12 @@  discard block
 block discarded – undo
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 ) ) {
38
-		return false;
39
-	}
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
+        return false;
39
+    }
40 40
 
41
-	return true;
41
+    return true;
42 42
 }
43 43
 
44 44
 /**
@@ -51,30 +51,30 @@  discard block
 block discarded – undo
51 51
  * @return bool Whether subdirectory installation is allowed
52 52
  */
53 53
 function allow_subdirectory_install() {
54
-	global $wpdb;
55
-
56
-	/**
57
-	 * Filters whether to enable the subdirectory installation feature in Multisite.
58
-	 *
59
-	 * @since 3.0.0
60
-	 *
61
-	 * @param bool $allow Whether to enable the subdirectory installation feature in Multisite.
62
-	 *                    Default false.
63
-	 */
64
-	if ( apply_filters( 'allow_subdirectory_install', false ) ) {
65
-		return true;
66
-	}
67
-
68
-	if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) {
69
-		return true;
70
-	}
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 ) ) {
74
-		return true;
75
-	}
76
-
77
-	return false;
54
+    global $wpdb;
55
+
56
+    /**
57
+     * Filters whether to enable the subdirectory installation feature in Multisite.
58
+     *
59
+     * @since 3.0.0
60
+     *
61
+     * @param bool $allow Whether to enable the subdirectory installation feature in Multisite.
62
+     *                    Default false.
63
+     */
64
+    if ( apply_filters( 'allow_subdirectory_install', false ) ) {
65
+        return true;
66
+    }
67
+
68
+    if ( defined( 'ALLOW_SUBDIRECTORY_INSTALL' ) && ALLOW_SUBDIRECTORY_INSTALL ) {
69
+        return true;
70
+    }
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 ) ) {
74
+        return true;
75
+    }
76
+
77
+    return false;
78 78
 }
79 79
 
80 80
 /**
@@ -84,16 +84,16 @@  discard block
 block discarded – undo
84 84
  * @return string Base domain.
85 85
  */
86 86
 function get_clean_basedomain() {
87
-	$existing_domain = network_domain_check();
88
-	if ( $existing_domain ) {
89
-		return $existing_domain;
90
-	}
91
-	$domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
92
-	$slash  = strpos( $domain, '/' );
93
-	if ( $slash ) {
94
-		$domain = substr( $domain, 0, $slash );
95
-	}
96
-	return $domain;
87
+    $existing_domain = network_domain_check();
88
+    if ( $existing_domain ) {
89
+        return $existing_domain;
90
+    }
91
+    $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) );
92
+    $slash  = strpos( $domain, '/' );
93
+    if ( $slash ) {
94
+        $domain = substr( $domain, 0, $slash );
95
+    }
96
+    return $domain;
97 97
 }
98 98
 
99 99
 /**
@@ -110,120 +110,120 @@  discard block
 block discarded – undo
110 110
  * @param false|WP_Error $errors Optional. Error object. Default false.
111 111
  */
112 112
 function network_step1( $errors = false ) {
113
-	global $is_apache;
114
-
115
-	if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
116
-		echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
117
-			/* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
118
-			__( 'The constant %s cannot be defined when creating a network.' ),
119
-			'<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
120
-		) . '</p></div>';
121
-		echo '</div>';
122
-		require_once ABSPATH . 'wp-admin/admin-footer.php';
123
-		die();
124
-	}
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(
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' )
132
-		) . '</p></div>';
133
-		echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
134
-		echo '</div>';
135
-		require_once ABSPATH . 'wp-admin/admin-footer.php';
136
-		die();
137
-	}
138
-
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>';
143
-		echo '<p>' . sprintf(
144
-			/* translators: %s: Port number. */
145
-			__( 'You cannot use port numbers such as %s.' ),
146
-			'<code>' . $has_ports . '</code>'
147
-		) . '</p>';
148
-		echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
149
-		echo '</div>';
150
-		require_once ABSPATH . 'wp-admin/admin-footer.php';
151
-		die();
152
-	}
153
-
154
-	echo '<form method="post">';
155
-
156
-	wp_nonce_field( 'install-network-1' );
157
-
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 ) {
162
-			echo "<p>$error</p>";
163
-		}
164
-		echo '</div>';
165
-		$error_codes = $errors->get_error_codes();
166
-	}
167
-
168
-	if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
169
-		$site_name = $_POST['sitename'];
170
-	} else {
171
-		/* translators: %s: Default network title. */
172
-		$site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) );
173
-	}
174
-
175
-	if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) {
176
-		$admin_email = $_POST['email'];
177
-	} else {
178
-		$admin_email = get_option( 'admin_email' );
179
-	}
180
-	?>
113
+    global $is_apache;
114
+
115
+    if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) {
116
+        echo '<div class="error"><p><strong>' . __( 'Error:' ) . '</strong> ' . sprintf(
117
+            /* translators: %s: DO_NOT_UPGRADE_GLOBAL_TABLES */
118
+            __( 'The constant %s cannot be defined when creating a network.' ),
119
+            '<code>DO_NOT_UPGRADE_GLOBAL_TABLES</code>'
120
+        ) . '</p></div>';
121
+        echo '</div>';
122
+        require_once ABSPATH . 'wp-admin/admin-footer.php';
123
+        die();
124
+    }
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(
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' )
132
+        ) . '</p></div>';
133
+        echo '<p>' . __( 'Once the network is created, you may reactivate your plugins.' ) . '</p>';
134
+        echo '</div>';
135
+        require_once ABSPATH . 'wp-admin/admin-footer.php';
136
+        die();
137
+    }
138
+
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>';
143
+        echo '<p>' . sprintf(
144
+            /* translators: %s: Port number. */
145
+            __( 'You cannot use port numbers such as %s.' ),
146
+            '<code>' . $has_ports . '</code>'
147
+        ) . '</p>';
148
+        echo '<a href="' . esc_url( admin_url() ) . '">' . __( 'Go to Dashboard' ) . '</a>';
149
+        echo '</div>';
150
+        require_once ABSPATH . 'wp-admin/admin-footer.php';
151
+        die();
152
+    }
153
+
154
+    echo '<form method="post">';
155
+
156
+    wp_nonce_field( 'install-network-1' );
157
+
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 ) {
162
+            echo "<p>$error</p>";
163
+        }
164
+        echo '</div>';
165
+        $error_codes = $errors->get_error_codes();
166
+    }
167
+
168
+    if ( ! empty( $_POST['sitename'] ) && ! in_array( 'empty_sitename', $error_codes, true ) ) {
169
+        $site_name = $_POST['sitename'];
170
+    } else {
171
+        /* translators: %s: Default network title. */
172
+        $site_name = sprintf( __( '%s Sites' ), get_option( 'blogname' ) );
173
+    }
174
+
175
+    if ( ! empty( $_POST['email'] ) && ! in_array( 'invalid_email', $error_codes, true ) ) {
176
+        $admin_email = $_POST['email'];
177
+    } else {
178
+        $admin_email = get_option( 'admin_email' );
179
+    }
180
+    ?>
181 181
 	<p><?php _e( 'Welcome to the Network installation process!' ); ?></p>
182 182
 	<p><?php _e( 'Fill in the information below and you&#8217;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'] ) ) {
186
-		$subdomain_install = (bool) $_POST['subdomain_install'];
187
-	} elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing.
188
-		$subdomain_install = true;
189
-	} elseif ( ! allow_subdirectory_install() ) {
190
-		$subdomain_install = true;
191
-	} else {
192
-		$subdomain_install = false;
193
-		$got_mod_rewrite   = got_mod_rewrite();
194
-		if ( $got_mod_rewrite ) { // Dangerous assumptions.
195
-			echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
196
-			printf(
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.' ),
199
-				'<code>mod_rewrite</code>'
200
-			);
201
-			echo '</p>';
202
-		} elseif ( $is_apache ) {
203
-			echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ';
204
-			printf(
205
-				/* translators: %s: mod_rewrite */
206
-				__( 'It looks like the Apache %s module is not installed.' ),
207
-				'<code>mod_rewrite</code>'
208
-			);
209
-			echo '</p>';
210
-		}
211
-
212
-		if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
213
-			echo '<p>';
214
-			printf(
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.' ),
217
-				'<code>mod_rewrite</code>',
218
-				'https://httpd.apache.org/docs/mod/mod_rewrite.html',
219
-				'https://www.google.com/search?q=apache+mod_rewrite'
220
-			);
221
-			echo '</p></div>';
222
-		}
223
-	}
224
-
225
-	if ( allow_subdomain_install() && allow_subdirectory_install() ) :
226
-		?>
185
+    if ( isset( $_POST['subdomain_install'] ) ) {
186
+        $subdomain_install = (bool) $_POST['subdomain_install'];
187
+    } elseif ( apache_mod_loaded( 'mod_rewrite' ) ) { // Assume nothing.
188
+        $subdomain_install = true;
189
+    } elseif ( ! allow_subdirectory_install() ) {
190
+        $subdomain_install = true;
191
+    } else {
192
+        $subdomain_install = false;
193
+        $got_mod_rewrite   = got_mod_rewrite();
194
+        if ( $got_mod_rewrite ) { // Dangerous assumptions.
195
+            echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> ';
196
+            printf(
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.' ),
199
+                '<code>mod_rewrite</code>'
200
+            );
201
+            echo '</p>';
202
+        } elseif ( $is_apache ) {
203
+            echo '<div class="error inline"><p><strong>' . __( 'Warning:' ) . '</strong> ';
204
+            printf(
205
+                /* translators: %s: mod_rewrite */
206
+                __( 'It looks like the Apache %s module is not installed.' ),
207
+                '<code>mod_rewrite</code>'
208
+            );
209
+            echo '</p>';
210
+        }
211
+
212
+        if ( $got_mod_rewrite || $is_apache ) { // Protect against mod_rewrite mimicry (but ! Apache).
213
+            echo '<p>';
214
+            printf(
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.' ),
217
+                '<code>mod_rewrite</code>',
218
+                'https://httpd.apache.org/docs/mod/mod_rewrite.html',
219
+                'https://www.google.com/search?q=apache+mod_rewrite'
220
+            );
221
+            echo '</p></div>';
222
+        }
223
+    }
224
+
225
+    if ( allow_subdomain_install() && allow_subdirectory_install() ) :
226
+        ?>
227 227
 		<h3><?php esc_html_e( 'Addresses of Sites in your Network' ); ?></h3>
228 228
 		<p><?php _e( 'Please choose whether you would like sites in your WordPress network to use sub-domains or sub-directories.' ); ?>
229 229
 			<strong><?php _e( 'You cannot change this later.' ); ?></strong></p>
@@ -234,61 +234,61 @@  discard block
 block discarded – undo
234 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
-				printf(
238
-					/* translators: 1: Host name. */
239
-					_x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ),
240
-					$hostname
241
-				);
242
-				?>
237
+                printf(
238
+                    /* translators: 1: Host name. */
239
+                    _x( 'like <code>site1.%1$s</code> and <code>site2.%1$s</code>', 'subdomain examples' ),
240
+                    $hostname
241
+                );
242
+                ?>
243 243
 				</td>
244 244
 			</tr>
245 245
 			<tr>
246 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
-				printf(
250
-					/* translators: 1: Host name. */
251
-					_x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ),
252
-					$hostname
253
-				);
254
-				?>
249
+                printf(
250
+                    /* translators: 1: Host name. */
251
+                    _x( 'like <code>%1$s/site1</code> and <code>%1$s/site2</code>', 'subdirectory examples' ),
252
+                    $hostname
253
+                );
254
+                ?>
255 255
 				</td>
256 256
 			</tr>
257 257
 		</table>
258 258
 
259 259
 		<?php
260
-	endif;
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>';
264
-	}
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
+    }
265 265
 
266
-	$is_www = ( 0 === strpos( $hostname, 'www.' ) );
267
-	if ( $is_www ) :
268
-		?>
266
+    $is_www = ( 0 === strpos( $hostname, 'www.' ) );
267
+    if ( $is_www ) :
268
+        ?>
269 269
 		<h3><?php esc_html_e( 'Server Address' ); ?></h3>
270 270
 		<p>
271 271
 		<?php
272
-		printf(
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>',
276
-			'<code>' . $hostname . '</code>',
277
-			'<code>www</code>'
278
-		);
279
-		?>
272
+        printf(
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>',
276
+            '<code>' . $hostname . '</code>',
277
+            '<code>www</code>'
278
+        );
279
+        ?>
280 280
 		</p>
281 281
 		<table class="form-table" role="presentation">
282 282
 			<tr>
283 283
 			<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
284 284
 			<td>
285 285
 				<?php
286
-					printf(
287
-						/* translators: %s: Host name. */
288
-						__( 'The internet address of your network will be %s.' ),
289
-						'<code>' . $hostname . '</code>'
290
-					);
291
-				?>
286
+                    printf(
287
+                        /* translators: %s: Host name. */
288
+                        __( 'The internet address of your network will be %s.' ),
289
+                        '<code>' . $hostname . '</code>'
290
+                    );
291
+                ?>
292 292
 				</td>
293 293
 			</tr>
294 294
 		</table>
@@ -301,17 +301,17 @@  discard block
 block discarded – undo
301 301
 				<th scope="row"><?php esc_html_e( 'Sub-directory Installation' ); ?></th>
302 302
 				<td>
303 303
 				<?php
304
-					printf(
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.' ),
307
-						'<code>localhost</code>',
308
-						'<code>localhost.localdomain</code>'
309
-					);
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>';
313
-				}
314
-				?>
304
+                    printf(
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.' ),
307
+                        '<code>localhost</code>',
308
+                        '<code>localhost.localdomain</code>'
309
+                    );
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>';
313
+                }
314
+                ?>
315 315
 				</td>
316 316
 			</tr>
317 317
 		<?php elseif ( ! allow_subdomain_install() ) : ?>
@@ -319,12 +319,12 @@  discard block
 block discarded – undo
319 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.' );
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>';
326
-				}
327
-				?>
322
+                    _e( 'Because your installation is in a directory, the sites in your WordPress network must use sub-directories.' );
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>';
326
+                }
327
+                ?>
328 328
 				</td>
329 329
 			</tr>
330 330
 		<?php elseif ( ! allow_subdirectory_install() ) : ?>
@@ -332,9 +332,9 @@  discard block
 block discarded – undo
332 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>';
337
-				?>
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
+                ?>
338 338
 				</td>
339 339
 			</tr>
340 340
 		<?php endif; ?>
@@ -343,12 +343,12 @@  discard block
 block discarded – undo
343 343
 				<th scope='row'><?php esc_html_e( 'Server Address' ); ?></th>
344 344
 				<td>
345 345
 					<?php
346
-					printf(
347
-						/* translators: %s: Host name. */
348
-						__( 'The internet address of your network will be %s.' ),
349
-						'<code>' . $hostname . '</code>'
350
-					);
351
-					?>
346
+                    printf(
347
+                        /* translators: %s: Host name. */
348
+                        __( 'The internet address of your network will be %s.' ),
349
+                        '<code>' . $hostname . '</code>'
350
+                    );
351
+                    ?>
352 352
 				</td>
353 353
 			</tr>
354 354
 		<?php endif; ?>
@@ -387,104 +387,104 @@  discard block
 block discarded – undo
387 387
  * @param false|WP_Error $errors Optional. Error object. Default false.
388 388
  */
389 389
 function network_step2( $errors = false ) {
390
-	global $wpdb, $is_nginx;
391
-
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 ), '/' ) : '';
400
-
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 );
404
-	}
405
-	$location_of_wp_config = trailingslashit( $location_of_wp_config );
406
-
407
-	// Wildcard DNS message.
408
-	if ( is_wp_error( $errors ) ) {
409
-		echo '<div class="error">' . $errors->get_error_message() . '</div>';
410
-	}
411
-
412
-	if ( $_POST ) {
413
-		if ( allow_subdomain_install() ) {
414
-			$subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
415
-		} else {
416
-			$subdomain_install = false;
417
-		}
418
-	} else {
419
-		if ( is_multisite() ) {
420
-			$subdomain_install = is_subdomain_install();
421
-			?>
390
+    global $wpdb, $is_nginx;
391
+
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 ), '/' ) : '';
400
+
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 );
404
+    }
405
+    $location_of_wp_config = trailingslashit( $location_of_wp_config );
406
+
407
+    // Wildcard DNS message.
408
+    if ( is_wp_error( $errors ) ) {
409
+        echo '<div class="error">' . $errors->get_error_message() . '</div>';
410
+    }
411
+
412
+    if ( $_POST ) {
413
+        if ( allow_subdomain_install() ) {
414
+            $subdomain_install = allow_subdirectory_install() ? ! empty( $_POST['subdomain_install'] ) : true;
415
+        } else {
416
+            $subdomain_install = false;
417
+        }
418
+    } else {
419
+        if ( is_multisite() ) {
420
+            $subdomain_install = is_subdomain_install();
421
+            ?>
422 422
 	<p><?php _e( 'The original configuration steps are shown here for reference.' ); ?></p>
423 423
 			<?php
424
-		} else {
425
-			$subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
426
-			?>
424
+        } else {
425
+            $subdomain_install = (bool) $wpdb->get_var( "SELECT meta_value FROM $wpdb->sitemeta WHERE site_id = 1 AND meta_key = 'subdomain_install'" );
426
+            ?>
427 427
 	<div class="error"><p><strong><?php _e( 'Warning:' ); ?></strong> <?php _e( 'An existing WordPress network was detected.' ); ?></p></div>
428 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
-		}
431
-	}
430
+        }
431
+    }
432 432
 
433
-	$subdir_match          = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?';
434
-	$subdir_replacement_01 = $subdomain_install ? '' : '$1';
435
-	$subdir_replacement_12 = $subdomain_install ? '$1' : '$2';
433
+    $subdir_match          = $subdomain_install ? '' : '([_0-9a-zA-Z-]+/)?';
434
+    $subdir_replacement_01 = $subdomain_install ? '' : '$1';
435
+    $subdir_replacement_12 = $subdomain_install ? '$1' : '$2';
436 436
 
437
-	if ( $_POST || ! is_multisite() ) {
438
-		?>
437
+    if ( $_POST || ! is_multisite() ) {
438
+        ?>
439 439
 		<h3><?php esc_html_e( 'Enabling the Network' ); ?></h3>
440 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> ';
445
-			printf(
446
-				/* translators: 1: wp-config.php, 2: .htaccess */
447
-				__( 'You should back up your existing %1$s and %2$s files.' ),
448
-				'<code>wp-config.php</code>',
449
-				'<code>.htaccess</code>'
450
-			);
451
-		} elseif ( file_exists( $home_path . 'web.config' ) ) {
452
-			echo '<strong>' . __( 'Caution:' ) . '</strong> ';
453
-			printf(
454
-				/* translators: 1: wp-config.php, 2: web.config */
455
-				__( 'You should back up your existing %1$s and %2$s files.' ),
456
-				'<code>wp-config.php</code>',
457
-				'<code>web.config</code>'
458
-			);
459
-		} else {
460
-			echo '<strong>' . __( 'Caution:' ) . '</strong> ';
461
-			printf(
462
-				/* translators: %s: wp-config.php */
463
-				__( 'You should back up your existing %s file.' ),
464
-				'<code>wp-config.php</code>'
465
-			);
466
-		}
467
-		?>
443
+        if ( file_exists( $home_path . '.htaccess' ) ) {
444
+            echo '<strong>' . __( 'Caution:' ) . '</strong> ';
445
+            printf(
446
+                /* translators: 1: wp-config.php, 2: .htaccess */
447
+                __( 'You should back up your existing %1$s and %2$s files.' ),
448
+                '<code>wp-config.php</code>',
449
+                '<code>.htaccess</code>'
450
+            );
451
+        } elseif ( file_exists( $home_path . 'web.config' ) ) {
452
+            echo '<strong>' . __( 'Caution:' ) . '</strong> ';
453
+            printf(
454
+                /* translators: 1: wp-config.php, 2: web.config */
455
+                __( 'You should back up your existing %1$s and %2$s files.' ),
456
+                '<code>wp-config.php</code>',
457
+                '<code>web.config</code>'
458
+            );
459
+        } else {
460
+            echo '<strong>' . __( 'Caution:' ) . '</strong> ';
461
+            printf(
462
+                /* translators: %s: wp-config.php */
463
+                __( 'You should back up your existing %s file.' ),
464
+                '<code>wp-config.php</code>'
465
+            );
466
+        }
467
+        ?>
468 468
 		</p></div>
469 469
 		<?php
470
-	}
471
-	?>
470
+    }
471
+    ?>
472 472
 	<ol>
473 473
 		<li><p>
474 474
 		<?php
475
-		printf(
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:' ),
478
-			'<code>wp-config.php</code>',
479
-			'<code>' . $location_of_wp_config . '</code>',
480
-			/*
475
+        printf(
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:' ),
478
+            '<code>wp-config.php</code>',
479
+            '<code>' . $location_of_wp_config . '</code>',
480
+            /*
481 481
 			 * translators: This string should only be translated if wp-config-sample.php is localized.
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&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>'
486
-		);
487
-		?>
485
+            '<code>/* ' . __( 'That&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>'
486
+        );
487
+        ?>
488 488
 		</p>
489 489
 		<textarea class="code" readonly="readonly" cols="100" rows="7">
490 490
 define( 'MULTISITE', true );
@@ -495,68 +495,68 @@  discard block
 block discarded – undo
495 495
 define( 'BLOG_ID_CURRENT_SITE', 1 );
496 496
 </textarea>
497 497
 		<?php
498
-		$keys_salts = array(
499
-			'AUTH_KEY'         => '',
500
-			'SECURE_AUTH_KEY'  => '',
501
-			'LOGGED_IN_KEY'    => '',
502
-			'NONCE_KEY'        => '',
503
-			'AUTH_SALT'        => '',
504
-			'SECURE_AUTH_SALT' => '',
505
-			'LOGGED_IN_SALT'   => '',
506
-			'NONCE_SALT'       => '',
507
-		);
508
-		foreach ( $keys_salts as $c => $v ) {
509
-			if ( defined( $c ) ) {
510
-				unset( $keys_salts[ $c ] );
511
-			}
512
-		}
513
-
514
-		if ( ! empty( $keys_salts ) ) {
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 ) . "' );";
520
-				}
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 ) . "' );";
525
-				}
526
-			}
527
-			$num_keys_salts = count( $keys_salts );
528
-			?>
498
+        $keys_salts = array(
499
+            'AUTH_KEY'         => '',
500
+            'SECURE_AUTH_KEY'  => '',
501
+            'LOGGED_IN_KEY'    => '',
502
+            'NONCE_KEY'        => '',
503
+            'AUTH_SALT'        => '',
504
+            'SECURE_AUTH_SALT' => '',
505
+            'LOGGED_IN_SALT'   => '',
506
+            'NONCE_SALT'       => '',
507
+        );
508
+        foreach ( $keys_salts as $c => $v ) {
509
+            if ( defined( $c ) ) {
510
+                unset( $keys_salts[ $c ] );
511
+            }
512
+        }
513
+
514
+        if ( ! empty( $keys_salts ) ) {
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 ) . "' );";
520
+                }
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 ) . "' );";
525
+                }
526
+            }
527
+            $num_keys_salts = count( $keys_salts );
528
+            ?>
529 529
 		<p>
530 530
 			<?php
531
-			if ( 1 === $num_keys_salts ) {
532
-				printf(
533
-					/* translators: %s: wp-config.php */
534
-					__( 'This unique authentication key is also missing from your %s file.' ),
535
-					'<code>wp-config.php</code>'
536
-				);
537
-			} else {
538
-				printf(
539
-					/* translators: %s: wp-config.php */
540
-					__( 'These unique authentication keys are also missing from your %s file.' ),
541
-					'<code>wp-config.php</code>'
542
-				);
543
-			}
544
-			?>
531
+            if ( 1 === $num_keys_salts ) {
532
+                printf(
533
+                    /* translators: %s: wp-config.php */
534
+                    __( 'This unique authentication key is also missing from your %s file.' ),
535
+                    '<code>wp-config.php</code>'
536
+                );
537
+            } else {
538
+                printf(
539
+                    /* translators: %s: wp-config.php */
540
+                    __( 'These unique authentication keys are also missing from your %s file.' ),
541
+                    '<code>wp-config.php</code>'
542
+                );
543
+            }
544
+            ?>
545 545
 			<?php _e( 'To make your installation more secure, you should also add:' ); ?>
546 546
 		</p>
547 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
-		}
550
-		?>
549
+        }
550
+        ?>
551 551
 		</li>
552 552
 	<?php
553
-	if ( iis7_supports_permalinks() ) :
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;
557
-		$iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';
553
+    if ( iis7_supports_permalinks() ) :
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;
557
+        $iis_subdir_replacement = $subdomain_install ? '' : '{R:1}';
558 558
 
559
-		$web_config_file = '<?xml version="1.0" encoding="UTF-8"?>
559
+        $web_config_file = '<?xml version="1.0" encoding="UTF-8"?>
560 560
 <configuration>
561 561
     <system.webServer>
562 562
         <rewrite>
@@ -565,14 +565,14 @@  discard block
 block discarded – undo
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' ) ) {
569
-			$web_config_file .= '
568
+        if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
569
+            $web_config_file .= '
570 570
                 <rule name="WordPress Rule for Files" stopProcessing="true">
571 571
                     <match url="^' . $iis_subdir_match . 'files/(.+)" ignoreCase="false" />
572 572
                     <action type="Rewrite" url="' . $iis_rewrite_base . WPINC . '/ms-files.php?file={R:1}" appendQueryString="false" />
573 573
                 </rule>';
574
-		}
575
-			$web_config_file .= '
574
+        }
575
+            $web_config_file .= '
576 576
                 <rule name="WordPress Rule 2" stopProcessing="true">
577 577
                     <match url="^' . $iis_subdir_match . 'wp-admin$" ignoreCase="false" />
578 578
                     <action type="Redirect" url="' . $iis_subdir_replacement . 'wp-admin/" redirectType="Permanent" />
@@ -603,42 +603,42 @@  discard block
 block discarded – undo
603 603
 </configuration>
604 604
 ';
605 605
 
606
-			echo '<li><p>';
607
-			printf(
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:' ),
610
-				'<code>web.config</code>',
611
-				'<code>' . $home_path . '</code>'
612
-			);
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>';
616
-		}
617
-		?>
606
+            echo '<li><p>';
607
+            printf(
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:' ),
610
+                '<code>web.config</code>',
611
+                '<code>' . $home_path . '</code>'
612
+            );
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>';
616
+        }
617
+        ?>
618 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
-		echo '<li><p>';
626
-		printf(
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/' )
630
-		);
631
-		echo '</p></li>';
625
+        echo '<li><p>';
626
+        printf(
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/' )
630
+        );
631
+        echo '</p></li>';
632 632
 
633
-	else : // End $is_nginx. Construct an .htaccess file instead:
633
+    else : // End $is_nginx. Construct an .htaccess file instead:
634 634
 
635
-		$ms_files_rewriting = '';
636
-		if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
637
-			$ms_files_rewriting  = "\n# uploaded files\nRewriteRule ^";
638
-			$ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
639
-		}
635
+        $ms_files_rewriting = '';
636
+        if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
637
+            $ms_files_rewriting  = "\n# uploaded files\nRewriteRule ^";
638
+            $ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
639
+        }
640 640
 
641
-		$htaccess_file = <<<EOF
641
+        $htaccess_file = <<<EOF
642 642
 RewriteEngine On
643 643
 RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
644 644
 RewriteBase {$base}
@@ -656,28 +656,28 @@  discard block
 block discarded – undo
656 656
 
657 657
 EOF;
658 658
 
659
-		echo '<li><p>';
660
-		printf(
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:' ),
663
-			'<code>.htaccess</code>',
664
-			'<code>' . $home_path . '</code>'
665
-		);
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>';
669
-		}
670
-		?>
659
+        echo '<li><p>';
660
+        printf(
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:' ),
663
+            '<code>.htaccess</code>',
664
+            '<code>' . $home_path . '</code>'
665
+        );
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>';
669
+        }
670
+        ?>
671 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
-	endif; // End IIS/Nginx/Apache code branches.
676
+    endif; // End IIS/Nginx/Apache code branches.
677 677
 
678
-	if ( ! is_multisite() ) {
679
-		?>
678
+    if ( ! is_multisite() ) {
679
+        ?>
680 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
 }
Please login to merge, or discard this patch.
Spacing   +161 added lines, -161 removed lines patch added patch discarded remove patch
@@ -19,9 +19,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&#8217;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&#8217;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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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&#8217;s all, stop editing! Happy publishing.' ) . ' */</code>'
485
+			'<code>/* ' . __('That&#8217;s all, stop editing! Happy publishing.') . ' */</code>'
486 486
 		);
487 487
 		?>
488 488
 		</p>
@@ -505,55 +505,55 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -630,9 +630,11 @@
 block discarded – undo
630 630
 		);
631 631
 		echo '</p></li>';
632 632
 
633
-	else : // End $is_nginx. Construct an .htaccess file instead:
633
+	else {
634
+	    : // End $is_nginx. Construct an .htaccess file instead:
634 635
 
635 636
 		$ms_files_rewriting = '';
637
+	}
636 638
 		if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
637 639
 			$ms_files_rewriting  = "\n# uploaded files\nRewriteRule ^";
638 640
 			$ms_files_rewriting .= $subdir_match . "files/(.+) {$rewrite_base}" . WPINC . "/ms-files.php?file={$subdir_replacement_12} [L]" . "\n";
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-wp-automatic-updater.php 2 patches
Indentation   +1425 added lines, -1425 removed lines patch added patch discarded remove patch
@@ -15,605 +15,605 @@  discard block
 block discarded – undo
15 15
  */
16 16
 class WP_Automatic_Updater {
17 17
 
18
-	/**
19
-	 * Tracks update results during processing.
20
-	 *
21
-	 * @var array
22
-	 */
23
-	protected $update_results = array();
24
-
25
-	/**
26
-	 * Determines whether the entire automatic updater is disabled.
27
-	 *
28
-	 * @since 3.7.0
29
-	 */
30
-	public function is_disabled() {
31
-		// Background updates are disabled if you don't want file changes.
32
-		if ( ! wp_is_file_mod_allowed( 'automatic_updater' ) ) {
33
-			return true;
34
-		}
35
-
36
-		if ( wp_installing() ) {
37
-			return true;
38
-		}
39
-
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;
42
-
43
-		/**
44
-		 * Filters whether to entirely disable background updates.
45
-		 *
46
-		 * There are more fine-grained filters and controls for selective disabling.
47
-		 * This filter parallels the AUTOMATIC_UPDATER_DISABLED constant in name.
48
-		 *
49
-		 * This also disables update notification emails. That may change in the future.
50
-		 *
51
-		 * @since 3.7.0
52
-		 *
53
-		 * @param bool $disabled Whether the updater should be disabled.
54
-		 */
55
-		return apply_filters( 'automatic_updater_disabled', $disabled );
56
-	}
57
-
58
-	/**
59
-	 * Checks for version control checkouts.
60
-	 *
61
-	 * Checks for Subversion, Git, Mercurial, and Bazaar. It recursively looks up the
62
-	 * filesystem to the top of the drive, erring on the side of detecting a VCS
63
-	 * checkout somewhere.
64
-	 *
65
-	 * ABSPATH is always checked in addition to whatever `$context` is (which may be the
66
-	 * wp-content directory, for example). The underlying assumption is that if you are
67
-	 * using version control *anywhere*, then you should be making decisions for
68
-	 * how things get updated.
69
-	 *
70
-	 * @since 3.7.0
71
-	 *
72
-	 * @param string $context The filesystem path to check, in addition to ABSPATH.
73
-	 * @return bool True if a VCS checkout was discovered at `$context` or ABSPATH,
74
-	 *              or anywhere higher. False otherwise.
75
-	 */
76
-	public function is_vcs_checkout( $context ) {
77
-		$context_dirs = array( untrailingslashit( $context ) );
78
-		if ( ABSPATH !== $context ) {
79
-			$context_dirs[] = untrailingslashit( ABSPATH );
80
-		}
81
-
82
-		$vcs_dirs   = array( '.svn', '.git', '.hg', '.bzr' );
83
-		$check_dirs = array();
84
-
85
-		foreach ( $context_dirs as $context_dir ) {
86
-			// Walk up from $context_dir to the root.
87
-			do {
88
-				$check_dirs[] = $context_dir;
89
-
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 ) {
92
-					break;
93
-				}
94
-
95
-				// Continue one level at a time.
96
-			} while ( $context_dir = dirname( $context_dir ) );
97
-		}
98
-
99
-		$check_dirs = array_unique( $check_dirs );
100
-
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 ) {
106
-					break 2;
107
-				}
108
-			}
109
-		}
110
-
111
-		/**
112
-		 * Filters whether the automatic updater should consider a filesystem
113
-		 * location to be potentially managed by a version control system.
114
-		 *
115
-		 * @since 3.7.0
116
-		 *
117
-		 * @param bool $checkout  Whether a VCS checkout was discovered at `$context`
118
-		 *                        or ABSPATH, or anywhere higher.
119
-		 * @param string $context The filesystem context (a path) against which
120
-		 *                        filesystem status should be checked.
121
-		 */
122
-		return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context );
123
-	}
124
-
125
-	/**
126
-	 * Tests to see if we can and should update a specific item.
127
-	 *
128
-	 * @since 3.7.0
129
-	 *
130
-	 * @global wpdb $wpdb WordPress database abstraction object.
131
-	 *
132
-	 * @param string $type    The type of update being checked: 'core', 'theme',
133
-	 *                        'plugin', 'translation'.
134
-	 * @param object $item    The update offer.
135
-	 * @param string $context The filesystem context (a path) against which filesystem
136
-	 *                        access and status should be checked.
137
-	 * @return bool True if the item should be updated, false otherwise.
138
-	 */
139
-	public function should_update( $type, $item, $context ) {
140
-		// Used to see if WP_Filesystem is set up to allow unattended updates.
141
-		$skin = new Automatic_Upgrader_Skin;
142
-
143
-		if ( $this->is_disabled() ) {
144
-			return false;
145
-		}
146
-
147
-		// Only relax the filesystem checks when the update doesn't include new files.
148
-		$allow_relaxed_file_ownership = false;
149
-		if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) {
150
-			$allow_relaxed_file_ownership = true;
151
-		}
152
-
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 )
156
-		) {
157
-			if ( 'core' === $type ) {
158
-				$this->send_core_update_notification_email( $item );
159
-			}
160
-			return false;
161
-		}
162
-
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 );
168
-
169
-			if ( ! $update && wp_is_auto_update_enabled_for_type( $type ) ) {
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 );
173
-			}
174
-		} else {
175
-			$update = ! empty( $item->autoupdate );
176
-		}
177
-
178
-		// If the `disable_autoupdate` flag is set, override any user-choice, but allow filters.
179
-		if ( ! empty( $item->disable_autoupdate ) ) {
180
-			$update = $item->disable_autoupdate;
181
-		}
182
-
183
-		/**
184
-		 * Filters whether to automatically update core, a plugin, a theme, or a language.
185
-		 *
186
-		 * The dynamic portion of the hook name, `$type`, refers to the type of update
187
-		 * being checked.
188
-		 *
189
-		 * Possible hook names include:
190
-		 *
191
-		 *  - `auto_update_core`
192
-		 *  - `auto_update_plugin`
193
-		 *  - `auto_update_theme`
194
-		 *  - `auto_update_translation`
195
-		 *
196
-		 * Since WordPress 3.7, minor and development versions of core, and translations have
197
-		 * been auto-updated by default. New installs on WordPress 5.6 or higher will also
198
-		 * auto-update major versions by default. Starting in 5.6, older sites can opt-in to
199
-		 * major version auto-updates, and auto-updates for plugins and themes.
200
-		 *
201
-		 * See the {@see 'allow_dev_auto_core_updates'}, {@see 'allow_minor_auto_core_updates'},
202
-		 * and {@see 'allow_major_auto_core_updates'} filters for a more straightforward way to
203
-		 * adjust core updates.
204
-		 *
205
-		 * @since 3.7.0
206
-		 * @since 5.5.0 The `$update` parameter accepts the value of null.
207
-		 *
208
-		 * @param bool|null $update Whether to update. The value of null is internally used
209
-		 *                          to detect whether nothing has hooked into this filter.
210
-		 * @param object    $item   The update offer.
211
-		 */
212
-		$update = apply_filters( "auto_update_{$type}", $update, $item );
213
-
214
-		if ( ! $update ) {
215
-			if ( 'core' === $type ) {
216
-				$this->send_core_update_notification_email( $item );
217
-			}
218
-			return false;
219
-		}
220
-
221
-		// If it's a core update, are we actually compatible with its requirements?
222
-		if ( 'core' === $type ) {
223
-			global $wpdb;
224
-
225
-			$php_compat = version_compare( phpversion(), $item->php_version, '>=' );
226
-			if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
227
-				$mysql_compat = true;
228
-			} else {
229
-				$mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
230
-			}
231
-
232
-			if ( ! $php_compat || ! $mysql_compat ) {
233
-				return false;
234
-			}
235
-		}
236
-
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, '<' ) ) {
240
-				return false;
241
-			}
242
-		}
243
-
244
-		return true;
245
-	}
246
-
247
-	/**
248
-	 * Notifies an administrator of a core update.
249
-	 *
250
-	 * @since 3.7.0
251
-	 *
252
-	 * @param object $item The update offer.
253
-	 * @return bool True if the site administrator is notified of a core update,
254
-	 *              false otherwise.
255
-	 */
256
-	protected function send_core_update_notification_email( $item ) {
257
-		$notified = get_site_option( 'auto_core_update_notified' );
258
-
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']
262
-			&& $notified['version'] === $item->current
263
-		) {
264
-			return false;
265
-		}
266
-
267
-		// See if we need to notify users of a core update.
268
-		$notify = ! empty( $item->notify_email );
269
-
270
-		/**
271
-		 * Filters whether to notify the site administrator of a new core update.
272
-		 *
273
-		 * By default, administrators are notified when the update offer received
274
-		 * from WordPress.org sets a particular flag. This allows some discretion
275
-		 * in if and when to notify.
276
-		 *
277
-		 * This filter is only evaluated once per release. If the same email address
278
-		 * was already notified of the same new version, WordPress won't repeatedly
279
-		 * email the administrator.
280
-		 *
281
-		 * This filter is also used on about.php to check if a plugin has disabled
282
-		 * these notifications.
283
-		 *
284
-		 * @since 3.7.0
285
-		 *
286
-		 * @param bool   $notify Whether the site administrator is notified.
287
-		 * @param object $item   The update offer.
288
-		 */
289
-		if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) {
290
-			return false;
291
-		}
292
-
293
-		$this->send_email( 'manual', $item );
294
-		return true;
295
-	}
296
-
297
-	/**
298
-	 * Updates an item, if appropriate.
299
-	 *
300
-	 * @since 3.7.0
301
-	 *
302
-	 * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'.
303
-	 * @param object $item The update offer.
304
-	 * @return null|WP_Error
305
-	 */
306
-	public function update( $type, $item ) {
307
-		$skin = new Automatic_Upgrader_Skin;
308
-
309
-		switch ( $type ) {
310
-			case 'core':
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 );
314
-				$context  = ABSPATH;
315
-				break;
316
-			case 'plugin':
317
-				$upgrader = new Plugin_Upgrader( $skin );
318
-				$context  = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR.
319
-				break;
320
-			case 'theme':
321
-				$upgrader = new Theme_Upgrader( $skin );
322
-				$context  = get_theme_root( $item->theme );
323
-				break;
324
-			case 'translation':
325
-				$upgrader = new Language_Pack_Upgrader( $skin );
326
-				$context  = WP_CONTENT_DIR; // WP_LANG_DIR;
327
-				break;
328
-		}
329
-
330
-		// Determine whether we can and should perform this update.
331
-		if ( ! $this->should_update( $type, $item, $context ) ) {
332
-			return false;
333
-		}
334
-
335
-		/**
336
-		 * Fires immediately prior to an auto-update.
337
-		 *
338
-		 * @since 4.4.0
339
-		 *
340
-		 * @param string $type    The type of update being checked: 'core', 'theme', 'plugin', or 'translation'.
341
-		 * @param object $item    The update offer.
342
-		 * @param string $context The filesystem context (a path) against which filesystem access and status
343
-		 *                        should be checked.
344
-		 */
345
-		do_action( 'pre_auto_update', $type, $item, $context );
346
-
347
-		$upgrader_item = $item;
348
-		switch ( $type ) {
349
-			case 'core':
350
-				/* translators: %s: WordPress version. */
351
-				$skin->feedback( __( 'Updating to WordPress %s' ), $item->version );
352
-				/* translators: %s: WordPress version. */
353
-				$item_name = sprintf( __( 'WordPress %s' ), $item->version );
354
-				break;
355
-			case 'theme':
356
-				$upgrader_item = $item->theme;
357
-				$theme         = wp_get_theme( $upgrader_item );
358
-				$item_name     = $theme->Get( 'Name' );
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 ) ) {
362
-					$item->current_version = false;
363
-				}
364
-				/* translators: %s: Theme name. */
365
-				$skin->feedback( __( 'Updating theme: %s' ), $item_name );
366
-				break;
367
-			case 'plugin':
368
-				$upgrader_item = $item->plugin;
369
-				$plugin_data   = get_plugin_data( $context . '/' . $upgrader_item );
370
-				$item_name     = $plugin_data['Name'];
371
-				// Add the current version so that it can be reported in the notification email.
372
-				$item->current_version = $plugin_data['Version'];
373
-				if ( empty( $item->current_version ) ) {
374
-					$item->current_version = false;
375
-				}
376
-				/* translators: %s: Plugin name. */
377
-				$skin->feedback( __( 'Updating plugin: %s' ), $item_name );
378
-				break;
379
-			case 'translation':
380
-				$language_item_name = $upgrader->get_name_for_update( $item );
381
-				/* translators: %s: Project name (plugin, theme, or WordPress). */
382
-				$item_name = sprintf( __( 'Translations for %s' ), $language_item_name );
383
-				/* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */
384
-				$skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)&#8230;' ), $language_item_name, $item->language ) );
385
-				break;
386
-		}
387
-
388
-		$allow_relaxed_file_ownership = false;
389
-		if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) {
390
-			$allow_relaxed_file_ownership = true;
391
-		}
392
-
393
-		// Boom, this site's about to get a whole new splash of paint!
394
-		$upgrade_result = $upgrader->upgrade(
395
-			$upgrader_item,
396
-			array(
397
-				'clear_update_cache'           => false,
398
-				// Always use partial builds if possible for core updates.
399
-				'pre_check_md5'                => false,
400
-				// Only available for core updates.
401
-				'attempt_rollback'             => true,
402
-				// Allow relaxed file ownership in some scenarios.
403
-				'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
404
-			)
405
-		);
406
-
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.' ) );
410
-		}
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() )
416
-			) {
417
-				// These aren't actual errors, treat it as a skipped-update instead
418
-				// to avoid triggering the post-core update failure routines.
419
-				return false;
420
-			}
421
-
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 );
426
-			} else {
427
-				$skin->feedback( __( 'WordPress updated successfully.' ) );
428
-			}
429
-		}
430
-
431
-		$this->update_results[ $type ][] = (object) array(
432
-			'item'     => $item,
433
-			'result'   => $upgrade_result,
434
-			'name'     => $item_name,
435
-			'messages' => $skin->get_upgrade_messages(),
436
-		);
437
-
438
-		return $upgrade_result;
439
-	}
440
-
441
-	/**
442
-	 * Kicks off the background update process, looping through all pending updates.
443
-	 *
444
-	 * @since 3.7.0
445
-	 */
446
-	public function run() {
447
-		if ( $this->is_disabled() ) {
448
-			return;
449
-		}
450
-
451
-		if ( ! is_main_network() || ! is_main_site() ) {
452
-			return;
453
-		}
454
-
455
-		if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) {
456
-			return;
457
-		}
458
-
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' );
464
-
465
-		// Next, plugins.
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 );
471
-			}
472
-			// Force refresh of plugin update information.
473
-			wp_clean_plugins_cache();
474
-		}
475
-
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 );
482
-			}
483
-			// Force refresh of theme update information.
484
-			wp_clean_themes_cache();
485
-		}
486
-
487
-		// Next, process any core update.
488
-		wp_version_check(); // Check for core updates.
489
-		$core_update = find_core_auto_update();
490
-
491
-		if ( $core_update ) {
492
-			$this->update( 'core', $core_update );
493
-		}
494
-
495
-		// Clean up, and check for any pending translations.
496
-		// (Core_Upgrader checks for core updates.)
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 );
501
-			}
502
-		}
503
-		wp_update_themes( $theme_stats ); // Check for theme updates.
504
-
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 );
509
-			}
510
-		}
511
-		wp_update_plugins( $plugin_stats ); // Check for plugin updates.
512
-
513
-		// Finally, process any new translations.
514
-		$language_updates = wp_get_translation_updates();
515
-		if ( $language_updates ) {
516
-			foreach ( $language_updates as $update ) {
517
-				$this->update( 'translation', $update );
518
-			}
519
-
520
-			// Clear existing caches.
521
-			wp_clean_update_cache();
522
-
523
-			wp_version_check();  // Check for core updates.
524
-			wp_update_themes();  // Check for theme updates.
525
-			wp_update_plugins(); // Check for plugin updates.
526
-		}
527
-
528
-		// Send debugging email to admin for all development installations.
529
-		if ( ! empty( $this->update_results ) ) {
530
-			$development_version = false !== strpos( get_bloginfo( 'version' ), '-' );
531
-
532
-			/**
533
-			 * Filters whether to send a debugging email for each automatic background update.
534
-			 *
535
-			 * @since 3.7.0
536
-			 *
537
-			 * @param bool $development_version By default, emails are sent if the
538
-			 *                                  install is a development version.
539
-			 *                                  Return false to avoid the email.
540
-			 */
541
-			if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) ) {
542
-				$this->send_debug_email();
543
-			}
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 );
549
-			}
550
-
551
-			/**
552
-			 * Fires after all automatic updates have run.
553
-			 *
554
-			 * @since 3.8.0
555
-			 *
556
-			 * @param array $update_results The results of all attempted updates.
557
-			 */
558
-			do_action( 'automatic_updates_complete', $this->update_results );
559
-		}
560
-
561
-		WP_Upgrader::release_lock( 'auto_updater' );
562
-	}
563
-
564
-	/**
565
-	 * If we tried to perform a core update, check if we should send an email,
566
-	 * and if we need to avoid processing future updates.
567
-	 *
568
-	 * @since 3.7.0
569
-	 *
570
-	 * @param object $update_result The result of the core update. Includes the update offer and result.
571
-	 */
572
-	protected function after_core_update( $update_result ) {
573
-		$wp_version = get_bloginfo( 'version' );
574
-
575
-		$core_update = $update_result->item;
576
-		$result      = $update_result->result;
577
-
578
-		if ( ! is_wp_error( $result ) ) {
579
-			$this->send_email( 'success', $core_update );
580
-			return;
581
-		}
582
-
583
-		$error_code = $result->get_error_code();
584
-
585
-		// Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files.
586
-		// We should not try to perform a background update again until there is a successful one-click update performed by the user.
587
-		$critical = false;
588
-		if ( 'disk_full' === $error_code || false !== strpos( $error_code, '__copy_dir' ) ) {
589
-			$critical = true;
590
-		} elseif ( 'rollback_was_required' === $error_code && is_wp_error( $result->get_error_data()->rollback ) ) {
591
-			// A rollback is only critical if it failed too.
592
-			$critical        = true;
593
-			$rollback_result = $result->get_error_data()->rollback;
594
-		} elseif ( false !== strpos( $error_code, 'do_rollback' ) ) {
595
-			$critical = true;
596
-		}
597
-
598
-		if ( $critical ) {
599
-			$critical_data = array(
600
-				'attempted'  => $core_update->current,
601
-				'current'    => $wp_version,
602
-				'error_code' => $error_code,
603
-				'error_data' => $result->get_error_data(),
604
-				'timestamp'  => time(),
605
-				'critical'   => true,
606
-			);
607
-			if ( isset( $rollback_result ) ) {
608
-				$critical_data['rollback_code'] = $rollback_result->get_error_code();
609
-				$critical_data['rollback_data'] = $rollback_result->get_error_data();
610
-			}
611
-			update_site_option( 'auto_core_update_failed', $critical_data );
612
-			$this->send_email( 'critical', $core_update, $result );
613
-			return;
614
-		}
615
-
616
-		/*
18
+    /**
19
+     * Tracks update results during processing.
20
+     *
21
+     * @var array
22
+     */
23
+    protected $update_results = array();
24
+
25
+    /**
26
+     * Determines whether the entire automatic updater is disabled.
27
+     *
28
+     * @since 3.7.0
29
+     */
30
+    public function is_disabled() {
31
+        // Background updates are disabled if you don't want file changes.
32
+        if ( ! wp_is_file_mod_allowed( 'automatic_updater' ) ) {
33
+            return true;
34
+        }
35
+
36
+        if ( wp_installing() ) {
37
+            return true;
38
+        }
39
+
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;
42
+
43
+        /**
44
+         * Filters whether to entirely disable background updates.
45
+         *
46
+         * There are more fine-grained filters and controls for selective disabling.
47
+         * This filter parallels the AUTOMATIC_UPDATER_DISABLED constant in name.
48
+         *
49
+         * This also disables update notification emails. That may change in the future.
50
+         *
51
+         * @since 3.7.0
52
+         *
53
+         * @param bool $disabled Whether the updater should be disabled.
54
+         */
55
+        return apply_filters( 'automatic_updater_disabled', $disabled );
56
+    }
57
+
58
+    /**
59
+     * Checks for version control checkouts.
60
+     *
61
+     * Checks for Subversion, Git, Mercurial, and Bazaar. It recursively looks up the
62
+     * filesystem to the top of the drive, erring on the side of detecting a VCS
63
+     * checkout somewhere.
64
+     *
65
+     * ABSPATH is always checked in addition to whatever `$context` is (which may be the
66
+     * wp-content directory, for example). The underlying assumption is that if you are
67
+     * using version control *anywhere*, then you should be making decisions for
68
+     * how things get updated.
69
+     *
70
+     * @since 3.7.0
71
+     *
72
+     * @param string $context The filesystem path to check, in addition to ABSPATH.
73
+     * @return bool True if a VCS checkout was discovered at `$context` or ABSPATH,
74
+     *              or anywhere higher. False otherwise.
75
+     */
76
+    public function is_vcs_checkout( $context ) {
77
+        $context_dirs = array( untrailingslashit( $context ) );
78
+        if ( ABSPATH !== $context ) {
79
+            $context_dirs[] = untrailingslashit( ABSPATH );
80
+        }
81
+
82
+        $vcs_dirs   = array( '.svn', '.git', '.hg', '.bzr' );
83
+        $check_dirs = array();
84
+
85
+        foreach ( $context_dirs as $context_dir ) {
86
+            // Walk up from $context_dir to the root.
87
+            do {
88
+                $check_dirs[] = $context_dir;
89
+
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 ) {
92
+                    break;
93
+                }
94
+
95
+                // Continue one level at a time.
96
+            } while ( $context_dir = dirname( $context_dir ) );
97
+        }
98
+
99
+        $check_dirs = array_unique( $check_dirs );
100
+
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 ) {
106
+                    break 2;
107
+                }
108
+            }
109
+        }
110
+
111
+        /**
112
+         * Filters whether the automatic updater should consider a filesystem
113
+         * location to be potentially managed by a version control system.
114
+         *
115
+         * @since 3.7.0
116
+         *
117
+         * @param bool $checkout  Whether a VCS checkout was discovered at `$context`
118
+         *                        or ABSPATH, or anywhere higher.
119
+         * @param string $context The filesystem context (a path) against which
120
+         *                        filesystem status should be checked.
121
+         */
122
+        return apply_filters( 'automatic_updates_is_vcs_checkout', $checkout, $context );
123
+    }
124
+
125
+    /**
126
+     * Tests to see if we can and should update a specific item.
127
+     *
128
+     * @since 3.7.0
129
+     *
130
+     * @global wpdb $wpdb WordPress database abstraction object.
131
+     *
132
+     * @param string $type    The type of update being checked: 'core', 'theme',
133
+     *                        'plugin', 'translation'.
134
+     * @param object $item    The update offer.
135
+     * @param string $context The filesystem context (a path) against which filesystem
136
+     *                        access and status should be checked.
137
+     * @return bool True if the item should be updated, false otherwise.
138
+     */
139
+    public function should_update( $type, $item, $context ) {
140
+        // Used to see if WP_Filesystem is set up to allow unattended updates.
141
+        $skin = new Automatic_Upgrader_Skin;
142
+
143
+        if ( $this->is_disabled() ) {
144
+            return false;
145
+        }
146
+
147
+        // Only relax the filesystem checks when the update doesn't include new files.
148
+        $allow_relaxed_file_ownership = false;
149
+        if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) {
150
+            $allow_relaxed_file_ownership = true;
151
+        }
152
+
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 )
156
+        ) {
157
+            if ( 'core' === $type ) {
158
+                $this->send_core_update_notification_email( $item );
159
+            }
160
+            return false;
161
+        }
162
+
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 );
168
+
169
+            if ( ! $update && wp_is_auto_update_enabled_for_type( $type ) ) {
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 );
173
+            }
174
+        } else {
175
+            $update = ! empty( $item->autoupdate );
176
+        }
177
+
178
+        // If the `disable_autoupdate` flag is set, override any user-choice, but allow filters.
179
+        if ( ! empty( $item->disable_autoupdate ) ) {
180
+            $update = $item->disable_autoupdate;
181
+        }
182
+
183
+        /**
184
+         * Filters whether to automatically update core, a plugin, a theme, or a language.
185
+         *
186
+         * The dynamic portion of the hook name, `$type`, refers to the type of update
187
+         * being checked.
188
+         *
189
+         * Possible hook names include:
190
+         *
191
+         *  - `auto_update_core`
192
+         *  - `auto_update_plugin`
193
+         *  - `auto_update_theme`
194
+         *  - `auto_update_translation`
195
+         *
196
+         * Since WordPress 3.7, minor and development versions of core, and translations have
197
+         * been auto-updated by default. New installs on WordPress 5.6 or higher will also
198
+         * auto-update major versions by default. Starting in 5.6, older sites can opt-in to
199
+         * major version auto-updates, and auto-updates for plugins and themes.
200
+         *
201
+         * See the {@see 'allow_dev_auto_core_updates'}, {@see 'allow_minor_auto_core_updates'},
202
+         * and {@see 'allow_major_auto_core_updates'} filters for a more straightforward way to
203
+         * adjust core updates.
204
+         *
205
+         * @since 3.7.0
206
+         * @since 5.5.0 The `$update` parameter accepts the value of null.
207
+         *
208
+         * @param bool|null $update Whether to update. The value of null is internally used
209
+         *                          to detect whether nothing has hooked into this filter.
210
+         * @param object    $item   The update offer.
211
+         */
212
+        $update = apply_filters( "auto_update_{$type}", $update, $item );
213
+
214
+        if ( ! $update ) {
215
+            if ( 'core' === $type ) {
216
+                $this->send_core_update_notification_email( $item );
217
+            }
218
+            return false;
219
+        }
220
+
221
+        // If it's a core update, are we actually compatible with its requirements?
222
+        if ( 'core' === $type ) {
223
+            global $wpdb;
224
+
225
+            $php_compat = version_compare( phpversion(), $item->php_version, '>=' );
226
+            if ( file_exists( WP_CONTENT_DIR . '/db.php' ) && empty( $wpdb->is_mysql ) ) {
227
+                $mysql_compat = true;
228
+            } else {
229
+                $mysql_compat = version_compare( $wpdb->db_version(), $item->mysql_version, '>=' );
230
+            }
231
+
232
+            if ( ! $php_compat || ! $mysql_compat ) {
233
+                return false;
234
+            }
235
+        }
236
+
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, '<' ) ) {
240
+                return false;
241
+            }
242
+        }
243
+
244
+        return true;
245
+    }
246
+
247
+    /**
248
+     * Notifies an administrator of a core update.
249
+     *
250
+     * @since 3.7.0
251
+     *
252
+     * @param object $item The update offer.
253
+     * @return bool True if the site administrator is notified of a core update,
254
+     *              false otherwise.
255
+     */
256
+    protected function send_core_update_notification_email( $item ) {
257
+        $notified = get_site_option( 'auto_core_update_notified' );
258
+
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']
262
+            && $notified['version'] === $item->current
263
+        ) {
264
+            return false;
265
+        }
266
+
267
+        // See if we need to notify users of a core update.
268
+        $notify = ! empty( $item->notify_email );
269
+
270
+        /**
271
+         * Filters whether to notify the site administrator of a new core update.
272
+         *
273
+         * By default, administrators are notified when the update offer received
274
+         * from WordPress.org sets a particular flag. This allows some discretion
275
+         * in if and when to notify.
276
+         *
277
+         * This filter is only evaluated once per release. If the same email address
278
+         * was already notified of the same new version, WordPress won't repeatedly
279
+         * email the administrator.
280
+         *
281
+         * This filter is also used on about.php to check if a plugin has disabled
282
+         * these notifications.
283
+         *
284
+         * @since 3.7.0
285
+         *
286
+         * @param bool   $notify Whether the site administrator is notified.
287
+         * @param object $item   The update offer.
288
+         */
289
+        if ( ! apply_filters( 'send_core_update_notification_email', $notify, $item ) ) {
290
+            return false;
291
+        }
292
+
293
+        $this->send_email( 'manual', $item );
294
+        return true;
295
+    }
296
+
297
+    /**
298
+     * Updates an item, if appropriate.
299
+     *
300
+     * @since 3.7.0
301
+     *
302
+     * @param string $type The type of update being checked: 'core', 'theme', 'plugin', 'translation'.
303
+     * @param object $item The update offer.
304
+     * @return null|WP_Error
305
+     */
306
+    public function update( $type, $item ) {
307
+        $skin = new Automatic_Upgrader_Skin;
308
+
309
+        switch ( $type ) {
310
+            case 'core':
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 );
314
+                $context  = ABSPATH;
315
+                break;
316
+            case 'plugin':
317
+                $upgrader = new Plugin_Upgrader( $skin );
318
+                $context  = WP_PLUGIN_DIR; // We don't support custom Plugin directories, or updates for WPMU_PLUGIN_DIR.
319
+                break;
320
+            case 'theme':
321
+                $upgrader = new Theme_Upgrader( $skin );
322
+                $context  = get_theme_root( $item->theme );
323
+                break;
324
+            case 'translation':
325
+                $upgrader = new Language_Pack_Upgrader( $skin );
326
+                $context  = WP_CONTENT_DIR; // WP_LANG_DIR;
327
+                break;
328
+        }
329
+
330
+        // Determine whether we can and should perform this update.
331
+        if ( ! $this->should_update( $type, $item, $context ) ) {
332
+            return false;
333
+        }
334
+
335
+        /**
336
+         * Fires immediately prior to an auto-update.
337
+         *
338
+         * @since 4.4.0
339
+         *
340
+         * @param string $type    The type of update being checked: 'core', 'theme', 'plugin', or 'translation'.
341
+         * @param object $item    The update offer.
342
+         * @param string $context The filesystem context (a path) against which filesystem access and status
343
+         *                        should be checked.
344
+         */
345
+        do_action( 'pre_auto_update', $type, $item, $context );
346
+
347
+        $upgrader_item = $item;
348
+        switch ( $type ) {
349
+            case 'core':
350
+                /* translators: %s: WordPress version. */
351
+                $skin->feedback( __( 'Updating to WordPress %s' ), $item->version );
352
+                /* translators: %s: WordPress version. */
353
+                $item_name = sprintf( __( 'WordPress %s' ), $item->version );
354
+                break;
355
+            case 'theme':
356
+                $upgrader_item = $item->theme;
357
+                $theme         = wp_get_theme( $upgrader_item );
358
+                $item_name     = $theme->Get( 'Name' );
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 ) ) {
362
+                    $item->current_version = false;
363
+                }
364
+                /* translators: %s: Theme name. */
365
+                $skin->feedback( __( 'Updating theme: %s' ), $item_name );
366
+                break;
367
+            case 'plugin':
368
+                $upgrader_item = $item->plugin;
369
+                $plugin_data   = get_plugin_data( $context . '/' . $upgrader_item );
370
+                $item_name     = $plugin_data['Name'];
371
+                // Add the current version so that it can be reported in the notification email.
372
+                $item->current_version = $plugin_data['Version'];
373
+                if ( empty( $item->current_version ) ) {
374
+                    $item->current_version = false;
375
+                }
376
+                /* translators: %s: Plugin name. */
377
+                $skin->feedback( __( 'Updating plugin: %s' ), $item_name );
378
+                break;
379
+            case 'translation':
380
+                $language_item_name = $upgrader->get_name_for_update( $item );
381
+                /* translators: %s: Project name (plugin, theme, or WordPress). */
382
+                $item_name = sprintf( __( 'Translations for %s' ), $language_item_name );
383
+                /* translators: 1: Project name (plugin, theme, or WordPress), 2: Language. */
384
+                $skin->feedback( sprintf( __( 'Updating translations for %1$s (%2$s)&#8230;' ), $language_item_name, $item->language ) );
385
+                break;
386
+        }
387
+
388
+        $allow_relaxed_file_ownership = false;
389
+        if ( 'core' === $type && isset( $item->new_files ) && ! $item->new_files ) {
390
+            $allow_relaxed_file_ownership = true;
391
+        }
392
+
393
+        // Boom, this site's about to get a whole new splash of paint!
394
+        $upgrade_result = $upgrader->upgrade(
395
+            $upgrader_item,
396
+            array(
397
+                'clear_update_cache'           => false,
398
+                // Always use partial builds if possible for core updates.
399
+                'pre_check_md5'                => false,
400
+                // Only available for core updates.
401
+                'attempt_rollback'             => true,
402
+                // Allow relaxed file ownership in some scenarios.
403
+                'allow_relaxed_file_ownership' => $allow_relaxed_file_ownership,
404
+            )
405
+        );
406
+
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.' ) );
410
+        }
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() )
416
+            ) {
417
+                // These aren't actual errors, treat it as a skipped-update instead
418
+                // to avoid triggering the post-core update failure routines.
419
+                return false;
420
+            }
421
+
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 );
426
+            } else {
427
+                $skin->feedback( __( 'WordPress updated successfully.' ) );
428
+            }
429
+        }
430
+
431
+        $this->update_results[ $type ][] = (object) array(
432
+            'item'     => $item,
433
+            'result'   => $upgrade_result,
434
+            'name'     => $item_name,
435
+            'messages' => $skin->get_upgrade_messages(),
436
+        );
437
+
438
+        return $upgrade_result;
439
+    }
440
+
441
+    /**
442
+     * Kicks off the background update process, looping through all pending updates.
443
+     *
444
+     * @since 3.7.0
445
+     */
446
+    public function run() {
447
+        if ( $this->is_disabled() ) {
448
+            return;
449
+        }
450
+
451
+        if ( ! is_main_network() || ! is_main_site() ) {
452
+            return;
453
+        }
454
+
455
+        if ( ! WP_Upgrader::create_lock( 'auto_updater' ) ) {
456
+            return;
457
+        }
458
+
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' );
464
+
465
+        // Next, plugins.
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 );
471
+            }
472
+            // Force refresh of plugin update information.
473
+            wp_clean_plugins_cache();
474
+        }
475
+
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 );
482
+            }
483
+            // Force refresh of theme update information.
484
+            wp_clean_themes_cache();
485
+        }
486
+
487
+        // Next, process any core update.
488
+        wp_version_check(); // Check for core updates.
489
+        $core_update = find_core_auto_update();
490
+
491
+        if ( $core_update ) {
492
+            $this->update( 'core', $core_update );
493
+        }
494
+
495
+        // Clean up, and check for any pending translations.
496
+        // (Core_Upgrader checks for core updates.)
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 );
501
+            }
502
+        }
503
+        wp_update_themes( $theme_stats ); // Check for theme updates.
504
+
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 );
509
+            }
510
+        }
511
+        wp_update_plugins( $plugin_stats ); // Check for plugin updates.
512
+
513
+        // Finally, process any new translations.
514
+        $language_updates = wp_get_translation_updates();
515
+        if ( $language_updates ) {
516
+            foreach ( $language_updates as $update ) {
517
+                $this->update( 'translation', $update );
518
+            }
519
+
520
+            // Clear existing caches.
521
+            wp_clean_update_cache();
522
+
523
+            wp_version_check();  // Check for core updates.
524
+            wp_update_themes();  // Check for theme updates.
525
+            wp_update_plugins(); // Check for plugin updates.
526
+        }
527
+
528
+        // Send debugging email to admin for all development installations.
529
+        if ( ! empty( $this->update_results ) ) {
530
+            $development_version = false !== strpos( get_bloginfo( 'version' ), '-' );
531
+
532
+            /**
533
+             * Filters whether to send a debugging email for each automatic background update.
534
+             *
535
+             * @since 3.7.0
536
+             *
537
+             * @param bool $development_version By default, emails are sent if the
538
+             *                                  install is a development version.
539
+             *                                  Return false to avoid the email.
540
+             */
541
+            if ( apply_filters( 'automatic_updates_send_debug_email', $development_version ) ) {
542
+                $this->send_debug_email();
543
+            }
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 );
549
+            }
550
+
551
+            /**
552
+             * Fires after all automatic updates have run.
553
+             *
554
+             * @since 3.8.0
555
+             *
556
+             * @param array $update_results The results of all attempted updates.
557
+             */
558
+            do_action( 'automatic_updates_complete', $this->update_results );
559
+        }
560
+
561
+        WP_Upgrader::release_lock( 'auto_updater' );
562
+    }
563
+
564
+    /**
565
+     * If we tried to perform a core update, check if we should send an email,
566
+     * and if we need to avoid processing future updates.
567
+     *
568
+     * @since 3.7.0
569
+     *
570
+     * @param object $update_result The result of the core update. Includes the update offer and result.
571
+     */
572
+    protected function after_core_update( $update_result ) {
573
+        $wp_version = get_bloginfo( 'version' );
574
+
575
+        $core_update = $update_result->item;
576
+        $result      = $update_result->result;
577
+
578
+        if ( ! is_wp_error( $result ) ) {
579
+            $this->send_email( 'success', $core_update );
580
+            return;
581
+        }
582
+
583
+        $error_code = $result->get_error_code();
584
+
585
+        // Any of these WP_Error codes are critical failures, as in they occurred after we started to copy core files.
586
+        // We should not try to perform a background update again until there is a successful one-click update performed by the user.
587
+        $critical = false;
588
+        if ( 'disk_full' === $error_code || false !== strpos( $error_code, '__copy_dir' ) ) {
589
+            $critical = true;
590
+        } elseif ( 'rollback_was_required' === $error_code && is_wp_error( $result->get_error_data()->rollback ) ) {
591
+            // A rollback is only critical if it failed too.
592
+            $critical        = true;
593
+            $rollback_result = $result->get_error_data()->rollback;
594
+        } elseif ( false !== strpos( $error_code, 'do_rollback' ) ) {
595
+            $critical = true;
596
+        }
597
+
598
+        if ( $critical ) {
599
+            $critical_data = array(
600
+                'attempted'  => $core_update->current,
601
+                'current'    => $wp_version,
602
+                'error_code' => $error_code,
603
+                'error_data' => $result->get_error_data(),
604
+                'timestamp'  => time(),
605
+                'critical'   => true,
606
+            );
607
+            if ( isset( $rollback_result ) ) {
608
+                $critical_data['rollback_code'] = $rollback_result->get_error_code();
609
+                $critical_data['rollback_data'] = $rollback_result->get_error_data();
610
+            }
611
+            update_site_option( 'auto_core_update_failed', $critical_data );
612
+            $this->send_email( 'critical', $core_update, $result );
613
+            return;
614
+        }
615
+
616
+        /*
617 617
 		 * Any other WP_Error code (like download_failed or files_not_writable) occurs before
618 618
 		 * we tried to copy over core files. Thus, the failures are early and graceful.
619 619
 		 *
@@ -624,745 +624,745 @@  discard block
 block discarded – undo
624 624
 		 * In fact, let's schedule a special update for an hour from now. (It's possible
625 625
 		 * the issue could actually be on WordPress.org's side.) If that one fails, then email.
626 626
 		 */
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' );
631
-			$send = false;
632
-		}
633
-
634
-		$notified = get_site_option( 'auto_core_update_notified' );
635
-
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
638
-			&& 'fail' === $notified['type']
639
-			&& get_site_option( 'admin_email' ) === $notified['email']
640
-			&& $notified['version'] === $core_update->current
641
-		) {
642
-			$send = false;
643
-		}
644
-
645
-		update_site_option(
646
-			'auto_core_update_failed',
647
-			array(
648
-				'attempted'  => $core_update->current,
649
-				'current'    => $wp_version,
650
-				'error_code' => $error_code,
651
-				'error_data' => $result->get_error_data(),
652
-				'timestamp'  => time(),
653
-				'retry'      => in_array( $error_code, $transient_failures, true ),
654
-			)
655
-		);
656
-
657
-		if ( $send ) {
658
-			$this->send_email( 'fail', $core_update, $result );
659
-		}
660
-	}
661
-
662
-	/**
663
-	 * Sends an email upon the completion or failure of a background core update.
664
-	 *
665
-	 * @since 3.7.0
666
-	 *
667
-	 * @param string $type        The type of email to send. Can be one of 'success', 'fail', 'manual', 'critical'.
668
-	 * @param object $core_update The update offer that was attempted.
669
-	 * @param mixed  $result      Optional. The result for the core update. Can be WP_Error.
670
-	 */
671
-	protected function send_email( $type, $core_update, $result = null ) {
672
-		update_site_option(
673
-			'auto_core_update_notified',
674
-			array(
675
-				'type'      => $type,
676
-				'email'     => get_site_option( 'admin_email' ),
677
-				'version'   => $core_update->current,
678
-				'timestamp' => time(),
679
-			)
680
-		);
681
-
682
-		$next_user_core_update = get_preferred_from_update_core();
683
-
684
-		// If the update transient is empty, use the update we just performed.
685
-		if ( ! $next_user_core_update ) {
686
-			$next_user_core_update = $core_update;
687
-		}
688
-
689
-		if ( 'upgrade' === $next_user_core_update->response
690
-			&& version_compare( $next_user_core_update->version, $core_update->version, '>' )
691
-		) {
692
-			$newer_version_available = true;
693
-		} else {
694
-			$newer_version_available = false;
695
-		}
696
-
697
-		/**
698
-		 * Filters whether to send an email following an automatic background core update.
699
-		 *
700
-		 * @since 3.7.0
701
-		 *
702
-		 * @param bool   $send        Whether to send the email. Default true.
703
-		 * @param string $type        The type of email to send. Can be one of
704
-		 *                            'success', 'fail', 'critical'.
705
-		 * @param object $core_update The update offer that was attempted.
706
-		 * @param mixed  $result      The result for the core update. Can be WP_Error.
707
-		 */
708
-		if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) {
709
-			return;
710
-		}
711
-
712
-		switch ( $type ) {
713
-			case 'success': // We updated.
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' );
716
-				break;
717
-
718
-			case 'fail':   // We tried to update but couldn't.
719
-			case 'manual': // We can't update (and made no attempt).
720
-				/* translators: Update available notification email subject. 1: Site title, 2: WordPress version. */
721
-				$subject = __( '[%1$s] WordPress %2$s is available. Please update!' );
722
-				break;
723
-
724
-			case 'critical': // We tried to update, started to copy files, then things went wrong.
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' );
727
-				break;
728
-
729
-			default:
730
-				return;
731
-		}
732
-
733
-		// If the auto-update is not to the latest version, say that the current version of WP is available instead.
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 );
736
-
737
-		$body = '';
738
-
739
-		switch ( $type ) {
740
-			case 'success':
741
-				$body .= sprintf(
742
-					/* translators: 1: Home URL, 2: WordPress version. */
743
-					__( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ),
744
-					home_url(),
745
-					$core_update->current
746
-				);
747
-				$body .= "\n\n";
748
-				if ( ! $newer_version_available ) {
749
-					$body .= __( 'No further action is needed on your part.' ) . ' ';
750
-				}
751
-
752
-				// Can only reference the About screen if their update was successful.
753
-				list( $about_version ) = explode( '-', $core_update->current, 2 );
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' );
757
-
758
-				if ( $newer_version_available ) {
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' );
763
-				}
764
-
765
-				break;
766
-
767
-			case 'fail':
768
-			case 'manual':
769
-				$body .= sprintf(
770
-					/* translators: 1: Home URL, 2: WordPress version. */
771
-					__( 'Please update your site at %1$s to WordPress %2$s.' ),
772
-					home_url(),
773
-					$next_user_core_update->current
774
-				);
775
-
776
-				$body .= "\n\n";
777
-
778
-				// Don't show this message if there is a newer version available.
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.' ) . ' ';
782
-				}
783
-
784
-				$body .= __( 'Updating is easy and only takes a few moments:' );
785
-				$body .= "\n" . network_admin_url( 'update-core.php' );
786
-				break;
787
-
788
-			case 'critical':
789
-				if ( $newer_version_available ) {
790
-					$body .= sprintf(
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.' ),
793
-						home_url(),
794
-						$core_update->current
795
-					);
796
-				} else {
797
-					$body .= sprintf(
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.' ),
800
-						home_url(),
801
-						$core_update->current
802
-					);
803
-				}
804
-
805
-				$body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." );
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' );
809
-				break;
810
-		}
811
-
812
-		$critical_support = 'critical' === $type && ! empty( $core_update->support_email );
813
-		if ( $critical_support ) {
814
-			// Support offer if available.
815
-			$body .= "\n\n" . sprintf(
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.' ),
818
-				$core_update->support_email
819
-			);
820
-		} else {
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/' );
824
-		}
825
-
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.' );
829
-		}
830
-
831
-		if ( $critical_support ) {
832
-			$body .= ' ' . __( "If you reach out to us, we'll also ensure you'll never have this problem again." );
833
-		}
834
-
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:' );
838
-			$body .= "\n" . network_admin_url();
839
-		}
840
-
841
-		$body .= "\n\n" . __( 'The WordPress Team' ) . "\n";
842
-
843
-		if ( 'critical' === $type && is_wp_error( $result ) ) {
844
-			$body .= "\n***\n\n";
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:' );
849
-
850
-			// If we had a rollback and we're still critical, then the rollback failed too.
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 );
854
-			} else {
855
-				$errors = array( $result );
856
-			}
857
-
858
-			foreach ( $errors as $error ) {
859
-				if ( ! is_wp_error( $error ) ) {
860
-					continue;
861
-				}
862
-
863
-				$error_code = $error->get_error_code();
864
-				/* translators: %s: Error code. */
865
-				$body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code );
866
-
867
-				if ( 'rollback_was_required' === $error_code ) {
868
-					continue;
869
-				}
870
-
871
-				if ( $error->get_error_message() ) {
872
-					$body .= "\n" . $error->get_error_message();
873
-				}
874
-
875
-				$error_data = $error->get_error_data();
876
-				if ( $error_data ) {
877
-					$body .= "\n" . implode( ', ', (array) $error_data );
878
-				}
879
-			}
880
-
881
-			$body .= "\n";
882
-		}
883
-
884
-		$to      = get_site_option( 'admin_email' );
885
-		$headers = '';
886
-
887
-		$email = compact( 'to', 'subject', 'body', 'headers' );
888
-
889
-		/**
890
-		 * Filters the email sent following an automatic background core update.
891
-		 *
892
-		 * @since 3.7.0
893
-		 *
894
-		 * @param array $email {
895
-		 *     Array of email arguments that will be passed to wp_mail().
896
-		 *
897
-		 *     @type string $to      The email recipient. An array of emails
898
-		 *                            can be returned, as handled by wp_mail().
899
-		 *     @type string $subject The email's subject.
900
-		 *     @type string $body    The email message body.
901
-		 *     @type string $headers Any email headers, defaults to no headers.
902
-		 * }
903
-		 * @param string $type        The type of email being sent. Can be one of
904
-		 *                            'success', 'fail', 'manual', 'critical'.
905
-		 * @param object $core_update The update offer that was attempted.
906
-		 * @param mixed  $result      The result for the core update. Can be WP_Error.
907
-		 */
908
-		$email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result );
909
-
910
-		wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
911
-	}
912
-
913
-
914
-	/**
915
-	 * If we tried to perform plugin or theme updates, check if we should send an email.
916
-	 *
917
-	 * @since 5.5.0
918
-	 *
919
-	 * @param array $update_results The results of update tasks.
920
-	 */
921
-	protected function after_plugin_theme_update( $update_results ) {
922
-		$successful_updates = array();
923
-		$failed_updates     = array();
924
-
925
-		if ( ! empty( $update_results['plugin'] ) ) {
926
-			/**
927
-			 * Filters whether to send an email following an automatic background plugin update.
928
-			 *
929
-			 * @since 5.5.0
930
-			 * @since 5.5.1 Added the `$update_results` parameter.
931
-			 *
932
-			 * @param bool  $enabled        True if plugin update notifications are enabled, false otherwise.
933
-			 * @param array $update_results The results of plugins update tasks.
934
-			 */
935
-			$notifications_enabled = apply_filters( 'auto_plugin_update_send_email', true, $update_results['plugin'] );
936
-
937
-			if ( $notifications_enabled ) {
938
-				foreach ( $update_results['plugin'] as $update_result ) {
939
-					if ( true === $update_result->result ) {
940
-						$successful_updates['plugin'][] = $update_result;
941
-					} else {
942
-						$failed_updates['plugin'][] = $update_result;
943
-					}
944
-				}
945
-			}
946
-		}
947
-
948
-		if ( ! empty( $update_results['theme'] ) ) {
949
-			/**
950
-			 * Filters whether to send an email following an automatic background theme update.
951
-			 *
952
-			 * @since 5.5.0
953
-			 * @since 5.5.1 Added the `$update_results` parameter.
954
-			 *
955
-			 * @param bool  $enabled        True if theme update notifications are enabled, false otherwise.
956
-			 * @param array $update_results The results of theme update tasks.
957
-			 */
958
-			$notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] );
959
-
960
-			if ( $notifications_enabled ) {
961
-				foreach ( $update_results['theme'] as $update_result ) {
962
-					if ( true === $update_result->result ) {
963
-						$successful_updates['theme'][] = $update_result;
964
-					} else {
965
-						$failed_updates['theme'][] = $update_result;
966
-					}
967
-				}
968
-			}
969
-		}
970
-
971
-		if ( empty( $successful_updates ) && empty( $failed_updates ) ) {
972
-			return;
973
-		}
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 );
979
-		} else {
980
-			$this->send_plugin_theme_email( 'mixed', $successful_updates, $failed_updates );
981
-		}
982
-	}
983
-
984
-	/**
985
-	 * Sends an email upon the completion or failure of a plugin or theme background update.
986
-	 *
987
-	 * @since 5.5.0
988
-	 *
989
-	 * @param string $type               The type of email to send. Can be one of 'success', 'fail', 'mixed'.
990
-	 * @param array  $successful_updates A list of updates that succeeded.
991
-	 * @param array  $failed_updates     A list of updates that failed.
992
-	 */
993
-	protected function send_plugin_theme_email( $type, $successful_updates, $failed_updates ) {
994
-		// No updates were attempted.
995
-		if ( empty( $successful_updates ) && empty( $failed_updates ) ) {
996
-			return;
997
-		}
998
-
999
-		$unique_failures     = false;
1000
-		$past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
1001
-
1002
-		/*
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' );
631
+            $send = false;
632
+        }
633
+
634
+        $notified = get_site_option( 'auto_core_update_notified' );
635
+
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
638
+            && 'fail' === $notified['type']
639
+            && get_site_option( 'admin_email' ) === $notified['email']
640
+            && $notified['version'] === $core_update->current
641
+        ) {
642
+            $send = false;
643
+        }
644
+
645
+        update_site_option(
646
+            'auto_core_update_failed',
647
+            array(
648
+                'attempted'  => $core_update->current,
649
+                'current'    => $wp_version,
650
+                'error_code' => $error_code,
651
+                'error_data' => $result->get_error_data(),
652
+                'timestamp'  => time(),
653
+                'retry'      => in_array( $error_code, $transient_failures, true ),
654
+            )
655
+        );
656
+
657
+        if ( $send ) {
658
+            $this->send_email( 'fail', $core_update, $result );
659
+        }
660
+    }
661
+
662
+    /**
663
+     * Sends an email upon the completion or failure of a background core update.
664
+     *
665
+     * @since 3.7.0
666
+     *
667
+     * @param string $type        The type of email to send. Can be one of 'success', 'fail', 'manual', 'critical'.
668
+     * @param object $core_update The update offer that was attempted.
669
+     * @param mixed  $result      Optional. The result for the core update. Can be WP_Error.
670
+     */
671
+    protected function send_email( $type, $core_update, $result = null ) {
672
+        update_site_option(
673
+            'auto_core_update_notified',
674
+            array(
675
+                'type'      => $type,
676
+                'email'     => get_site_option( 'admin_email' ),
677
+                'version'   => $core_update->current,
678
+                'timestamp' => time(),
679
+            )
680
+        );
681
+
682
+        $next_user_core_update = get_preferred_from_update_core();
683
+
684
+        // If the update transient is empty, use the update we just performed.
685
+        if ( ! $next_user_core_update ) {
686
+            $next_user_core_update = $core_update;
687
+        }
688
+
689
+        if ( 'upgrade' === $next_user_core_update->response
690
+            && version_compare( $next_user_core_update->version, $core_update->version, '>' )
691
+        ) {
692
+            $newer_version_available = true;
693
+        } else {
694
+            $newer_version_available = false;
695
+        }
696
+
697
+        /**
698
+         * Filters whether to send an email following an automatic background core update.
699
+         *
700
+         * @since 3.7.0
701
+         *
702
+         * @param bool   $send        Whether to send the email. Default true.
703
+         * @param string $type        The type of email to send. Can be one of
704
+         *                            'success', 'fail', 'critical'.
705
+         * @param object $core_update The update offer that was attempted.
706
+         * @param mixed  $result      The result for the core update. Can be WP_Error.
707
+         */
708
+        if ( 'manual' !== $type && ! apply_filters( 'auto_core_update_send_email', true, $type, $core_update, $result ) ) {
709
+            return;
710
+        }
711
+
712
+        switch ( $type ) {
713
+            case 'success': // We updated.
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' );
716
+                break;
717
+
718
+            case 'fail':   // We tried to update but couldn't.
719
+            case 'manual': // We can't update (and made no attempt).
720
+                /* translators: Update available notification email subject. 1: Site title, 2: WordPress version. */
721
+                $subject = __( '[%1$s] WordPress %2$s is available. Please update!' );
722
+                break;
723
+
724
+            case 'critical': // We tried to update, started to copy files, then things went wrong.
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' );
727
+                break;
728
+
729
+            default:
730
+                return;
731
+        }
732
+
733
+        // If the auto-update is not to the latest version, say that the current version of WP is available instead.
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 );
736
+
737
+        $body = '';
738
+
739
+        switch ( $type ) {
740
+            case 'success':
741
+                $body .= sprintf(
742
+                    /* translators: 1: Home URL, 2: WordPress version. */
743
+                    __( 'Howdy! Your site at %1$s has been updated automatically to WordPress %2$s.' ),
744
+                    home_url(),
745
+                    $core_update->current
746
+                );
747
+                $body .= "\n\n";
748
+                if ( ! $newer_version_available ) {
749
+                    $body .= __( 'No further action is needed on your part.' ) . ' ';
750
+                }
751
+
752
+                // Can only reference the About screen if their update was successful.
753
+                list( $about_version ) = explode( '-', $core_update->current, 2 );
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' );
757
+
758
+                if ( $newer_version_available ) {
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' );
763
+                }
764
+
765
+                break;
766
+
767
+            case 'fail':
768
+            case 'manual':
769
+                $body .= sprintf(
770
+                    /* translators: 1: Home URL, 2: WordPress version. */
771
+                    __( 'Please update your site at %1$s to WordPress %2$s.' ),
772
+                    home_url(),
773
+                    $next_user_core_update->current
774
+                );
775
+
776
+                $body .= "\n\n";
777
+
778
+                // Don't show this message if there is a newer version available.
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.' ) . ' ';
782
+                }
783
+
784
+                $body .= __( 'Updating is easy and only takes a few moments:' );
785
+                $body .= "\n" . network_admin_url( 'update-core.php' );
786
+                break;
787
+
788
+            case 'critical':
789
+                if ( $newer_version_available ) {
790
+                    $body .= sprintf(
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.' ),
793
+                        home_url(),
794
+                        $core_update->current
795
+                    );
796
+                } else {
797
+                    $body .= sprintf(
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.' ),
800
+                        home_url(),
801
+                        $core_update->current
802
+                    );
803
+                }
804
+
805
+                $body .= "\n\n" . __( "This means your site may be offline or broken. Don't panic; this can be fixed." );
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' );
809
+                break;
810
+        }
811
+
812
+        $critical_support = 'critical' === $type && ! empty( $core_update->support_email );
813
+        if ( $critical_support ) {
814
+            // Support offer if available.
815
+            $body .= "\n\n" . sprintf(
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.' ),
818
+                $core_update->support_email
819
+            );
820
+        } else {
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/' );
824
+        }
825
+
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.' );
829
+        }
830
+
831
+        if ( $critical_support ) {
832
+            $body .= ' ' . __( "If you reach out to us, we'll also ensure you'll never have this problem again." );
833
+        }
834
+
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:' );
838
+            $body .= "\n" . network_admin_url();
839
+        }
840
+
841
+        $body .= "\n\n" . __( 'The WordPress Team' ) . "\n";
842
+
843
+        if ( 'critical' === $type && is_wp_error( $result ) ) {
844
+            $body .= "\n***\n\n";
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:' );
849
+
850
+            // If we had a rollback and we're still critical, then the rollback failed too.
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 );
854
+            } else {
855
+                $errors = array( $result );
856
+            }
857
+
858
+            foreach ( $errors as $error ) {
859
+                if ( ! is_wp_error( $error ) ) {
860
+                    continue;
861
+                }
862
+
863
+                $error_code = $error->get_error_code();
864
+                /* translators: %s: Error code. */
865
+                $body .= "\n\n" . sprintf( __( 'Error code: %s' ), $error_code );
866
+
867
+                if ( 'rollback_was_required' === $error_code ) {
868
+                    continue;
869
+                }
870
+
871
+                if ( $error->get_error_message() ) {
872
+                    $body .= "\n" . $error->get_error_message();
873
+                }
874
+
875
+                $error_data = $error->get_error_data();
876
+                if ( $error_data ) {
877
+                    $body .= "\n" . implode( ', ', (array) $error_data );
878
+                }
879
+            }
880
+
881
+            $body .= "\n";
882
+        }
883
+
884
+        $to      = get_site_option( 'admin_email' );
885
+        $headers = '';
886
+
887
+        $email = compact( 'to', 'subject', 'body', 'headers' );
888
+
889
+        /**
890
+         * Filters the email sent following an automatic background core update.
891
+         *
892
+         * @since 3.7.0
893
+         *
894
+         * @param array $email {
895
+         *     Array of email arguments that will be passed to wp_mail().
896
+         *
897
+         *     @type string $to      The email recipient. An array of emails
898
+         *                            can be returned, as handled by wp_mail().
899
+         *     @type string $subject The email's subject.
900
+         *     @type string $body    The email message body.
901
+         *     @type string $headers Any email headers, defaults to no headers.
902
+         * }
903
+         * @param string $type        The type of email being sent. Can be one of
904
+         *                            'success', 'fail', 'manual', 'critical'.
905
+         * @param object $core_update The update offer that was attempted.
906
+         * @param mixed  $result      The result for the core update. Can be WP_Error.
907
+         */
908
+        $email = apply_filters( 'auto_core_update_email', $email, $type, $core_update, $result );
909
+
910
+        wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
911
+    }
912
+
913
+
914
+    /**
915
+     * If we tried to perform plugin or theme updates, check if we should send an email.
916
+     *
917
+     * @since 5.5.0
918
+     *
919
+     * @param array $update_results The results of update tasks.
920
+     */
921
+    protected function after_plugin_theme_update( $update_results ) {
922
+        $successful_updates = array();
923
+        $failed_updates     = array();
924
+
925
+        if ( ! empty( $update_results['plugin'] ) ) {
926
+            /**
927
+             * Filters whether to send an email following an automatic background plugin update.
928
+             *
929
+             * @since 5.5.0
930
+             * @since 5.5.1 Added the `$update_results` parameter.
931
+             *
932
+             * @param bool  $enabled        True if plugin update notifications are enabled, false otherwise.
933
+             * @param array $update_results The results of plugins update tasks.
934
+             */
935
+            $notifications_enabled = apply_filters( 'auto_plugin_update_send_email', true, $update_results['plugin'] );
936
+
937
+            if ( $notifications_enabled ) {
938
+                foreach ( $update_results['plugin'] as $update_result ) {
939
+                    if ( true === $update_result->result ) {
940
+                        $successful_updates['plugin'][] = $update_result;
941
+                    } else {
942
+                        $failed_updates['plugin'][] = $update_result;
943
+                    }
944
+                }
945
+            }
946
+        }
947
+
948
+        if ( ! empty( $update_results['theme'] ) ) {
949
+            /**
950
+             * Filters whether to send an email following an automatic background theme update.
951
+             *
952
+             * @since 5.5.0
953
+             * @since 5.5.1 Added the `$update_results` parameter.
954
+             *
955
+             * @param bool  $enabled        True if theme update notifications are enabled, false otherwise.
956
+             * @param array $update_results The results of theme update tasks.
957
+             */
958
+            $notifications_enabled = apply_filters( 'auto_theme_update_send_email', true, $update_results['theme'] );
959
+
960
+            if ( $notifications_enabled ) {
961
+                foreach ( $update_results['theme'] as $update_result ) {
962
+                    if ( true === $update_result->result ) {
963
+                        $successful_updates['theme'][] = $update_result;
964
+                    } else {
965
+                        $failed_updates['theme'][] = $update_result;
966
+                    }
967
+                }
968
+            }
969
+        }
970
+
971
+        if ( empty( $successful_updates ) && empty( $failed_updates ) ) {
972
+            return;
973
+        }
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 );
979
+        } else {
980
+            $this->send_plugin_theme_email( 'mixed', $successful_updates, $failed_updates );
981
+        }
982
+    }
983
+
984
+    /**
985
+     * Sends an email upon the completion or failure of a plugin or theme background update.
986
+     *
987
+     * @since 5.5.0
988
+     *
989
+     * @param string $type               The type of email to send. Can be one of 'success', 'fail', 'mixed'.
990
+     * @param array  $successful_updates A list of updates that succeeded.
991
+     * @param array  $failed_updates     A list of updates that failed.
992
+     */
993
+    protected function send_plugin_theme_email( $type, $successful_updates, $failed_updates ) {
994
+        // No updates were attempted.
995
+        if ( empty( $successful_updates ) && empty( $failed_updates ) ) {
996
+            return;
997
+        }
998
+
999
+        $unique_failures     = false;
1000
+        $past_failure_emails = get_option( 'auto_plugin_theme_update_emails', array() );
1001
+
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} ] ) ) {
1011
-						$unique_failures = true;
1012
-						continue;
1013
-					}
1014
-
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, '<' ) ) {
1017
-						$unique_failures = true;
1018
-					}
1019
-				}
1020
-			}
1021
-
1022
-			if ( ! $unique_failures ) {
1023
-				return;
1024
-			}
1025
-		}
1026
-
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'] ) );
1032
-
1033
-		switch ( $type ) {
1034
-			case 'success':
1035
-				if ( $successful_plugins && $successful_themes ) {
1036
-					/* translators: %s: Site title. */
1037
-					$subject = __( '[%s] Some plugins and themes have automatically updated' );
1038
-					$body[]  = sprintf(
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.' ),
1041
-						home_url()
1042
-					);
1043
-				} elseif ( $successful_plugins ) {
1044
-					/* translators: %s: Site title. */
1045
-					$subject = __( '[%s] Some plugins were automatically updated' );
1046
-					$body[]  = sprintf(
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.' ),
1049
-						home_url()
1050
-					);
1051
-				} else {
1052
-					/* translators: %s: Site title. */
1053
-					$subject = __( '[%s] Some themes were automatically updated' );
1054
-					$body[]  = sprintf(
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.' ),
1057
-						home_url()
1058
-					);
1059
-				}
1060
-
1061
-				break;
1062
-			case 'fail':
1063
-			case 'mixed':
1064
-				if ( $failed_plugins && $failed_themes ) {
1065
-					/* translators: %s: Site title. */
1066
-					$subject = __( '[%s] Some plugins and themes have failed to update' );
1067
-					$body[]  = sprintf(
1068
-						/* translators: %s: Home URL. */
1069
-						__( 'Howdy! Plugins and themes failed to update on your site at %s.' ),
1070
-						home_url()
1071
-					);
1072
-				} elseif ( $failed_plugins ) {
1073
-					/* translators: %s: Site title. */
1074
-					$subject = __( '[%s] Some plugins have failed to update' );
1075
-					$body[]  = sprintf(
1076
-						/* translators: %s: Home URL. */
1077
-						__( 'Howdy! Plugins failed to update on your site at %s.' ),
1078
-						home_url()
1079
-					);
1080
-				} else {
1081
-					/* translators: %s: Site title. */
1082
-					$subject = __( '[%s] Some themes have failed to update' );
1083
-					$body[]  = sprintf(
1084
-						/* translators: %s: Home URL. */
1085
-						__( 'Howdy! Themes failed to update on your site at %s.' ),
1086
-						home_url()
1087
-					);
1088
-				}
1089
-
1090
-				break;
1091
-		}
1092
-
1093
-		if ( in_array( $type, array( 'fail', 'mixed' ), true ) ) {
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.' );
1096
-			$body[] = "\n";
1097
-
1098
-			// List failed plugin updates.
1099
-			if ( ! empty( $failed_updates['plugin'] ) ) {
1100
-				$body[] = __( 'These plugins failed to update:' );
1101
-
1102
-				foreach ( $failed_updates['plugin'] as $item ) {
1103
-					if ( $item->item->current_version ) {
1104
-						$body[] = sprintf(
1105
-							/* translators: 1: Plugin name, 2: Current version number, 3: New version number. */
1106
-							__( '- %1$s (from version %2$s to %3$s)' ),
1107
-							$item->name,
1108
-							$item->item->current_version,
1109
-							$item->item->new_version
1110
-						);
1111
-					} else {
1112
-						$body[] = sprintf(
1113
-							/* translators: 1: Plugin name, 2: Version number. */
1114
-							__( '- %1$s version %2$s' ),
1115
-							$item->name,
1116
-							$item->item->new_version
1117
-						);
1118
-					}
1119
-
1120
-					$past_failure_emails[ $item->item->plugin ] = $item->item->new_version;
1121
-				}
1122
-
1123
-				$body[] = "\n";
1124
-			}
1125
-
1126
-			// List failed theme updates.
1127
-			if ( ! empty( $failed_updates['theme'] ) ) {
1128
-				$body[] = __( 'These themes failed to update:' );
1129
-
1130
-				foreach ( $failed_updates['theme'] as $item ) {
1131
-					if ( $item->item->current_version ) {
1132
-						$body[] = sprintf(
1133
-							/* translators: 1: Theme name, 2: Current version number, 3: New version number. */
1134
-							__( '- %1$s (from version %2$s to %3$s)' ),
1135
-							$item->name,
1136
-							$item->item->current_version,
1137
-							$item->item->new_version
1138
-						);
1139
-					} else {
1140
-						$body[] = sprintf(
1141
-							/* translators: 1: Theme name, 2: Version number. */
1142
-							__( '- %1$s version %2$s' ),
1143
-							$item->name,
1144
-							$item->item->new_version
1145
-						);
1146
-					}
1147
-
1148
-					$past_failure_emails[ $item->item->theme ] = $item->item->new_version;
1149
-				}
1150
-
1151
-				$body[] = "\n";
1152
-			}
1153
-		}
1154
-
1155
-		// List successful updates.
1156
-		if ( in_array( $type, array( 'success', 'mixed' ), true ) ) {
1157
-			$body[] = "\n";
1158
-
1159
-			// List successful plugin updates.
1160
-			if ( ! empty( $successful_updates['plugin'] ) ) {
1161
-				$body[] = __( 'These plugins are now up to date:' );
1162
-
1163
-				foreach ( $successful_updates['plugin'] as $item ) {
1164
-					if ( $item->item->current_version ) {
1165
-						$body[] = sprintf(
1166
-							/* translators: 1: Plugin name, 2: Current version number, 3: New version number. */
1167
-							__( '- %1$s (from version %2$s to %3$s)' ),
1168
-							$item->name,
1169
-							$item->item->current_version,
1170
-							$item->item->new_version
1171
-						);
1172
-					} else {
1173
-						$body[] = sprintf(
1174
-							/* translators: 1: Plugin name, 2: Version number. */
1175
-							__( '- %1$s version %2$s' ),
1176
-							$item->name,
1177
-							$item->item->new_version
1178
-						);
1179
-					}
1180
-
1181
-					unset( $past_failure_emails[ $item->item->plugin ] );
1182
-				}
1183
-
1184
-				$body[] = "\n";
1185
-			}
1186
-
1187
-			// List successful theme updates.
1188
-			if ( ! empty( $successful_updates['theme'] ) ) {
1189
-				$body[] = __( 'These themes are now up to date:' );
1190
-
1191
-				foreach ( $successful_updates['theme'] as $item ) {
1192
-					if ( $item->item->current_version ) {
1193
-						$body[] = sprintf(
1194
-							/* translators: 1: Theme name, 2: Current version number, 3: New version number. */
1195
-							__( '- %1$s (from version %2$s to %3$s)' ),
1196
-							$item->name,
1197
-							$item->item->current_version,
1198
-							$item->item->new_version
1199
-						);
1200
-					} else {
1201
-						$body[] = sprintf(
1202
-							/* translators: 1: Theme name, 2: Version number. */
1203
-							__( '- %1$s version %2$s' ),
1204
-							$item->name,
1205
-							$item->item->new_version
1206
-						);
1207
-					}
1208
-
1209
-					unset( $past_failure_emails[ $item->item->theme ] );
1210
-				}
1211
-
1212
-				$body[] = "\n";
1213
-			}
1214
-		}
1215
-
1216
-		if ( $failed_plugins ) {
1217
-			$body[] = sprintf(
1218
-				/* translators: %s: Plugins screen URL. */
1219
-				__( 'To manage plugins on your site, visit the Plugins page: %s' ),
1220
-				admin_url( 'plugins.php' )
1221
-			);
1222
-			$body[] = "\n";
1223
-		}
1224
-
1225
-		if ( $failed_themes ) {
1226
-			$body[] = sprintf(
1227
-				/* translators: %s: Themes screen URL. */
1228
-				__( 'To manage themes on your site, visit the Themes page: %s' ),
1229
-				admin_url( 'themes.php' )
1230
-			);
1231
-			$body[] = "\n";
1232
-		}
1233
-
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' );
1238
-
1239
-		if ( '' !== get_option( 'blogname' ) ) {
1240
-			$site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
1241
-		} else {
1242
-			$site_title = parse_url( home_url(), PHP_URL_HOST );
1243
-		}
1244
-
1245
-		$body    = implode( "\n", $body );
1246
-		$to      = get_site_option( 'admin_email' );
1247
-		$subject = sprintf( $subject, $site_title );
1248
-		$headers = '';
1249
-
1250
-		$email = compact( 'to', 'subject', 'body', 'headers' );
1251
-
1252
-		/**
1253
-		 * Filters the email sent following an automatic background update for plugins and themes.
1254
-		 *
1255
-		 * @since 5.5.0
1256
-		 *
1257
-		 * @param array  $email {
1258
-		 *     Array of email arguments that will be passed to wp_mail().
1259
-		 *
1260
-		 *     @type string $to      The email recipient. An array of emails
1261
-		 *                           can be returned, as handled by wp_mail().
1262
-		 *     @type string $subject The email's subject.
1263
-		 *     @type string $body    The email message body.
1264
-		 *     @type string $headers Any email headers, defaults to no headers.
1265
-		 * }
1266
-		 * @param string $type               The type of email being sent. Can be one of 'success', 'fail', 'mixed'.
1267
-		 * @param array  $successful_updates A list of updates that succeeded.
1268
-		 * @param array  $failed_updates     A list of updates that failed.
1269
-		 */
1270
-		$email = apply_filters( 'auto_plugin_theme_update_email', $email, $type, $successful_updates, $failed_updates );
1271
-
1272
-		$result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
1273
-
1274
-		if ( $result ) {
1275
-			update_option( 'auto_plugin_theme_update_emails', $past_failure_emails );
1276
-		}
1277
-	}
1278
-
1279
-	/**
1280
-	 * Prepares and sends an email of a full log of background update results, useful for debugging and geekery.
1281
-	 *
1282
-	 * @since 3.7.0
1283
-	 */
1284
-	protected function send_debug_email() {
1285
-		$update_count = 0;
1286
-		foreach ( $this->update_results as $type => $updates ) {
1287
-			$update_count += count( $updates );
1288
-		}
1289
-
1290
-		$body     = array();
1291
-		$failures = 0;
1292
-
1293
-		/* translators: %s: Network home URL. */
1294
-		$body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );
1295
-
1296
-		// Core.
1297
-		if ( isset( $this->update_results['core'] ) ) {
1298
-			$result = $this->update_results['core'][0];
1299
-
1300
-			if ( $result->result && ! is_wp_error( $result->result ) ) {
1301
-				/* translators: %s: WordPress version. */
1302
-				$body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name );
1303
-			} else {
1304
-				/* translators: %s: WordPress version. */
1305
-				$body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name );
1306
-				$failures++;
1307
-			}
1308
-
1309
-			$body[] = '';
1310
-		}
1311
-
1312
-		// Plugins, Themes, Translations.
1313
-		foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
1314
-			if ( ! isset( $this->update_results[ $type ] ) ) {
1315
-				continue;
1316
-			}
1317
-
1318
-			$success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
1319
-
1320
-			if ( $success_items ) {
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:' ),
1325
-				);
1326
-
1327
-				$body[] = $messages[ $type ];
1328
-				foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) {
1329
-					/* translators: %s: Name of plugin / theme / translation. */
1330
-					$body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name );
1331
-				}
1332
-			}
1333
-
1334
-			if ( $success_items !== $this->update_results[ $type ] ) {
1335
-				// Failed updates.
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:' ),
1340
-				);
1341
-
1342
-				$body[] = $messages[ $type ];
1343
-
1344
-				foreach ( $this->update_results[ $type ] as $item ) {
1345
-					if ( ! $item->result || is_wp_error( $item->result ) ) {
1346
-						/* translators: %s: Name of plugin / theme / translation. */
1347
-						$body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name );
1348
-						$failures++;
1349
-					}
1350
-				}
1351
-			}
1352
-
1353
-			$body[] = '';
1354
-		}
1355
-
1356
-		if ( '' !== get_bloginfo( 'name' ) ) {
1357
-			$site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1358
-		} else {
1359
-			$site_title = parse_url( home_url(), PHP_URL_HOST );
1360
-		}
1361
-
1362
-		if ( $failures ) {
1363
-			$body[] = trim(
1364
-				__(
1365
-					"BETA TESTING?
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
+                        $unique_failures = true;
1012
+                        continue;
1013
+                    }
1014
+
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, '<' ) ) {
1017
+                        $unique_failures = true;
1018
+                    }
1019
+                }
1020
+            }
1021
+
1022
+            if ( ! $unique_failures ) {
1023
+                return;
1024
+            }
1025
+        }
1026
+
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'] ) );
1032
+
1033
+        switch ( $type ) {
1034
+            case 'success':
1035
+                if ( $successful_plugins && $successful_themes ) {
1036
+                    /* translators: %s: Site title. */
1037
+                    $subject = __( '[%s] Some plugins and themes have automatically updated' );
1038
+                    $body[]  = sprintf(
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.' ),
1041
+                        home_url()
1042
+                    );
1043
+                } elseif ( $successful_plugins ) {
1044
+                    /* translators: %s: Site title. */
1045
+                    $subject = __( '[%s] Some plugins were automatically updated' );
1046
+                    $body[]  = sprintf(
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.' ),
1049
+                        home_url()
1050
+                    );
1051
+                } else {
1052
+                    /* translators: %s: Site title. */
1053
+                    $subject = __( '[%s] Some themes were automatically updated' );
1054
+                    $body[]  = sprintf(
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.' ),
1057
+                        home_url()
1058
+                    );
1059
+                }
1060
+
1061
+                break;
1062
+            case 'fail':
1063
+            case 'mixed':
1064
+                if ( $failed_plugins && $failed_themes ) {
1065
+                    /* translators: %s: Site title. */
1066
+                    $subject = __( '[%s] Some plugins and themes have failed to update' );
1067
+                    $body[]  = sprintf(
1068
+                        /* translators: %s: Home URL. */
1069
+                        __( 'Howdy! Plugins and themes failed to update on your site at %s.' ),
1070
+                        home_url()
1071
+                    );
1072
+                } elseif ( $failed_plugins ) {
1073
+                    /* translators: %s: Site title. */
1074
+                    $subject = __( '[%s] Some plugins have failed to update' );
1075
+                    $body[]  = sprintf(
1076
+                        /* translators: %s: Home URL. */
1077
+                        __( 'Howdy! Plugins failed to update on your site at %s.' ),
1078
+                        home_url()
1079
+                    );
1080
+                } else {
1081
+                    /* translators: %s: Site title. */
1082
+                    $subject = __( '[%s] Some themes have failed to update' );
1083
+                    $body[]  = sprintf(
1084
+                        /* translators: %s: Home URL. */
1085
+                        __( 'Howdy! Themes failed to update on your site at %s.' ),
1086
+                        home_url()
1087
+                    );
1088
+                }
1089
+
1090
+                break;
1091
+        }
1092
+
1093
+        if ( in_array( $type, array( 'fail', 'mixed' ), true ) ) {
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.' );
1096
+            $body[] = "\n";
1097
+
1098
+            // List failed plugin updates.
1099
+            if ( ! empty( $failed_updates['plugin'] ) ) {
1100
+                $body[] = __( 'These plugins failed to update:' );
1101
+
1102
+                foreach ( $failed_updates['plugin'] as $item ) {
1103
+                    if ( $item->item->current_version ) {
1104
+                        $body[] = sprintf(
1105
+                            /* translators: 1: Plugin name, 2: Current version number, 3: New version number. */
1106
+                            __( '- %1$s (from version %2$s to %3$s)' ),
1107
+                            $item->name,
1108
+                            $item->item->current_version,
1109
+                            $item->item->new_version
1110
+                        );
1111
+                    } else {
1112
+                        $body[] = sprintf(
1113
+                            /* translators: 1: Plugin name, 2: Version number. */
1114
+                            __( '- %1$s version %2$s' ),
1115
+                            $item->name,
1116
+                            $item->item->new_version
1117
+                        );
1118
+                    }
1119
+
1120
+                    $past_failure_emails[ $item->item->plugin ] = $item->item->new_version;
1121
+                }
1122
+
1123
+                $body[] = "\n";
1124
+            }
1125
+
1126
+            // List failed theme updates.
1127
+            if ( ! empty( $failed_updates['theme'] ) ) {
1128
+                $body[] = __( 'These themes failed to update:' );
1129
+
1130
+                foreach ( $failed_updates['theme'] as $item ) {
1131
+                    if ( $item->item->current_version ) {
1132
+                        $body[] = sprintf(
1133
+                            /* translators: 1: Theme name, 2: Current version number, 3: New version number. */
1134
+                            __( '- %1$s (from version %2$s to %3$s)' ),
1135
+                            $item->name,
1136
+                            $item->item->current_version,
1137
+                            $item->item->new_version
1138
+                        );
1139
+                    } else {
1140
+                        $body[] = sprintf(
1141
+                            /* translators: 1: Theme name, 2: Version number. */
1142
+                            __( '- %1$s version %2$s' ),
1143
+                            $item->name,
1144
+                            $item->item->new_version
1145
+                        );
1146
+                    }
1147
+
1148
+                    $past_failure_emails[ $item->item->theme ] = $item->item->new_version;
1149
+                }
1150
+
1151
+                $body[] = "\n";
1152
+            }
1153
+        }
1154
+
1155
+        // List successful updates.
1156
+        if ( in_array( $type, array( 'success', 'mixed' ), true ) ) {
1157
+            $body[] = "\n";
1158
+
1159
+            // List successful plugin updates.
1160
+            if ( ! empty( $successful_updates['plugin'] ) ) {
1161
+                $body[] = __( 'These plugins are now up to date:' );
1162
+
1163
+                foreach ( $successful_updates['plugin'] as $item ) {
1164
+                    if ( $item->item->current_version ) {
1165
+                        $body[] = sprintf(
1166
+                            /* translators: 1: Plugin name, 2: Current version number, 3: New version number. */
1167
+                            __( '- %1$s (from version %2$s to %3$s)' ),
1168
+                            $item->name,
1169
+                            $item->item->current_version,
1170
+                            $item->item->new_version
1171
+                        );
1172
+                    } else {
1173
+                        $body[] = sprintf(
1174
+                            /* translators: 1: Plugin name, 2: Version number. */
1175
+                            __( '- %1$s version %2$s' ),
1176
+                            $item->name,
1177
+                            $item->item->new_version
1178
+                        );
1179
+                    }
1180
+
1181
+                    unset( $past_failure_emails[ $item->item->plugin ] );
1182
+                }
1183
+
1184
+                $body[] = "\n";
1185
+            }
1186
+
1187
+            // List successful theme updates.
1188
+            if ( ! empty( $successful_updates['theme'] ) ) {
1189
+                $body[] = __( 'These themes are now up to date:' );
1190
+
1191
+                foreach ( $successful_updates['theme'] as $item ) {
1192
+                    if ( $item->item->current_version ) {
1193
+                        $body[] = sprintf(
1194
+                            /* translators: 1: Theme name, 2: Current version number, 3: New version number. */
1195
+                            __( '- %1$s (from version %2$s to %3$s)' ),
1196
+                            $item->name,
1197
+                            $item->item->current_version,
1198
+                            $item->item->new_version
1199
+                        );
1200
+                    } else {
1201
+                        $body[] = sprintf(
1202
+                            /* translators: 1: Theme name, 2: Version number. */
1203
+                            __( '- %1$s version %2$s' ),
1204
+                            $item->name,
1205
+                            $item->item->new_version
1206
+                        );
1207
+                    }
1208
+
1209
+                    unset( $past_failure_emails[ $item->item->theme ] );
1210
+                }
1211
+
1212
+                $body[] = "\n";
1213
+            }
1214
+        }
1215
+
1216
+        if ( $failed_plugins ) {
1217
+            $body[] = sprintf(
1218
+                /* translators: %s: Plugins screen URL. */
1219
+                __( 'To manage plugins on your site, visit the Plugins page: %s' ),
1220
+                admin_url( 'plugins.php' )
1221
+            );
1222
+            $body[] = "\n";
1223
+        }
1224
+
1225
+        if ( $failed_themes ) {
1226
+            $body[] = sprintf(
1227
+                /* translators: %s: Themes screen URL. */
1228
+                __( 'To manage themes on your site, visit the Themes page: %s' ),
1229
+                admin_url( 'themes.php' )
1230
+            );
1231
+            $body[] = "\n";
1232
+        }
1233
+
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' );
1238
+
1239
+        if ( '' !== get_option( 'blogname' ) ) {
1240
+            $site_title = wp_specialchars_decode( get_option( 'blogname' ), ENT_QUOTES );
1241
+        } else {
1242
+            $site_title = parse_url( home_url(), PHP_URL_HOST );
1243
+        }
1244
+
1245
+        $body    = implode( "\n", $body );
1246
+        $to      = get_site_option( 'admin_email' );
1247
+        $subject = sprintf( $subject, $site_title );
1248
+        $headers = '';
1249
+
1250
+        $email = compact( 'to', 'subject', 'body', 'headers' );
1251
+
1252
+        /**
1253
+         * Filters the email sent following an automatic background update for plugins and themes.
1254
+         *
1255
+         * @since 5.5.0
1256
+         *
1257
+         * @param array  $email {
1258
+         *     Array of email arguments that will be passed to wp_mail().
1259
+         *
1260
+         *     @type string $to      The email recipient. An array of emails
1261
+         *                           can be returned, as handled by wp_mail().
1262
+         *     @type string $subject The email's subject.
1263
+         *     @type string $body    The email message body.
1264
+         *     @type string $headers Any email headers, defaults to no headers.
1265
+         * }
1266
+         * @param string $type               The type of email being sent. Can be one of 'success', 'fail', 'mixed'.
1267
+         * @param array  $successful_updates A list of updates that succeeded.
1268
+         * @param array  $failed_updates     A list of updates that failed.
1269
+         */
1270
+        $email = apply_filters( 'auto_plugin_theme_update_email', $email, $type, $successful_updates, $failed_updates );
1271
+
1272
+        $result = wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
1273
+
1274
+        if ( $result ) {
1275
+            update_option( 'auto_plugin_theme_update_emails', $past_failure_emails );
1276
+        }
1277
+    }
1278
+
1279
+    /**
1280
+     * Prepares and sends an email of a full log of background update results, useful for debugging and geekery.
1281
+     *
1282
+     * @since 3.7.0
1283
+     */
1284
+    protected function send_debug_email() {
1285
+        $update_count = 0;
1286
+        foreach ( $this->update_results as $type => $updates ) {
1287
+            $update_count += count( $updates );
1288
+        }
1289
+
1290
+        $body     = array();
1291
+        $failures = 0;
1292
+
1293
+        /* translators: %s: Network home URL. */
1294
+        $body[] = sprintf( __( 'WordPress site: %s' ), network_home_url( '/' ) );
1295
+
1296
+        // Core.
1297
+        if ( isset( $this->update_results['core'] ) ) {
1298
+            $result = $this->update_results['core'][0];
1299
+
1300
+            if ( $result->result && ! is_wp_error( $result->result ) ) {
1301
+                /* translators: %s: WordPress version. */
1302
+                $body[] = sprintf( __( 'SUCCESS: WordPress was successfully updated to %s' ), $result->name );
1303
+            } else {
1304
+                /* translators: %s: WordPress version. */
1305
+                $body[] = sprintf( __( 'FAILED: WordPress failed to update to %s' ), $result->name );
1306
+                $failures++;
1307
+            }
1308
+
1309
+            $body[] = '';
1310
+        }
1311
+
1312
+        // Plugins, Themes, Translations.
1313
+        foreach ( array( 'plugin', 'theme', 'translation' ) as $type ) {
1314
+            if ( ! isset( $this->update_results[ $type ] ) ) {
1315
+                continue;
1316
+            }
1317
+
1318
+            $success_items = wp_list_filter( $this->update_results[ $type ], array( 'result' => true ) );
1319
+
1320
+            if ( $success_items ) {
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:' ),
1325
+                );
1326
+
1327
+                $body[] = $messages[ $type ];
1328
+                foreach ( wp_list_pluck( $success_items, 'name' ) as $name ) {
1329
+                    /* translators: %s: Name of plugin / theme / translation. */
1330
+                    $body[] = ' * ' . sprintf( __( 'SUCCESS: %s' ), $name );
1331
+                }
1332
+            }
1333
+
1334
+            if ( $success_items !== $this->update_results[ $type ] ) {
1335
+                // Failed updates.
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:' ),
1340
+                );
1341
+
1342
+                $body[] = $messages[ $type ];
1343
+
1344
+                foreach ( $this->update_results[ $type ] as $item ) {
1345
+                    if ( ! $item->result || is_wp_error( $item->result ) ) {
1346
+                        /* translators: %s: Name of plugin / theme / translation. */
1347
+                        $body[] = ' * ' . sprintf( __( 'FAILED: %s' ), $item->name );
1348
+                        $failures++;
1349
+                    }
1350
+                }
1351
+            }
1352
+
1353
+            $body[] = '';
1354
+        }
1355
+
1356
+        if ( '' !== get_bloginfo( 'name' ) ) {
1357
+            $site_title = wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES );
1358
+        } else {
1359
+            $site_title = parse_url( home_url(), PHP_URL_HOST );
1360
+        }
1361
+
1362
+        if ( $failures ) {
1363
+            $body[] = trim(
1364
+                __(
1365
+                    "BETA TESTING?
1366 1366
 =============
1367 1367
 
1368 1368
 This debugging email is sent when you are using a development version of WordPress.
@@ -1372,96 +1372,96 @@  discard block
 block discarded – undo
1372 1372
  * Or, if you're comfortable writing a bug report: https://core.trac.wordpress.org/
1373 1373
 
1374 1374
 Thanks! -- The WordPress Team"
1375
-				)
1376
-			);
1377
-			$body[] = '';
1378
-
1379
-			/* translators: Background update failed notification email subject. %s: Site title. */
1380
-			$subject = sprintf( __( '[%s] Background Update Failed' ), $site_title );
1381
-		} else {
1382
-			/* translators: Background update finished notification email subject. %s: Site title. */
1383
-			$subject = sprintf( __( '[%s] Background Update Finished' ), $site_title );
1384
-		}
1385
-
1386
-		$body[] = trim(
1387
-			__(
1388
-				'UPDATE LOG
1375
+                )
1376
+            );
1377
+            $body[] = '';
1378
+
1379
+            /* translators: Background update failed notification email subject. %s: Site title. */
1380
+            $subject = sprintf( __( '[%s] Background Update Failed' ), $site_title );
1381
+        } else {
1382
+            /* translators: Background update finished notification email subject. %s: Site title. */
1383
+            $subject = sprintf( __( '[%s] Background Update Finished' ), $site_title );
1384
+        }
1385
+
1386
+        $body[] = trim(
1387
+            __(
1388
+                'UPDATE LOG
1389 1389
 =========='
1390
-			)
1391
-		);
1392
-		$body[] = '';
1393
-
1394
-		foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
1395
-			if ( ! isset( $this->update_results[ $type ] ) ) {
1396
-				continue;
1397
-			}
1398
-
1399
-			foreach ( $this->update_results[ $type ] as $update ) {
1400
-				$body[] = $update->name;
1401
-				$body[] = str_repeat( '-', strlen( $update->name ) );
1402
-
1403
-				foreach ( $update->messages as $message ) {
1404
-					$body[] = '  ' . html_entity_decode( str_replace( '&#8230;', '...', $message ) );
1405
-				}
1406
-
1407
-				if ( is_wp_error( $update->result ) ) {
1408
-					$results = array( 'update' => $update->result );
1409
-
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() ) {
1412
-						$results = (array) $update->result->get_error_data();
1413
-					}
1414
-
1415
-					foreach ( $results as $result_type => $result ) {
1416
-						if ( ! is_wp_error( $result ) ) {
1417
-							continue;
1418
-						}
1419
-
1420
-						if ( 'rollback' === $result_type ) {
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() );
1423
-						} else {
1424
-							/* translators: 1: Error code, 2: Error message. */
1425
-							$body[] = '  ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
1426
-						}
1427
-
1428
-						if ( $result->get_error_data() ) {
1429
-							$body[] = '         ' . implode( ', ', (array) $result->get_error_data() );
1430
-						}
1431
-					}
1432
-				}
1433
-
1434
-				$body[] = '';
1435
-			}
1436
-		}
1437
-
1438
-		$email = array(
1439
-			'to'      => get_site_option( 'admin_email' ),
1440
-			'subject' => $subject,
1441
-			'body'    => implode( "\n", $body ),
1442
-			'headers' => '',
1443
-		);
1444
-
1445
-		/**
1446
-		 * Filters the debug email that can be sent following an automatic
1447
-		 * background core update.
1448
-		 *
1449
-		 * @since 3.8.0
1450
-		 *
1451
-		 * @param array $email {
1452
-		 *     Array of email arguments that will be passed to wp_mail().
1453
-		 *
1454
-		 *     @type string $to      The email recipient. An array of emails
1455
-		 *                           can be returned, as handled by wp_mail().
1456
-		 *     @type string $subject Email subject.
1457
-		 *     @type string $body    Email message body.
1458
-		 *     @type string $headers Any email headers. Default empty.
1459
-		 * }
1460
-		 * @param int   $failures The number of failures encountered while upgrading.
1461
-		 * @param mixed $results  The results of all attempted updates.
1462
-		 */
1463
-		$email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results );
1464
-
1465
-		wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
1466
-	}
1390
+            )
1391
+        );
1392
+        $body[] = '';
1393
+
1394
+        foreach ( array( 'core', 'plugin', 'theme', 'translation' ) as $type ) {
1395
+            if ( ! isset( $this->update_results[ $type ] ) ) {
1396
+                continue;
1397
+            }
1398
+
1399
+            foreach ( $this->update_results[ $type ] as $update ) {
1400
+                $body[] = $update->name;
1401
+                $body[] = str_repeat( '-', strlen( $update->name ) );
1402
+
1403
+                foreach ( $update->messages as $message ) {
1404
+                    $body[] = '  ' . html_entity_decode( str_replace( '&#8230;', '...', $message ) );
1405
+                }
1406
+
1407
+                if ( is_wp_error( $update->result ) ) {
1408
+                    $results = array( 'update' => $update->result );
1409
+
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() ) {
1412
+                        $results = (array) $update->result->get_error_data();
1413
+                    }
1414
+
1415
+                    foreach ( $results as $result_type => $result ) {
1416
+                        if ( ! is_wp_error( $result ) ) {
1417
+                            continue;
1418
+                        }
1419
+
1420
+                        if ( 'rollback' === $result_type ) {
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() );
1423
+                        } else {
1424
+                            /* translators: 1: Error code, 2: Error message. */
1425
+                            $body[] = '  ' . sprintf( __( 'Error: [%1$s] %2$s' ), $result->get_error_code(), $result->get_error_message() );
1426
+                        }
1427
+
1428
+                        if ( $result->get_error_data() ) {
1429
+                            $body[] = '         ' . implode( ', ', (array) $result->get_error_data() );
1430
+                        }
1431
+                    }
1432
+                }
1433
+
1434
+                $body[] = '';
1435
+            }
1436
+        }
1437
+
1438
+        $email = array(
1439
+            'to'      => get_site_option( 'admin_email' ),
1440
+            'subject' => $subject,
1441
+            'body'    => implode( "\n", $body ),
1442
+            'headers' => '',
1443
+        );
1444
+
1445
+        /**
1446
+         * Filters the debug email that can be sent following an automatic
1447
+         * background core update.
1448
+         *
1449
+         * @since 3.8.0
1450
+         *
1451
+         * @param array $email {
1452
+         *     Array of email arguments that will be passed to wp_mail().
1453
+         *
1454
+         *     @type string $to      The email recipient. An array of emails
1455
+         *                           can be returned, as handled by wp_mail().
1456
+         *     @type string $subject Email subject.
1457
+         *     @type string $body    Email message body.
1458
+         *     @type string $headers Any email headers. Default empty.
1459
+         * }
1460
+         * @param int   $failures The number of failures encountered while upgrading.
1461
+         * @param mixed $results  The results of all attempted updates.
1462
+         */
1463
+        $email = apply_filters( 'automatic_updates_debug_email', $email, $failures, $this->update_results );
1464
+
1465
+        wp_mail( $email['to'], wp_specialchars_decode( $email['subject'] ), $email['body'], $email['headers'] );
1466
+    }
1467 1467
 }
Please login to merge, or discard this patch.
Spacing   +360 added lines, -360 removed lines patch added patch discarded remove patch
@@ -29,16 +29,16 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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)&#8230;' ), $language_item_name, $item->language ) );
384
+				$skin->feedback(sprintf(__('Updating translations for %1$s (%2$s)&#8230;'), $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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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( '&#8230;', '...', $message ) );
1403
+				foreach ($update->messages as $message) {
1404
+					$body[] = '  ' . html_entity_decode(str_replace('&#8230;', '...', $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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
brighty/wp-admin/includes/menu.php 2 patches
Indentation   +245 added lines, -245 removed lines patch added patch discarded remove patch
@@ -8,66 +8,66 @@  discard block
 block discarded – undo
8 8
 
9 9
 if ( is_network_admin() ) {
10 10
 
11
-	/**
12
-	 * Fires before the administration menu loads in the Network Admin.
13
-	 *
14
-	 * The hook fires before menus and sub-menus are removed based on user privileges.
15
-	 *
16
-	 * @private
17
-	 * @since 3.1.0
18
-	 */
19
-	do_action( '_network_admin_menu' );
11
+    /**
12
+     * Fires before the administration menu loads in the Network Admin.
13
+     *
14
+     * The hook fires before menus and sub-menus are removed based on user privileges.
15
+     *
16
+     * @private
17
+     * @since 3.1.0
18
+     */
19
+    do_action( '_network_admin_menu' );
20 20
 } elseif ( is_user_admin() ) {
21 21
 
22
-	/**
23
-	 * Fires before the administration menu loads in the User Admin.
24
-	 *
25
-	 * The hook fires before menus and sub-menus are removed based on user privileges.
26
-	 *
27
-	 * @private
28
-	 * @since 3.1.0
29
-	 */
30
-	do_action( '_user_admin_menu' );
22
+    /**
23
+     * Fires before the administration menu loads in the User Admin.
24
+     *
25
+     * The hook fires before menus and sub-menus are removed based on user privileges.
26
+     *
27
+     * @private
28
+     * @since 3.1.0
29
+     */
30
+    do_action( '_user_admin_menu' );
31 31
 } else {
32 32
 
33
-	/**
34
-	 * Fires before the administration menu loads in the admin.
35
-	 *
36
-	 * The hook fires before menus and sub-menus are removed based on user privileges.
37
-	 *
38
-	 * @private
39
-	 * @since 2.2.0
40
-	 */
41
-	do_action( '_admin_menu' );
33
+    /**
34
+     * Fires before the administration menu loads in the admin.
35
+     *
36
+     * The hook fires before menus and sub-menus are removed based on user privileges.
37
+     *
38
+     * @private
39
+     * @since 2.2.0
40
+     */
41
+    do_action( '_admin_menu' );
42 42
 }
43 43
 
44 44
 // Create list of page plugin hook names.
45 45
 foreach ( $menu as $menu_page ) {
46
-	$pos = strpos( $menu_page[2], '?' );
47
-	if ( false !== $pos ) {
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 );
52
-		// Set the hook name to be the post type.
53
-		if ( isset( $hook_args['post_type'] ) ) {
54
-			$hook_name = $hook_args['post_type'];
55
-		} else {
56
-			$hook_name = basename( $hook_name, '.php' );
57
-		}
58
-		unset( $hook_args );
59
-	} else {
60
-		$hook_name = basename( $menu_page[2], '.php' );
61
-	}
62
-	$hook_name = sanitize_title( $hook_name );
63
-
64
-	if ( isset( $compat[ $hook_name ] ) ) {
65
-		$hook_name = $compat[ $hook_name ];
66
-	} elseif ( ! $hook_name ) {
67
-		continue;
68
-	}
69
-
70
-	$admin_page_hooks[ $menu_page[2] ] = $hook_name;
46
+    $pos = strpos( $menu_page[2], '?' );
47
+    if ( false !== $pos ) {
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 );
52
+        // Set the hook name to be the post type.
53
+        if ( isset( $hook_args['post_type'] ) ) {
54
+            $hook_name = $hook_args['post_type'];
55
+        } else {
56
+            $hook_name = basename( $hook_name, '.php' );
57
+        }
58
+        unset( $hook_args );
59
+    } else {
60
+        $hook_name = basename( $menu_page[2], '.php' );
61
+    }
62
+    $hook_name = sanitize_title( $hook_name );
63
+
64
+    if ( isset( $compat[ $hook_name ] ) ) {
65
+        $hook_name = $compat[ $hook_name ];
66
+    } elseif ( ! $hook_name ) {
67
+        continue;
68
+    }
69
+
70
+    $admin_page_hooks[ $menu_page[2] ] = $hook_name;
71 71
 }
72 72
 unset( $menu_page, $compat );
73 73
 
@@ -75,17 +75,17 @@  discard block
 block discarded – undo
75 75
 $_wp_menu_nopriv    = array();
76 76
 // Loop over submenus and remove pages for which the user does not have privs.
77 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
-		}
83
-	}
84
-	unset( $index, $data );
85
-
86
-	if ( empty( $submenu[ $parent ] ) ) {
87
-		unset( $submenu[ $parent ] );
88
-	}
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
+        }
83
+    }
84
+    unset( $index, $data );
85
+
86
+    if ( empty( $submenu[ $parent ] ) ) {
87
+        unset( $submenu[ $parent ] );
88
+    }
89 89
 }
90 90
 unset( $sub, $parent );
91 91
 
@@ -95,64 +95,64 @@  discard block
 block discarded – undo
95 95
  * will have the next submenu in line be assigned as the new menu parent.
96 96
  */
97 97
 foreach ( $menu as $id => $data ) {
98
-	if ( empty( $submenu[ $data[2] ] ) ) {
99
-		continue;
100
-	}
101
-	$subs       = $submenu[ $data[2] ];
102
-	$first_sub  = reset( $subs );
103
-	$old_parent = $data[2];
104
-	$new_parent = $first_sub[2];
105
-	/*
98
+    if ( empty( $submenu[ $data[2] ] ) ) {
99
+        continue;
100
+    }
101
+    $subs       = $submenu[ $data[2] ];
102
+    $first_sub  = reset( $subs );
103
+    $old_parent = $data[2];
104
+    $new_parent = $first_sub[2];
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;
112
-
113
-		foreach ( $submenu[ $old_parent ] as $index => $data ) {
114
-			$submenu[ $new_parent ][ $index ] = $submenu[ $old_parent ][ $index ];
115
-			unset( $submenu[ $old_parent ][ $index ] );
116
-		}
117
-		unset( $submenu[ $old_parent ], $index );
118
-
119
-		if ( isset( $_wp_submenu_nopriv[ $old_parent ] ) ) {
120
-			$_wp_submenu_nopriv[ $new_parent ] = $_wp_submenu_nopriv[ $old_parent ];
121
-		}
122
-	}
109
+    if ( $new_parent != $old_parent ) {
110
+        $_wp_real_parent_file[ $old_parent ] = $new_parent;
111
+        $menu[ $id ][2]                      = $new_parent;
112
+
113
+        foreach ( $submenu[ $old_parent ] as $index => $data ) {
114
+            $submenu[ $new_parent ][ $index ] = $submenu[ $old_parent ][ $index ];
115
+            unset( $submenu[ $old_parent ][ $index ] );
116
+        }
117
+        unset( $submenu[ $old_parent ], $index );
118
+
119
+        if ( isset( $_wp_submenu_nopriv[ $old_parent ] ) ) {
120
+            $_wp_submenu_nopriv[ $new_parent ] = $_wp_submenu_nopriv[ $old_parent ];
121
+        }
122
+    }
123 123
 }
124 124
 unset( $id, $data, $subs, $first_sub, $old_parent, $new_parent );
125 125
 
126 126
 if ( is_network_admin() ) {
127 127
 
128
-	/**
129
-	 * Fires before the administration menu loads in the Network Admin.
130
-	 *
131
-	 * @since 3.1.0
132
-	 *
133
-	 * @param string $context Empty context.
134
-	 */
135
-	do_action( 'network_admin_menu', '' );
128
+    /**
129
+     * Fires before the administration menu loads in the Network Admin.
130
+     *
131
+     * @since 3.1.0
132
+     *
133
+     * @param string $context Empty context.
134
+     */
135
+    do_action( 'network_admin_menu', '' );
136 136
 } elseif ( is_user_admin() ) {
137 137
 
138
-	/**
139
-	 * Fires before the administration menu loads in the User Admin.
140
-	 *
141
-	 * @since 3.1.0
142
-	 *
143
-	 * @param string $context Empty context.
144
-	 */
145
-	do_action( 'user_admin_menu', '' );
138
+    /**
139
+     * Fires before the administration menu loads in the User Admin.
140
+     *
141
+     * @since 3.1.0
142
+     *
143
+     * @param string $context Empty context.
144
+     */
145
+    do_action( 'user_admin_menu', '' );
146 146
 } else {
147 147
 
148
-	/**
149
-	 * Fires before the administration menu loads in the admin.
150
-	 *
151
-	 * @since 1.5.0
152
-	 *
153
-	 * @param string $context Empty context.
154
-	 */
155
-	do_action( 'admin_menu', '' );
148
+    /**
149
+     * Fires before the administration menu loads in the admin.
150
+     *
151
+     * @since 1.5.0
152
+     *
153
+     * @param string $context Empty context.
154
+     */
155
+    do_action( 'admin_menu', '' );
156 156
 }
157 157
 
158 158
 /*
@@ -160,29 +160,29 @@  discard block
 block discarded – undo
160 160
  * that the user does not have. Run re-parent loop again.
161 161
  */
162 162
 foreach ( $menu as $id => $data ) {
163
-	if ( ! current_user_can( $data[1] ) ) {
164
-		$_wp_menu_nopriv[ $data[2] ] = true;
165
-	}
163
+    if ( ! current_user_can( $data[1] ) ) {
164
+        $_wp_menu_nopriv[ $data[2] ] = true;
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] ] );
176
-		}
177
-	}
178
-
179
-	// If submenu is empty...
180
-	if ( empty( $submenu[ $data[2] ] ) ) {
181
-		// And user doesn't have privs, remove menu.
182
-		if ( isset( $_wp_menu_nopriv[ $data[2] ] ) ) {
183
-			unset( $menu[ $id ] );
184
-		}
185
-	}
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
+        }
177
+    }
178
+
179
+    // If submenu is empty...
180
+    if ( empty( $submenu[ $data[2] ] ) ) {
181
+        // And user doesn't have privs, remove menu.
182
+        if ( isset( $_wp_menu_nopriv[ $data[2] ] ) ) {
183
+            unset( $menu[ $id ] );
184
+        }
185
+    }
186 186
 }
187 187
 unset( $id, $data, $subs, $first_sub );
188 188
 
@@ -196,11 +196,11 @@  discard block
 block discarded – undo
196 196
  * @return string The string with the CSS class added.
197 197
  */
198 198
 function add_cssclass( $class_to_add, $classes ) {
199
-	if ( empty( $classes ) ) {
200
-		return $class_to_add;
201
-	}
199
+    if ( empty( $classes ) ) {
200
+        return $class_to_add;
201
+    }
202 202
 
203
-	return $classes . ' ' . $class_to_add;
203
+    return $classes . ' ' . $class_to_add;
204 204
 }
205 205
 
206 206
 /**
@@ -214,49 +214,49 @@  discard block
 block discarded – undo
214 214
  * @return array The array of administration menu items with the CSS classes added.
215 215
  */
216 216
 function add_menu_classes( $menu ) {
217
-	$first_item  = false;
218
-	$last_order  = false;
219
-	$items_count = count( $menu );
220
-	$i           = 0;
221
-
222
-	foreach ( $menu as $order => $top ) {
223
-		$i++;
224
-
225
-		if ( 0 == $order ) { // Dashboard is always shown/single.
226
-			$menu[0][4] = add_cssclass( 'menu-top-first', $top[4] );
227
-			$last_order = 0;
228
-			continue;
229
-		}
230
-
231
-		if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { // If separator.
232
-			$first_item             = true;
233
-			$classes                = $menu[ $last_order ][4];
234
-			$menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes );
235
-			continue;
236
-		}
237
-
238
-		if ( $first_item ) {
239
-			$classes           = $menu[ $order ][4];
240
-			$menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes );
241
-			$first_item        = false;
242
-		}
243
-
244
-		if ( $i == $items_count ) { // Last item.
245
-			$classes           = $menu[ $order ][4];
246
-			$menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes );
247
-		}
248
-
249
-		$last_order = $order;
250
-	}
251
-
252
-	/**
253
-	 * Filters administration menu array with classes added for top-level items.
254
-	 *
255
-	 * @since 2.7.0
256
-	 *
257
-	 * @param array $menu Associative array of administration menu items.
258
-	 */
259
-	return apply_filters( 'add_menu_classes', $menu );
217
+    $first_item  = false;
218
+    $last_order  = false;
219
+    $items_count = count( $menu );
220
+    $i           = 0;
221
+
222
+    foreach ( $menu as $order => $top ) {
223
+        $i++;
224
+
225
+        if ( 0 == $order ) { // Dashboard is always shown/single.
226
+            $menu[0][4] = add_cssclass( 'menu-top-first', $top[4] );
227
+            $last_order = 0;
228
+            continue;
229
+        }
230
+
231
+        if ( 0 === strpos( $top[2], 'separator' ) && false !== $last_order ) { // If separator.
232
+            $first_item             = true;
233
+            $classes                = $menu[ $last_order ][4];
234
+            $menu[ $last_order ][4] = add_cssclass( 'menu-top-last', $classes );
235
+            continue;
236
+        }
237
+
238
+        if ( $first_item ) {
239
+            $classes           = $menu[ $order ][4];
240
+            $menu[ $order ][4] = add_cssclass( 'menu-top-first', $classes );
241
+            $first_item        = false;
242
+        }
243
+
244
+        if ( $i == $items_count ) { // Last item.
245
+            $classes           = $menu[ $order ][4];
246
+            $menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes );
247
+        }
248
+
249
+        $last_order = $order;
250
+    }
251
+
252
+    /**
253
+     * Filters administration menu array with classes added for top-level items.
254
+     *
255
+     * @since 2.7.0
256
+     *
257
+     * @param array $menu Associative array of administration menu items.
258
+     */
259
+    return apply_filters( 'add_menu_classes', $menu );
260 260
 }
261 261
 
262 262
 uksort( $menu, 'strnatcasecmp' ); // Make it all pretty.
@@ -271,76 +271,76 @@  discard block
 block discarded – undo
271 271
  * @param bool $custom Whether custom ordering is enabled. Default false.
272 272
  */
273 273
 if ( apply_filters( 'custom_menu_order', false ) ) {
274
-	$menu_order = array();
275
-	foreach ( $menu as $menu_item ) {
276
-		$menu_order[] = $menu_item[2];
277
-	}
278
-	unset( $menu_item );
279
-	$default_menu_order = $menu_order;
280
-
281
-	/**
282
-	 * Filters the order of administration menu items.
283
-	 *
284
-	 * A truthy value must first be passed to the {@see 'custom_menu_order'} filter
285
-	 * for this filter to work. Use the following to enable custom menu ordering:
286
-	 *
287
-	 *     add_filter( 'custom_menu_order', '__return_true' );
288
-	 *
289
-	 * @since 2.8.0
290
-	 *
291
-	 * @param array $menu_order An ordered array of menu items.
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 );
296
-
297
-	/**
298
-	 * @global array $menu_order
299
-	 * @global array $default_menu_order
300
-	 *
301
-	 * @param array $a
302
-	 * @param array $b
303
-	 * @return int
304
-	 */
305
-	function sort_menu( $a, $b ) {
306
-		global $menu_order, $default_menu_order;
307
-		$a = $a[2];
308
-		$b = $b[2];
309
-		if ( isset( $menu_order[ $a ] ) && ! isset( $menu_order[ $b ] ) ) {
310
-			return -1;
311
-		} elseif ( ! isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) {
312
-			return 1;
313
-		} elseif ( isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) {
314
-			if ( $menu_order[ $a ] == $menu_order[ $b ] ) {
315
-				return 0;
316
-			}
317
-			return ( $menu_order[ $a ] < $menu_order[ $b ] ) ? -1 : 1;
318
-		} else {
319
-			return ( $default_menu_order[ $a ] <= $default_menu_order[ $b ] ) ? -1 : 1;
320
-		}
321
-	}
322
-
323
-	usort( $menu, 'sort_menu' );
324
-	unset( $menu_order, $default_menu_order );
274
+    $menu_order = array();
275
+    foreach ( $menu as $menu_item ) {
276
+        $menu_order[] = $menu_item[2];
277
+    }
278
+    unset( $menu_item );
279
+    $default_menu_order = $menu_order;
280
+
281
+    /**
282
+     * Filters the order of administration menu items.
283
+     *
284
+     * A truthy value must first be passed to the {@see 'custom_menu_order'} filter
285
+     * for this filter to work. Use the following to enable custom menu ordering:
286
+     *
287
+     *     add_filter( 'custom_menu_order', '__return_true' );
288
+     *
289
+     * @since 2.8.0
290
+     *
291
+     * @param array $menu_order An ordered array of menu items.
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 );
296
+
297
+    /**
298
+     * @global array $menu_order
299
+     * @global array $default_menu_order
300
+     *
301
+     * @param array $a
302
+     * @param array $b
303
+     * @return int
304
+     */
305
+    function sort_menu( $a, $b ) {
306
+        global $menu_order, $default_menu_order;
307
+        $a = $a[2];
308
+        $b = $b[2];
309
+        if ( isset( $menu_order[ $a ] ) && ! isset( $menu_order[ $b ] ) ) {
310
+            return -1;
311
+        } elseif ( ! isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) {
312
+            return 1;
313
+        } elseif ( isset( $menu_order[ $a ] ) && isset( $menu_order[ $b ] ) ) {
314
+            if ( $menu_order[ $a ] == $menu_order[ $b ] ) {
315
+                return 0;
316
+            }
317
+            return ( $menu_order[ $a ] < $menu_order[ $b ] ) ? -1 : 1;
318
+        } else {
319
+            return ( $default_menu_order[ $a ] <= $default_menu_order[ $b ] ) ? -1 : 1;
320
+        }
321
+    }
322
+
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 329
 foreach ( $menu as $id => $data ) {
330
-	if ( false === stristr( $data[4], 'wp-menu-separator' ) ) {
330
+    if ( false === stristr( $data[4], 'wp-menu-separator' ) ) {
331 331
 
332
-		// This item is not a separator, so falsey the toggler and do nothing.
333
-		$prev_menu_was_separator = false;
334
-	} else {
332
+        // This item is not a separator, so falsey the toggler and do nothing.
333
+        $prev_menu_was_separator = false;
334
+    } else {
335 335
 
336
-		// The previous item was a separator, so unset this one.
337
-		if ( true === $prev_menu_was_separator ) {
338
-			unset( $menu[ $id ] );
339
-		}
336
+        // The previous item was a separator, so unset this one.
337
+        if ( true === $prev_menu_was_separator ) {
338
+            unset( $menu[ $id ] );
339
+        }
340 340
 
341
-		// This item is a separator, so truthy the toggler and move on.
342
-		$prev_menu_was_separator = true;
343
-	}
341
+        // This item is a separator, so truthy the toggler and move on.
342
+        $prev_menu_was_separator = true;
343
+    }
344 344
 }
345 345
 unset( $id, $data, $prev_menu_was_separator );
346 346
 
@@ -348,20 +348,20 @@  discard block
 block discarded – undo
348 348
 $last_menu_key = array_keys( $menu );
349 349
 $last_menu_key = array_pop( $last_menu_key );
350 350
 if ( ! empty( $menu ) && 'wp-menu-separator' === $menu[ $last_menu_key ][4] ) {
351
-	unset( $menu[ $last_menu_key ] );
351
+    unset( $menu[ $last_menu_key ] );
352 352
 }
353 353
 unset( $last_menu_key );
354 354
 
355 355
 if ( ! user_can_access_admin_page() ) {
356 356
 
357
-	/**
358
-	 * Fires when access to an admin page is denied.
359
-	 *
360
-	 * @since 2.5.0
361
-	 */
362
-	do_action( 'admin_page_access_denied' );
357
+    /**
358
+     * Fires when access to an admin page is denied.
359
+     *
360
+     * @since 2.5.0
361
+     */
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 367
 $menu = add_menu_classes( $menu );
Please login to merge, or discard this patch.
Spacing   +108 added lines, -108 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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);
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-wp-filesystem-ftpsockets.php 2 patches
Indentation   +671 added lines, -671 removed lines patch added patch discarded remove patch
@@ -15,675 +15,675 @@
 block discarded – undo
15 15
  */
16 16
 class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
17 17
 
18
-	/**
19
-	 * @since 2.5.0
20
-	 * @var ftp
21
-	 */
22
-	public $ftp;
23
-
24
-	/**
25
-	 * Constructor.
26
-	 *
27
-	 * @since 2.5.0
28
-	 *
29
-	 * @param array $opt
30
-	 */
31
-	public function __construct( $opt = '' ) {
32
-		$this->method = 'ftpsockets';
33
-		$this->errors = new WP_Error();
34
-
35
-		// Check if possible to use ftp functions.
36
-		if ( ! include_once ABSPATH . 'wp-admin/includes/class-ftp.php' ) {
37
-			return;
38
-		}
39
-
40
-		$this->ftp = new ftp();
41
-
42
-		if ( empty( $opt['port'] ) ) {
43
-			$this->options['port'] = 21;
44
-		} else {
45
-			$this->options['port'] = (int) $opt['port'];
46
-		}
47
-
48
-		if ( empty( $opt['hostname'] ) ) {
49
-			$this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) );
50
-		} else {
51
-			$this->options['hostname'] = $opt['hostname'];
52
-		}
53
-
54
-		// Check if the options provided are OK.
55
-		if ( empty( $opt['username'] ) ) {
56
-			$this->errors->add( 'empty_username', __( 'FTP username is required' ) );
57
-		} else {
58
-			$this->options['username'] = $opt['username'];
59
-		}
60
-
61
-		if ( empty( $opt['password'] ) ) {
62
-			$this->errors->add( 'empty_password', __( 'FTP password is required' ) );
63
-		} else {
64
-			$this->options['password'] = $opt['password'];
65
-		}
66
-	}
67
-
68
-	/**
69
-	 * Connects filesystem.
70
-	 *
71
-	 * @since 2.5.0
72
-	 *
73
-	 * @return bool True on success, false on failure.
74
-	 */
75
-	public function connect() {
76
-		if ( ! $this->ftp ) {
77
-			return false;
78
-		}
79
-
80
-		$this->ftp->setTimeout( FS_CONNECT_TIMEOUT );
81
-
82
-		if ( ! $this->ftp->SetServer( $this->options['hostname'], $this->options['port'] ) ) {
83
-			$this->errors->add(
84
-				'connect',
85
-				sprintf(
86
-					/* translators: %s: hostname:port */
87
-					__( 'Failed to connect to FTP Server %s' ),
88
-					$this->options['hostname'] . ':' . $this->options['port']
89
-				)
90
-			);
91
-
92
-			return false;
93
-		}
94
-
95
-		if ( ! $this->ftp->connect() ) {
96
-			$this->errors->add(
97
-				'connect',
98
-				sprintf(
99
-					/* translators: %s: hostname:port */
100
-					__( 'Failed to connect to FTP Server %s' ),
101
-					$this->options['hostname'] . ':' . $this->options['port']
102
-				)
103
-			);
104
-
105
-			return false;
106
-		}
107
-
108
-		if ( ! $this->ftp->login( $this->options['username'], $this->options['password'] ) ) {
109
-			$this->errors->add(
110
-				'auth',
111
-				sprintf(
112
-					/* translators: %s: Username. */
113
-					__( 'Username/Password incorrect for %s' ),
114
-					$this->options['username']
115
-				)
116
-			);
117
-
118
-			return false;
119
-		}
120
-
121
-		$this->ftp->SetType( FTP_BINARY );
122
-		$this->ftp->Passive( true );
123
-		$this->ftp->setTimeout( FS_TIMEOUT );
124
-
125
-		return true;
126
-	}
127
-
128
-	/**
129
-	 * Reads entire file into a string.
130
-	 *
131
-	 * @since 2.5.0
132
-	 *
133
-	 * @param string $file Name of the file to read.
134
-	 * @return string|false Read data on success, false if no temporary file could be opened,
135
-	 *                      or if the file couldn't be retrieved.
136
-	 */
137
-	public function get_contents( $file ) {
138
-		if ( ! $this->exists( $file ) ) {
139
-			return false;
140
-		}
141
-
142
-		$tempfile   = wp_tempnam( $file );
143
-		$temphandle = fopen( $tempfile, 'w+' );
144
-
145
-		if ( ! $temphandle ) {
146
-			unlink( $tempfile );
147
-			return false;
148
-		}
149
-
150
-		mbstring_binary_safe_encoding();
151
-
152
-		if ( ! $this->ftp->fget( $temphandle, $file ) ) {
153
-			fclose( $temphandle );
154
-			unlink( $tempfile );
155
-
156
-			reset_mbstring_encoding();
157
-
158
-			return ''; // Blank document. File does exist, it's just blank.
159
-		}
160
-
161
-		reset_mbstring_encoding();
162
-
163
-		fseek( $temphandle, 0 ); // Skip back to the start of the file being written to.
164
-		$contents = '';
165
-
166
-		while ( ! feof( $temphandle ) ) {
167
-			$contents .= fread( $temphandle, 8 * KB_IN_BYTES );
168
-		}
169
-
170
-		fclose( $temphandle );
171
-		unlink( $tempfile );
172
-
173
-		return $contents;
174
-	}
175
-
176
-	/**
177
-	 * Reads entire file into an array.
178
-	 *
179
-	 * @since 2.5.0
180
-	 *
181
-	 * @param string $file Path to the file.
182
-	 * @return array|false File contents in an array on success, false on failure.
183
-	 */
184
-	public function get_contents_array( $file ) {
185
-		return explode( "\n", $this->get_contents( $file ) );
186
-	}
187
-
188
-	/**
189
-	 * Writes a string to a file.
190
-	 *
191
-	 * @since 2.5.0
192
-	 *
193
-	 * @param string    $file     Remote path to the file where to write the data.
194
-	 * @param string    $contents The data to write.
195
-	 * @param int|false $mode     Optional. The file permissions as octal number, usually 0644.
196
-	 *                            Default false.
197
-	 * @return bool True on success, false on failure.
198
-	 */
199
-	public function put_contents( $file, $contents, $mode = false ) {
200
-		$tempfile   = wp_tempnam( $file );
201
-		$temphandle = @fopen( $tempfile, 'w+' );
202
-
203
-		if ( ! $temphandle ) {
204
-			unlink( $tempfile );
205
-			return false;
206
-		}
207
-
208
-		// The FTP class uses string functions internally during file download/upload.
209
-		mbstring_binary_safe_encoding();
210
-
211
-		$bytes_written = fwrite( $temphandle, $contents );
212
-
213
-		if ( false === $bytes_written || strlen( $contents ) !== $bytes_written ) {
214
-			fclose( $temphandle );
215
-			unlink( $tempfile );
216
-
217
-			reset_mbstring_encoding();
218
-
219
-			return false;
220
-		}
221
-
222
-		fseek( $temphandle, 0 ); // Skip back to the start of the file being written to.
223
-
224
-		$ret = $this->ftp->fput( $file, $temphandle );
225
-
226
-		reset_mbstring_encoding();
227
-
228
-		fclose( $temphandle );
229
-		unlink( $tempfile );
230
-
231
-		$this->chmod( $file, $mode );
232
-
233
-		return $ret;
234
-	}
235
-
236
-	/**
237
-	 * Gets the current working directory.
238
-	 *
239
-	 * @since 2.5.0
240
-	 *
241
-	 * @return string|false The current working directory on success, false on failure.
242
-	 */
243
-	public function cwd() {
244
-		$cwd = $this->ftp->pwd();
245
-
246
-		if ( $cwd ) {
247
-			$cwd = trailingslashit( $cwd );
248
-		}
249
-
250
-		return $cwd;
251
-	}
252
-
253
-	/**
254
-	 * Changes current directory.
255
-	 *
256
-	 * @since 2.5.0
257
-	 *
258
-	 * @param string $dir The new current directory.
259
-	 * @return bool True on success, false on failure.
260
-	 */
261
-	public function chdir( $dir ) {
262
-		return $this->ftp->chdir( $dir );
263
-	}
264
-
265
-	/**
266
-	 * Changes filesystem permissions.
267
-	 *
268
-	 * @since 2.5.0
269
-	 *
270
-	 * @param string    $file      Path to the file.
271
-	 * @param int|false $mode      Optional. The permissions as octal number, usually 0644 for files,
272
-	 *                             0755 for directories. Default false.
273
-	 * @param bool      $recursive Optional. If set to true, changes file permissions recursively.
274
-	 *                             Default false.
275
-	 * @return bool True on success, false on failure.
276
-	 */
277
-	public function chmod( $file, $mode = false, $recursive = false ) {
278
-		if ( ! $mode ) {
279
-			if ( $this->is_file( $file ) ) {
280
-				$mode = FS_CHMOD_FILE;
281
-			} elseif ( $this->is_dir( $file ) ) {
282
-				$mode = FS_CHMOD_DIR;
283
-			} else {
284
-				return false;
285
-			}
286
-		}
287
-
288
-		// chmod any sub-objects if recursive.
289
-		if ( $recursive && $this->is_dir( $file ) ) {
290
-			$filelist = $this->dirlist( $file );
291
-
292
-			foreach ( (array) $filelist as $filename => $filemeta ) {
293
-				$this->chmod( $file . '/' . $filename, $mode, $recursive );
294
-			}
295
-		}
296
-
297
-		// chmod the file or directory.
298
-		return $this->ftp->chmod( $file, $mode );
299
-	}
300
-
301
-	/**
302
-	 * Gets the file owner.
303
-	 *
304
-	 * @since 2.5.0
305
-	 *
306
-	 * @param string $file Path to the file.
307
-	 * @return string|false Username of the owner on success, false on failure.
308
-	 */
309
-	public function owner( $file ) {
310
-		$dir = $this->dirlist( $file );
311
-
312
-		return $dir[ $file ]['owner'];
313
-	}
314
-
315
-	/**
316
-	 * Gets the permissions of the specified file or filepath in their octal format.
317
-	 *
318
-	 * @since 2.5.0
319
-	 *
320
-	 * @param string $file Path to the file.
321
-	 * @return string Mode of the file (the last 3 digits).
322
-	 */
323
-	public function getchmod( $file ) {
324
-		$dir = $this->dirlist( $file );
325
-
326
-		return $dir[ $file ]['permsn'];
327
-	}
328
-
329
-	/**
330
-	 * Gets the file's group.
331
-	 *
332
-	 * @since 2.5.0
333
-	 *
334
-	 * @param string $file Path to the file.
335
-	 * @return string|false The group on success, false on failure.
336
-	 */
337
-	public function group( $file ) {
338
-		$dir = $this->dirlist( $file );
339
-
340
-		return $dir[ $file ]['group'];
341
-	}
342
-
343
-	/**
344
-	 * Copies a file.
345
-	 *
346
-	 * @since 2.5.0
347
-	 *
348
-	 * @param string    $source      Path to the source file.
349
-	 * @param string    $destination Path to the destination file.
350
-	 * @param bool      $overwrite   Optional. Whether to overwrite the destination file if it exists.
351
-	 *                               Default false.
352
-	 * @param int|false $mode        Optional. The permissions as octal number, usually 0644 for files,
353
-	 *                               0755 for dirs. Default false.
354
-	 * @return bool True on success, false on failure.
355
-	 */
356
-	public function copy( $source, $destination, $overwrite = false, $mode = false ) {
357
-		if ( ! $overwrite && $this->exists( $destination ) ) {
358
-			return false;
359
-		}
360
-
361
-		$content = $this->get_contents( $source );
362
-
363
-		if ( false === $content ) {
364
-			return false;
365
-		}
366
-
367
-		return $this->put_contents( $destination, $content, $mode );
368
-	}
369
-
370
-	/**
371
-	 * Moves a file.
372
-	 *
373
-	 * @since 2.5.0
374
-	 *
375
-	 * @param string $source      Path to the source file.
376
-	 * @param string $destination Path to the destination file.
377
-	 * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
378
-	 *                            Default false.
379
-	 * @return bool True on success, false on failure.
380
-	 */
381
-	public function move( $source, $destination, $overwrite = false ) {
382
-		return $this->ftp->rename( $source, $destination );
383
-	}
384
-
385
-	/**
386
-	 * Deletes a file or directory.
387
-	 *
388
-	 * @since 2.5.0
389
-	 *
390
-	 * @param string       $file      Path to the file or directory.
391
-	 * @param bool         $recursive Optional. If set to true, deletes files and folders recursively.
392
-	 *                                Default false.
393
-	 * @param string|false $type      Type of resource. 'f' for file, 'd' for directory.
394
-	 *                                Default false.
395
-	 * @return bool True on success, false on failure.
396
-	 */
397
-	public function delete( $file, $recursive = false, $type = false ) {
398
-		if ( empty( $file ) ) {
399
-			return false;
400
-		}
401
-
402
-		if ( 'f' === $type || $this->is_file( $file ) ) {
403
-			return $this->ftp->delete( $file );
404
-		}
405
-
406
-		if ( ! $recursive ) {
407
-			return $this->ftp->rmdir( $file );
408
-		}
409
-
410
-		return $this->ftp->mdel( $file );
411
-	}
412
-
413
-	/**
414
-	 * Checks if a file or directory exists.
415
-	 *
416
-	 * @since 2.5.0
417
-	 *
418
-	 * @param string $file Path to file or directory.
419
-	 * @return bool Whether $file exists or not.
420
-	 */
421
-	public function exists( $file ) {
422
-		$list = $this->ftp->nlist( $file );
423
-
424
-		if ( empty( $list ) && $this->is_dir( $file ) ) {
425
-			return true; // File is an empty directory.
426
-		}
427
-
428
-		return ! empty( $list ); // Empty list = no file, so invert.
429
-		// Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
430
-	}
431
-
432
-	/**
433
-	 * Checks if resource is a file.
434
-	 *
435
-	 * @since 2.5.0
436
-	 *
437
-	 * @param string $file File path.
438
-	 * @return bool Whether $file is a file.
439
-	 */
440
-	public function is_file( $file ) {
441
-		if ( $this->is_dir( $file ) ) {
442
-			return false;
443
-		}
444
-
445
-		if ( $this->exists( $file ) ) {
446
-			return true;
447
-		}
448
-
449
-		return false;
450
-	}
451
-
452
-	/**
453
-	 * Checks if resource is a directory.
454
-	 *
455
-	 * @since 2.5.0
456
-	 *
457
-	 * @param string $path Directory path.
458
-	 * @return bool Whether $path is a directory.
459
-	 */
460
-	public function is_dir( $path ) {
461
-		$cwd = $this->cwd();
462
-
463
-		if ( $this->chdir( $path ) ) {
464
-			$this->chdir( $cwd );
465
-			return true;
466
-		}
467
-
468
-		return false;
469
-	}
470
-
471
-	/**
472
-	 * Checks if a file is readable.
473
-	 *
474
-	 * @since 2.5.0
475
-	 *
476
-	 * @param string $file Path to file.
477
-	 * @return bool Whether $file is readable.
478
-	 */
479
-	public function is_readable( $file ) {
480
-		return true;
481
-	}
482
-
483
-	/**
484
-	 * Checks if a file or directory is writable.
485
-	 *
486
-	 * @since 2.5.0
487
-	 *
488
-	 * @param string $file Path to file or directory.
489
-	 * @return bool Whether $file is writable.
490
-	 */
491
-	public function is_writable( $file ) {
492
-		return true;
493
-	}
494
-
495
-	/**
496
-	 * Gets the file's last access time.
497
-	 *
498
-	 * @since 2.5.0
499
-	 *
500
-	 * @param string $file Path to file.
501
-	 * @return int|false Unix timestamp representing last access time, false on failure.
502
-	 */
503
-	public function atime( $file ) {
504
-		return false;
505
-	}
506
-
507
-	/**
508
-	 * Gets the file modification time.
509
-	 *
510
-	 * @since 2.5.0
511
-	 *
512
-	 * @param string $file Path to file.
513
-	 * @return int|false Unix timestamp representing modification time, false on failure.
514
-	 */
515
-	public function mtime( $file ) {
516
-		return $this->ftp->mdtm( $file );
517
-	}
518
-
519
-	/**
520
-	 * Gets the file size (in bytes).
521
-	 *
522
-	 * @since 2.5.0
523
-	 *
524
-	 * @param string $file Path to file.
525
-	 * @return int|false Size of the file in bytes on success, false on failure.
526
-	 */
527
-	public function size( $file ) {
528
-		return $this->ftp->filesize( $file );
529
-	}
530
-
531
-	/**
532
-	 * Sets the access and modification times of a file.
533
-	 *
534
-	 * Note: If $file doesn't exist, it will be created.
535
-	 *
536
-	 * @since 2.5.0
537
-	 *
538
-	 * @param string $file  Path to file.
539
-	 * @param int    $time  Optional. Modified time to set for file.
540
-	 *                      Default 0.
541
-	 * @param int    $atime Optional. Access time to set for file.
542
-	 *                      Default 0.
543
-	 * @return bool True on success, false on failure.
544
-	 */
545
-	public function touch( $file, $time = 0, $atime = 0 ) {
546
-		return false;
547
-	}
548
-
549
-	/**
550
-	 * Creates a directory.
551
-	 *
552
-	 * @since 2.5.0
553
-	 *
554
-	 * @param string           $path  Path for new directory.
555
-	 * @param int|false        $chmod Optional. The permissions as octal number (or false to skip chmod).
556
-	 *                                Default false.
557
-	 * @param string|int|false $chown Optional. A user name or number (or false to skip chown).
558
-	 *                                Default false.
559
-	 * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
560
-	 *                                Default false.
561
-	 * @return bool True on success, false on failure.
562
-	 */
563
-	public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
564
-		$path = untrailingslashit( $path );
565
-
566
-		if ( empty( $path ) ) {
567
-			return false;
568
-		}
569
-
570
-		if ( ! $this->ftp->mkdir( $path ) ) {
571
-			return false;
572
-		}
573
-
574
-		if ( ! $chmod ) {
575
-			$chmod = FS_CHMOD_DIR;
576
-		}
577
-
578
-		$this->chmod( $path, $chmod );
579
-
580
-		return true;
581
-	}
582
-
583
-	/**
584
-	 * Deletes a directory.
585
-	 *
586
-	 * @since 2.5.0
587
-	 *
588
-	 * @param string $path      Path to directory.
589
-	 * @param bool   $recursive Optional. Whether to recursively remove files/directories.
590
-	 *                          Default false.
591
-	 * @return bool True on success, false on failure.
592
-	 */
593
-	public function rmdir( $path, $recursive = false ) {
594
-		return $this->delete( $path, $recursive );
595
-	}
596
-
597
-	/**
598
-	 * Gets details for files in a directory or a specific file.
599
-	 *
600
-	 * @since 2.5.0
601
-	 *
602
-	 * @param string $path           Path to directory or file.
603
-	 * @param bool   $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
604
-	 *                               Default true.
605
-	 * @param bool   $recursive      Optional. Whether to recursively include file details in nested directories.
606
-	 *                               Default false.
607
-	 * @return array|false {
608
-	 *     Array of files. False if unable to list directory contents.
609
-	 *
610
-	 *     @type string $name        Name of the file or directory.
611
-	 *     @type string $perms       *nix representation of permissions.
612
-	 *     @type string $permsn      Octal representation of permissions.
613
-	 *     @type string $owner       Owner name or ID.
614
-	 *     @type int    $size        Size of file in bytes.
615
-	 *     @type int    $lastmodunix Last modified unix timestamp.
616
-	 *     @type mixed  $lastmod     Last modified month (3 letter) and day (without leading 0).
617
-	 *     @type int    $time        Last modified time.
618
-	 *     @type string $type        Type of resource. 'f' for file, 'd' for directory.
619
-	 *     @type mixed  $files       If a directory and `$recursive` is true, contains another array of files.
620
-	 * }
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 ) . '/';
626
-		} else {
627
-			$limit_file = false;
628
-		}
629
-
630
-		mbstring_binary_safe_encoding();
631
-
632
-		$list = $this->ftp->dirlist( $path );
633
-
634
-		if ( empty( $list ) && ! $this->exists( $path ) ) {
635
-
636
-			reset_mbstring_encoding();
637
-
638
-			return false;
639
-		}
640
-
641
-		$ret = array();
642
-
643
-		foreach ( $list as $struc ) {
644
-
645
-			if ( '.' === $struc['name'] || '..' === $struc['name'] ) {
646
-				continue;
647
-			}
648
-
649
-			if ( ! $include_hidden && '.' === $struc['name'][0] ) {
650
-				continue;
651
-			}
652
-
653
-			if ( $limit_file && $struc['name'] !== $limit_file ) {
654
-				continue;
655
-			}
656
-
657
-			if ( 'd' === $struc['type'] ) {
658
-				if ( $recursive ) {
659
-					$struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
660
-				} else {
661
-					$struc['files'] = array();
662
-				}
663
-			}
664
-
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'] );
668
-			}
669
-
670
-			// Add the octal representation of the file permissions.
671
-			$struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] );
672
-
673
-			$ret[ $struc['name'] ] = $struc;
674
-		}
675
-
676
-		reset_mbstring_encoding();
677
-
678
-		return $ret;
679
-	}
680
-
681
-	/**
682
-	 * Destructor.
683
-	 *
684
-	 * @since 2.5.0
685
-	 */
686
-	public function __destruct() {
687
-		$this->ftp->quit();
688
-	}
18
+    /**
19
+     * @since 2.5.0
20
+     * @var ftp
21
+     */
22
+    public $ftp;
23
+
24
+    /**
25
+     * Constructor.
26
+     *
27
+     * @since 2.5.0
28
+     *
29
+     * @param array $opt
30
+     */
31
+    public function __construct( $opt = '' ) {
32
+        $this->method = 'ftpsockets';
33
+        $this->errors = new WP_Error();
34
+
35
+        // Check if possible to use ftp functions.
36
+        if ( ! include_once ABSPATH . 'wp-admin/includes/class-ftp.php' ) {
37
+            return;
38
+        }
39
+
40
+        $this->ftp = new ftp();
41
+
42
+        if ( empty( $opt['port'] ) ) {
43
+            $this->options['port'] = 21;
44
+        } else {
45
+            $this->options['port'] = (int) $opt['port'];
46
+        }
47
+
48
+        if ( empty( $opt['hostname'] ) ) {
49
+            $this->errors->add( 'empty_hostname', __( 'FTP hostname is required' ) );
50
+        } else {
51
+            $this->options['hostname'] = $opt['hostname'];
52
+        }
53
+
54
+        // Check if the options provided are OK.
55
+        if ( empty( $opt['username'] ) ) {
56
+            $this->errors->add( 'empty_username', __( 'FTP username is required' ) );
57
+        } else {
58
+            $this->options['username'] = $opt['username'];
59
+        }
60
+
61
+        if ( empty( $opt['password'] ) ) {
62
+            $this->errors->add( 'empty_password', __( 'FTP password is required' ) );
63
+        } else {
64
+            $this->options['password'] = $opt['password'];
65
+        }
66
+    }
67
+
68
+    /**
69
+     * Connects filesystem.
70
+     *
71
+     * @since 2.5.0
72
+     *
73
+     * @return bool True on success, false on failure.
74
+     */
75
+    public function connect() {
76
+        if ( ! $this->ftp ) {
77
+            return false;
78
+        }
79
+
80
+        $this->ftp->setTimeout( FS_CONNECT_TIMEOUT );
81
+
82
+        if ( ! $this->ftp->SetServer( $this->options['hostname'], $this->options['port'] ) ) {
83
+            $this->errors->add(
84
+                'connect',
85
+                sprintf(
86
+                    /* translators: %s: hostname:port */
87
+                    __( 'Failed to connect to FTP Server %s' ),
88
+                    $this->options['hostname'] . ':' . $this->options['port']
89
+                )
90
+            );
91
+
92
+            return false;
93
+        }
94
+
95
+        if ( ! $this->ftp->connect() ) {
96
+            $this->errors->add(
97
+                'connect',
98
+                sprintf(
99
+                    /* translators: %s: hostname:port */
100
+                    __( 'Failed to connect to FTP Server %s' ),
101
+                    $this->options['hostname'] . ':' . $this->options['port']
102
+                )
103
+            );
104
+
105
+            return false;
106
+        }
107
+
108
+        if ( ! $this->ftp->login( $this->options['username'], $this->options['password'] ) ) {
109
+            $this->errors->add(
110
+                'auth',
111
+                sprintf(
112
+                    /* translators: %s: Username. */
113
+                    __( 'Username/Password incorrect for %s' ),
114
+                    $this->options['username']
115
+                )
116
+            );
117
+
118
+            return false;
119
+        }
120
+
121
+        $this->ftp->SetType( FTP_BINARY );
122
+        $this->ftp->Passive( true );
123
+        $this->ftp->setTimeout( FS_TIMEOUT );
124
+
125
+        return true;
126
+    }
127
+
128
+    /**
129
+     * Reads entire file into a string.
130
+     *
131
+     * @since 2.5.0
132
+     *
133
+     * @param string $file Name of the file to read.
134
+     * @return string|false Read data on success, false if no temporary file could be opened,
135
+     *                      or if the file couldn't be retrieved.
136
+     */
137
+    public function get_contents( $file ) {
138
+        if ( ! $this->exists( $file ) ) {
139
+            return false;
140
+        }
141
+
142
+        $tempfile   = wp_tempnam( $file );
143
+        $temphandle = fopen( $tempfile, 'w+' );
144
+
145
+        if ( ! $temphandle ) {
146
+            unlink( $tempfile );
147
+            return false;
148
+        }
149
+
150
+        mbstring_binary_safe_encoding();
151
+
152
+        if ( ! $this->ftp->fget( $temphandle, $file ) ) {
153
+            fclose( $temphandle );
154
+            unlink( $tempfile );
155
+
156
+            reset_mbstring_encoding();
157
+
158
+            return ''; // Blank document. File does exist, it's just blank.
159
+        }
160
+
161
+        reset_mbstring_encoding();
162
+
163
+        fseek( $temphandle, 0 ); // Skip back to the start of the file being written to.
164
+        $contents = '';
165
+
166
+        while ( ! feof( $temphandle ) ) {
167
+            $contents .= fread( $temphandle, 8 * KB_IN_BYTES );
168
+        }
169
+
170
+        fclose( $temphandle );
171
+        unlink( $tempfile );
172
+
173
+        return $contents;
174
+    }
175
+
176
+    /**
177
+     * Reads entire file into an array.
178
+     *
179
+     * @since 2.5.0
180
+     *
181
+     * @param string $file Path to the file.
182
+     * @return array|false File contents in an array on success, false on failure.
183
+     */
184
+    public function get_contents_array( $file ) {
185
+        return explode( "\n", $this->get_contents( $file ) );
186
+    }
187
+
188
+    /**
189
+     * Writes a string to a file.
190
+     *
191
+     * @since 2.5.0
192
+     *
193
+     * @param string    $file     Remote path to the file where to write the data.
194
+     * @param string    $contents The data to write.
195
+     * @param int|false $mode     Optional. The file permissions as octal number, usually 0644.
196
+     *                            Default false.
197
+     * @return bool True on success, false on failure.
198
+     */
199
+    public function put_contents( $file, $contents, $mode = false ) {
200
+        $tempfile   = wp_tempnam( $file );
201
+        $temphandle = @fopen( $tempfile, 'w+' );
202
+
203
+        if ( ! $temphandle ) {
204
+            unlink( $tempfile );
205
+            return false;
206
+        }
207
+
208
+        // The FTP class uses string functions internally during file download/upload.
209
+        mbstring_binary_safe_encoding();
210
+
211
+        $bytes_written = fwrite( $temphandle, $contents );
212
+
213
+        if ( false === $bytes_written || strlen( $contents ) !== $bytes_written ) {
214
+            fclose( $temphandle );
215
+            unlink( $tempfile );
216
+
217
+            reset_mbstring_encoding();
218
+
219
+            return false;
220
+        }
221
+
222
+        fseek( $temphandle, 0 ); // Skip back to the start of the file being written to.
223
+
224
+        $ret = $this->ftp->fput( $file, $temphandle );
225
+
226
+        reset_mbstring_encoding();
227
+
228
+        fclose( $temphandle );
229
+        unlink( $tempfile );
230
+
231
+        $this->chmod( $file, $mode );
232
+
233
+        return $ret;
234
+    }
235
+
236
+    /**
237
+     * Gets the current working directory.
238
+     *
239
+     * @since 2.5.0
240
+     *
241
+     * @return string|false The current working directory on success, false on failure.
242
+     */
243
+    public function cwd() {
244
+        $cwd = $this->ftp->pwd();
245
+
246
+        if ( $cwd ) {
247
+            $cwd = trailingslashit( $cwd );
248
+        }
249
+
250
+        return $cwd;
251
+    }
252
+
253
+    /**
254
+     * Changes current directory.
255
+     *
256
+     * @since 2.5.0
257
+     *
258
+     * @param string $dir The new current directory.
259
+     * @return bool True on success, false on failure.
260
+     */
261
+    public function chdir( $dir ) {
262
+        return $this->ftp->chdir( $dir );
263
+    }
264
+
265
+    /**
266
+     * Changes filesystem permissions.
267
+     *
268
+     * @since 2.5.0
269
+     *
270
+     * @param string    $file      Path to the file.
271
+     * @param int|false $mode      Optional. The permissions as octal number, usually 0644 for files,
272
+     *                             0755 for directories. Default false.
273
+     * @param bool      $recursive Optional. If set to true, changes file permissions recursively.
274
+     *                             Default false.
275
+     * @return bool True on success, false on failure.
276
+     */
277
+    public function chmod( $file, $mode = false, $recursive = false ) {
278
+        if ( ! $mode ) {
279
+            if ( $this->is_file( $file ) ) {
280
+                $mode = FS_CHMOD_FILE;
281
+            } elseif ( $this->is_dir( $file ) ) {
282
+                $mode = FS_CHMOD_DIR;
283
+            } else {
284
+                return false;
285
+            }
286
+        }
287
+
288
+        // chmod any sub-objects if recursive.
289
+        if ( $recursive && $this->is_dir( $file ) ) {
290
+            $filelist = $this->dirlist( $file );
291
+
292
+            foreach ( (array) $filelist as $filename => $filemeta ) {
293
+                $this->chmod( $file . '/' . $filename, $mode, $recursive );
294
+            }
295
+        }
296
+
297
+        // chmod the file or directory.
298
+        return $this->ftp->chmod( $file, $mode );
299
+    }
300
+
301
+    /**
302
+     * Gets the file owner.
303
+     *
304
+     * @since 2.5.0
305
+     *
306
+     * @param string $file Path to the file.
307
+     * @return string|false Username of the owner on success, false on failure.
308
+     */
309
+    public function owner( $file ) {
310
+        $dir = $this->dirlist( $file );
311
+
312
+        return $dir[ $file ]['owner'];
313
+    }
314
+
315
+    /**
316
+     * Gets the permissions of the specified file or filepath in their octal format.
317
+     *
318
+     * @since 2.5.0
319
+     *
320
+     * @param string $file Path to the file.
321
+     * @return string Mode of the file (the last 3 digits).
322
+     */
323
+    public function getchmod( $file ) {
324
+        $dir = $this->dirlist( $file );
325
+
326
+        return $dir[ $file ]['permsn'];
327
+    }
328
+
329
+    /**
330
+     * Gets the file's group.
331
+     *
332
+     * @since 2.5.0
333
+     *
334
+     * @param string $file Path to the file.
335
+     * @return string|false The group on success, false on failure.
336
+     */
337
+    public function group( $file ) {
338
+        $dir = $this->dirlist( $file );
339
+
340
+        return $dir[ $file ]['group'];
341
+    }
342
+
343
+    /**
344
+     * Copies a file.
345
+     *
346
+     * @since 2.5.0
347
+     *
348
+     * @param string    $source      Path to the source file.
349
+     * @param string    $destination Path to the destination file.
350
+     * @param bool      $overwrite   Optional. Whether to overwrite the destination file if it exists.
351
+     *                               Default false.
352
+     * @param int|false $mode        Optional. The permissions as octal number, usually 0644 for files,
353
+     *                               0755 for dirs. Default false.
354
+     * @return bool True on success, false on failure.
355
+     */
356
+    public function copy( $source, $destination, $overwrite = false, $mode = false ) {
357
+        if ( ! $overwrite && $this->exists( $destination ) ) {
358
+            return false;
359
+        }
360
+
361
+        $content = $this->get_contents( $source );
362
+
363
+        if ( false === $content ) {
364
+            return false;
365
+        }
366
+
367
+        return $this->put_contents( $destination, $content, $mode );
368
+    }
369
+
370
+    /**
371
+     * Moves a file.
372
+     *
373
+     * @since 2.5.0
374
+     *
375
+     * @param string $source      Path to the source file.
376
+     * @param string $destination Path to the destination file.
377
+     * @param bool   $overwrite   Optional. Whether to overwrite the destination file if it exists.
378
+     *                            Default false.
379
+     * @return bool True on success, false on failure.
380
+     */
381
+    public function move( $source, $destination, $overwrite = false ) {
382
+        return $this->ftp->rename( $source, $destination );
383
+    }
384
+
385
+    /**
386
+     * Deletes a file or directory.
387
+     *
388
+     * @since 2.5.0
389
+     *
390
+     * @param string       $file      Path to the file or directory.
391
+     * @param bool         $recursive Optional. If set to true, deletes files and folders recursively.
392
+     *                                Default false.
393
+     * @param string|false $type      Type of resource. 'f' for file, 'd' for directory.
394
+     *                                Default false.
395
+     * @return bool True on success, false on failure.
396
+     */
397
+    public function delete( $file, $recursive = false, $type = false ) {
398
+        if ( empty( $file ) ) {
399
+            return false;
400
+        }
401
+
402
+        if ( 'f' === $type || $this->is_file( $file ) ) {
403
+            return $this->ftp->delete( $file );
404
+        }
405
+
406
+        if ( ! $recursive ) {
407
+            return $this->ftp->rmdir( $file );
408
+        }
409
+
410
+        return $this->ftp->mdel( $file );
411
+    }
412
+
413
+    /**
414
+     * Checks if a file or directory exists.
415
+     *
416
+     * @since 2.5.0
417
+     *
418
+     * @param string $file Path to file or directory.
419
+     * @return bool Whether $file exists or not.
420
+     */
421
+    public function exists( $file ) {
422
+        $list = $this->ftp->nlist( $file );
423
+
424
+        if ( empty( $list ) && $this->is_dir( $file ) ) {
425
+            return true; // File is an empty directory.
426
+        }
427
+
428
+        return ! empty( $list ); // Empty list = no file, so invert.
429
+        // Return $this->ftp->is_exists($file); has issues with ABOR+426 responses on the ncFTPd server.
430
+    }
431
+
432
+    /**
433
+     * Checks if resource is a file.
434
+     *
435
+     * @since 2.5.0
436
+     *
437
+     * @param string $file File path.
438
+     * @return bool Whether $file is a file.
439
+     */
440
+    public function is_file( $file ) {
441
+        if ( $this->is_dir( $file ) ) {
442
+            return false;
443
+        }
444
+
445
+        if ( $this->exists( $file ) ) {
446
+            return true;
447
+        }
448
+
449
+        return false;
450
+    }
451
+
452
+    /**
453
+     * Checks if resource is a directory.
454
+     *
455
+     * @since 2.5.0
456
+     *
457
+     * @param string $path Directory path.
458
+     * @return bool Whether $path is a directory.
459
+     */
460
+    public function is_dir( $path ) {
461
+        $cwd = $this->cwd();
462
+
463
+        if ( $this->chdir( $path ) ) {
464
+            $this->chdir( $cwd );
465
+            return true;
466
+        }
467
+
468
+        return false;
469
+    }
470
+
471
+    /**
472
+     * Checks if a file is readable.
473
+     *
474
+     * @since 2.5.0
475
+     *
476
+     * @param string $file Path to file.
477
+     * @return bool Whether $file is readable.
478
+     */
479
+    public function is_readable( $file ) {
480
+        return true;
481
+    }
482
+
483
+    /**
484
+     * Checks if a file or directory is writable.
485
+     *
486
+     * @since 2.5.0
487
+     *
488
+     * @param string $file Path to file or directory.
489
+     * @return bool Whether $file is writable.
490
+     */
491
+    public function is_writable( $file ) {
492
+        return true;
493
+    }
494
+
495
+    /**
496
+     * Gets the file's last access time.
497
+     *
498
+     * @since 2.5.0
499
+     *
500
+     * @param string $file Path to file.
501
+     * @return int|false Unix timestamp representing last access time, false on failure.
502
+     */
503
+    public function atime( $file ) {
504
+        return false;
505
+    }
506
+
507
+    /**
508
+     * Gets the file modification time.
509
+     *
510
+     * @since 2.5.0
511
+     *
512
+     * @param string $file Path to file.
513
+     * @return int|false Unix timestamp representing modification time, false on failure.
514
+     */
515
+    public function mtime( $file ) {
516
+        return $this->ftp->mdtm( $file );
517
+    }
518
+
519
+    /**
520
+     * Gets the file size (in bytes).
521
+     *
522
+     * @since 2.5.0
523
+     *
524
+     * @param string $file Path to file.
525
+     * @return int|false Size of the file in bytes on success, false on failure.
526
+     */
527
+    public function size( $file ) {
528
+        return $this->ftp->filesize( $file );
529
+    }
530
+
531
+    /**
532
+     * Sets the access and modification times of a file.
533
+     *
534
+     * Note: If $file doesn't exist, it will be created.
535
+     *
536
+     * @since 2.5.0
537
+     *
538
+     * @param string $file  Path to file.
539
+     * @param int    $time  Optional. Modified time to set for file.
540
+     *                      Default 0.
541
+     * @param int    $atime Optional. Access time to set for file.
542
+     *                      Default 0.
543
+     * @return bool True on success, false on failure.
544
+     */
545
+    public function touch( $file, $time = 0, $atime = 0 ) {
546
+        return false;
547
+    }
548
+
549
+    /**
550
+     * Creates a directory.
551
+     *
552
+     * @since 2.5.0
553
+     *
554
+     * @param string           $path  Path for new directory.
555
+     * @param int|false        $chmod Optional. The permissions as octal number (or false to skip chmod).
556
+     *                                Default false.
557
+     * @param string|int|false $chown Optional. A user name or number (or false to skip chown).
558
+     *                                Default false.
559
+     * @param string|int|false $chgrp Optional. A group name or number (or false to skip chgrp).
560
+     *                                Default false.
561
+     * @return bool True on success, false on failure.
562
+     */
563
+    public function mkdir( $path, $chmod = false, $chown = false, $chgrp = false ) {
564
+        $path = untrailingslashit( $path );
565
+
566
+        if ( empty( $path ) ) {
567
+            return false;
568
+        }
569
+
570
+        if ( ! $this->ftp->mkdir( $path ) ) {
571
+            return false;
572
+        }
573
+
574
+        if ( ! $chmod ) {
575
+            $chmod = FS_CHMOD_DIR;
576
+        }
577
+
578
+        $this->chmod( $path, $chmod );
579
+
580
+        return true;
581
+    }
582
+
583
+    /**
584
+     * Deletes a directory.
585
+     *
586
+     * @since 2.5.0
587
+     *
588
+     * @param string $path      Path to directory.
589
+     * @param bool   $recursive Optional. Whether to recursively remove files/directories.
590
+     *                          Default false.
591
+     * @return bool True on success, false on failure.
592
+     */
593
+    public function rmdir( $path, $recursive = false ) {
594
+        return $this->delete( $path, $recursive );
595
+    }
596
+
597
+    /**
598
+     * Gets details for files in a directory or a specific file.
599
+     *
600
+     * @since 2.5.0
601
+     *
602
+     * @param string $path           Path to directory or file.
603
+     * @param bool   $include_hidden Optional. Whether to include details of hidden ("." prefixed) files.
604
+     *                               Default true.
605
+     * @param bool   $recursive      Optional. Whether to recursively include file details in nested directories.
606
+     *                               Default false.
607
+     * @return array|false {
608
+     *     Array of files. False if unable to list directory contents.
609
+     *
610
+     *     @type string $name        Name of the file or directory.
611
+     *     @type string $perms       *nix representation of permissions.
612
+     *     @type string $permsn      Octal representation of permissions.
613
+     *     @type string $owner       Owner name or ID.
614
+     *     @type int    $size        Size of file in bytes.
615
+     *     @type int    $lastmodunix Last modified unix timestamp.
616
+     *     @type mixed  $lastmod     Last modified month (3 letter) and day (without leading 0).
617
+     *     @type int    $time        Last modified time.
618
+     *     @type string $type        Type of resource. 'f' for file, 'd' for directory.
619
+     *     @type mixed  $files       If a directory and `$recursive` is true, contains another array of files.
620
+     * }
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 ) . '/';
626
+        } else {
627
+            $limit_file = false;
628
+        }
629
+
630
+        mbstring_binary_safe_encoding();
631
+
632
+        $list = $this->ftp->dirlist( $path );
633
+
634
+        if ( empty( $list ) && ! $this->exists( $path ) ) {
635
+
636
+            reset_mbstring_encoding();
637
+
638
+            return false;
639
+        }
640
+
641
+        $ret = array();
642
+
643
+        foreach ( $list as $struc ) {
644
+
645
+            if ( '.' === $struc['name'] || '..' === $struc['name'] ) {
646
+                continue;
647
+            }
648
+
649
+            if ( ! $include_hidden && '.' === $struc['name'][0] ) {
650
+                continue;
651
+            }
652
+
653
+            if ( $limit_file && $struc['name'] !== $limit_file ) {
654
+                continue;
655
+            }
656
+
657
+            if ( 'd' === $struc['type'] ) {
658
+                if ( $recursive ) {
659
+                    $struc['files'] = $this->dirlist( $path . '/' . $struc['name'], $include_hidden, $recursive );
660
+                } else {
661
+                    $struc['files'] = array();
662
+                }
663
+            }
664
+
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'] );
668
+            }
669
+
670
+            // Add the octal representation of the file permissions.
671
+            $struc['permsn'] = $this->getnumchmodfromh( $struc['perms'] );
672
+
673
+            $ret[ $struc['name'] ] = $struc;
674
+        }
675
+
676
+        reset_mbstring_encoding();
677
+
678
+        return $ret;
679
+    }
680
+
681
+    /**
682
+     * Destructor.
683
+     *
684
+     * @since 2.5.0
685
+     */
686
+    public function __destruct() {
687
+        $this->ftp->quit();
688
+    }
689 689
 }
Please login to merge, or discard this patch.
Spacing   +129 added lines, -129 removed lines patch added patch discarded remove patch
@@ -28,38 +28,38 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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();
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-wp-terms-list-table.php 2 patches
Indentation   +650 added lines, -650 removed lines patch added patch discarded remove patch
@@ -17,639 +17,639 @@  discard block
 block discarded – undo
17 17
  */
18 18
 class WP_Terms_List_Table extends WP_List_Table {
19 19
 
20
-	public $callback_args;
21
-
22
-	private $level;
23
-
24
-	/**
25
-	 * Constructor.
26
-	 *
27
-	 * @since 3.1.0
28
-	 *
29
-	 * @see WP_List_Table::__construct() for more information on default arguments.
30
-	 *
31
-	 * @global string $post_type
32
-	 * @global string $taxonomy
33
-	 * @global string $action
34
-	 * @global object $tax
35
-	 *
36
-	 * @param array $args An associative array of arguments.
37
-	 */
38
-	public function __construct( $args = array() ) {
39
-		global $post_type, $taxonomy, $action, $tax;
40
-
41
-		parent::__construct(
42
-			array(
43
-				'plural'   => 'tags',
44
-				'singular' => 'tag',
45
-				'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
46
-			)
47
-		);
48
-
49
-		$action    = $this->screen->action;
50
-		$post_type = $this->screen->post_type;
51
-		$taxonomy  = $this->screen->taxonomy;
52
-
53
-		if ( empty( $taxonomy ) ) {
54
-			$taxonomy = 'post_tag';
55
-		}
56
-
57
-		if ( ! taxonomy_exists( $taxonomy ) ) {
58
-			wp_die( __( 'Invalid taxonomy.' ) );
59
-		}
60
-
61
-		$tax = get_taxonomy( $taxonomy );
62
-
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 ) ) {
65
-			$post_type = 'post';
66
-		}
67
-
68
-	}
69
-
70
-	/**
71
-	 * @return bool
72
-	 */
73
-	public function ajax_user_can() {
74
-		return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
75
-	}
76
-
77
-	/**
78
-	 */
79
-	public function prepare_items() {
80
-		$taxonomy = $this->screen->taxonomy;
81
-
82
-		$tags_per_page = $this->get_items_per_page( "edit_{$taxonomy}_per_page" );
83
-
84
-		if ( 'post_tag' === $taxonomy ) {
85
-			/**
86
-			 * Filters the number of terms displayed per page for the Tags list table.
87
-			 *
88
-			 * @since 2.8.0
89
-			 *
90
-			 * @param int $tags_per_page Number of tags to be displayed. Default 20.
91
-			 */
92
-			$tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
93
-
94
-			/**
95
-			 * Filters the number of terms displayed per page for the Tags list table.
96
-			 *
97
-			 * @since 2.7.0
98
-			 * @deprecated 2.8.0 Use {@see 'edit_tags_per_page'} instead.
99
-			 *
100
-			 * @param int $tags_per_page Number of tags to be displayed. Default 20.
101
-			 */
102
-			$tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' );
103
-		} elseif ( 'category' === $taxonomy ) {
104
-			/**
105
-			 * Filters the number of terms displayed per page for the Categories list table.
106
-			 *
107
-			 * @since 2.8.0
108
-			 *
109
-			 * @param int $tags_per_page Number of categories to be displayed. Default 20.
110
-			 */
111
-			$tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page );
112
-		}
113
-
114
-		$search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
115
-
116
-		$args = array(
117
-			'taxonomy'   => $taxonomy,
118
-			'search'     => $search,
119
-			'page'       => $this->get_pagenum(),
120
-			'number'     => $tags_per_page,
121
-			'hide_empty' => 0,
122
-		);
123
-
124
-		if ( ! empty( $_REQUEST['orderby'] ) ) {
125
-			$args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
126
-		}
127
-
128
-		if ( ! empty( $_REQUEST['order'] ) ) {
129
-			$args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
130
-		}
131
-
132
-		$args['offset'] = ( $args['page'] - 1 ) * $args['number'];
133
-
134
-		// Save the values because 'number' and 'offset' can be subsequently overridden.
135
-		$this->callback_args = $args;
136
-
137
-		if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
138
-			// We'll need the full set of terms then.
139
-			$args['number'] = 0;
140
-			$args['offset'] = $args['number'];
141
-		}
142
-
143
-		$this->items = get_terms( $args );
144
-
145
-		$this->set_pagination_args(
146
-			array(
147
-				'total_items' => wp_count_terms(
148
-					array(
149
-						'taxonomy' => $taxonomy,
150
-						'search'   => $search,
151
-					)
152
-				),
153
-				'per_page'    => $tags_per_page,
154
-			)
155
-		);
156
-	}
157
-
158
-	/**
159
-	 */
160
-	public function no_items() {
161
-		echo get_taxonomy( $this->screen->taxonomy )->labels->not_found;
162
-	}
163
-
164
-	/**
165
-	 * @return array
166
-	 */
167
-	protected function get_bulk_actions() {
168
-		$actions = array();
169
-
170
-		if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) ) {
171
-			$actions['delete'] = __( 'Delete' );
172
-		}
173
-
174
-		return $actions;
175
-	}
176
-
177
-	/**
178
-	 * @return string
179
-	 */
180
-	public function current_action() {
181
-		if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && 'delete' === $_REQUEST['action'] ) {
182
-			return 'bulk-delete';
183
-		}
184
-
185
-		return parent::current_action();
186
-	}
187
-
188
-	/**
189
-	 * @return array
190
-	 */
191
-	public function get_columns() {
192
-		$columns = array(
193
-			'cb'          => '<input type="checkbox" />',
194
-			'name'        => _x( 'Name', 'term name' ),
195
-			'description' => __( 'Description' ),
196
-			'slug'        => __( 'Slug' ),
197
-		);
198
-
199
-		if ( 'link_category' === $this->screen->taxonomy ) {
200
-			$columns['links'] = __( 'Links' );
201
-		} else {
202
-			$columns['posts'] = _x( 'Count', 'Number/count of items' );
203
-		}
204
-
205
-		return $columns;
206
-	}
207
-
208
-	/**
209
-	 * @return array
210
-	 */
211
-	protected function get_sortable_columns() {
212
-		return array(
213
-			'name'        => 'name',
214
-			'description' => 'description',
215
-			'slug'        => 'slug',
216
-			'posts'       => 'count',
217
-			'links'       => 'count',
218
-		);
219
-	}
220
-
221
-	/**
222
-	 */
223
-	public function display_rows_or_placeholder() {
224
-		$taxonomy = $this->screen->taxonomy;
225
-
226
-		$number = $this->callback_args['number'];
227
-		$offset = $this->callback_args['offset'];
228
-
229
-		// Convert it to table rows.
230
-		$count = 0;
231
-
232
-		if ( empty( $this->items ) || ! is_array( $this->items ) ) {
233
-			echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
234
-			$this->no_items();
235
-			echo '</td></tr>';
236
-			return;
237
-		}
238
-
239
-		if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $this->callback_args['orderby'] ) ) {
240
-			if ( ! empty( $this->callback_args['search'] ) ) {// Ignore children on searches.
241
-				$children = array();
242
-			} else {
243
-				$children = _get_term_hierarchy( $taxonomy );
244
-			}
245
-
246
-			/*
20
+    public $callback_args;
21
+
22
+    private $level;
23
+
24
+    /**
25
+     * Constructor.
26
+     *
27
+     * @since 3.1.0
28
+     *
29
+     * @see WP_List_Table::__construct() for more information on default arguments.
30
+     *
31
+     * @global string $post_type
32
+     * @global string $taxonomy
33
+     * @global string $action
34
+     * @global object $tax
35
+     *
36
+     * @param array $args An associative array of arguments.
37
+     */
38
+    public function __construct( $args = array() ) {
39
+        global $post_type, $taxonomy, $action, $tax;
40
+
41
+        parent::__construct(
42
+            array(
43
+                'plural'   => 'tags',
44
+                'singular' => 'tag',
45
+                'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
46
+            )
47
+        );
48
+
49
+        $action    = $this->screen->action;
50
+        $post_type = $this->screen->post_type;
51
+        $taxonomy  = $this->screen->taxonomy;
52
+
53
+        if ( empty( $taxonomy ) ) {
54
+            $taxonomy = 'post_tag';
55
+        }
56
+
57
+        if ( ! taxonomy_exists( $taxonomy ) ) {
58
+            wp_die( __( 'Invalid taxonomy.' ) );
59
+        }
60
+
61
+        $tax = get_taxonomy( $taxonomy );
62
+
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 ) ) {
65
+            $post_type = 'post';
66
+        }
67
+
68
+    }
69
+
70
+    /**
71
+     * @return bool
72
+     */
73
+    public function ajax_user_can() {
74
+        return current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->manage_terms );
75
+    }
76
+
77
+    /**
78
+     */
79
+    public function prepare_items() {
80
+        $taxonomy = $this->screen->taxonomy;
81
+
82
+        $tags_per_page = $this->get_items_per_page( "edit_{$taxonomy}_per_page" );
83
+
84
+        if ( 'post_tag' === $taxonomy ) {
85
+            /**
86
+             * Filters the number of terms displayed per page for the Tags list table.
87
+             *
88
+             * @since 2.8.0
89
+             *
90
+             * @param int $tags_per_page Number of tags to be displayed. Default 20.
91
+             */
92
+            $tags_per_page = apply_filters( 'edit_tags_per_page', $tags_per_page );
93
+
94
+            /**
95
+             * Filters the number of terms displayed per page for the Tags list table.
96
+             *
97
+             * @since 2.7.0
98
+             * @deprecated 2.8.0 Use {@see 'edit_tags_per_page'} instead.
99
+             *
100
+             * @param int $tags_per_page Number of tags to be displayed. Default 20.
101
+             */
102
+            $tags_per_page = apply_filters_deprecated( 'tagsperpage', array( $tags_per_page ), '2.8.0', 'edit_tags_per_page' );
103
+        } elseif ( 'category' === $taxonomy ) {
104
+            /**
105
+             * Filters the number of terms displayed per page for the Categories list table.
106
+             *
107
+             * @since 2.8.0
108
+             *
109
+             * @param int $tags_per_page Number of categories to be displayed. Default 20.
110
+             */
111
+            $tags_per_page = apply_filters( 'edit_categories_per_page', $tags_per_page );
112
+        }
113
+
114
+        $search = ! empty( $_REQUEST['s'] ) ? trim( wp_unslash( $_REQUEST['s'] ) ) : '';
115
+
116
+        $args = array(
117
+            'taxonomy'   => $taxonomy,
118
+            'search'     => $search,
119
+            'page'       => $this->get_pagenum(),
120
+            'number'     => $tags_per_page,
121
+            'hide_empty' => 0,
122
+        );
123
+
124
+        if ( ! empty( $_REQUEST['orderby'] ) ) {
125
+            $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) );
126
+        }
127
+
128
+        if ( ! empty( $_REQUEST['order'] ) ) {
129
+            $args['order'] = trim( wp_unslash( $_REQUEST['order'] ) );
130
+        }
131
+
132
+        $args['offset'] = ( $args['page'] - 1 ) * $args['number'];
133
+
134
+        // Save the values because 'number' and 'offset' can be subsequently overridden.
135
+        $this->callback_args = $args;
136
+
137
+        if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) {
138
+            // We'll need the full set of terms then.
139
+            $args['number'] = 0;
140
+            $args['offset'] = $args['number'];
141
+        }
142
+
143
+        $this->items = get_terms( $args );
144
+
145
+        $this->set_pagination_args(
146
+            array(
147
+                'total_items' => wp_count_terms(
148
+                    array(
149
+                        'taxonomy' => $taxonomy,
150
+                        'search'   => $search,
151
+                    )
152
+                ),
153
+                'per_page'    => $tags_per_page,
154
+            )
155
+        );
156
+    }
157
+
158
+    /**
159
+     */
160
+    public function no_items() {
161
+        echo get_taxonomy( $this->screen->taxonomy )->labels->not_found;
162
+    }
163
+
164
+    /**
165
+     * @return array
166
+     */
167
+    protected function get_bulk_actions() {
168
+        $actions = array();
169
+
170
+        if ( current_user_can( get_taxonomy( $this->screen->taxonomy )->cap->delete_terms ) ) {
171
+            $actions['delete'] = __( 'Delete' );
172
+        }
173
+
174
+        return $actions;
175
+    }
176
+
177
+    /**
178
+     * @return string
179
+     */
180
+    public function current_action() {
181
+        if ( isset( $_REQUEST['action'] ) && isset( $_REQUEST['delete_tags'] ) && 'delete' === $_REQUEST['action'] ) {
182
+            return 'bulk-delete';
183
+        }
184
+
185
+        return parent::current_action();
186
+    }
187
+
188
+    /**
189
+     * @return array
190
+     */
191
+    public function get_columns() {
192
+        $columns = array(
193
+            'cb'          => '<input type="checkbox" />',
194
+            'name'        => _x( 'Name', 'term name' ),
195
+            'description' => __( 'Description' ),
196
+            'slug'        => __( 'Slug' ),
197
+        );
198
+
199
+        if ( 'link_category' === $this->screen->taxonomy ) {
200
+            $columns['links'] = __( 'Links' );
201
+        } else {
202
+            $columns['posts'] = _x( 'Count', 'Number/count of items' );
203
+        }
204
+
205
+        return $columns;
206
+    }
207
+
208
+    /**
209
+     * @return array
210
+     */
211
+    protected function get_sortable_columns() {
212
+        return array(
213
+            'name'        => 'name',
214
+            'description' => 'description',
215
+            'slug'        => 'slug',
216
+            'posts'       => 'count',
217
+            'links'       => 'count',
218
+        );
219
+    }
220
+
221
+    /**
222
+     */
223
+    public function display_rows_or_placeholder() {
224
+        $taxonomy = $this->screen->taxonomy;
225
+
226
+        $number = $this->callback_args['number'];
227
+        $offset = $this->callback_args['offset'];
228
+
229
+        // Convert it to table rows.
230
+        $count = 0;
231
+
232
+        if ( empty( $this->items ) || ! is_array( $this->items ) ) {
233
+            echo '<tr class="no-items"><td class="colspanchange" colspan="' . $this->get_column_count() . '">';
234
+            $this->no_items();
235
+            echo '</td></tr>';
236
+            return;
237
+        }
238
+
239
+        if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $this->callback_args['orderby'] ) ) {
240
+            if ( ! empty( $this->callback_args['search'] ) ) {// Ignore children on searches.
241
+                $children = array();
242
+            } else {
243
+                $children = _get_term_hierarchy( $taxonomy );
244
+            }
245
+
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 );
251
-		} else {
252
-			foreach ( $this->items as $term ) {
253
-				$this->single_row( $term );
254
-			}
255
-		}
256
-	}
257
-
258
-	/**
259
-	 * @param string $taxonomy
260
-	 * @param array  $terms
261
-	 * @param array  $children
262
-	 * @param int    $start
263
-	 * @param int    $per_page
264
-	 * @param int    $count
265
-	 * @param int    $parent_term
266
-	 * @param int    $level
267
-	 */
268
-	private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent_term = 0, $level = 0 ) {
269
-
270
-		$end = $start + $per_page;
271
-
272
-		foreach ( $terms as $key => $term ) {
273
-
274
-			if ( $count >= $end ) {
275
-				break;
276
-			}
277
-
278
-			if ( $term->parent !== $parent_term && empty( $_REQUEST['s'] ) ) {
279
-				continue;
280
-			}
281
-
282
-			// If the page starts in a subtree, print the parents.
283
-			if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
284
-				$my_parents = array();
285
-				$parent_ids = array();
286
-				$p          = $term->parent;
287
-
288
-				while ( $p ) {
289
-					$my_parent    = get_term( $p, $taxonomy );
290
-					$my_parents[] = $my_parent;
291
-					$p            = $my_parent->parent;
292
-
293
-					if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops.
294
-						break;
295
-					}
296
-
297
-					$parent_ids[] = $p;
298
-				}
299
-
300
-				unset( $parent_ids );
301
-
302
-				$num_parents = count( $my_parents );
303
-
304
-				while ( $my_parent = array_pop( $my_parents ) ) {
305
-					echo "\t";
306
-					$this->single_row( $my_parent, $level - $num_parents );
307
-					$num_parents--;
308
-				}
309
-			}
310
-
311
-			if ( $count >= $start ) {
312
-				echo "\t";
313
-				$this->single_row( $term, $level );
314
-			}
315
-
316
-			++$count;
317
-
318
-			unset( $terms[ $key ] );
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 );
322
-			}
323
-		}
324
-	}
325
-
326
-	/**
327
-	 * @global string $taxonomy
328
-	 * @param WP_Term $tag   Term object.
329
-	 * @param int     $level
330
-	 */
331
-	public function single_row( $tag, $level = 0 ) {
332
-		global $taxonomy;
333
-		$tag = sanitize_term( $tag, $taxonomy );
334
-
335
-		$this->level = $level;
336
-
337
-		if ( $tag->parent ) {
338
-			$count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) );
339
-			$level = 'level-' . $count;
340
-		} else {
341
-			$level = 'level-0';
342
-		}
343
-
344
-		echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">';
345
-		$this->single_row_columns( $tag );
346
-		echo '</tr>';
347
-	}
348
-
349
-	/**
350
-	 * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
351
-	 *
352
-	 * @param WP_Term $item Term object.
353
-	 * @return string
354
-	 */
355
-	public function column_cb( $item ) {
356
-		// Restores the more descriptive, specific name for use within this method.
357
-		$tag = $item;
358
-
359
-		if ( current_user_can( 'delete_term', $tag->term_id ) ) {
360
-			return sprintf(
361
-				'<label class="screen-reader-text" for="cb-select-%1$s">%2$s</label>' .
362
-				'<input type="checkbox" name="delete_tags[]" value="%1$s" id="cb-select-%1$s" />',
363
-				$tag->term_id,
364
-				/* translators: %s: Taxonomy term name. */
365
-				sprintf( __( 'Select %s' ), $tag->name )
366
-			);
367
-		}
368
-
369
-		return '&nbsp;';
370
-	}
371
-
372
-	/**
373
-	 * @param WP_Term $tag Term object.
374
-	 * @return string
375
-	 */
376
-	public function column_name( $tag ) {
377
-		$taxonomy = $this->screen->taxonomy;
378
-
379
-		$pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
380
-
381
-		/**
382
-		 * Filters display of the term name in the terms list table.
383
-		 *
384
-		 * The default output may include padding due to the term's
385
-		 * current level in the term hierarchy.
386
-		 *
387
-		 * @since 2.5.0
388
-		 *
389
-		 * @see WP_Terms_List_Table::column_name()
390
-		 *
391
-		 * @param string $pad_tag_name The term name, padded if not top-level.
392
-		 * @param WP_Term $tag         Term object.
393
-		 */
394
-		$name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
395
-
396
-		$qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
397
-
398
-		$uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
399
-
400
-		$edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type );
401
-
402
-		if ( $edit_link ) {
403
-			$edit_link = add_query_arg(
404
-				'wp_http_referer',
405
-				urlencode( wp_unslash( $uri ) ),
406
-				$edit_link
407
-			);
408
-			$name      = sprintf(
409
-				'<a class="row-title" href="%s" aria-label="%s">%s</a>',
410
-				esc_url( $edit_link ),
411
-				/* translators: %s: Taxonomy term name. */
412
-				esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
413
-				$name
414
-			);
415
-		}
416
-
417
-		$out = sprintf(
418
-			'<strong>%s</strong><br />',
419
-			$name
420
-		);
421
-
422
-		$out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
423
-		$out .= '<div class="name">' . $qe_data->name . '</div>';
424
-
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>';
427
-		$out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
428
-
429
-		return $out;
430
-	}
431
-
432
-	/**
433
-	 * Gets the name of the default primary column.
434
-	 *
435
-	 * @since 4.3.0
436
-	 *
437
-	 * @return string Name of the default primary column, in this case, 'name'.
438
-	 */
439
-	protected function get_default_primary_column_name() {
440
-		return 'name';
441
-	}
442
-
443
-	/**
444
-	 * Generates and displays row action links.
445
-	 *
446
-	 * @since 4.3.0
447
-	 * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
448
-	 *
449
-	 * @param WP_Term $item        Tag being acted upon.
450
-	 * @param string  $column_name Current column name.
451
-	 * @param string  $primary     Primary column name.
452
-	 * @return string Row actions output for terms, or an empty string
453
-	 *                if the current column is not the primary column.
454
-	 */
455
-	protected function handle_row_actions( $item, $column_name, $primary ) {
456
-		if ( $primary !== $column_name ) {
457
-			return '';
458
-		}
459
-
460
-		// Restores the more descriptive, specific name for use within this method.
461
-		$tag      = $item;
462
-		$taxonomy = $this->screen->taxonomy;
463
-		$tax      = get_taxonomy( $taxonomy );
464
-		$uri      = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
465
-
466
-		$edit_link = add_query_arg(
467
-			'wp_http_referer',
468
-			urlencode( wp_unslash( $uri ) ),
469
-			get_edit_term_link( $tag, $taxonomy, $this->screen->post_type )
470
-		);
471
-
472
-		$actions = array();
473
-
474
-		if ( current_user_can( 'edit_term', $tag->term_id ) ) {
475
-			$actions['edit'] = sprintf(
476
-				'<a href="%s" aria-label="%s">%s</a>',
477
-				esc_url( $edit_link ),
478
-				/* translators: %s: Taxonomy term name. */
479
-				esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
480
-				__( 'Edit' )
481
-			);
482
-			$actions['inline hide-if-no-js'] = sprintf(
483
-				'<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
484
-				/* translators: %s: Taxonomy term name. */
485
-				esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
486
-				__( 'Quick&nbsp;Edit' )
487
-			);
488
-		}
489
-
490
-		if ( current_user_can( 'delete_term', $tag->term_id ) ) {
491
-			$actions['delete'] = sprintf(
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&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ),
494
-				/* translators: %s: Taxonomy term name. */
495
-				esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
496
-				__( 'Delete' )
497
-			);
498
-		}
499
-
500
-		if ( is_taxonomy_viewable( $tax ) ) {
501
-			$actions['view'] = sprintf(
502
-				'<a href="%s" aria-label="%s">%s</a>',
503
-				get_term_link( $tag ),
504
-				/* translators: %s: Taxonomy term name. */
505
-				esc_attr( sprintf( __( 'View &#8220;%s&#8221; archive' ), $tag->name ) ),
506
-				__( 'View' )
507
-			);
508
-		}
509
-
510
-		/**
511
-		 * Filters the action links displayed for each term in the Tags list table.
512
-		 *
513
-		 * @since 2.8.0
514
-		 * @since 3.0.0 Deprecated in favor of {@see '{$taxonomy}_row_actions'} filter.
515
-		 * @since 5.4.2 Restored (un-deprecated).
516
-		 *
517
-		 * @param string[] $actions An array of action links to be displayed. Default
518
-		 *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
519
-		 * @param WP_Term  $tag     Term object.
520
-		 */
521
-		$actions = apply_filters( 'tag_row_actions', $actions, $tag );
522
-
523
-		/**
524
-		 * Filters the action links displayed for each term in the terms list table.
525
-		 *
526
-		 * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
527
-		 *
528
-		 * Possible hook names include:
529
-		 *
530
-		 *  - `category_row_actions`
531
-		 *  - `post_tag_row_actions`
532
-		 *
533
-		 * @since 3.0.0
534
-		 *
535
-		 * @param string[] $actions An array of action links to be displayed. Default
536
-		 *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
537
-		 * @param WP_Term  $tag     Term object.
538
-		 */
539
-		$actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
540
-
541
-		return $this->row_actions( $actions );
542
-	}
543
-
544
-	/**
545
-	 * @param WP_Term $tag Term object.
546
-	 * @return string
547
-	 */
548
-	public function column_description( $tag ) {
549
-		if ( $tag->description ) {
550
-			return $tag->description;
551
-		} else {
552
-			return '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . __( 'No description' ) . '</span>';
553
-		}
554
-	}
555
-
556
-	/**
557
-	 * @param WP_Term $tag Term object.
558
-	 * @return string
559
-	 */
560
-	public function column_slug( $tag ) {
561
-		/** This filter is documented in wp-admin/edit-tag-form.php */
562
-		return apply_filters( 'editable_slug', $tag->slug, $tag );
563
-	}
564
-
565
-	/**
566
-	 * @param WP_Term $tag Term object.
567
-	 * @return string
568
-	 */
569
-	public function column_posts( $tag ) {
570
-		$count = number_format_i18n( $tag->count );
571
-
572
-		$tax = get_taxonomy( $this->screen->taxonomy );
573
-
574
-		$ptype_object = get_post_type_object( $this->screen->post_type );
575
-		if ( ! $ptype_object->show_ui ) {
576
-			return $count;
577
-		}
578
-
579
-		if ( $tax->query_var ) {
580
-			$args = array( $tax->query_var => $tag->slug );
581
-		} else {
582
-			$args = array(
583
-				'taxonomy' => $tax->name,
584
-				'term'     => $tag->slug,
585
-			);
586
-		}
587
-
588
-		if ( 'post' !== $this->screen->post_type ) {
589
-			$args['post_type'] = $this->screen->post_type;
590
-		}
591
-
592
-		if ( 'attachment' === $this->screen->post_type ) {
593
-			return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
594
-		}
595
-
596
-		return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
597
-	}
598
-
599
-	/**
600
-	 * @param WP_Term $tag Term object.
601
-	 * @return string
602
-	 */
603
-	public function column_links( $tag ) {
604
-		$count = number_format_i18n( $tag->count );
605
-
606
-		if ( $count ) {
607
-			$count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
608
-		}
609
-
610
-		return $count;
611
-	}
612
-
613
-	/**
614
-	 * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
615
-	 *
616
-	 * @param WP_Term $item        Term object.
617
-	 * @param string  $column_name Name of the column.
618
-	 * @return string
619
-	 */
620
-	public function column_default( $item, $column_name ) {
621
-		/**
622
-		 * Filters the displayed columns in the terms list table.
623
-		 *
624
-		 * The dynamic portion of the hook name, `$this->screen->taxonomy`,
625
-		 * refers to the slug of the current taxonomy.
626
-		 *
627
-		 * Possible hook names include:
628
-		 *
629
-		 *  - `manage_category_custom_column`
630
-		 *  - `manage_post_tag_custom_column`
631
-		 *
632
-		 * @since 2.8.0
633
-		 *
634
-		 * @param string $string      Custom column output. Default empty.
635
-		 * @param string $column_name Name of the column.
636
-		 * @param int    $term_id     Term ID.
637
-		 */
638
-		return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id );
639
-	}
640
-
641
-	/**
642
-	 * Outputs the hidden row displayed when inline editing
643
-	 *
644
-	 * @since 3.1.0
645
-	 */
646
-	public function inline_edit() {
647
-		$tax = get_taxonomy( $this->screen->taxonomy );
648
-
649
-		if ( ! current_user_can( $tax->cap->edit_terms ) ) {
650
-			return;
651
-		}
652
-		?>
250
+            $this->_rows( $taxonomy, $this->items, $children, $offset, $number, $count );
251
+        } else {
252
+            foreach ( $this->items as $term ) {
253
+                $this->single_row( $term );
254
+            }
255
+        }
256
+    }
257
+
258
+    /**
259
+     * @param string $taxonomy
260
+     * @param array  $terms
261
+     * @param array  $children
262
+     * @param int    $start
263
+     * @param int    $per_page
264
+     * @param int    $count
265
+     * @param int    $parent_term
266
+     * @param int    $level
267
+     */
268
+    private function _rows( $taxonomy, $terms, &$children, $start, $per_page, &$count, $parent_term = 0, $level = 0 ) {
269
+
270
+        $end = $start + $per_page;
271
+
272
+        foreach ( $terms as $key => $term ) {
273
+
274
+            if ( $count >= $end ) {
275
+                break;
276
+            }
277
+
278
+            if ( $term->parent !== $parent_term && empty( $_REQUEST['s'] ) ) {
279
+                continue;
280
+            }
281
+
282
+            // If the page starts in a subtree, print the parents.
283
+            if ( $count === $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) {
284
+                $my_parents = array();
285
+                $parent_ids = array();
286
+                $p          = $term->parent;
287
+
288
+                while ( $p ) {
289
+                    $my_parent    = get_term( $p, $taxonomy );
290
+                    $my_parents[] = $my_parent;
291
+                    $p            = $my_parent->parent;
292
+
293
+                    if ( in_array( $p, $parent_ids, true ) ) { // Prevent parent loops.
294
+                        break;
295
+                    }
296
+
297
+                    $parent_ids[] = $p;
298
+                }
299
+
300
+                unset( $parent_ids );
301
+
302
+                $num_parents = count( $my_parents );
303
+
304
+                while ( $my_parent = array_pop( $my_parents ) ) {
305
+                    echo "\t";
306
+                    $this->single_row( $my_parent, $level - $num_parents );
307
+                    $num_parents--;
308
+                }
309
+            }
310
+
311
+            if ( $count >= $start ) {
312
+                echo "\t";
313
+                $this->single_row( $term, $level );
314
+            }
315
+
316
+            ++$count;
317
+
318
+            unset( $terms[ $key ] );
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 );
322
+            }
323
+        }
324
+    }
325
+
326
+    /**
327
+     * @global string $taxonomy
328
+     * @param WP_Term $tag   Term object.
329
+     * @param int     $level
330
+     */
331
+    public function single_row( $tag, $level = 0 ) {
332
+        global $taxonomy;
333
+        $tag = sanitize_term( $tag, $taxonomy );
334
+
335
+        $this->level = $level;
336
+
337
+        if ( $tag->parent ) {
338
+            $count = count( get_ancestors( $tag->term_id, $taxonomy, 'taxonomy' ) );
339
+            $level = 'level-' . $count;
340
+        } else {
341
+            $level = 'level-0';
342
+        }
343
+
344
+        echo '<tr id="tag-' . $tag->term_id . '" class="' . $level . '">';
345
+        $this->single_row_columns( $tag );
346
+        echo '</tr>';
347
+    }
348
+
349
+    /**
350
+     * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
351
+     *
352
+     * @param WP_Term $item Term object.
353
+     * @return string
354
+     */
355
+    public function column_cb( $item ) {
356
+        // Restores the more descriptive, specific name for use within this method.
357
+        $tag = $item;
358
+
359
+        if ( current_user_can( 'delete_term', $tag->term_id ) ) {
360
+            return sprintf(
361
+                '<label class="screen-reader-text" for="cb-select-%1$s">%2$s</label>' .
362
+                '<input type="checkbox" name="delete_tags[]" value="%1$s" id="cb-select-%1$s" />',
363
+                $tag->term_id,
364
+                /* translators: %s: Taxonomy term name. */
365
+                sprintf( __( 'Select %s' ), $tag->name )
366
+            );
367
+        }
368
+
369
+        return '&nbsp;';
370
+    }
371
+
372
+    /**
373
+     * @param WP_Term $tag Term object.
374
+     * @return string
375
+     */
376
+    public function column_name( $tag ) {
377
+        $taxonomy = $this->screen->taxonomy;
378
+
379
+        $pad = str_repeat( '&#8212; ', max( 0, $this->level ) );
380
+
381
+        /**
382
+         * Filters display of the term name in the terms list table.
383
+         *
384
+         * The default output may include padding due to the term's
385
+         * current level in the term hierarchy.
386
+         *
387
+         * @since 2.5.0
388
+         *
389
+         * @see WP_Terms_List_Table::column_name()
390
+         *
391
+         * @param string $pad_tag_name The term name, padded if not top-level.
392
+         * @param WP_Term $tag         Term object.
393
+         */
394
+        $name = apply_filters( 'term_name', $pad . ' ' . $tag->name, $tag );
395
+
396
+        $qe_data = get_term( $tag->term_id, $taxonomy, OBJECT, 'edit' );
397
+
398
+        $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
399
+
400
+        $edit_link = get_edit_term_link( $tag, $taxonomy, $this->screen->post_type );
401
+
402
+        if ( $edit_link ) {
403
+            $edit_link = add_query_arg(
404
+                'wp_http_referer',
405
+                urlencode( wp_unslash( $uri ) ),
406
+                $edit_link
407
+            );
408
+            $name      = sprintf(
409
+                '<a class="row-title" href="%s" aria-label="%s">%s</a>',
410
+                esc_url( $edit_link ),
411
+                /* translators: %s: Taxonomy term name. */
412
+                esc_attr( sprintf( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
413
+                $name
414
+            );
415
+        }
416
+
417
+        $out = sprintf(
418
+            '<strong>%s</strong><br />',
419
+            $name
420
+        );
421
+
422
+        $out .= '<div class="hidden" id="inline_' . $qe_data->term_id . '">';
423
+        $out .= '<div class="name">' . $qe_data->name . '</div>';
424
+
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>';
427
+        $out .= '<div class="parent">' . $qe_data->parent . '</div></div>';
428
+
429
+        return $out;
430
+    }
431
+
432
+    /**
433
+     * Gets the name of the default primary column.
434
+     *
435
+     * @since 4.3.0
436
+     *
437
+     * @return string Name of the default primary column, in this case, 'name'.
438
+     */
439
+    protected function get_default_primary_column_name() {
440
+        return 'name';
441
+    }
442
+
443
+    /**
444
+     * Generates and displays row action links.
445
+     *
446
+     * @since 4.3.0
447
+     * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
448
+     *
449
+     * @param WP_Term $item        Tag being acted upon.
450
+     * @param string  $column_name Current column name.
451
+     * @param string  $primary     Primary column name.
452
+     * @return string Row actions output for terms, or an empty string
453
+     *                if the current column is not the primary column.
454
+     */
455
+    protected function handle_row_actions( $item, $column_name, $primary ) {
456
+        if ( $primary !== $column_name ) {
457
+            return '';
458
+        }
459
+
460
+        // Restores the more descriptive, specific name for use within this method.
461
+        $tag      = $item;
462
+        $taxonomy = $this->screen->taxonomy;
463
+        $tax      = get_taxonomy( $taxonomy );
464
+        $uri      = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
465
+
466
+        $edit_link = add_query_arg(
467
+            'wp_http_referer',
468
+            urlencode( wp_unslash( $uri ) ),
469
+            get_edit_term_link( $tag, $taxonomy, $this->screen->post_type )
470
+        );
471
+
472
+        $actions = array();
473
+
474
+        if ( current_user_can( 'edit_term', $tag->term_id ) ) {
475
+            $actions['edit'] = sprintf(
476
+                '<a href="%s" aria-label="%s">%s</a>',
477
+                esc_url( $edit_link ),
478
+                /* translators: %s: Taxonomy term name. */
479
+                esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $tag->name ) ),
480
+                __( 'Edit' )
481
+            );
482
+            $actions['inline hide-if-no-js'] = sprintf(
483
+                '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>',
484
+                /* translators: %s: Taxonomy term name. */
485
+                esc_attr( sprintf( __( 'Quick edit &#8220;%s&#8221; inline' ), $tag->name ) ),
486
+                __( 'Quick&nbsp;Edit' )
487
+            );
488
+        }
489
+
490
+        if ( current_user_can( 'delete_term', $tag->term_id ) ) {
491
+            $actions['delete'] = sprintf(
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&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ),
494
+                /* translators: %s: Taxonomy term name. */
495
+                esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
496
+                __( 'Delete' )
497
+            );
498
+        }
499
+
500
+        if ( is_taxonomy_viewable( $tax ) ) {
501
+            $actions['view'] = sprintf(
502
+                '<a href="%s" aria-label="%s">%s</a>',
503
+                get_term_link( $tag ),
504
+                /* translators: %s: Taxonomy term name. */
505
+                esc_attr( sprintf( __( 'View &#8220;%s&#8221; archive' ), $tag->name ) ),
506
+                __( 'View' )
507
+            );
508
+        }
509
+
510
+        /**
511
+         * Filters the action links displayed for each term in the Tags list table.
512
+         *
513
+         * @since 2.8.0
514
+         * @since 3.0.0 Deprecated in favor of {@see '{$taxonomy}_row_actions'} filter.
515
+         * @since 5.4.2 Restored (un-deprecated).
516
+         *
517
+         * @param string[] $actions An array of action links to be displayed. Default
518
+         *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
519
+         * @param WP_Term  $tag     Term object.
520
+         */
521
+        $actions = apply_filters( 'tag_row_actions', $actions, $tag );
522
+
523
+        /**
524
+         * Filters the action links displayed for each term in the terms list table.
525
+         *
526
+         * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug.
527
+         *
528
+         * Possible hook names include:
529
+         *
530
+         *  - `category_row_actions`
531
+         *  - `post_tag_row_actions`
532
+         *
533
+         * @since 3.0.0
534
+         *
535
+         * @param string[] $actions An array of action links to be displayed. Default
536
+         *                          'Edit', 'Quick Edit', 'Delete', and 'View'.
537
+         * @param WP_Term  $tag     Term object.
538
+         */
539
+        $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );
540
+
541
+        return $this->row_actions( $actions );
542
+    }
543
+
544
+    /**
545
+     * @param WP_Term $tag Term object.
546
+     * @return string
547
+     */
548
+    public function column_description( $tag ) {
549
+        if ( $tag->description ) {
550
+            return $tag->description;
551
+        } else {
552
+            return '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . __( 'No description' ) . '</span>';
553
+        }
554
+    }
555
+
556
+    /**
557
+     * @param WP_Term $tag Term object.
558
+     * @return string
559
+     */
560
+    public function column_slug( $tag ) {
561
+        /** This filter is documented in wp-admin/edit-tag-form.php */
562
+        return apply_filters( 'editable_slug', $tag->slug, $tag );
563
+    }
564
+
565
+    /**
566
+     * @param WP_Term $tag Term object.
567
+     * @return string
568
+     */
569
+    public function column_posts( $tag ) {
570
+        $count = number_format_i18n( $tag->count );
571
+
572
+        $tax = get_taxonomy( $this->screen->taxonomy );
573
+
574
+        $ptype_object = get_post_type_object( $this->screen->post_type );
575
+        if ( ! $ptype_object->show_ui ) {
576
+            return $count;
577
+        }
578
+
579
+        if ( $tax->query_var ) {
580
+            $args = array( $tax->query_var => $tag->slug );
581
+        } else {
582
+            $args = array(
583
+                'taxonomy' => $tax->name,
584
+                'term'     => $tag->slug,
585
+            );
586
+        }
587
+
588
+        if ( 'post' !== $this->screen->post_type ) {
589
+            $args['post_type'] = $this->screen->post_type;
590
+        }
591
+
592
+        if ( 'attachment' === $this->screen->post_type ) {
593
+            return "<a href='" . esc_url( add_query_arg( $args, 'upload.php' ) ) . "'>$count</a>";
594
+        }
595
+
596
+        return "<a href='" . esc_url( add_query_arg( $args, 'edit.php' ) ) . "'>$count</a>";
597
+    }
598
+
599
+    /**
600
+     * @param WP_Term $tag Term object.
601
+     * @return string
602
+     */
603
+    public function column_links( $tag ) {
604
+        $count = number_format_i18n( $tag->count );
605
+
606
+        if ( $count ) {
607
+            $count = "<a href='link-manager.php?cat_id=$tag->term_id'>$count</a>";
608
+        }
609
+
610
+        return $count;
611
+    }
612
+
613
+    /**
614
+     * @since 5.9.0 Renamed `$tag` to `$item` to match parent class for PHP 8 named parameter support.
615
+     *
616
+     * @param WP_Term $item        Term object.
617
+     * @param string  $column_name Name of the column.
618
+     * @return string
619
+     */
620
+    public function column_default( $item, $column_name ) {
621
+        /**
622
+         * Filters the displayed columns in the terms list table.
623
+         *
624
+         * The dynamic portion of the hook name, `$this->screen->taxonomy`,
625
+         * refers to the slug of the current taxonomy.
626
+         *
627
+         * Possible hook names include:
628
+         *
629
+         *  - `manage_category_custom_column`
630
+         *  - `manage_post_tag_custom_column`
631
+         *
632
+         * @since 2.8.0
633
+         *
634
+         * @param string $string      Custom column output. Default empty.
635
+         * @param string $column_name Name of the column.
636
+         * @param int    $term_id     Term ID.
637
+         */
638
+        return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id );
639
+    }
640
+
641
+    /**
642
+     * Outputs the hidden row displayed when inline editing
643
+     *
644
+     * @since 3.1.0
645
+     */
646
+    public function inline_edit() {
647
+        $tax = get_taxonomy( $this->screen->taxonomy );
648
+
649
+        if ( ! current_user_can( $tax->cap->edit_terms ) ) {
650
+            return;
651
+        }
652
+        ?>
653 653
 
654 654
 		<form method="get">
655 655
 		<table style="display: none"><tbody id="inlineedit">
@@ -676,25 +676,25 @@  discard block
 block discarded – undo
676 676
 			</fieldset>
677 677
 
678 678
 			<?php
679
-			$core_columns = array(
680
-				'cb'          => true,
681
-				'description' => true,
682
-				'name'        => true,
683
-				'slug'        => true,
684
-				'posts'       => true,
685
-			);
686
-
687
-			list( $columns ) = $this->get_column_info();
688
-
689
-			foreach ( $columns as $column_name => $column_display_name ) {
690
-				if ( isset( $core_columns[ $column_name ] ) ) {
691
-					continue;
692
-				}
693
-
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 );
696
-			}
697
-			?>
679
+            $core_columns = array(
680
+                'cb'          => true,
681
+                'description' => true,
682
+                'name'        => true,
683
+                'slug'        => true,
684
+                'posts'       => true,
685
+            );
686
+
687
+            list( $columns ) = $this->get_column_info();
688
+
689
+            foreach ( $columns as $column_name => $column_display_name ) {
690
+                if ( isset( $core_columns[ $column_name ] ) ) {
691
+                    continue;
692
+                }
693
+
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 );
696
+            }
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>
@@ -716,5 +716,5 @@  discard block
 block discarded – undo
716 716
 		</tbody></table>
717 717
 		</form>
718 718
 		<?php
719
-	}
719
+    }
720 720
 }
Please login to merge, or discard this patch.
Spacing   +132 added lines, -132 removed lines patch added patch discarded remove patch
@@ -35,14 +35,14 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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( '&#8212; ', max( 0, $this->level ) );
379
+		$pad = str_repeat('&#8212; ', 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
 block discarded – undo
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( __( '&#8220;%s&#8221; (Edit)' ), $tag->name ) ),
412
+				esc_attr(sprintf(__('&#8220;%s&#8221; (Edit)'), $tag->name)),
413 413
 				$name
414 414
 			);
415 415
 		}
@@ -423,7 +423,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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 &#8220;%s&#8221;' ), $tag->name ) ),
480
-				__( 'Edit' )
479
+				esc_attr(sprintf(__('Edit &#8220;%s&#8221;'), $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 &#8220;%s&#8221; inline' ), $tag->name ) ),
486
-				__( 'Quick&nbsp;Edit' )
485
+				esc_attr(sprintf(__('Quick edit &#8220;%s&#8221; inline'), $tag->name)),
486
+				__('Quick&nbsp;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&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ),
493
+				wp_nonce_url("edit-tags.php?action=delete&amp;taxonomy=$taxonomy&amp;tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id),
494 494
 				/* translators: %s: Taxonomy term name. */
495
-				esc_attr( sprintf( __( 'Delete &#8220;%s&#8221;' ), $tag->name ) ),
496
-				__( 'Delete' )
495
+				esc_attr(sprintf(__('Delete &#8220;%s&#8221;'), $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 &#8220;%s&#8221; archive' ), $tag->name ) ),
506
-				__( 'View' )
505
+				esc_attr(sprintf(__('View &#8220;%s&#8221; archive'), $tag->name)),
506
+				__('View')
507 507
 			);
508 508
 		}
509 509
 
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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">&#8212;</span><span class="screen-reader-text">' . __( 'No description' ) . '</span>';
552
+			return '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . __('No description') . '</span>';
553 553
 		}
554 554
 	}
555 555
 
@@ -557,27 +557,27 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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>
Please login to merge, or discard this patch.