Passed
Push — main ( d78e29...2865cf )
by TARIQ
92:06
created
brighty/xmlrpc.php 2 patches
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -18,12 +18,12 @@  discard block
 block discarded – undo
18 18
 // $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
19 19
 // phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved
20 20
 if ( ! isset( $HTTP_RAW_POST_DATA ) ) {
21
-	$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
21
+    $HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
22 22
 }
23 23
 
24 24
 // Fix for mozBlog and other cases where '<?xml' isn't on the very first line.
25 25
 if ( isset( $HTTP_RAW_POST_DATA ) ) {
26
-	$HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
26
+    $HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
27 27
 }
28 28
 // phpcs:enable
29 29
 
@@ -31,9 +31,9 @@  discard block
 block discarded – undo
31 31
 require_once __DIR__ . '/wp-load.php';
32 32
 
33 33
 if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
34
-	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
35
-	echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
36
-	?>
34
+    header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
35
+    echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
36
+    ?>
37 37
 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
38 38
 	<service>
39 39
 		<engineName>WordPress</engineName>
@@ -45,20 +45,20 @@  discard block
 block discarded – undo
45 45
 			<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
46 46
 			<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
47 47
 			<?php
48
-			/**
49
-			 * Add additional APIs to the Really Simple Discovery (RSD) endpoint.
50
-			 *
51
-			 * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
52
-			 *
53
-			 * @since 3.5.0
54
-			 */
55
-			do_action( 'xmlrpc_rsd_apis' );
56
-			?>
48
+            /**
49
+             * Add additional APIs to the Really Simple Discovery (RSD) endpoint.
50
+             *
51
+             * @link http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
52
+             *
53
+             * @since 3.5.0
54
+             */
55
+            do_action( 'xmlrpc_rsd_apis' );
56
+            ?>
57 57
 		</apis>
58 58
 	</service>
59 59
 </rsd>
60 60
 	<?php
61
-	exit;
61
+    exit;
62 62
 }
63 63
 
64 64
 require_once ABSPATH . 'wp-admin/includes/admin.php';
@@ -98,8 +98,8 @@  discard block
 block discarded – undo
98 98
  * @param string $msg Information describing logging reason.
99 99
  */
100 100
 function logIO( $io, $msg ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
101
-	_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
102
-	if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
103
-		error_log( $io . ' - ' . $msg );
104
-	}
101
+    _deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
102
+    if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
103
+        error_log( $io . ' - ' . $msg );
104
+    }
105 105
 }
Please login to merge, or discard this patch.
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -10,40 +10,40 @@  discard block
 block discarded – undo
10 10
  *
11 11
  * @var bool
12 12
  */
13
-define( 'XMLRPC_REQUEST', true );
13
+define('XMLRPC_REQUEST', true);
14 14
 
15 15
 // Some browser-embedded clients send cookies. We don't want them.
16 16
 $_COOKIE = array();
17 17
 
18 18
 // $HTTP_RAW_POST_DATA was deprecated in PHP 5.6 and removed in PHP 7.0.
19 19
 // phpcs:disable PHPCompatibility.Variables.RemovedPredefinedGlobalVariables.http_raw_post_dataDeprecatedRemoved
20
-if ( ! isset( $HTTP_RAW_POST_DATA ) ) {
21
-	$HTTP_RAW_POST_DATA = file_get_contents( 'php://input' );
20
+if (!isset($HTTP_RAW_POST_DATA)) {
21
+	$HTTP_RAW_POST_DATA = file_get_contents('php://input');
22 22
 }
23 23
 
24 24
 // Fix for mozBlog and other cases where '<?xml' isn't on the very first line.
25
-if ( isset( $HTTP_RAW_POST_DATA ) ) {
26
-	$HTTP_RAW_POST_DATA = trim( $HTTP_RAW_POST_DATA );
25
+if (isset($HTTP_RAW_POST_DATA)) {
26
+	$HTTP_RAW_POST_DATA = trim($HTTP_RAW_POST_DATA);
27 27
 }
28 28
 // phpcs:enable
29 29
 
30 30
 /** Include the bootstrap for setting up WordPress environment */
31 31
 require_once __DIR__ . '/wp-load.php';
32 32
 
33
-if ( isset( $_GET['rsd'] ) ) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
34
-	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
35
-	echo '<?xml version="1.0" encoding="' . get_option( 'blog_charset' ) . '"?' . '>';
33
+if (isset($_GET['rsd'])) { // http://cyber.law.harvard.edu/blogs/gems/tech/rsd.html
34
+	header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
35
+	echo '<?xml version="1.0" encoding="' . get_option('blog_charset') . '"?' . '>';
36 36
 	?>
37 37
 <rsd version="1.0" xmlns="http://archipelago.phrasewise.com/rsd">
38 38
 	<service>
39 39
 		<engineName>WordPress</engineName>
40 40
 		<engineLink>https://wordpress.org/</engineLink>
41
-		<homePageLink><?php bloginfo_rss( 'url' ); ?></homePageLink>
41
+		<homePageLink><?php bloginfo_rss('url'); ?></homePageLink>
42 42
 		<apis>
43
-			<api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
44
-			<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
45
-			<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
46
-			<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url( 'xmlrpc.php', 'rpc' ); ?>" />
43
+			<api name="WordPress" blogID="1" preferred="true" apiLink="<?php echo site_url('xmlrpc.php', 'rpc'); ?>" />
44
+			<api name="Movable Type" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc'); ?>" />
45
+			<api name="MetaWeblog" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc'); ?>" />
46
+			<api name="Blogger" blogID="1" preferred="false" apiLink="<?php echo site_url('xmlrpc.php', 'rpc'); ?>" />
47 47
 			<?php
48 48
 			/**
49 49
 			 * Add additional APIs to the Really Simple Discovery (RSD) endpoint.
@@ -52,7 +52,7 @@  discard block
 block discarded – undo
52 52
 			 *
53 53
 			 * @since 3.5.0
54 54
 			 */
55
-			do_action( 'xmlrpc_rsd_apis' );
55
+			do_action('xmlrpc_rsd_apis');
56 56
 			?>
57 57
 		</apis>
58 58
 	</service>
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
  *
81 81
  * @param string $class The name of the XML-RPC server class.
82 82
  */
83
-$wp_xmlrpc_server_class = apply_filters( 'wp_xmlrpc_server_class', 'wp_xmlrpc_server' );
83
+$wp_xmlrpc_server_class = apply_filters('wp_xmlrpc_server_class', 'wp_xmlrpc_server');
84 84
 $wp_xmlrpc_server       = new $wp_xmlrpc_server_class;
85 85
 
86 86
 // Fire off the request.
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
  * @param string $io Whether input or output
98 98
  * @param string $msg Information describing logging reason.
99 99
  */
100
-function logIO( $io, $msg ) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
101
-	_deprecated_function( __FUNCTION__, '3.4.0', 'error_log()' );
102
-	if ( ! empty( $GLOBALS['xmlrpc_logging'] ) ) {
103
-		error_log( $io . ' - ' . $msg );
100
+function logIO($io, $msg) { // phpcs:ignore WordPress.NamingConventions.ValidFunctionName.FunctionNameInvalid
101
+	_deprecated_function(__FUNCTION__, '3.4.0', 'error_log()');
102
+	if (!empty($GLOBALS['xmlrpc_logging'])) {
103
+		error_log($io . ' - ' . $msg);
104 104
 	}
105 105
 }
Please login to merge, or discard this patch.
brighty/wp-cron.php 2 patches
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -20,16 +20,16 @@  discard block
 block discarded – undo
20 20
 
21 21
 /* Don't make the request block till we finish, if possible. */
22 22
 if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
23
-	if ( ! headers_sent() ) {
24
-		header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
25
-		header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
26
-	}
23
+    if ( ! headers_sent() ) {
24
+        header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
25
+        header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
26
+    }
27 27
 
28
-	fastcgi_finish_request();
28
+    fastcgi_finish_request();
29 29
 }
30 30
 
31 31
 if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
32
-	die();
32
+    die();
33 33
 }
34 34
 
35 35
 /**
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 define( 'DOING_CRON', true );
41 41
 
42 42
 if ( ! defined( 'ABSPATH' ) ) {
43
-	/** Set up WordPress environment */
44
-	require_once __DIR__ . '/wp-load.php';
43
+    /** Set up WordPress environment */
44
+    require_once __DIR__ . '/wp-load.php';
45 45
 }
46 46
 
47 47
 /**
@@ -57,28 +57,28 @@  discard block
 block discarded – undo
57 57
  * @return string|int|false Value of the `doing_cron` transient, 0|false otherwise.
58 58
  */
59 59
 function _get_cron_lock() {
60
-	global $wpdb;
60
+    global $wpdb;
61 61
 
62
-	$value = 0;
63
-	if ( wp_using_ext_object_cache() ) {
64
-		/*
62
+    $value = 0;
63
+    if ( wp_using_ext_object_cache() ) {
64
+        /*
65 65
 		 * Skip local cache and force re-fetch of doing_cron transient
66 66
 		 * in case another process updated the cache.
67 67
 		 */
68
-		$value = wp_cache_get( 'doing_cron', 'transient', true );
69
-	} else {
70
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) );
71
-		if ( is_object( $row ) ) {
72
-			$value = $row->option_value;
73
-		}
74
-	}
75
-
76
-	return $value;
68
+        $value = wp_cache_get( 'doing_cron', 'transient', true );
69
+    } else {
70
+        $row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) );
71
+        if ( is_object( $row ) ) {
72
+            $value = $row->option_value;
73
+        }
74
+    }
75
+
76
+    return $value;
77 77
 }
78 78
 
79 79
 $crons = wp_get_ready_cron_jobs();
80 80
 if ( empty( $crons ) ) {
81
-	die();
81
+    die();
82 82
 }
83 83
 
84 84
 $gmt_time = microtime( true );
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 
89 89
 // Use global $doing_wp_cron lock, otherwise use the GET lock. If no lock, try to grab a new lock.
90 90
 if ( empty( $doing_wp_cron ) ) {
91
-	if ( empty( $_GET['doing_wp_cron'] ) ) {
92
-		// Called from external script/job. Try setting a lock.
93
-		if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) {
94
-			return;
95
-		}
96
-		$doing_wp_cron        = sprintf( '%.22F', microtime( true ) );
97
-		$doing_cron_transient = $doing_wp_cron;
98
-		set_transient( 'doing_cron', $doing_wp_cron );
99
-	} else {
100
-		$doing_wp_cron = $_GET['doing_wp_cron'];
101
-	}
91
+    if ( empty( $_GET['doing_wp_cron'] ) ) {
92
+        // Called from external script/job. Try setting a lock.
93
+        if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) {
94
+            return;
95
+        }
96
+        $doing_wp_cron        = sprintf( '%.22F', microtime( true ) );
97
+        $doing_cron_transient = $doing_wp_cron;
98
+        set_transient( 'doing_cron', $doing_wp_cron );
99
+    } else {
100
+        $doing_wp_cron = $_GET['doing_wp_cron'];
101
+    }
102 102
 }
103 103
 
104 104
 /*
@@ -106,47 +106,47 @@  discard block
 block discarded – undo
106 106
  * must match $doing_wp_cron (the "key").
107 107
  */
108 108
 if ( $doing_cron_transient !== $doing_wp_cron ) {
109
-	return;
109
+    return;
110 110
 }
111 111
 
112 112
 foreach ( $crons as $timestamp => $cronhooks ) {
113
-	if ( $timestamp > $gmt_time ) {
114
-		break;
115
-	}
116
-
117
-	foreach ( $cronhooks as $hook => $keys ) {
118
-
119
-		foreach ( $keys as $k => $v ) {
120
-
121
-			$schedule = $v['schedule'];
122
-
123
-			if ( $schedule ) {
124
-				wp_reschedule_event( $timestamp, $schedule, $hook, $v['args'] );
125
-			}
126
-
127
-			wp_unschedule_event( $timestamp, $hook, $v['args'] );
128
-
129
-			/**
130
-			 * Fires scheduled events.
131
-			 *
132
-			 * @ignore
133
-			 * @since 2.1.0
134
-			 *
135
-			 * @param string $hook Name of the hook that was scheduled to be fired.
136
-			 * @param array  $args The arguments to be passed to the hook.
137
-			 */
138
-			do_action_ref_array( $hook, $v['args'] );
139
-
140
-			// If the hook ran too long and another cron process stole the lock, quit.
141
-			if ( _get_cron_lock() !== $doing_wp_cron ) {
142
-				return;
143
-			}
144
-		}
145
-	}
113
+    if ( $timestamp > $gmt_time ) {
114
+        break;
115
+    }
116
+
117
+    foreach ( $cronhooks as $hook => $keys ) {
118
+
119
+        foreach ( $keys as $k => $v ) {
120
+
121
+            $schedule = $v['schedule'];
122
+
123
+            if ( $schedule ) {
124
+                wp_reschedule_event( $timestamp, $schedule, $hook, $v['args'] );
125
+            }
126
+
127
+            wp_unschedule_event( $timestamp, $hook, $v['args'] );
128
+
129
+            /**
130
+             * Fires scheduled events.
131
+             *
132
+             * @ignore
133
+             * @since 2.1.0
134
+             *
135
+             * @param string $hook Name of the hook that was scheduled to be fired.
136
+             * @param array  $args The arguments to be passed to the hook.
137
+             */
138
+            do_action_ref_array( $hook, $v['args'] );
139
+
140
+            // If the hook ran too long and another cron process stole the lock, quit.
141
+            if ( _get_cron_lock() !== $doing_wp_cron ) {
142
+                return;
143
+            }
144
+        }
145
+    }
146 146
 }
147 147
 
148 148
 if ( _get_cron_lock() === $doing_wp_cron ) {
149
-	delete_transient( 'doing_cron' );
149
+    delete_transient( 'doing_cron' );
150 150
 }
151 151
 
152 152
 die();
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -16,19 +16,19 @@  discard block
 block discarded – undo
16 16
  * @package WordPress
17 17
  */
18 18
 
19
-ignore_user_abort( true );
19
+ignore_user_abort(true);
20 20
 
21 21
 /* Don't make the request block till we finish, if possible. */
22
-if ( function_exists( 'fastcgi_finish_request' ) && version_compare( phpversion(), '7.0.16', '>=' ) ) {
23
-	if ( ! headers_sent() ) {
24
-		header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
25
-		header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
22
+if (function_exists('fastcgi_finish_request') && version_compare(phpversion(), '7.0.16', '>=')) {
23
+	if (!headers_sent()) {
24
+		header('Expires: Wed, 11 Jan 1984 05:00:00 GMT');
25
+		header('Cache-Control: no-cache, must-revalidate, max-age=0');
26 26
 	}
27 27
 
28 28
 	fastcgi_finish_request();
29 29
 }
30 30
 
31
-if ( ! empty( $_POST ) || defined( 'DOING_AJAX' ) || defined( 'DOING_CRON' ) ) {
31
+if (!empty($_POST) || defined('DOING_AJAX') || defined('DOING_CRON')) {
32 32
 	die();
33 33
 }
34 34
 
@@ -37,9 +37,9 @@  discard block
 block discarded – undo
37 37
  *
38 38
  * @var bool
39 39
  */
40
-define( 'DOING_CRON', true );
40
+define('DOING_CRON', true);
41 41
 
42
-if ( ! defined( 'ABSPATH' ) ) {
42
+if (!defined('ABSPATH')) {
43 43
 	/** Set up WordPress environment */
44 44
 	require_once __DIR__ . '/wp-load.php';
45 45
 }
@@ -60,15 +60,15 @@  discard block
 block discarded – undo
60 60
 	global $wpdb;
61 61
 
62 62
 	$value = 0;
63
-	if ( wp_using_ext_object_cache() ) {
63
+	if (wp_using_ext_object_cache()) {
64 64
 		/*
65 65
 		 * Skip local cache and force re-fetch of doing_cron transient
66 66
 		 * in case another process updated the cache.
67 67
 		 */
68
-		$value = wp_cache_get( 'doing_cron', 'transient', true );
68
+		$value = wp_cache_get('doing_cron', 'transient', true);
69 69
 	} else {
70
-		$row = $wpdb->get_row( $wpdb->prepare( "SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron' ) );
71
-		if ( is_object( $row ) ) {
70
+		$row = $wpdb->get_row($wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s LIMIT 1", '_transient_doing_cron'));
71
+		if (is_object($row)) {
72 72
 			$value = $row->option_value;
73 73
 		}
74 74
 	}
@@ -77,25 +77,25 @@  discard block
 block discarded – undo
77 77
 }
78 78
 
79 79
 $crons = wp_get_ready_cron_jobs();
80
-if ( empty( $crons ) ) {
80
+if (empty($crons)) {
81 81
 	die();
82 82
 }
83 83
 
84
-$gmt_time = microtime( true );
84
+$gmt_time = microtime(true);
85 85
 
86 86
 // The cron lock: a unix timestamp from when the cron was spawned.
87
-$doing_cron_transient = get_transient( 'doing_cron' );
87
+$doing_cron_transient = get_transient('doing_cron');
88 88
 
89 89
 // Use global $doing_wp_cron lock, otherwise use the GET lock. If no lock, try to grab a new lock.
90
-if ( empty( $doing_wp_cron ) ) {
91
-	if ( empty( $_GET['doing_wp_cron'] ) ) {
90
+if (empty($doing_wp_cron)) {
91
+	if (empty($_GET['doing_wp_cron'])) {
92 92
 		// Called from external script/job. Try setting a lock.
93
-		if ( $doing_cron_transient && ( $doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time ) ) {
93
+		if ($doing_cron_transient && ($doing_cron_transient + WP_CRON_LOCK_TIMEOUT > $gmt_time)) {
94 94
 			return;
95 95
 		}
96
-		$doing_wp_cron        = sprintf( '%.22F', microtime( true ) );
96
+		$doing_wp_cron        = sprintf('%.22F', microtime(true));
97 97
 		$doing_cron_transient = $doing_wp_cron;
98
-		set_transient( 'doing_cron', $doing_wp_cron );
98
+		set_transient('doing_cron', $doing_wp_cron);
99 99
 	} else {
100 100
 		$doing_wp_cron = $_GET['doing_wp_cron'];
101 101
 	}
@@ -105,26 +105,26 @@  discard block
 block discarded – undo
105 105
  * The cron lock (a unix timestamp set when the cron was spawned),
106 106
  * must match $doing_wp_cron (the "key").
107 107
  */
108
-if ( $doing_cron_transient !== $doing_wp_cron ) {
108
+if ($doing_cron_transient !== $doing_wp_cron) {
109 109
 	return;
110 110
 }
111 111
 
112
-foreach ( $crons as $timestamp => $cronhooks ) {
113
-	if ( $timestamp > $gmt_time ) {
112
+foreach ($crons as $timestamp => $cronhooks) {
113
+	if ($timestamp > $gmt_time) {
114 114
 		break;
115 115
 	}
116 116
 
117
-	foreach ( $cronhooks as $hook => $keys ) {
117
+	foreach ($cronhooks as $hook => $keys) {
118 118
 
119
-		foreach ( $keys as $k => $v ) {
119
+		foreach ($keys as $k => $v) {
120 120
 
121 121
 			$schedule = $v['schedule'];
122 122
 
123
-			if ( $schedule ) {
124
-				wp_reschedule_event( $timestamp, $schedule, $hook, $v['args'] );
123
+			if ($schedule) {
124
+				wp_reschedule_event($timestamp, $schedule, $hook, $v['args']);
125 125
 			}
126 126
 
127
-			wp_unschedule_event( $timestamp, $hook, $v['args'] );
127
+			wp_unschedule_event($timestamp, $hook, $v['args']);
128 128
 
129 129
 			/**
130 130
 			 * Fires scheduled events.
@@ -135,18 +135,18 @@  discard block
 block discarded – undo
135 135
 			 * @param string $hook Name of the hook that was scheduled to be fired.
136 136
 			 * @param array  $args The arguments to be passed to the hook.
137 137
 			 */
138
-			do_action_ref_array( $hook, $v['args'] );
138
+			do_action_ref_array($hook, $v['args']);
139 139
 
140 140
 			// If the hook ran too long and another cron process stole the lock, quit.
141
-			if ( _get_cron_lock() !== $doing_wp_cron ) {
141
+			if (_get_cron_lock() !== $doing_wp_cron) {
142 142
 				return;
143 143
 			}
144 144
 		}
145 145
 	}
146 146
 }
147 147
 
148
-if ( _get_cron_lock() === $doing_wp_cron ) {
149
-	delete_transient( 'doing_cron' );
148
+if (_get_cron_lock() === $doing_wp_cron) {
149
+	delete_transient('doing_cron');
150 150
 }
151 151
 
152 152
 die();
Please login to merge, or discard this patch.
brighty/wp-admin/theme-editor.php 3 patches
Indentation   +152 added lines, -152 removed lines patch added patch discarded remove patch
@@ -10,12 +10,12 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( is_multisite() && ! is_network_admin() ) {
13
-	wp_redirect( network_admin_url( 'theme-editor.php' ) );
14
-	exit;
13
+    wp_redirect( network_admin_url( 'theme-editor.php' ) );
14
+    exit;
15 15
 }
16 16
 
17 17
 if ( ! current_user_can( 'edit_themes' ) ) {
18
-	wp_die( '<p>' . __( 'Sorry, you are not allowed to edit templates for this site.' ) . '</p>' );
18
+    wp_die( '<p>' . __( 'Sorry, you are not allowed to edit templates for this site.' ) . '</p>' );
19 19
 }
20 20
 
21 21
 // Used in the HTML title tag.
@@ -23,55 +23,55 @@  discard block
 block discarded – undo
23 23
 $parent_file = 'themes.php';
24 24
 
25 25
 get_current_screen()->add_help_tab(
26
-	array(
27
-		'id'      => 'overview',
28
-		'title'   => __( 'Overview' ),
29
-		'content' =>
30
-				'<p>' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
31
-				'<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme&#8217;s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
32
-				'<p>' . __( 'For PHP files, you can use the documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
33
-				'<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
34
-				'<ul>' .
35
-				'<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' .
36
-				'<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' .
37
-				'<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' .
38
-				'</ul>' .
39
-				'<p>' . __( 'After typing in your edits, click Update File.' ) . '</p>' .
40
-				'<p>' . __( '<strong>Advice:</strong> Think very carefully about your site crashing if you are live-editing the theme currently in use.' ) . '</p>' .
41
-				'<p>' . sprintf(
42
-					/* translators: %s: Link to documentation on child themes. */
43
-					__( 'Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.' ),
44
-					__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
45
-				) . '</p>' .
46
-				( is_network_admin() ? '<p>' . __( 'Any edits to files from this screen will be reflected on all sites in the network.' ) . '</p>' : '' ),
47
-	)
26
+    array(
27
+        'id'      => 'overview',
28
+        'title'   => __( 'Overview' ),
29
+        'content' =>
30
+                '<p>' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
31
+                '<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme&#8217;s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
32
+                '<p>' . __( 'For PHP files, you can use the documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
33
+                '<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
34
+                '<ul>' .
35
+                '<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' .
36
+                '<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' .
37
+                '<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' .
38
+                '</ul>' .
39
+                '<p>' . __( 'After typing in your edits, click Update File.' ) . '</p>' .
40
+                '<p>' . __( '<strong>Advice:</strong> Think very carefully about your site crashing if you are live-editing the theme currently in use.' ) . '</p>' .
41
+                '<p>' . sprintf(
42
+                    /* translators: %s: Link to documentation on child themes. */
43
+                    __( 'Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.' ),
44
+                    __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
45
+                ) . '</p>' .
46
+                ( is_network_admin() ? '<p>' . __( 'Any edits to files from this screen will be reflected on all sites in the network.' ) . '</p>' : '' ),
47
+    )
48 48
 );
49 49
 
50 50
 get_current_screen()->set_help_sidebar(
51
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
52
-	'<p>' . __( '<a href="https://developer.wordpress.org/themes/">Documentation on Theme Development</a>' ) . '</p>' .
53
-	'<p>' . __( '<a href="https://wordpress.org/support/article/appearance-editor-screen/">Documentation on Editing Themes</a>' ) . '</p>' .
54
-	'<p>' . __( '<a href="https://wordpress.org/support/article/editing-files/">Documentation on Editing Files</a>' ) . '</p>' .
55
-	'<p>' . __( '<a href="https://developer.wordpress.org/themes/basics/template-tags/">Documentation on Template Tags</a>' ) . '</p>' .
56
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
51
+    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
52
+    '<p>' . __( '<a href="https://developer.wordpress.org/themes/">Documentation on Theme Development</a>' ) . '</p>' .
53
+    '<p>' . __( '<a href="https://wordpress.org/support/article/appearance-editor-screen/">Documentation on Editing Themes</a>' ) . '</p>' .
54
+    '<p>' . __( '<a href="https://wordpress.org/support/article/editing-files/">Documentation on Editing Files</a>' ) . '</p>' .
55
+    '<p>' . __( '<a href="https://developer.wordpress.org/themes/basics/template-tags/">Documentation on Template Tags</a>' ) . '</p>' .
56
+    '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
57 57
 );
58 58
 
59 59
 wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
60 60
 
61 61
 if ( $theme ) {
62
-	$stylesheet = $theme;
62
+    $stylesheet = $theme;
63 63
 } else {
64
-	$stylesheet = get_stylesheet();
64
+    $stylesheet = get_stylesheet();
65 65
 }
66 66
 
67 67
 $theme = wp_get_theme( $stylesheet );
68 68
 
69 69
 if ( ! $theme->exists() ) {
70
-	wp_die( __( 'The requested theme does not exist.' ) );
70
+    wp_die( __( 'The requested theme does not exist.' ) );
71 71
 }
72 72
 
73 73
 if ( $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code() ) {
74
-	wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
74
+    wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
75 75
 }
76 76
 
77 77
 $allowed_files = array();
@@ -80,35 +80,35 @@  discard block
 block discarded – undo
80 80
 $file_types = wp_get_theme_file_editable_extensions( $theme );
81 81
 
82 82
 foreach ( $file_types as $type ) {
83
-	switch ( $type ) {
84
-		case 'php':
85
-			$allowed_files += $theme->get_files( 'php', -1 );
86
-			break;
87
-		case 'css':
88
-			$style_files                = $theme->get_files( 'css', -1 );
89
-			$allowed_files['style.css'] = $style_files['style.css'];
90
-			$allowed_files             += $style_files;
91
-			break;
92
-		default:
93
-			$allowed_files += $theme->get_files( $type, -1 );
94
-			break;
95
-	}
83
+    switch ( $type ) {
84
+        case 'php':
85
+            $allowed_files += $theme->get_files( 'php', -1 );
86
+            break;
87
+        case 'css':
88
+            $style_files                = $theme->get_files( 'css', -1 );
89
+            $allowed_files['style.css'] = $style_files['style.css'];
90
+            $allowed_files             += $style_files;
91
+            break;
92
+        default:
93
+            $allowed_files += $theme->get_files( $type, -1 );
94
+            break;
95
+    }
96 96
 }
97 97
 
98 98
 // Move functions.php and style.css to the top.
99 99
 if ( isset( $allowed_files['functions.php'] ) ) {
100
-	$allowed_files = array( 'functions.php' => $allowed_files['functions.php'] ) + $allowed_files;
100
+    $allowed_files = array( 'functions.php' => $allowed_files['functions.php'] ) + $allowed_files;
101 101
 }
102 102
 if ( isset( $allowed_files['style.css'] ) ) {
103
-	$allowed_files = array( 'style.css' => $allowed_files['style.css'] ) + $allowed_files;
103
+    $allowed_files = array( 'style.css' => $allowed_files['style.css'] ) + $allowed_files;
104 104
 }
105 105
 
106 106
 if ( empty( $file ) ) {
107
-	$relative_file = 'style.css';
108
-	$file          = $allowed_files['style.css'];
107
+    $relative_file = 'style.css';
108
+    $file          = $allowed_files['style.css'];
109 109
 } else {
110
-	$relative_file = wp_unslash( $file );
111
-	$file          = $theme->get_stylesheet_directory() . '/' . $relative_file;
110
+    $relative_file = wp_unslash( $file );
111
+    $file          = $theme->get_stylesheet_directory() . '/' . $relative_file;
112 112
 }
113 113
 
114 114
 validate_file_to_edit( $file, $allowed_files );
@@ -118,29 +118,29 @@  discard block
 block discarded – undo
118 118
 $posted_content = null;
119 119
 
120 120
 if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
121
-	$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
122
-	if ( is_wp_error( $r ) ) {
123
-		$edit_error = $r;
124
-		if ( check_ajax_referer( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
125
-			$posted_content = wp_unslash( $_POST['newcontent'] );
126
-		}
127
-	} else {
128
-		wp_redirect(
129
-			add_query_arg(
130
-				array(
131
-					'a'     => 1, // This means "success" for some reason.
132
-					'theme' => $stylesheet,
133
-					'file'  => $relative_file,
134
-				),
135
-				admin_url( 'theme-editor.php' )
136
-			)
137
-		);
138
-		exit;
139
-	}
121
+    $r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
122
+    if ( is_wp_error( $r ) ) {
123
+        $edit_error = $r;
124
+        if ( check_ajax_referer( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
125
+            $posted_content = wp_unslash( $_POST['newcontent'] );
126
+        }
127
+    } else {
128
+        wp_redirect(
129
+            add_query_arg(
130
+                array(
131
+                    'a'     => 1, // This means "success" for some reason.
132
+                    'theme' => $stylesheet,
133
+                    'file'  => $relative_file,
134
+                ),
135
+                admin_url( 'theme-editor.php' )
136
+            )
137
+        );
138
+        exit;
139
+    }
140 140
 }
141 141
 
142 142
 $settings = array(
143
-	'codeEditor' => wp_enqueue_code_editor( compact( 'file' ) ),
143
+    'codeEditor' => wp_enqueue_code_editor( compact( 'file' ) ),
144 144
 );
145 145
 wp_enqueue_script( 'wp-theme-plugin-editor' );
146 146
 wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings ) ) );
@@ -151,35 +151,35 @@  discard block
 block discarded – undo
151 151
 update_recently_edited( $file );
152 152
 
153 153
 if ( ! is_file( $file ) ) {
154
-	$error = true;
154
+    $error = true;
155 155
 }
156 156
 
157 157
 $content = '';
158 158
 if ( ! empty( $posted_content ) ) {
159
-	$content = $posted_content;
159
+    $content = $posted_content;
160 160
 } elseif ( ! $error && filesize( $file ) > 0 ) {
161
-	$f       = fopen( $file, 'r' );
162
-	$content = fread( $f, filesize( $file ) );
161
+    $f       = fopen( $file, 'r' );
162
+    $content = fread( $f, filesize( $file ) );
163 163
 
164
-	if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
165
-		$functions = wp_doc_link_parse( $content );
164
+    if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
165
+        $functions = wp_doc_link_parse( $content );
166 166
 
167
-		$docs_select  = '<select name="docs-list" id="docs-list">';
168
-		$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
169
-		foreach ( $functions as $function ) {
170
-			$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
171
-		}
172
-		$docs_select .= '</select>';
173
-	}
167
+        $docs_select  = '<select name="docs-list" id="docs-list">';
168
+        $docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
169
+        foreach ( $functions as $function ) {
170
+            $docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
171
+        }
172
+        $docs_select .= '</select>';
173
+    }
174 174
 
175
-	$content = esc_textarea( $content );
175
+    $content = esc_textarea( $content );
176 176
 }
177 177
 
178 178
 $file_description = get_file_description( $relative_file );
179 179
 $file_show        = array_search( $file, array_filter( $allowed_files ), true );
180 180
 $description      = esc_html( $file_description );
181 181
 if ( $file_description !== $file_show ) {
182
-	$description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
182
+    $description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
183 183
 }
184 184
 ?>
185 185
 <div class="wrap">
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 		<p><strong><?php _e( 'Did you know?' ); ?></strong></p>
202 202
 		<p>
203 203
 			<?php
204
-			printf(
205
-				/* translators: %s: Link to Custom CSS section in the Customizer. */
206
-				__( 'There is no need to change your CSS here &mdash; you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ),
207
-				esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) )
208
-			);
209
-			?>
204
+            printf(
205
+                /* translators: %s: Link to Custom CSS section in the Customizer. */
206
+                __( 'There is no need to change your CSS here &mdash; you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ),
207
+                esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) )
208
+            );
209
+            ?>
210 210
 		</p>
211 211
 	</div>
212 212
 <?php endif; ?>
@@ -215,10 +215,10 @@  discard block
 block discarded – undo
215 215
 <div class="alignleft">
216 216
 <h2>
217 217
 	<?php
218
-	echo $theme->display( 'Name' );
219
-	if ( $description ) {
220
-		echo ': ' . $description;}
221
-	?>
218
+    echo $theme->display( 'Name' );
219
+    if ( $description ) {
220
+        echo ': ' . $description;}
221
+    ?>
222 222
 </h2>
223 223
 </div>
224 224
 <div class="alignright">
@@ -226,15 +226,15 @@  discard block
 block discarded – undo
226 226
 		<label for="theme" id="theme-plugin-editor-selector"><?php _e( 'Select theme to edit:' ); ?> </label>
227 227
 		<select name="theme" id="theme">
228 228
 		<?php
229
-		foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
230
-			if ( $a_theme->errors() && 'theme_no_stylesheet' === $a_theme->errors()->get_error_code() ) {
231
-				continue;
232
-			}
233
-
234
-			$selected = ( $a_stylesheet === $stylesheet ) ? ' selected="selected"' : '';
235
-			echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display( 'Name' ) . '</option>';
236
-		}
237
-		?>
229
+        foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
230
+            if ( $a_theme->errors() && 'theme_no_stylesheet' === $a_theme->errors()->get_error_code() ) {
231
+                continue;
232
+            }
233
+
234
+            $selected = ( $a_stylesheet === $stylesheet ) ? ' selected="selected"' : '';
235
+            echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display( 'Name' ) . '</option>';
236
+        }
237
+        ?>
238 238
 		</select>
239 239
 		<?php submit_button( __( 'Select' ), '', 'Submit', false ); ?>
240 240
 	</form>
@@ -244,7 +244,7 @@  discard block
 block discarded – undo
244 244
 
245 245
 <?php
246 246
 if ( $theme->errors() ) {
247
-	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
247
+    echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
248 248
 }
249 249
 ?>
250 250
 
@@ -254,16 +254,16 @@  discard block
 block discarded – undo
254 254
 		<?php if ( $theme->parent() ) : ?>
255 255
 			<li class="howto">
256 256
 				<?php
257
-				printf(
258
-					/* translators: %s: Link to edit parent theme. */
259
-					__( 'This child theme inherits templates from a parent theme, %s.' ),
260
-					sprintf(
261
-						'<a href="%s">%s</a>',
262
-						self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
263
-						$theme->parent()->display( 'Name' )
264
-					)
265
-				);
266
-				?>
257
+                printf(
258
+                    /* translators: %s: Link to edit parent theme. */
259
+                    __( 'This child theme inherits templates from a parent theme, %s.' ),
260
+                    sprintf(
261
+                        '<a href="%s">%s</a>',
262
+                        self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
263
+                        $theme->parent()->display( 'Name' )
264
+                    )
265
+                );
266
+                ?>
267 267
 			</li>
268 268
 		<?php endif; ?>
269 269
 		<li role="treeitem" tabindex="-1" aria-expanded="true" aria-level="1" aria-posinset="1" aria-setsize="1">
@@ -276,9 +276,9 @@  discard block
 block discarded – undo
276 276
 
277 277
 <?php
278 278
 if ( $error ) :
279
-	echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
279
+    echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
280 280
 else :
281
-	?>
281
+    ?>
282 282
 	<form name="template" id="template" action="theme-editor.php" method="post">
283 283
 		<?php wp_nonce_field( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce' ); ?>
284 284
 		<div>
@@ -318,12 +318,12 @@  discard block
 block discarded – undo
318 318
 			<?php else : ?>
319 319
 				<p>
320 320
 					<?php
321
-					printf(
322
-						/* translators: %s: Documentation URL. */
323
-						__( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
324
-						__( 'https://wordpress.org/support/article/changing-file-permissions/' )
325
-					);
326
-					?>
321
+                    printf(
322
+                        /* translators: %s: Documentation URL. */
323
+                        __( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
324
+                        __( 'https://wordpress.org/support/article/changing-file-permissions/' )
325
+                    );
326
+                    ?>
327 327
 				</p>
328 328
 			<?php endif; ?>
329 329
 		</div>
@@ -338,19 +338,19 @@  discard block
 block discarded – undo
338 338
 <?php
339 339
 $dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
340 340
 if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :
341
-	// Get a back URL.
342
-	$referer = wp_get_referer();
343
-
344
-	$excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
345
-
346
-	$return_url = admin_url( '/' );
347
-	if ( $referer ) {
348
-		$referer_path = parse_url( $referer, PHP_URL_PATH );
349
-		if ( is_string( $referer_path ) && ! in_array( basename( $referer_path ), $excluded_referer_basenames, true ) ) {
350
-			$return_url = $referer;
351
-		}
352
-	}
353
-	?>
341
+    // Get a back URL.
342
+    $referer = wp_get_referer();
343
+
344
+    $excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
345
+
346
+    $return_url = admin_url( '/' );
347
+    if ( $referer ) {
348
+        $referer_path = parse_url( $referer, PHP_URL_PATH );
349
+        if ( is_string( $referer_path ) && ! in_array( basename( $referer_path ), $excluded_referer_basenames, true ) ) {
350
+            $return_url = $referer;
351
+        }
352
+    }
353
+    ?>
354 354
 	<div id="file-editor-warning" class="notification-dialog-wrap file-editor-warning hide-if-no-js hidden">
355 355
 		<div class="notification-dialog-background"></div>
356 356
 		<div class="notification-dialog">
@@ -359,20 +359,20 @@  discard block
 block discarded – undo
359 359
 					<h1><?php _e( 'Heads up!' ); ?></h1>
360 360
 					<p>
361 361
 						<?php
362
-						_e( 'You appear to be making direct edits to your theme in the WordPress dashboard. It is not recommended! Editing your theme directly could break your site and your changes may be lost in future updates.' );
363
-						?>
362
+                        _e( 'You appear to be making direct edits to your theme in the WordPress dashboard. It is not recommended! Editing your theme directly could break your site and your changes may be lost in future updates.' );
363
+                        ?>
364 364
 					</p>
365 365
 						<?php
366
-						if ( ! $theme->parent() ) {
367
-							echo '<p>';
368
-							printf(
369
-								/* translators: %s: Link to documentation on child themes. */
370
-								__( 'If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.' ),
371
-								esc_url( __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) )
372
-							);
373
-							echo '</p>';
374
-						}
375
-						?>
366
+                        if ( ! $theme->parent() ) {
367
+                            echo '<p>';
368
+                            printf(
369
+                                /* translators: %s: Link to documentation on child themes. */
370
+                                __( 'If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.' ),
371
+                                esc_url( __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) )
372
+                            );
373
+                            echo '</p>';
374
+                        }
375
+                        ?>
376 376
 					<p><?php _e( 'If you decide to go ahead with direct edits anyway, use a file manager to create a copy with a new name and hang on to the original. That way, you can re-enable a functional version if something goes wrong.' ); ?></p>
377 377
 				</div>
378 378
 				<p>
Please login to merge, or discard this patch.
Spacing   +130 added lines, -130 removed lines patch added patch discarded remove patch
@@ -9,120 +9,120 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12
-if ( is_multisite() && ! is_network_admin() ) {
13
-	wp_redirect( network_admin_url( 'theme-editor.php' ) );
12
+if (is_multisite() && !is_network_admin()) {
13
+	wp_redirect(network_admin_url('theme-editor.php'));
14 14
 	exit;
15 15
 }
16 16
 
17
-if ( ! current_user_can( 'edit_themes' ) ) {
18
-	wp_die( '<p>' . __( 'Sorry, you are not allowed to edit templates for this site.' ) . '</p>' );
17
+if (!current_user_can('edit_themes')) {
18
+	wp_die('<p>' . __('Sorry, you are not allowed to edit templates for this site.') . '</p>');
19 19
 }
20 20
 
21 21
 // Used in the HTML title tag.
22
-$title       = __( 'Edit Themes' );
22
+$title       = __('Edit Themes');
23 23
 $parent_file = 'themes.php';
24 24
 
25 25
 get_current_screen()->add_help_tab(
26 26
 	array(
27 27
 		'id'      => 'overview',
28
-		'title'   => __( 'Overview' ),
28
+		'title'   => __('Overview'),
29 29
 		'content' =>
30
-				'<p>' . __( 'You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.' ) . '</p>' .
31
-				'<p>' . __( 'Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme&#8217;s template files. Clicking once on any file name causes the file to appear in the large Editor box.' ) . '</p>' .
32
-				'<p>' . __( 'For PHP files, you can use the documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.' ) . '</p>' .
33
-				'<p id="editor-keyboard-trap-help-1">' . __( 'When using a keyboard to navigate:' ) . '</p>' .
30
+				'<p>' . __('You can use the theme file editor to edit the individual CSS and PHP files which make up your theme.') . '</p>' .
31
+				'<p>' . __('Begin by choosing a theme to edit from the dropdown menu and clicking the Select button. A list then appears of the theme&#8217;s template files. Clicking once on any file name causes the file to appear in the large Editor box.') . '</p>' .
32
+				'<p>' . __('For PHP files, you can use the documentation dropdown to select from functions recognized in that file. Look Up takes you to a web page with reference material about that particular function.') . '</p>' .
33
+				'<p id="editor-keyboard-trap-help-1">' . __('When using a keyboard to navigate:') . '</p>' .
34 34
 				'<ul>' .
35
-				'<li id="editor-keyboard-trap-help-2">' . __( 'In the editing area, the Tab key enters a tab character.' ) . '</li>' .
36
-				'<li id="editor-keyboard-trap-help-3">' . __( 'To move away from this area, press the Esc key followed by the Tab key.' ) . '</li>' .
37
-				'<li id="editor-keyboard-trap-help-4">' . __( 'Screen reader users: when in forms mode, you may need to press the Esc key twice.' ) . '</li>' .
35
+				'<li id="editor-keyboard-trap-help-2">' . __('In the editing area, the Tab key enters a tab character.') . '</li>' .
36
+				'<li id="editor-keyboard-trap-help-3">' . __('To move away from this area, press the Esc key followed by the Tab key.') . '</li>' .
37
+				'<li id="editor-keyboard-trap-help-4">' . __('Screen reader users: when in forms mode, you may need to press the Esc key twice.') . '</li>' .
38 38
 				'</ul>' .
39
-				'<p>' . __( 'After typing in your edits, click Update File.' ) . '</p>' .
40
-				'<p>' . __( '<strong>Advice:</strong> Think very carefully about your site crashing if you are live-editing the theme currently in use.' ) . '</p>' .
39
+				'<p>' . __('After typing in your edits, click Update File.') . '</p>' .
40
+				'<p>' . __('<strong>Advice:</strong> Think very carefully about your site crashing if you are live-editing the theme currently in use.') . '</p>' .
41 41
 				'<p>' . sprintf(
42 42
 					/* translators: %s: Link to documentation on child themes. */
43
-					__( 'Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.' ),
44
-					__( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' )
43
+					__('Upgrading to a newer version of the same theme will override changes made here. To avoid this, consider creating a <a href="%s">child theme</a> instead.'),
44
+					__('https://developer.wordpress.org/themes/advanced-topics/child-themes/')
45 45
 				) . '</p>' .
46
-				( is_network_admin() ? '<p>' . __( 'Any edits to files from this screen will be reflected on all sites in the network.' ) . '</p>' : '' ),
46
+				(is_network_admin() ? '<p>' . __('Any edits to files from this screen will be reflected on all sites in the network.') . '</p>' : ''),
47 47
 	)
48 48
 );
49 49
 
50 50
 get_current_screen()->set_help_sidebar(
51
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
52
-	'<p>' . __( '<a href="https://developer.wordpress.org/themes/">Documentation on Theme Development</a>' ) . '</p>' .
53
-	'<p>' . __( '<a href="https://wordpress.org/support/article/appearance-editor-screen/">Documentation on Editing Themes</a>' ) . '</p>' .
54
-	'<p>' . __( '<a href="https://wordpress.org/support/article/editing-files/">Documentation on Editing Files</a>' ) . '</p>' .
55
-	'<p>' . __( '<a href="https://developer.wordpress.org/themes/basics/template-tags/">Documentation on Template Tags</a>' ) . '</p>' .
56
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
51
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
52
+	'<p>' . __('<a href="https://developer.wordpress.org/themes/">Documentation on Theme Development</a>') . '</p>' .
53
+	'<p>' . __('<a href="https://wordpress.org/support/article/appearance-editor-screen/">Documentation on Editing Themes</a>') . '</p>' .
54
+	'<p>' . __('<a href="https://wordpress.org/support/article/editing-files/">Documentation on Editing Files</a>') . '</p>' .
55
+	'<p>' . __('<a href="https://developer.wordpress.org/themes/basics/template-tags/">Documentation on Template Tags</a>') . '</p>' .
56
+	'<p>' . __('<a href="https://wordpress.org/support/">Support</a>') . '</p>'
57 57
 );
58 58
 
59
-wp_reset_vars( array( 'action', 'error', 'file', 'theme' ) );
59
+wp_reset_vars(array('action', 'error', 'file', 'theme'));
60 60
 
61
-if ( $theme ) {
61
+if ($theme) {
62 62
 	$stylesheet = $theme;
63 63
 } else {
64 64
 	$stylesheet = get_stylesheet();
65 65
 }
66 66
 
67
-$theme = wp_get_theme( $stylesheet );
67
+$theme = wp_get_theme($stylesheet);
68 68
 
69
-if ( ! $theme->exists() ) {
70
-	wp_die( __( 'The requested theme does not exist.' ) );
69
+if (!$theme->exists()) {
70
+	wp_die(__('The requested theme does not exist.'));
71 71
 }
72 72
 
73
-if ( $theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code() ) {
74
-	wp_die( __( 'The requested theme does not exist.' ) . ' ' . $theme->errors()->get_error_message() );
73
+if ($theme->errors() && 'theme_no_stylesheet' === $theme->errors()->get_error_code()) {
74
+	wp_die(__('The requested theme does not exist.') . ' ' . $theme->errors()->get_error_message());
75 75
 }
76 76
 
77 77
 $allowed_files = array();
78 78
 $style_files   = array();
79 79
 
80
-$file_types = wp_get_theme_file_editable_extensions( $theme );
80
+$file_types = wp_get_theme_file_editable_extensions($theme);
81 81
 
82
-foreach ( $file_types as $type ) {
83
-	switch ( $type ) {
82
+foreach ($file_types as $type) {
83
+	switch ($type) {
84 84
 		case 'php':
85
-			$allowed_files += $theme->get_files( 'php', -1 );
85
+			$allowed_files += $theme->get_files('php', -1);
86 86
 			break;
87 87
 		case 'css':
88
-			$style_files                = $theme->get_files( 'css', -1 );
88
+			$style_files                = $theme->get_files('css', -1);
89 89
 			$allowed_files['style.css'] = $style_files['style.css'];
90 90
 			$allowed_files             += $style_files;
91 91
 			break;
92 92
 		default:
93
-			$allowed_files += $theme->get_files( $type, -1 );
93
+			$allowed_files += $theme->get_files($type, -1);
94 94
 			break;
95 95
 	}
96 96
 }
97 97
 
98 98
 // Move functions.php and style.css to the top.
99
-if ( isset( $allowed_files['functions.php'] ) ) {
100
-	$allowed_files = array( 'functions.php' => $allowed_files['functions.php'] ) + $allowed_files;
99
+if (isset($allowed_files['functions.php'])) {
100
+	$allowed_files = array('functions.php' => $allowed_files['functions.php']) + $allowed_files;
101 101
 }
102
-if ( isset( $allowed_files['style.css'] ) ) {
103
-	$allowed_files = array( 'style.css' => $allowed_files['style.css'] ) + $allowed_files;
102
+if (isset($allowed_files['style.css'])) {
103
+	$allowed_files = array('style.css' => $allowed_files['style.css']) + $allowed_files;
104 104
 }
105 105
 
106
-if ( empty( $file ) ) {
106
+if (empty($file)) {
107 107
 	$relative_file = 'style.css';
108 108
 	$file          = $allowed_files['style.css'];
109 109
 } else {
110
-	$relative_file = wp_unslash( $file );
110
+	$relative_file = wp_unslash($file);
111 111
 	$file          = $theme->get_stylesheet_directory() . '/' . $relative_file;
112 112
 }
113 113
 
114
-validate_file_to_edit( $file, $allowed_files );
114
+validate_file_to_edit($file, $allowed_files);
115 115
 
116 116
 // Handle fallback editing of file when JavaScript is not available.
117 117
 $edit_error     = null;
118 118
 $posted_content = null;
119 119
 
120
-if ( 'POST' === $_SERVER['REQUEST_METHOD'] ) {
121
-	$r = wp_edit_theme_plugin_file( wp_unslash( $_POST ) );
122
-	if ( is_wp_error( $r ) ) {
120
+if ('POST' === $_SERVER['REQUEST_METHOD']) {
121
+	$r = wp_edit_theme_plugin_file(wp_unslash($_POST));
122
+	if (is_wp_error($r)) {
123 123
 		$edit_error = $r;
124
-		if ( check_ajax_referer( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce', false ) && isset( $_POST['newcontent'] ) ) {
125
-			$posted_content = wp_unslash( $_POST['newcontent'] );
124
+		if (check_ajax_referer('edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce', false) && isset($_POST['newcontent'])) {
125
+			$posted_content = wp_unslash($_POST['newcontent']);
126 126
 		}
127 127
 	} else {
128 128
 		wp_redirect(
@@ -132,7 +132,7 @@  discard block
 block discarded – undo
132 132
 					'theme' => $stylesheet,
133 133
 					'file'  => $relative_file,
134 134
 				),
135
-				admin_url( 'theme-editor.php' )
135
+				admin_url('theme-editor.php')
136 136
 			)
137 137
 		);
138 138
 		exit;
@@ -140,71 +140,71 @@  discard block
 block discarded – undo
140 140
 }
141 141
 
142 142
 $settings = array(
143
-	'codeEditor' => wp_enqueue_code_editor( compact( 'file' ) ),
143
+	'codeEditor' => wp_enqueue_code_editor(compact('file')),
144 144
 );
145
-wp_enqueue_script( 'wp-theme-plugin-editor' );
146
-wp_add_inline_script( 'wp-theme-plugin-editor', sprintf( 'jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode( $settings ) ) );
147
-wp_add_inline_script( 'wp-theme-plugin-editor', 'wp.themePluginEditor.themeOrPlugin = "theme";' );
145
+wp_enqueue_script('wp-theme-plugin-editor');
146
+wp_add_inline_script('wp-theme-plugin-editor', sprintf('jQuery( function( $ ) { wp.themePluginEditor.init( $( "#template" ), %s ); } )', wp_json_encode($settings)));
147
+wp_add_inline_script('wp-theme-plugin-editor', 'wp.themePluginEditor.themeOrPlugin = "theme";');
148 148
 
149 149
 require_once ABSPATH . 'wp-admin/admin-header.php';
150 150
 
151
-update_recently_edited( $file );
151
+update_recently_edited($file);
152 152
 
153
-if ( ! is_file( $file ) ) {
153
+if (!is_file($file)) {
154 154
 	$error = true;
155 155
 }
156 156
 
157 157
 $content = '';
158
-if ( ! empty( $posted_content ) ) {
158
+if (!empty($posted_content)) {
159 159
 	$content = $posted_content;
160
-} elseif ( ! $error && filesize( $file ) > 0 ) {
161
-	$f       = fopen( $file, 'r' );
162
-	$content = fread( $f, filesize( $file ) );
160
+} elseif (!$error && filesize($file) > 0) {
161
+	$f       = fopen($file, 'r');
162
+	$content = fread($f, filesize($file));
163 163
 
164
-	if ( '.php' === substr( $file, strrpos( $file, '.' ) ) ) {
165
-		$functions = wp_doc_link_parse( $content );
164
+	if ('.php' === substr($file, strrpos($file, '.'))) {
165
+		$functions = wp_doc_link_parse($content);
166 166
 
167 167
 		$docs_select  = '<select name="docs-list" id="docs-list">';
168
-		$docs_select .= '<option value="">' . esc_attr__( 'Function Name&hellip;' ) . '</option>';
169
-		foreach ( $functions as $function ) {
170
-			$docs_select .= '<option value="' . esc_attr( urlencode( $function ) ) . '">' . htmlspecialchars( $function ) . '()</option>';
168
+		$docs_select .= '<option value="">' . esc_attr__('Function Name&hellip;') . '</option>';
169
+		foreach ($functions as $function) {
170
+			$docs_select .= '<option value="' . esc_attr(urlencode($function)) . '">' . htmlspecialchars($function) . '()</option>';
171 171
 		}
172 172
 		$docs_select .= '</select>';
173 173
 	}
174 174
 
175
-	$content = esc_textarea( $content );
175
+	$content = esc_textarea($content);
176 176
 }
177 177
 
178
-$file_description = get_file_description( $relative_file );
179
-$file_show        = array_search( $file, array_filter( $allowed_files ), true );
180
-$description      = esc_html( $file_description );
181
-if ( $file_description !== $file_show ) {
182
-	$description .= ' <span>(' . esc_html( $file_show ) . ')</span>';
178
+$file_description = get_file_description($relative_file);
179
+$file_show        = array_search($file, array_filter($allowed_files), true);
180
+$description      = esc_html($file_description);
181
+if ($file_description !== $file_show) {
182
+	$description .= ' <span>(' . esc_html($file_show) . ')</span>';
183 183
 }
184 184
 ?>
185 185
 <div class="wrap">
186
-<h1><?php echo esc_html( $title ); ?></h1>
186
+<h1><?php echo esc_html($title); ?></h1>
187 187
 
188
-<?php if ( isset( $_GET['a'] ) ) : ?>
188
+<?php if (isset($_GET['a'])) : ?>
189 189
 	<div id="message" class="updated notice is-dismissible">
190
-		<p><?php _e( 'File edited successfully.' ); ?></p>
190
+		<p><?php _e('File edited successfully.'); ?></p>
191 191
 	</div>
192
-<?php elseif ( is_wp_error( $edit_error ) ) : ?>
192
+<?php elseif (is_wp_error($edit_error)) : ?>
193 193
 	<div id="message" class="notice notice-error">
194
-		<p><?php _e( 'There was an error while trying to update the file. You may need to fix something and try updating again.' ); ?></p>
195
-		<pre><?php echo esc_html( $edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code() ); ?></pre>
194
+		<p><?php _e('There was an error while trying to update the file. You may need to fix something and try updating again.'); ?></p>
195
+		<pre><?php echo esc_html($edit_error->get_error_message() ? $edit_error->get_error_message() : $edit_error->get_error_code()); ?></pre>
196 196
 	</div>
197 197
 <?php endif; ?>
198 198
 
199
-<?php if ( preg_match( '/\.css$/', $file ) && ! wp_is_block_theme() && current_user_can( 'customize' ) ) : ?>
199
+<?php if (preg_match('/\.css$/', $file) && !wp_is_block_theme() && current_user_can('customize')) : ?>
200 200
 	<div id="message" class="notice-info notice">
201
-		<p><strong><?php _e( 'Did you know?' ); ?></strong></p>
201
+		<p><strong><?php _e('Did you know?'); ?></strong></p>
202 202
 		<p>
203 203
 			<?php
204 204
 			printf(
205 205
 				/* translators: %s: Link to Custom CSS section in the Customizer. */
206
-				__( 'There is no need to change your CSS here &mdash; you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.' ),
207
-				esc_url( add_query_arg( 'autofocus[section]', 'custom_css', admin_url( 'customize.php' ) ) )
206
+				__('There is no need to change your CSS here &mdash; you can edit and live preview CSS changes in the <a href="%s">built-in CSS editor</a>.'),
207
+				esc_url(add_query_arg('autofocus[section]', 'custom_css', admin_url('customize.php')))
208 208
 			);
209 209
 			?>
210 210
 		</p>
@@ -215,52 +215,52 @@  discard block
 block discarded – undo
215 215
 <div class="alignleft">
216 216
 <h2>
217 217
 	<?php
218
-	echo $theme->display( 'Name' );
219
-	if ( $description ) {
220
-		echo ': ' . $description;}
218
+	echo $theme->display('Name');
219
+	if ($description) {
220
+		echo ': ' . $description; }
221 221
 	?>
222 222
 </h2>
223 223
 </div>
224 224
 <div class="alignright">
225 225
 	<form action="theme-editor.php" method="get">
226
-		<label for="theme" id="theme-plugin-editor-selector"><?php _e( 'Select theme to edit:' ); ?> </label>
226
+		<label for="theme" id="theme-plugin-editor-selector"><?php _e('Select theme to edit:'); ?> </label>
227 227
 		<select name="theme" id="theme">
228 228
 		<?php
229
-		foreach ( wp_get_themes( array( 'errors' => null ) ) as $a_stylesheet => $a_theme ) {
230
-			if ( $a_theme->errors() && 'theme_no_stylesheet' === $a_theme->errors()->get_error_code() ) {
229
+		foreach (wp_get_themes(array('errors' => null)) as $a_stylesheet => $a_theme) {
230
+			if ($a_theme->errors() && 'theme_no_stylesheet' === $a_theme->errors()->get_error_code()) {
231 231
 				continue;
232 232
 			}
233 233
 
234
-			$selected = ( $a_stylesheet === $stylesheet ) ? ' selected="selected"' : '';
235
-			echo "\n\t" . '<option value="' . esc_attr( $a_stylesheet ) . '"' . $selected . '>' . $a_theme->display( 'Name' ) . '</option>';
234
+			$selected = ($a_stylesheet === $stylesheet) ? ' selected="selected"' : '';
235
+			echo "\n\t" . '<option value="' . esc_attr($a_stylesheet) . '"' . $selected . '>' . $a_theme->display('Name') . '</option>';
236 236
 		}
237 237
 		?>
238 238
 		</select>
239
-		<?php submit_button( __( 'Select' ), '', 'Submit', false ); ?>
239
+		<?php submit_button(__('Select'), '', 'Submit', false); ?>
240 240
 	</form>
241 241
 </div>
242 242
 <br class="clear" />
243 243
 </div>
244 244
 
245 245
 <?php
246
-if ( $theme->errors() ) {
247
-	echo '<div class="error"><p><strong>' . __( 'This theme is broken.' ) . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
246
+if ($theme->errors()) {
247
+	echo '<div class="error"><p><strong>' . __('This theme is broken.') . '</strong> ' . $theme->errors()->get_error_message() . '</p></div>';
248 248
 }
249 249
 ?>
250 250
 
251 251
 <div id="templateside">
252
-	<h2 id="theme-files-label"><?php _e( 'Theme Files' ); ?></h2>
252
+	<h2 id="theme-files-label"><?php _e('Theme Files'); ?></h2>
253 253
 	<ul role="tree" aria-labelledby="theme-files-label">
254
-		<?php if ( $theme->parent() ) : ?>
254
+		<?php if ($theme->parent()) : ?>
255 255
 			<li class="howto">
256 256
 				<?php
257 257
 				printf(
258 258
 					/* translators: %s: Link to edit parent theme. */
259
-					__( 'This child theme inherits templates from a parent theme, %s.' ),
259
+					__('This child theme inherits templates from a parent theme, %s.'),
260 260
 					sprintf(
261 261
 						'<a href="%s">%s</a>',
262
-						self_admin_url( 'theme-editor.php?theme=' . urlencode( $theme->get_template() ) ),
263
-						$theme->parent()->display( 'Name' )
262
+						self_admin_url('theme-editor.php?theme=' . urlencode($theme->get_template())),
263
+						$theme->parent()->display('Name')
264 264
 					)
265 265
 				);
266 266
 				?>
@@ -268,51 +268,51 @@  discard block
 block discarded – undo
268 268
 		<?php endif; ?>
269 269
 		<li role="treeitem" tabindex="-1" aria-expanded="true" aria-level="1" aria-posinset="1" aria-setsize="1">
270 270
 			<ul role="group">
271
-				<?php wp_print_theme_file_tree( wp_make_theme_file_tree( $allowed_files ) ); ?>
271
+				<?php wp_print_theme_file_tree(wp_make_theme_file_tree($allowed_files)); ?>
272 272
 			</ul>
273 273
 		</li>
274 274
 	</ul>
275 275
 </div>
276 276
 
277 277
 <?php
278
-if ( $error ) :
279
-	echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
278
+if ($error) :
279
+	echo '<div class="error"><p>' . __('File does not exist! Please double check the name and try again.') . '</p></div>';
280 280
 else :
281 281
 	?>
282 282
 	<form name="template" id="template" action="theme-editor.php" method="post">
283
-		<?php wp_nonce_field( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce' ); ?>
283
+		<?php wp_nonce_field('edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce'); ?>
284 284
 		<div>
285
-			<label for="newcontent" id="theme-plugin-editor-label"><?php _e( 'Selected file content:' ); ?></label>
285
+			<label for="newcontent" id="theme-plugin-editor-label"><?php _e('Selected file content:'); ?></label>
286 286
 			<textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo $content; ?></textarea>
287 287
 			<input type="hidden" name="action" value="update" />
288
-			<input type="hidden" name="file" value="<?php echo esc_attr( $relative_file ); ?>" />
289
-			<input type="hidden" name="theme" value="<?php echo esc_attr( $theme->get_stylesheet() ); ?>" />
288
+			<input type="hidden" name="file" value="<?php echo esc_attr($relative_file); ?>" />
289
+			<input type="hidden" name="theme" value="<?php echo esc_attr($theme->get_stylesheet()); ?>" />
290 290
 		</div>
291 291
 
292
-		<?php if ( ! empty( $functions ) ) : ?>
292
+		<?php if (!empty($functions)) : ?>
293 293
 			<div id="documentation" class="hide-if-no-js">
294
-				<label for="docs-list"><?php _e( 'Documentation:' ); ?></label>
294
+				<label for="docs-list"><?php _e('Documentation:'); ?></label>
295 295
 				<?php echo $docs_select; ?>
296
-				<input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e( 'Look Up' ); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode( get_user_locale() ); ?>&amp;version=<?php echo urlencode( get_bloginfo( 'version' ) ); ?>&amp;redirect=true'); }" />
296
+				<input disabled id="docs-lookup" type="button" class="button" value="<?php esc_attr_e('Look Up'); ?>" onclick="if ( '' != jQuery('#docs-list').val() ) { window.open( 'https://api.wordpress.org/core/handbook/1.0/?function=' + escape( jQuery( '#docs-list' ).val() ) + '&amp;locale=<?php echo urlencode(get_user_locale()); ?>&amp;version=<?php echo urlencode(get_bloginfo('version')); ?>&amp;redirect=true'); }" />
297 297
 			</div>
298 298
 		<?php endif; ?>
299 299
 
300 300
 		<div>
301 301
 			<div class="editor-notices">
302
-				<?php if ( is_child_theme() && $theme->get_stylesheet() === get_template() ) : ?>
302
+				<?php if (is_child_theme() && $theme->get_stylesheet() === get_template()) : ?>
303 303
 					<div class="notice notice-warning inline">
304 304
 						<p>
305
-							<?php if ( is_writable( $file ) ) : ?>
306
-								<strong><?php _e( 'Caution:' ); ?></strong>
305
+							<?php if (is_writable($file)) : ?>
306
+								<strong><?php _e('Caution:'); ?></strong>
307 307
 							<?php endif; ?>
308
-							<?php _e( 'This is a file in your current parent theme.' ); ?>
308
+							<?php _e('This is a file in your current parent theme.'); ?>
309 309
 						</p>
310 310
 					</div>
311 311
 				<?php endif; ?>
312 312
 			</div>
313
-			<?php if ( is_writable( $file ) ) : ?>
313
+			<?php if (is_writable($file)) : ?>
314 314
 				<p class="submit">
315
-					<?php submit_button( __( 'Update File' ), 'primary', 'submit', false ); ?>
315
+					<?php submit_button(__('Update File'), 'primary', 'submit', false); ?>
316 316
 					<span class="spinner"></span>
317 317
 				</p>
318 318
 			<?php else : ?>
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 					<?php
321 321
 					printf(
322 322
 						/* translators: %s: Documentation URL. */
323
-						__( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
324
-						__( 'https://wordpress.org/support/article/changing-file-permissions/' )
323
+						__('You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.'),
324
+						__('https://wordpress.org/support/article/changing-file-permissions/')
325 325
 					);
326 326
 					?>
327 327
 				</p>
@@ -336,17 +336,17 @@  discard block
 block discarded – undo
336 336
 <br class="clear" />
337 337
 </div>
338 338
 <?php
339
-$dismissed_pointers = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) );
340
-if ( ! in_array( 'theme_editor_notice', $dismissed_pointers, true ) ) :
339
+$dismissed_pointers = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true));
340
+if (!in_array('theme_editor_notice', $dismissed_pointers, true)) :
341 341
 	// Get a back URL.
342 342
 	$referer = wp_get_referer();
343 343
 
344
-	$excluded_referer_basenames = array( 'theme-editor.php', 'wp-login.php' );
344
+	$excluded_referer_basenames = array('theme-editor.php', 'wp-login.php');
345 345
 
346
-	$return_url = admin_url( '/' );
347
-	if ( $referer ) {
348
-		$referer_path = parse_url( $referer, PHP_URL_PATH );
349
-		if ( is_string( $referer_path ) && ! in_array( basename( $referer_path ), $excluded_referer_basenames, true ) ) {
346
+	$return_url = admin_url('/');
347
+	if ($referer) {
348
+		$referer_path = parse_url($referer, PHP_URL_PATH);
349
+		if (is_string($referer_path) && !in_array(basename($referer_path), $excluded_referer_basenames, true)) {
350 350
 			$return_url = $referer;
351 351
 		}
352 352
 	}
@@ -356,28 +356,28 @@  discard block
 block discarded – undo
356 356
 		<div class="notification-dialog">
357 357
 			<div class="file-editor-warning-content">
358 358
 				<div class="file-editor-warning-message">
359
-					<h1><?php _e( 'Heads up!' ); ?></h1>
359
+					<h1><?php _e('Heads up!'); ?></h1>
360 360
 					<p>
361 361
 						<?php
362
-						_e( 'You appear to be making direct edits to your theme in the WordPress dashboard. It is not recommended! Editing your theme directly could break your site and your changes may be lost in future updates.' );
362
+						_e('You appear to be making direct edits to your theme in the WordPress dashboard. It is not recommended! Editing your theme directly could break your site and your changes may be lost in future updates.');
363 363
 						?>
364 364
 					</p>
365 365
 						<?php
366
-						if ( ! $theme->parent() ) {
366
+						if (!$theme->parent()) {
367 367
 							echo '<p>';
368 368
 							printf(
369 369
 								/* translators: %s: Link to documentation on child themes. */
370
-								__( 'If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.' ),
371
-								esc_url( __( 'https://developer.wordpress.org/themes/advanced-topics/child-themes/' ) )
370
+								__('If you need to tweak more than your theme&#8217;s CSS, you might want to try <a href="%s">making a child theme</a>.'),
371
+								esc_url(__('https://developer.wordpress.org/themes/advanced-topics/child-themes/'))
372 372
 							);
373 373
 							echo '</p>';
374 374
 						}
375 375
 						?>
376
-					<p><?php _e( 'If you decide to go ahead with direct edits anyway, use a file manager to create a copy with a new name and hang on to the original. That way, you can re-enable a functional version if something goes wrong.' ); ?></p>
376
+					<p><?php _e('If you decide to go ahead with direct edits anyway, use a file manager to create a copy with a new name and hang on to the original. That way, you can re-enable a functional version if something goes wrong.'); ?></p>
377 377
 				</div>
378 378
 				<p>
379
-					<a class="button file-editor-warning-go-back" href="<?php echo esc_url( $return_url ); ?>"><?php _e( 'Go back' ); ?></a>
380
-					<button type="button" class="file-editor-warning-dismiss button button-primary"><?php _e( 'I understand' ); ?></button>
379
+					<a class="button file-editor-warning-go-back" href="<?php echo esc_url($return_url); ?>"><?php _e('Go back'); ?></a>
380
+					<button type="button" class="file-editor-warning-dismiss button button-primary"><?php _e('I understand'); ?></button>
381 381
 				</p>
382 382
 			</div>
383 383
 		</div>
Please login to merge, or discard this patch.
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -277,10 +277,13 @@  discard block
 block discarded – undo
277 277
 <?php
278 278
 if ( $error ) :
279 279
 	echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
280
-else :
280
+else {
281
+    :
281 282
 	?>
282 283
 	<form name="template" id="template" action="theme-editor.php" method="post">
283
-		<?php wp_nonce_field( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce' ); ?>
284
+		<?php wp_nonce_field( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce' );
285
+}
286
+?>
284 287
 		<div>
285 288
 			<label for="newcontent" id="theme-plugin-editor-label"><?php _e( 'Selected file content:' ); ?></label>
286 289
 			<textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo $content; ?></textarea>
@@ -315,7 +318,8 @@  discard block
 block discarded – undo
315 318
 					<?php submit_button( __( 'Update File' ), 'primary', 'submit', false ); ?>
316 319
 					<span class="spinner"></span>
317 320
 				</p>
318
-			<?php else : ?>
321
+			<?php else {
322
+    : ?>
319 323
 				<p>
320 324
 					<?php
321 325
 					printf(
@@ -323,6 +327,7 @@  discard block
 block discarded – undo
323 327
 						__( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
324 328
 						__( 'https://wordpress.org/support/article/changing-file-permissions/' )
325 329
 					);
330
+}
326 331
 					?>
327 332
 				</p>
328 333
 			<?php endif; ?>
Please login to merge, or discard this patch.
brighty/wp-admin/post.php 3 patches
Indentation   +315 added lines, -315 removed lines patch added patch discarded remove patch
@@ -17,13 +17,13 @@  discard block
 block discarded – undo
17 17
 wp_reset_vars( array( 'action' ) );
18 18
 
19 19
 if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
20
-	wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
20
+    wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
21 21
 } elseif ( isset( $_GET['post'] ) ) {
22
-	$post_id = (int) $_GET['post'];
22
+    $post_id = (int) $_GET['post'];
23 23
 } elseif ( isset( $_POST['post_ID'] ) ) {
24
-	$post_id = (int) $_POST['post_ID'];
24
+    $post_id = (int) $_POST['post_ID'];
25 25
 } else {
26
-	$post_id = 0;
26
+    $post_id = 0;
27 27
 }
28 28
 $post_ID = $post_id;
29 29
 
@@ -35,335 +35,335 @@  discard block
 block discarded – undo
35 35
 global $post_type, $post_type_object, $post;
36 36
 
37 37
 if ( $post_id ) {
38
-	$post = get_post( $post_id );
38
+    $post = get_post( $post_id );
39 39
 }
40 40
 
41 41
 if ( $post ) {
42
-	$post_type        = $post->post_type;
43
-	$post_type_object = get_post_type_object( $post_type );
42
+    $post_type        = $post->post_type;
43
+    $post_type_object = get_post_type_object( $post_type );
44 44
 }
45 45
 
46 46
 if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
47
-	wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
47
+    wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
48 48
 }
49 49
 
50 50
 if ( isset( $_POST['deletepost'] ) ) {
51
-	$action = 'delete';
51
+    $action = 'delete';
52 52
 } elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' === $_POST['wp-preview'] ) {
53
-	$action = 'preview';
53
+    $action = 'preview';
54 54
 }
55 55
 
56 56
 $sendback = wp_get_referer();
57 57
 if ( ! $sendback ||
58
-	false !== strpos( $sendback, 'post.php' ) ||
59
-	false !== strpos( $sendback, 'post-new.php' ) ) {
60
-	if ( 'attachment' === $post_type ) {
61
-		$sendback = admin_url( 'upload.php' );
62
-	} else {
63
-		$sendback = admin_url( 'edit.php' );
64
-		if ( ! empty( $post_type ) ) {
65
-			$sendback = add_query_arg( 'post_type', $post_type, $sendback );
66
-		}
67
-	}
58
+    false !== strpos( $sendback, 'post.php' ) ||
59
+    false !== strpos( $sendback, 'post-new.php' ) ) {
60
+    if ( 'attachment' === $post_type ) {
61
+        $sendback = admin_url( 'upload.php' );
62
+    } else {
63
+        $sendback = admin_url( 'edit.php' );
64
+        if ( ! empty( $post_type ) ) {
65
+            $sendback = add_query_arg( 'post_type', $post_type, $sendback );
66
+        }
67
+    }
68 68
 } else {
69
-	$sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), $sendback );
69
+    $sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), $sendback );
70 70
 }
71 71
 
72 72
 switch ( $action ) {
73
-	case 'post-quickdraft-save':
74
-		// Check nonce and capabilities.
75
-		$nonce     = $_REQUEST['_wpnonce'];
76
-		$error_msg = false;
77
-
78
-		// For output of the Quick Draft dashboard widget.
79
-		require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
-
81
-		if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
-			$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
-		}
84
-
85
-		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
-			exit;
87
-		}
88
-
89
-		if ( $error_msg ) {
90
-			return wp_dashboard_quick_press( $error_msg );
91
-		}
92
-
93
-		$post = get_post( $_REQUEST['post_ID'] );
94
-		check_admin_referer( 'add-' . $post->post_type );
95
-
96
-		$_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
-		$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
-
99
-		// Wrap Quick Draft content in the Paragraph block.
100
-		if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
-			$_POST['content'] = sprintf(
102
-				'<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
-				str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
-			);
105
-		}
106
-
107
-		edit_post();
108
-		wp_dashboard_quick_press();
109
-		exit;
110
-
111
-	case 'postajaxpost':
112
-	case 'post':
113
-		check_admin_referer( 'add-' . $post_type );
114
-		$post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
-		redirect_post( $post_id );
116
-		exit;
117
-
118
-	case 'edit':
119
-		$editing = true;
120
-
121
-		if ( empty( $post_id ) ) {
122
-			wp_redirect( admin_url( 'post.php' ) );
123
-			exit;
124
-		}
125
-
126
-		if ( ! $post ) {
127
-			wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
-		}
129
-
130
-		if ( ! $post_type_object ) {
131
-			wp_die( __( 'Invalid post type.' ) );
132
-		}
133
-
134
-		if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
-			wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
-		}
137
-
138
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
-			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
-		}
141
-
142
-		if ( 'trash' === $post->post_status ) {
143
-			wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
-		}
145
-
146
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
147
-			check_admin_referer( 'lock-post_' . $post_id );
148
-			wp_set_post_lock( $post_id );
149
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
-			exit;
151
-		}
152
-
153
-		$post_type = $post->post_type;
154
-		if ( 'post' === $post_type ) {
155
-			$parent_file   = 'edit.php';
156
-			$submenu_file  = 'edit.php';
157
-			$post_new_file = 'post-new.php';
158
-		} elseif ( 'attachment' === $post_type ) {
159
-			$parent_file   = 'upload.php';
160
-			$submenu_file  = 'upload.php';
161
-			$post_new_file = 'media-new.php';
162
-		} else {
163
-			if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
-				$parent_file = $post_type_object->show_in_menu;
165
-			} else {
166
-				$parent_file = "edit.php?post_type=$post_type";
167
-			}
168
-			$submenu_file  = "edit.php?post_type=$post_type";
169
-			$post_new_file = "post-new.php?post_type=$post_type";
170
-		}
171
-
172
-		$title = $post_type_object->labels->edit_item;
173
-
174
-		/**
175
-		 * Allows replacement of the editor.
176
-		 *
177
-		 * @since 4.9.0
178
-		 *
179
-		 * @param bool    $replace Whether to replace the editor. Default false.
180
-		 * @param WP_Post $post    Post object.
181
-		 */
182
-		if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
-			break;
184
-		}
185
-
186
-		if ( use_block_editor_for_post( $post ) ) {
187
-			require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
-			break;
189
-		}
190
-
191
-		if ( ! wp_check_post_lock( $post->ID ) ) {
192
-			$active_post_lock = wp_set_post_lock( $post->ID );
193
-
194
-			if ( 'attachment' !== $post_type ) {
195
-				wp_enqueue_script( 'autosave' );
196
-			}
197
-		}
198
-
199
-		$post = get_post( $post_id, OBJECT, 'edit' );
200
-
201
-		if ( post_type_supports( $post_type, 'comments' ) ) {
202
-			wp_enqueue_script( 'admin-comments' );
203
-			enqueue_comment_hotkeys_js();
204
-		}
205
-
206
-		require ABSPATH . 'wp-admin/edit-form-advanced.php';
207
-
208
-		break;
209
-
210
-	case 'editattachment':
211
-		check_admin_referer( 'update-post_' . $post_id );
212
-
213
-		// Don't let these be changed.
214
-		unset( $_POST['guid'] );
215
-		$_POST['post_type'] = 'attachment';
216
-
217
-		// Update the thumbnail filename.
218
-		$newmeta          = wp_get_attachment_metadata( $post_id, true );
219
-		$newmeta['thumb'] = wp_basename( $_POST['thumb'] );
220
-
221
-		wp_update_attachment_metadata( $post_id, $newmeta );
222
-
223
-		// Intentional fall-through to trigger the edit_post() call.
224
-	case 'editpost':
225
-		check_admin_referer( 'update-post_' . $post_id );
226
-
227
-		$post_id = edit_post();
228
-
229
-		// Session cookie flag that the post was saved.
230
-		if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
-			setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
-		}
233
-
234
-		redirect_post( $post_id ); // Send user on their way while we keep working.
235
-
236
-		exit;
237
-
238
-	case 'trash':
239
-		check_admin_referer( 'trash-post_' . $post_id );
240
-
241
-		if ( ! $post ) {
242
-			wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
-		}
244
-
245
-		if ( ! $post_type_object ) {
246
-			wp_die( __( 'Invalid post type.' ) );
247
-		}
248
-
249
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
-			wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
-		}
252
-
253
-		$user_id = wp_check_post_lock( $post_id );
254
-		if ( $user_id ) {
255
-			$user = get_userdata( $user_id );
256
-			/* translators: %s: User's display name. */
257
-			wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
-		}
259
-
260
-		if ( ! wp_trash_post( $post_id ) ) {
261
-			wp_die( __( 'Error in moving the item to Trash.' ) );
262
-		}
263
-
264
-		wp_redirect(
265
-			add_query_arg(
266
-				array(
267
-					'trashed' => 1,
268
-					'ids'     => $post_id,
269
-				),
270
-				$sendback
271
-			)
272
-		);
273
-		exit;
274
-
275
-	case 'untrash':
276
-		check_admin_referer( 'untrash-post_' . $post_id );
277
-
278
-		if ( ! $post ) {
279
-			wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
-		}
281
-
282
-		if ( ! $post_type_object ) {
283
-			wp_die( __( 'Invalid post type.' ) );
284
-		}
285
-
286
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
-			wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
-		}
289
-
290
-		if ( ! wp_untrash_post( $post_id ) ) {
291
-			wp_die( __( 'Error in restoring the item from Trash.' ) );
292
-		}
293
-
294
-		$sendback = add_query_arg(
295
-			array(
296
-				'untrashed' => 1,
297
-				'ids'       => $post_id,
298
-			),
299
-			$sendback
300
-		);
301
-		wp_redirect( $sendback );
302
-		exit;
303
-
304
-	case 'delete':
305
-		check_admin_referer( 'delete-post_' . $post_id );
306
-
307
-		if ( ! $post ) {
308
-			wp_die( __( 'This item has already been deleted.' ) );
309
-		}
310
-
311
-		if ( ! $post_type_object ) {
312
-			wp_die( __( 'Invalid post type.' ) );
313
-		}
314
-
315
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
-			wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
-		}
318
-
319
-		if ( 'attachment' === $post->post_type ) {
320
-			$force = ( ! MEDIA_TRASH );
321
-			if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
-				wp_die( __( 'Error in deleting the attachment.' ) );
323
-			}
324
-		} else {
325
-			if ( ! wp_delete_post( $post_id, true ) ) {
326
-				wp_die( __( 'Error in deleting the item.' ) );
327
-			}
328
-		}
329
-
330
-		wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
-		exit;
332
-
333
-	case 'preview':
334
-		check_admin_referer( 'update-post_' . $post_id );
335
-
336
-		$url = post_preview();
337
-
338
-		wp_redirect( $url );
339
-		exit;
340
-
341
-	case 'toggle-custom-fields':
342
-		check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
-
344
-		$current_user_id = get_current_user_id();
345
-		if ( $current_user_id ) {
346
-			$enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
-			update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
-		}
349
-
350
-		wp_safe_redirect( wp_get_referer() );
351
-		exit;
352
-
353
-	default:
354
-		/**
355
-		 * Fires for a given custom post action request.
356
-		 *
357
-		 * The dynamic portion of the hook name, `$action`, refers to the custom post action.
358
-		 *
359
-		 * @since 4.6.0
360
-		 *
361
-		 * @param int $post_id Post ID sent with the request.
362
-		 */
363
-		do_action( "post_action_{$action}", $post_id );
364
-
365
-		wp_redirect( admin_url( 'edit.php' ) );
366
-		exit;
73
+    case 'post-quickdraft-save':
74
+        // Check nonce and capabilities.
75
+        $nonce     = $_REQUEST['_wpnonce'];
76
+        $error_msg = false;
77
+
78
+        // For output of the Quick Draft dashboard widget.
79
+        require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
+
81
+        if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
+            $error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
+        }
84
+
85
+        if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
+            exit;
87
+        }
88
+
89
+        if ( $error_msg ) {
90
+            return wp_dashboard_quick_press( $error_msg );
91
+        }
92
+
93
+        $post = get_post( $_REQUEST['post_ID'] );
94
+        check_admin_referer( 'add-' . $post->post_type );
95
+
96
+        $_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
+        $_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
+
99
+        // Wrap Quick Draft content in the Paragraph block.
100
+        if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
+            $_POST['content'] = sprintf(
102
+                '<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
+                str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
+            );
105
+        }
106
+
107
+        edit_post();
108
+        wp_dashboard_quick_press();
109
+        exit;
110
+
111
+    case 'postajaxpost':
112
+    case 'post':
113
+        check_admin_referer( 'add-' . $post_type );
114
+        $post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
+        redirect_post( $post_id );
116
+        exit;
117
+
118
+    case 'edit':
119
+        $editing = true;
120
+
121
+        if ( empty( $post_id ) ) {
122
+            wp_redirect( admin_url( 'post.php' ) );
123
+            exit;
124
+        }
125
+
126
+        if ( ! $post ) {
127
+            wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
+        }
129
+
130
+        if ( ! $post_type_object ) {
131
+            wp_die( __( 'Invalid post type.' ) );
132
+        }
133
+
134
+        if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
+            wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
+        }
137
+
138
+        if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
+            wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
+        }
141
+
142
+        if ( 'trash' === $post->post_status ) {
143
+            wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
+        }
145
+
146
+        if ( ! empty( $_GET['get-post-lock'] ) ) {
147
+            check_admin_referer( 'lock-post_' . $post_id );
148
+            wp_set_post_lock( $post_id );
149
+            wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
+            exit;
151
+        }
152
+
153
+        $post_type = $post->post_type;
154
+        if ( 'post' === $post_type ) {
155
+            $parent_file   = 'edit.php';
156
+            $submenu_file  = 'edit.php';
157
+            $post_new_file = 'post-new.php';
158
+        } elseif ( 'attachment' === $post_type ) {
159
+            $parent_file   = 'upload.php';
160
+            $submenu_file  = 'upload.php';
161
+            $post_new_file = 'media-new.php';
162
+        } else {
163
+            if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
+                $parent_file = $post_type_object->show_in_menu;
165
+            } else {
166
+                $parent_file = "edit.php?post_type=$post_type";
167
+            }
168
+            $submenu_file  = "edit.php?post_type=$post_type";
169
+            $post_new_file = "post-new.php?post_type=$post_type";
170
+        }
171
+
172
+        $title = $post_type_object->labels->edit_item;
173
+
174
+        /**
175
+         * Allows replacement of the editor.
176
+         *
177
+         * @since 4.9.0
178
+         *
179
+         * @param bool    $replace Whether to replace the editor. Default false.
180
+         * @param WP_Post $post    Post object.
181
+         */
182
+        if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
+            break;
184
+        }
185
+
186
+        if ( use_block_editor_for_post( $post ) ) {
187
+            require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
+            break;
189
+        }
190
+
191
+        if ( ! wp_check_post_lock( $post->ID ) ) {
192
+            $active_post_lock = wp_set_post_lock( $post->ID );
193
+
194
+            if ( 'attachment' !== $post_type ) {
195
+                wp_enqueue_script( 'autosave' );
196
+            }
197
+        }
198
+
199
+        $post = get_post( $post_id, OBJECT, 'edit' );
200
+
201
+        if ( post_type_supports( $post_type, 'comments' ) ) {
202
+            wp_enqueue_script( 'admin-comments' );
203
+            enqueue_comment_hotkeys_js();
204
+        }
205
+
206
+        require ABSPATH . 'wp-admin/edit-form-advanced.php';
207
+
208
+        break;
209
+
210
+    case 'editattachment':
211
+        check_admin_referer( 'update-post_' . $post_id );
212
+
213
+        // Don't let these be changed.
214
+        unset( $_POST['guid'] );
215
+        $_POST['post_type'] = 'attachment';
216
+
217
+        // Update the thumbnail filename.
218
+        $newmeta          = wp_get_attachment_metadata( $post_id, true );
219
+        $newmeta['thumb'] = wp_basename( $_POST['thumb'] );
220
+
221
+        wp_update_attachment_metadata( $post_id, $newmeta );
222
+
223
+        // Intentional fall-through to trigger the edit_post() call.
224
+    case 'editpost':
225
+        check_admin_referer( 'update-post_' . $post_id );
226
+
227
+        $post_id = edit_post();
228
+
229
+        // Session cookie flag that the post was saved.
230
+        if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
+            setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
+        }
233
+
234
+        redirect_post( $post_id ); // Send user on their way while we keep working.
235
+
236
+        exit;
237
+
238
+    case 'trash':
239
+        check_admin_referer( 'trash-post_' . $post_id );
240
+
241
+        if ( ! $post ) {
242
+            wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
+        }
244
+
245
+        if ( ! $post_type_object ) {
246
+            wp_die( __( 'Invalid post type.' ) );
247
+        }
248
+
249
+        if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
+            wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
+        }
252
+
253
+        $user_id = wp_check_post_lock( $post_id );
254
+        if ( $user_id ) {
255
+            $user = get_userdata( $user_id );
256
+            /* translators: %s: User's display name. */
257
+            wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
+        }
259
+
260
+        if ( ! wp_trash_post( $post_id ) ) {
261
+            wp_die( __( 'Error in moving the item to Trash.' ) );
262
+        }
263
+
264
+        wp_redirect(
265
+            add_query_arg(
266
+                array(
267
+                    'trashed' => 1,
268
+                    'ids'     => $post_id,
269
+                ),
270
+                $sendback
271
+            )
272
+        );
273
+        exit;
274
+
275
+    case 'untrash':
276
+        check_admin_referer( 'untrash-post_' . $post_id );
277
+
278
+        if ( ! $post ) {
279
+            wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
+        }
281
+
282
+        if ( ! $post_type_object ) {
283
+            wp_die( __( 'Invalid post type.' ) );
284
+        }
285
+
286
+        if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
+            wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
+        }
289
+
290
+        if ( ! wp_untrash_post( $post_id ) ) {
291
+            wp_die( __( 'Error in restoring the item from Trash.' ) );
292
+        }
293
+
294
+        $sendback = add_query_arg(
295
+            array(
296
+                'untrashed' => 1,
297
+                'ids'       => $post_id,
298
+            ),
299
+            $sendback
300
+        );
301
+        wp_redirect( $sendback );
302
+        exit;
303
+
304
+    case 'delete':
305
+        check_admin_referer( 'delete-post_' . $post_id );
306
+
307
+        if ( ! $post ) {
308
+            wp_die( __( 'This item has already been deleted.' ) );
309
+        }
310
+
311
+        if ( ! $post_type_object ) {
312
+            wp_die( __( 'Invalid post type.' ) );
313
+        }
314
+
315
+        if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
+            wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
+        }
318
+
319
+        if ( 'attachment' === $post->post_type ) {
320
+            $force = ( ! MEDIA_TRASH );
321
+            if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
+                wp_die( __( 'Error in deleting the attachment.' ) );
323
+            }
324
+        } else {
325
+            if ( ! wp_delete_post( $post_id, true ) ) {
326
+                wp_die( __( 'Error in deleting the item.' ) );
327
+            }
328
+        }
329
+
330
+        wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
+        exit;
332
+
333
+    case 'preview':
334
+        check_admin_referer( 'update-post_' . $post_id );
335
+
336
+        $url = post_preview();
337
+
338
+        wp_redirect( $url );
339
+        exit;
340
+
341
+    case 'toggle-custom-fields':
342
+        check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
+
344
+        $current_user_id = get_current_user_id();
345
+        if ( $current_user_id ) {
346
+            $enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
+            update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
+        }
349
+
350
+        wp_safe_redirect( wp_get_referer() );
351
+        exit;
352
+
353
+    default:
354
+        /**
355
+         * Fires for a given custom post action request.
356
+         *
357
+         * The dynamic portion of the hook name, `$action`, refers to the custom post action.
358
+         *
359
+         * @since 4.6.0
360
+         *
361
+         * @param int $post_id Post ID sent with the request.
362
+         */
363
+        do_action( "post_action_{$action}", $post_id );
364
+
365
+        wp_redirect( admin_url( 'edit.php' ) );
366
+        exit;
367 367
 } // End switch.
368 368
 
369 369
 require_once ABSPATH . 'wp-admin/admin-footer.php';
Please login to merge, or discard this patch.
Switch Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -70,108 +70,108 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 switch ( $action ) {
73
-	case 'post-quickdraft-save':
74
-		// Check nonce and capabilities.
75
-		$nonce     = $_REQUEST['_wpnonce'];
76
-		$error_msg = false;
77
-
78
-		// For output of the Quick Draft dashboard widget.
79
-		require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
-
81
-		if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
-			$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
-		}
84
-
85
-		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
-			exit;
87
-		}
88
-
89
-		if ( $error_msg ) {
90
-			return wp_dashboard_quick_press( $error_msg );
91
-		}
92
-
93
-		$post = get_post( $_REQUEST['post_ID'] );
94
-		check_admin_referer( 'add-' . $post->post_type );
95
-
96
-		$_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
-		$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
-
99
-		// Wrap Quick Draft content in the Paragraph block.
100
-		if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
-			$_POST['content'] = sprintf(
102
-				'<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
-				str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
-			);
105
-		}
106
-
107
-		edit_post();
108
-		wp_dashboard_quick_press();
109
-		exit;
110
-
111
-	case 'postajaxpost':
112
-	case 'post':
113
-		check_admin_referer( 'add-' . $post_type );
114
-		$post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
-		redirect_post( $post_id );
116
-		exit;
117
-
118
-	case 'edit':
119
-		$editing = true;
120
-
121
-		if ( empty( $post_id ) ) {
122
-			wp_redirect( admin_url( 'post.php' ) );
123
-			exit;
124
-		}
125
-
126
-		if ( ! $post ) {
127
-			wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
-		}
129
-
130
-		if ( ! $post_type_object ) {
131
-			wp_die( __( 'Invalid post type.' ) );
132
-		}
133
-
134
-		if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
-			wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
-		}
137
-
138
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
-			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
-		}
141
-
142
-		if ( 'trash' === $post->post_status ) {
143
-			wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
-		}
145
-
146
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
147
-			check_admin_referer( 'lock-post_' . $post_id );
148
-			wp_set_post_lock( $post_id );
149
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
-			exit;
151
-		}
152
-
153
-		$post_type = $post->post_type;
154
-		if ( 'post' === $post_type ) {
155
-			$parent_file   = 'edit.php';
156
-			$submenu_file  = 'edit.php';
157
-			$post_new_file = 'post-new.php';
158
-		} elseif ( 'attachment' === $post_type ) {
159
-			$parent_file   = 'upload.php';
160
-			$submenu_file  = 'upload.php';
161
-			$post_new_file = 'media-new.php';
162
-		} else {
163
-			if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
-				$parent_file = $post_type_object->show_in_menu;
165
-			} else {
166
-				$parent_file = "edit.php?post_type=$post_type";
167
-			}
168
-			$submenu_file  = "edit.php?post_type=$post_type";
169
-			$post_new_file = "post-new.php?post_type=$post_type";
170
-		}
171
-
172
-		$title = $post_type_object->labels->edit_item;
173
-
174
-		/**
73
+	    case 'post-quickdraft-save':
74
+		    // Check nonce and capabilities.
75
+		    $nonce     = $_REQUEST['_wpnonce'];
76
+		    $error_msg = false;
77
+
78
+		    // For output of the Quick Draft dashboard widget.
79
+		    require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
+
81
+		    if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
+			    $error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
+		    }
84
+
85
+		    if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
+			    exit;
87
+		    }
88
+
89
+		    if ( $error_msg ) {
90
+			    return wp_dashboard_quick_press( $error_msg );
91
+		    }
92
+
93
+		    $post = get_post( $_REQUEST['post_ID'] );
94
+		    check_admin_referer( 'add-' . $post->post_type );
95
+
96
+		    $_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
+		    $_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
+
99
+		    // Wrap Quick Draft content in the Paragraph block.
100
+		    if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
+			    $_POST['content'] = sprintf(
102
+				    '<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
+				    str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
+			    );
105
+		    }
106
+
107
+		    edit_post();
108
+		    wp_dashboard_quick_press();
109
+		    exit;
110
+
111
+	    case 'postajaxpost':
112
+	    case 'post':
113
+		    check_admin_referer( 'add-' . $post_type );
114
+		    $post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
+		    redirect_post( $post_id );
116
+		    exit;
117
+
118
+	    case 'edit':
119
+		    $editing = true;
120
+
121
+		    if ( empty( $post_id ) ) {
122
+			    wp_redirect( admin_url( 'post.php' ) );
123
+			    exit;
124
+		    }
125
+
126
+		    if ( ! $post ) {
127
+			    wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
+		    }
129
+
130
+		    if ( ! $post_type_object ) {
131
+			    wp_die( __( 'Invalid post type.' ) );
132
+		    }
133
+
134
+		    if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
+			    wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
+		    }
137
+
138
+		    if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
+			    wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
+		    }
141
+
142
+		    if ( 'trash' === $post->post_status ) {
143
+			    wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
+		    }
145
+
146
+		    if ( ! empty( $_GET['get-post-lock'] ) ) {
147
+			    check_admin_referer( 'lock-post_' . $post_id );
148
+			    wp_set_post_lock( $post_id );
149
+			    wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
+			    exit;
151
+		    }
152
+
153
+		    $post_type = $post->post_type;
154
+		    if ( 'post' === $post_type ) {
155
+			    $parent_file   = 'edit.php';
156
+			    $submenu_file  = 'edit.php';
157
+			    $post_new_file = 'post-new.php';
158
+		    } elseif ( 'attachment' === $post_type ) {
159
+			    $parent_file   = 'upload.php';
160
+			    $submenu_file  = 'upload.php';
161
+			    $post_new_file = 'media-new.php';
162
+		    } else {
163
+			    if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
+				    $parent_file = $post_type_object->show_in_menu;
165
+			    } else {
166
+				    $parent_file = "edit.php?post_type=$post_type";
167
+			    }
168
+			    $submenu_file  = "edit.php?post_type=$post_type";
169
+			    $post_new_file = "post-new.php?post_type=$post_type";
170
+		    }
171
+
172
+		    $title = $post_type_object->labels->edit_item;
173
+
174
+		    /**
175 175
 		 * Allows replacement of the editor.
176 176
 		 *
177 177
 		 * @since 4.9.0
@@ -179,179 +179,179 @@  discard block
 block discarded – undo
179 179
 		 * @param bool    $replace Whether to replace the editor. Default false.
180 180
 		 * @param WP_Post $post    Post object.
181 181
 		 */
182
-		if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
-			break;
184
-		}
185
-
186
-		if ( use_block_editor_for_post( $post ) ) {
187
-			require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
-			break;
189
-		}
190
-
191
-		if ( ! wp_check_post_lock( $post->ID ) ) {
192
-			$active_post_lock = wp_set_post_lock( $post->ID );
193
-
194
-			if ( 'attachment' !== $post_type ) {
195
-				wp_enqueue_script( 'autosave' );
196
-			}
197
-		}
198
-
199
-		$post = get_post( $post_id, OBJECT, 'edit' );
200
-
201
-		if ( post_type_supports( $post_type, 'comments' ) ) {
202
-			wp_enqueue_script( 'admin-comments' );
203
-			enqueue_comment_hotkeys_js();
204
-		}
205
-
206
-		require ABSPATH . 'wp-admin/edit-form-advanced.php';
182
+		    if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
+			    break;
184
+		    }
207 185
 
208
-		break;
186
+		    if ( use_block_editor_for_post( $post ) ) {
187
+			    require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
+			    break;
189
+		    }
209 190
 
210
-	case 'editattachment':
211
-		check_admin_referer( 'update-post_' . $post_id );
191
+		    if ( ! wp_check_post_lock( $post->ID ) ) {
192
+			    $active_post_lock = wp_set_post_lock( $post->ID );
212 193
 
213
-		// Don't let these be changed.
214
-		unset( $_POST['guid'] );
215
-		$_POST['post_type'] = 'attachment';
194
+			    if ( 'attachment' !== $post_type ) {
195
+				    wp_enqueue_script( 'autosave' );
196
+			    }
197
+		    }
216 198
 
217
-		// Update the thumbnail filename.
218
-		$newmeta          = wp_get_attachment_metadata( $post_id, true );
219
-		$newmeta['thumb'] = wp_basename( $_POST['thumb'] );
199
+		    $post = get_post( $post_id, OBJECT, 'edit' );
220 200
 
221
-		wp_update_attachment_metadata( $post_id, $newmeta );
201
+		    if ( post_type_supports( $post_type, 'comments' ) ) {
202
+			    wp_enqueue_script( 'admin-comments' );
203
+			    enqueue_comment_hotkeys_js();
204
+		    }
205
+
206
+		    require ABSPATH . 'wp-admin/edit-form-advanced.php';
222 207
 
223
-		// Intentional fall-through to trigger the edit_post() call.
224
-	case 'editpost':
225
-		check_admin_referer( 'update-post_' . $post_id );
208
+		    break;
209
+
210
+	    case 'editattachment':
211
+		    check_admin_referer( 'update-post_' . $post_id );
226 212
 
227
-		$post_id = edit_post();
213
+		    // Don't let these be changed.
214
+		    unset( $_POST['guid'] );
215
+		    $_POST['post_type'] = 'attachment';
228 216
 
229
-		// Session cookie flag that the post was saved.
230
-		if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
-			setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
-		}
233
-
234
-		redirect_post( $post_id ); // Send user on their way while we keep working.
217
+		    // Update the thumbnail filename.
218
+		    $newmeta          = wp_get_attachment_metadata( $post_id, true );
219
+		    $newmeta['thumb'] = wp_basename( $_POST['thumb'] );
235 220
 
236
-		exit;
221
+		    wp_update_attachment_metadata( $post_id, $newmeta );
222
+
223
+		    // Intentional fall-through to trigger the edit_post() call.
224
+	    case 'editpost':
225
+		    check_admin_referer( 'update-post_' . $post_id );
226
+
227
+		    $post_id = edit_post();
228
+
229
+		    // Session cookie flag that the post was saved.
230
+		    if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
+			    setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
+		    }
233
+
234
+		    redirect_post( $post_id ); // Send user on their way while we keep working.
235
+
236
+		    exit;
237
+
238
+	    case 'trash':
239
+		    check_admin_referer( 'trash-post_' . $post_id );
237 240
 
238
-	case 'trash':
239
-		check_admin_referer( 'trash-post_' . $post_id );
241
+		    if ( ! $post ) {
242
+			    wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
+		    }
240 244
 
241
-		if ( ! $post ) {
242
-			wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
-		}
244
-
245
-		if ( ! $post_type_object ) {
246
-			wp_die( __( 'Invalid post type.' ) );
247
-		}
245
+		    if ( ! $post_type_object ) {
246
+			    wp_die( __( 'Invalid post type.' ) );
247
+		    }
248
+
249
+		    if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
+			    wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
+		    }
248 252
 
249
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
-			wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
-		}
252
-
253
-		$user_id = wp_check_post_lock( $post_id );
254
-		if ( $user_id ) {
255
-			$user = get_userdata( $user_id );
256
-			/* translators: %s: User's display name. */
257
-			wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
-		}
259
-
260
-		if ( ! wp_trash_post( $post_id ) ) {
261
-			wp_die( __( 'Error in moving the item to Trash.' ) );
262
-		}
263
-
264
-		wp_redirect(
265
-			add_query_arg(
266
-				array(
267
-					'trashed' => 1,
268
-					'ids'     => $post_id,
269
-				),
270
-				$sendback
271
-			)
272
-		);
273
-		exit;
274
-
275
-	case 'untrash':
276
-		check_admin_referer( 'untrash-post_' . $post_id );
277
-
278
-		if ( ! $post ) {
279
-			wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
-		}
281
-
282
-		if ( ! $post_type_object ) {
283
-			wp_die( __( 'Invalid post type.' ) );
284
-		}
253
+		    $user_id = wp_check_post_lock( $post_id );
254
+		    if ( $user_id ) {
255
+			    $user = get_userdata( $user_id );
256
+			    /* translators: %s: User's display name. */
257
+			    wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
+		    }
259
+
260
+		    if ( ! wp_trash_post( $post_id ) ) {
261
+			    wp_die( __( 'Error in moving the item to Trash.' ) );
262
+		    }
263
+
264
+		    wp_redirect(
265
+			    add_query_arg(
266
+				    array(
267
+					    'trashed' => 1,
268
+					    'ids'     => $post_id,
269
+				    ),
270
+				    $sendback
271
+			    )
272
+		    );
273
+		    exit;
274
+
275
+	    case 'untrash':
276
+		    check_admin_referer( 'untrash-post_' . $post_id );
277
+
278
+		    if ( ! $post ) {
279
+			    wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
+		    }
281
+
282
+		    if ( ! $post_type_object ) {
283
+			    wp_die( __( 'Invalid post type.' ) );
284
+		    }
285 285
 
286
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
-			wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
-		}
289
-
290
-		if ( ! wp_untrash_post( $post_id ) ) {
291
-			wp_die( __( 'Error in restoring the item from Trash.' ) );
292
-		}
293
-
294
-		$sendback = add_query_arg(
295
-			array(
296
-				'untrashed' => 1,
297
-				'ids'       => $post_id,
298
-			),
299
-			$sendback
300
-		);
301
-		wp_redirect( $sendback );
302
-		exit;
303
-
304
-	case 'delete':
305
-		check_admin_referer( 'delete-post_' . $post_id );
306
-
307
-		if ( ! $post ) {
308
-			wp_die( __( 'This item has already been deleted.' ) );
309
-		}
310
-
311
-		if ( ! $post_type_object ) {
312
-			wp_die( __( 'Invalid post type.' ) );
313
-		}
314
-
315
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
-			wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
-		}
318
-
319
-		if ( 'attachment' === $post->post_type ) {
320
-			$force = ( ! MEDIA_TRASH );
321
-			if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
-				wp_die( __( 'Error in deleting the attachment.' ) );
323
-			}
324
-		} else {
325
-			if ( ! wp_delete_post( $post_id, true ) ) {
326
-				wp_die( __( 'Error in deleting the item.' ) );
327
-			}
328
-		}
329
-
330
-		wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
-		exit;
332
-
333
-	case 'preview':
334
-		check_admin_referer( 'update-post_' . $post_id );
335
-
336
-		$url = post_preview();
337
-
338
-		wp_redirect( $url );
339
-		exit;
340
-
341
-	case 'toggle-custom-fields':
342
-		check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
-
344
-		$current_user_id = get_current_user_id();
345
-		if ( $current_user_id ) {
346
-			$enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
-			update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
-		}
286
+		    if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
+			    wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
+		    }
349 289
 
350
-		wp_safe_redirect( wp_get_referer() );
351
-		exit;
290
+		    if ( ! wp_untrash_post( $post_id ) ) {
291
+			    wp_die( __( 'Error in restoring the item from Trash.' ) );
292
+		    }
352 293
 
353
-	default:
354
-		/**
294
+		    $sendback = add_query_arg(
295
+			    array(
296
+				    'untrashed' => 1,
297
+				    'ids'       => $post_id,
298
+			    ),
299
+			    $sendback
300
+		    );
301
+		    wp_redirect( $sendback );
302
+		    exit;
303
+
304
+	    case 'delete':
305
+		    check_admin_referer( 'delete-post_' . $post_id );
306
+
307
+		    if ( ! $post ) {
308
+			    wp_die( __( 'This item has already been deleted.' ) );
309
+		    }
310
+
311
+		    if ( ! $post_type_object ) {
312
+			    wp_die( __( 'Invalid post type.' ) );
313
+		    }
314
+
315
+		    if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
+			    wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
+		    }
318
+
319
+		    if ( 'attachment' === $post->post_type ) {
320
+			    $force = ( ! MEDIA_TRASH );
321
+			    if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
+				    wp_die( __( 'Error in deleting the attachment.' ) );
323
+			    }
324
+		    } else {
325
+			    if ( ! wp_delete_post( $post_id, true ) ) {
326
+				    wp_die( __( 'Error in deleting the item.' ) );
327
+			    }
328
+		    }
329
+
330
+		    wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
+		    exit;
332
+
333
+	    case 'preview':
334
+		    check_admin_referer( 'update-post_' . $post_id );
335
+
336
+		    $url = post_preview();
337
+
338
+		    wp_redirect( $url );
339
+		    exit;
340
+
341
+	    case 'toggle-custom-fields':
342
+		    check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
+
344
+		    $current_user_id = get_current_user_id();
345
+		    if ( $current_user_id ) {
346
+			    $enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
+			    update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
+		    }
349
+
350
+		    wp_safe_redirect( wp_get_referer() );
351
+		    exit;
352
+
353
+	    default:
354
+		    /**
355 355
 		 * Fires for a given custom post action request.
356 356
 		 *
357 357
 		 * The dynamic portion of the hook name, `$action`, refers to the custom post action.
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 		 *
361 361
 		 * @param int $post_id Post ID sent with the request.
362 362
 		 */
363
-		do_action( "post_action_{$action}", $post_id );
363
+		    do_action( "post_action_{$action}", $post_id );
364 364
 
365
-		wp_redirect( admin_url( 'edit.php' ) );
366
-		exit;
365
+		    wp_redirect( admin_url( 'edit.php' ) );
366
+		    exit;
367 367
 } // End switch.
368 368
 
369 369
 require_once ABSPATH . 'wp-admin/admin-footer.php';
Please login to merge, or discard this patch.
Spacing   +119 added lines, -119 removed lines patch added patch discarded remove patch
@@ -14,13 +14,13 @@  discard block
 block discarded – undo
14 14
 $parent_file  = 'edit.php';
15 15
 $submenu_file = 'edit.php';
16 16
 
17
-wp_reset_vars( array( 'action' ) );
17
+wp_reset_vars(array('action'));
18 18
 
19
-if ( isset( $_GET['post'] ) && isset( $_POST['post_ID'] ) && (int) $_GET['post'] !== (int) $_POST['post_ID'] ) {
20
-	wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
21
-} elseif ( isset( $_GET['post'] ) ) {
19
+if (isset($_GET['post']) && isset($_POST['post_ID']) && (int) $_GET['post'] !== (int) $_POST['post_ID']) {
20
+	wp_die(__('A post ID mismatch has been detected.'), __('Sorry, you are not allowed to edit this item.'), 400);
21
+} elseif (isset($_GET['post'])) {
22 22
 	$post_id = (int) $_GET['post'];
23
-} elseif ( isset( $_POST['post_ID'] ) ) {
23
+} elseif (isset($_POST['post_ID'])) {
24 24
 	$post_id = (int) $_POST['post_ID'];
25 25
 } else {
26 26
 	$post_id = 0;
@@ -34,42 +34,42 @@  discard block
 block discarded – undo
34 34
  */
35 35
 global $post_type, $post_type_object, $post;
36 36
 
37
-if ( $post_id ) {
38
-	$post = get_post( $post_id );
37
+if ($post_id) {
38
+	$post = get_post($post_id);
39 39
 }
40 40
 
41
-if ( $post ) {
41
+if ($post) {
42 42
 	$post_type        = $post->post_type;
43
-	$post_type_object = get_post_type_object( $post_type );
43
+	$post_type_object = get_post_type_object($post_type);
44 44
 }
45 45
 
46
-if ( isset( $_POST['post_type'] ) && $post && $post_type !== $_POST['post_type'] ) {
47
-	wp_die( __( 'A post type mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 );
46
+if (isset($_POST['post_type']) && $post && $post_type !== $_POST['post_type']) {
47
+	wp_die(__('A post type mismatch has been detected.'), __('Sorry, you are not allowed to edit this item.'), 400);
48 48
 }
49 49
 
50
-if ( isset( $_POST['deletepost'] ) ) {
50
+if (isset($_POST['deletepost'])) {
51 51
 	$action = 'delete';
52
-} elseif ( isset( $_POST['wp-preview'] ) && 'dopreview' === $_POST['wp-preview'] ) {
52
+} elseif (isset($_POST['wp-preview']) && 'dopreview' === $_POST['wp-preview']) {
53 53
 	$action = 'preview';
54 54
 }
55 55
 
56 56
 $sendback = wp_get_referer();
57
-if ( ! $sendback ||
58
-	false !== strpos( $sendback, 'post.php' ) ||
59
-	false !== strpos( $sendback, 'post-new.php' ) ) {
60
-	if ( 'attachment' === $post_type ) {
61
-		$sendback = admin_url( 'upload.php' );
57
+if (!$sendback ||
58
+	false !== strpos($sendback, 'post.php') ||
59
+	false !== strpos($sendback, 'post-new.php')) {
60
+	if ('attachment' === $post_type) {
61
+		$sendback = admin_url('upload.php');
62 62
 	} else {
63
-		$sendback = admin_url( 'edit.php' );
64
-		if ( ! empty( $post_type ) ) {
65
-			$sendback = add_query_arg( 'post_type', $post_type, $sendback );
63
+		$sendback = admin_url('edit.php');
64
+		if (!empty($post_type)) {
65
+			$sendback = add_query_arg('post_type', $post_type, $sendback);
66 66
 		}
67 67
 	}
68 68
 } else {
69
-	$sendback = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'ids' ), $sendback );
69
+	$sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $sendback);
70 70
 }
71 71
 
72
-switch ( $action ) {
72
+switch ($action) {
73 73
 	case 'post-quickdraft-save':
74 74
 		// Check nonce and capabilities.
75 75
 		$nonce     = $_REQUEST['_wpnonce'];
@@ -78,29 +78,29 @@  discard block
 block discarded – undo
78 78
 		// For output of the Quick Draft dashboard widget.
79 79
 		require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80 80
 
81
-		if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
-			$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
81
+		if (!wp_verify_nonce($nonce, 'add-post')) {
82
+			$error_msg = __('Unable to submit this form, please refresh and try again.');
83 83
 		}
84 84
 
85
-		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
85
+		if (!current_user_can(get_post_type_object('post')->cap->create_posts)) {
86 86
 			exit;
87 87
 		}
88 88
 
89
-		if ( $error_msg ) {
90
-			return wp_dashboard_quick_press( $error_msg );
89
+		if ($error_msg) {
90
+			return wp_dashboard_quick_press($error_msg);
91 91
 		}
92 92
 
93
-		$post = get_post( $_REQUEST['post_ID'] );
94
-		check_admin_referer( 'add-' . $post->post_type );
93
+		$post = get_post($_REQUEST['post_ID']);
94
+		check_admin_referer('add-' . $post->post_type);
95 95
 
96
-		$_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
-		$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
96
+		$_POST['comment_status'] = get_default_comment_status($post->post_type);
97
+		$_POST['ping_status']    = get_default_comment_status($post->post_type, 'pingback');
98 98
 
99 99
 		// Wrap Quick Draft content in the Paragraph block.
100
-		if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
100
+		if (false === strpos($_POST['content'], '<!-- wp:paragraph -->')) {
101 101
 			$_POST['content'] = sprintf(
102 102
 				'<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
-				str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
103
+				str_replace(array("\r\n", "\r", "\n"), '<br />', $_POST['content'])
104 104
 			);
105 105
 		}
106 106
 
@@ -110,57 +110,57 @@  discard block
 block discarded – undo
110 110
 
111 111
 	case 'postajaxpost':
112 112
 	case 'post':
113
-		check_admin_referer( 'add-' . $post_type );
113
+		check_admin_referer('add-' . $post_type);
114 114
 		$post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
-		redirect_post( $post_id );
115
+		redirect_post($post_id);
116 116
 		exit;
117 117
 
118 118
 	case 'edit':
119 119
 		$editing = true;
120 120
 
121
-		if ( empty( $post_id ) ) {
122
-			wp_redirect( admin_url( 'post.php' ) );
121
+		if (empty($post_id)) {
122
+			wp_redirect(admin_url('post.php'));
123 123
 			exit;
124 124
 		}
125 125
 
126
-		if ( ! $post ) {
127
-			wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
126
+		if (!$post) {
127
+			wp_die(__('You attempted to edit an item that does not exist. Perhaps it was deleted?'));
128 128
 		}
129 129
 
130
-		if ( ! $post_type_object ) {
131
-			wp_die( __( 'Invalid post type.' ) );
130
+		if (!$post_type_object) {
131
+			wp_die(__('Invalid post type.'));
132 132
 		}
133 133
 
134
-		if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
-			wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
134
+		if (!in_array($typenow, get_post_types(array('show_ui' => true)), true)) {
135
+			wp_die(__('Sorry, you are not allowed to edit posts in this post type.'));
136 136
 		}
137 137
 
138
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
-			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
138
+		if (!current_user_can('edit_post', $post_id)) {
139
+			wp_die(__('Sorry, you are not allowed to edit this item.'));
140 140
 		}
141 141
 
142
-		if ( 'trash' === $post->post_status ) {
143
-			wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
142
+		if ('trash' === $post->post_status) {
143
+			wp_die(__('You cannot edit this item because it is in the Trash. Please restore it and try again.'));
144 144
 		}
145 145
 
146
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
147
-			check_admin_referer( 'lock-post_' . $post_id );
148
-			wp_set_post_lock( $post_id );
149
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
146
+		if (!empty($_GET['get-post-lock'])) {
147
+			check_admin_referer('lock-post_' . $post_id);
148
+			wp_set_post_lock($post_id);
149
+			wp_redirect(get_edit_post_link($post_id, 'url'));
150 150
 			exit;
151 151
 		}
152 152
 
153 153
 		$post_type = $post->post_type;
154
-		if ( 'post' === $post_type ) {
154
+		if ('post' === $post_type) {
155 155
 			$parent_file   = 'edit.php';
156 156
 			$submenu_file  = 'edit.php';
157 157
 			$post_new_file = 'post-new.php';
158
-		} elseif ( 'attachment' === $post_type ) {
158
+		} elseif ('attachment' === $post_type) {
159 159
 			$parent_file   = 'upload.php';
160 160
 			$submenu_file  = 'upload.php';
161 161
 			$post_new_file = 'media-new.php';
162 162
 		} else {
163
-			if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
163
+			if (isset($post_type_object) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu) {
164 164
 				$parent_file = $post_type_object->show_in_menu;
165 165
 			} else {
166 166
 				$parent_file = "edit.php?post_type=$post_type";
@@ -179,27 +179,27 @@  discard block
 block discarded – undo
179 179
 		 * @param bool    $replace Whether to replace the editor. Default false.
180 180
 		 * @param WP_Post $post    Post object.
181 181
 		 */
182
-		if ( true === apply_filters( 'replace_editor', false, $post ) ) {
182
+		if (true === apply_filters('replace_editor', false, $post)) {
183 183
 			break;
184 184
 		}
185 185
 
186
-		if ( use_block_editor_for_post( $post ) ) {
186
+		if (use_block_editor_for_post($post)) {
187 187
 			require ABSPATH . 'wp-admin/edit-form-blocks.php';
188 188
 			break;
189 189
 		}
190 190
 
191
-		if ( ! wp_check_post_lock( $post->ID ) ) {
192
-			$active_post_lock = wp_set_post_lock( $post->ID );
191
+		if (!wp_check_post_lock($post->ID)) {
192
+			$active_post_lock = wp_set_post_lock($post->ID);
193 193
 
194
-			if ( 'attachment' !== $post_type ) {
195
-				wp_enqueue_script( 'autosave' );
194
+			if ('attachment' !== $post_type) {
195
+				wp_enqueue_script('autosave');
196 196
 			}
197 197
 		}
198 198
 
199
-		$post = get_post( $post_id, OBJECT, 'edit' );
199
+		$post = get_post($post_id, OBJECT, 'edit');
200 200
 
201
-		if ( post_type_supports( $post_type, 'comments' ) ) {
202
-			wp_enqueue_script( 'admin-comments' );
201
+		if (post_type_supports($post_type, 'comments')) {
202
+			wp_enqueue_script('admin-comments');
203 203
 			enqueue_comment_hotkeys_js();
204 204
 		}
205 205
 
@@ -208,57 +208,57 @@  discard block
 block discarded – undo
208 208
 		break;
209 209
 
210 210
 	case 'editattachment':
211
-		check_admin_referer( 'update-post_' . $post_id );
211
+		check_admin_referer('update-post_' . $post_id);
212 212
 
213 213
 		// Don't let these be changed.
214
-		unset( $_POST['guid'] );
214
+		unset($_POST['guid']);
215 215
 		$_POST['post_type'] = 'attachment';
216 216
 
217 217
 		// Update the thumbnail filename.
218
-		$newmeta          = wp_get_attachment_metadata( $post_id, true );
219
-		$newmeta['thumb'] = wp_basename( $_POST['thumb'] );
218
+		$newmeta          = wp_get_attachment_metadata($post_id, true);
219
+		$newmeta['thumb'] = wp_basename($_POST['thumb']);
220 220
 
221
-		wp_update_attachment_metadata( $post_id, $newmeta );
221
+		wp_update_attachment_metadata($post_id, $newmeta);
222 222
 
223 223
 		// Intentional fall-through to trigger the edit_post() call.
224 224
 	case 'editpost':
225
-		check_admin_referer( 'update-post_' . $post_id );
225
+		check_admin_referer('update-post_' . $post_id);
226 226
 
227 227
 		$post_id = edit_post();
228 228
 
229 229
 		// Session cookie flag that the post was saved.
230
-		if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
-			setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
230
+		if (isset($_COOKIE['wp-saving-post']) && $_COOKIE['wp-saving-post'] === $post_id . '-check') {
231
+			setcookie('wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl());
232 232
 		}
233 233
 
234
-		redirect_post( $post_id ); // Send user on their way while we keep working.
234
+		redirect_post($post_id); // Send user on their way while we keep working.
235 235
 
236 236
 		exit;
237 237
 
238 238
 	case 'trash':
239
-		check_admin_referer( 'trash-post_' . $post_id );
239
+		check_admin_referer('trash-post_' . $post_id);
240 240
 
241
-		if ( ! $post ) {
242
-			wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
241
+		if (!$post) {
242
+			wp_die(__('The item you are trying to move to the Trash no longer exists.'));
243 243
 		}
244 244
 
245
-		if ( ! $post_type_object ) {
246
-			wp_die( __( 'Invalid post type.' ) );
245
+		if (!$post_type_object) {
246
+			wp_die(__('Invalid post type.'));
247 247
 		}
248 248
 
249
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
-			wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
249
+		if (!current_user_can('delete_post', $post_id)) {
250
+			wp_die(__('Sorry, you are not allowed to move this item to the Trash.'));
251 251
 		}
252 252
 
253
-		$user_id = wp_check_post_lock( $post_id );
254
-		if ( $user_id ) {
255
-			$user = get_userdata( $user_id );
253
+		$user_id = wp_check_post_lock($post_id);
254
+		if ($user_id) {
255
+			$user = get_userdata($user_id);
256 256
 			/* translators: %s: User's display name. */
257
-			wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
257
+			wp_die(sprintf(__('You cannot move this item to the Trash. %s is currently editing.'), $user->display_name));
258 258
 		}
259 259
 
260
-		if ( ! wp_trash_post( $post_id ) ) {
261
-			wp_die( __( 'Error in moving the item to Trash.' ) );
260
+		if (!wp_trash_post($post_id)) {
261
+			wp_die(__('Error in moving the item to Trash.'));
262 262
 		}
263 263
 
264 264
 		wp_redirect(
@@ -273,22 +273,22 @@  discard block
 block discarded – undo
273 273
 		exit;
274 274
 
275 275
 	case 'untrash':
276
-		check_admin_referer( 'untrash-post_' . $post_id );
276
+		check_admin_referer('untrash-post_' . $post_id);
277 277
 
278
-		if ( ! $post ) {
279
-			wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
278
+		if (!$post) {
279
+			wp_die(__('The item you are trying to restore from the Trash no longer exists.'));
280 280
 		}
281 281
 
282
-		if ( ! $post_type_object ) {
283
-			wp_die( __( 'Invalid post type.' ) );
282
+		if (!$post_type_object) {
283
+			wp_die(__('Invalid post type.'));
284 284
 		}
285 285
 
286
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
-			wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
286
+		if (!current_user_can('delete_post', $post_id)) {
287
+			wp_die(__('Sorry, you are not allowed to restore this item from the Trash.'));
288 288
 		}
289 289
 
290
-		if ( ! wp_untrash_post( $post_id ) ) {
291
-			wp_die( __( 'Error in restoring the item from Trash.' ) );
290
+		if (!wp_untrash_post($post_id)) {
291
+			wp_die(__('Error in restoring the item from Trash.'));
292 292
 		}
293 293
 
294 294
 		$sendback = add_query_arg(
@@ -298,56 +298,56 @@  discard block
 block discarded – undo
298 298
 			),
299 299
 			$sendback
300 300
 		);
301
-		wp_redirect( $sendback );
301
+		wp_redirect($sendback);
302 302
 		exit;
303 303
 
304 304
 	case 'delete':
305
-		check_admin_referer( 'delete-post_' . $post_id );
305
+		check_admin_referer('delete-post_' . $post_id);
306 306
 
307
-		if ( ! $post ) {
308
-			wp_die( __( 'This item has already been deleted.' ) );
307
+		if (!$post) {
308
+			wp_die(__('This item has already been deleted.'));
309 309
 		}
310 310
 
311
-		if ( ! $post_type_object ) {
312
-			wp_die( __( 'Invalid post type.' ) );
311
+		if (!$post_type_object) {
312
+			wp_die(__('Invalid post type.'));
313 313
 		}
314 314
 
315
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
-			wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
315
+		if (!current_user_can('delete_post', $post_id)) {
316
+			wp_die(__('Sorry, you are not allowed to delete this item.'));
317 317
 		}
318 318
 
319
-		if ( 'attachment' === $post->post_type ) {
320
-			$force = ( ! MEDIA_TRASH );
321
-			if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
-				wp_die( __( 'Error in deleting the attachment.' ) );
319
+		if ('attachment' === $post->post_type) {
320
+			$force = (!MEDIA_TRASH);
321
+			if (!wp_delete_attachment($post_id, $force)) {
322
+				wp_die(__('Error in deleting the attachment.'));
323 323
 			}
324 324
 		} else {
325
-			if ( ! wp_delete_post( $post_id, true ) ) {
326
-				wp_die( __( 'Error in deleting the item.' ) );
325
+			if (!wp_delete_post($post_id, true)) {
326
+				wp_die(__('Error in deleting the item.'));
327 327
 			}
328 328
 		}
329 329
 
330
-		wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
330
+		wp_redirect(add_query_arg('deleted', 1, $sendback));
331 331
 		exit;
332 332
 
333 333
 	case 'preview':
334
-		check_admin_referer( 'update-post_' . $post_id );
334
+		check_admin_referer('update-post_' . $post_id);
335 335
 
336 336
 		$url = post_preview();
337 337
 
338
-		wp_redirect( $url );
338
+		wp_redirect($url);
339 339
 		exit;
340 340
 
341 341
 	case 'toggle-custom-fields':
342
-		check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
342
+		check_admin_referer('toggle-custom-fields', 'toggle-custom-fields-nonce');
343 343
 
344 344
 		$current_user_id = get_current_user_id();
345
-		if ( $current_user_id ) {
346
-			$enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
-			update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
345
+		if ($current_user_id) {
346
+			$enable_custom_fields = (bool) get_user_meta($current_user_id, 'enable_custom_fields', true);
347
+			update_user_meta($current_user_id, 'enable_custom_fields', !$enable_custom_fields);
348 348
 		}
349 349
 
350
-		wp_safe_redirect( wp_get_referer() );
350
+		wp_safe_redirect(wp_get_referer());
351 351
 		exit;
352 352
 
353 353
 	default:
@@ -360,9 +360,9 @@  discard block
 block discarded – undo
360 360
 		 *
361 361
 		 * @param int $post_id Post ID sent with the request.
362 362
 		 */
363
-		do_action( "post_action_{$action}", $post_id );
363
+		do_action("post_action_{$action}", $post_id);
364 364
 
365
-		wp_redirect( admin_url( 'edit.php' ) );
365
+		wp_redirect(admin_url('edit.php'));
366 366
 		exit;
367 367
 } // End switch.
368 368
 
Please login to merge, or discard this patch.
brighty/wp-admin/options-media.php 3 patches
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( ! current_user_can( 'manage_options' ) ) {
13
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
13
+    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
14 14
 }
15 15
 
16 16
 // Used in the HTML title tag.
@@ -20,26 +20,26 @@  discard block
 block discarded – undo
20 20
 $media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>';
21 21
 
22 22
 if ( ! is_multisite()
23
-	&& ( get_option( 'upload_url_path' )
24
-		|| get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
23
+    && ( get_option( 'upload_url_path' )
24
+        || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
25 25
 ) {
26
-	$media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
26
+    $media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
27 27
 }
28 28
 
29 29
 $media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
30 30
 
31 31
 get_current_screen()->add_help_tab(
32
-	array(
33
-		'id'      => 'overview',
34
-		'title'   => __( 'Overview' ),
35
-		'content' => $media_options_help,
36
-	)
32
+    array(
33
+        'id'      => 'overview',
34
+        'title'   => __( 'Overview' ),
35
+        'content' => $media_options_help,
36
+    )
37 37
 );
38 38
 
39 39
 get_current_screen()->set_help_sidebar(
40
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
41
-	'<p>' . __( '<a href="https://wordpress.org/support/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
42
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
40
+    '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
41
+    '<p>' . __( '<a href="https://wordpress.org/support/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
42
+    '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
43 43
 );
44 44
 
45 45
 require_once ABSPATH . 'wp-admin/admin-header.php';
@@ -100,7 +100,7 @@  discard block
 block discarded – undo
100 100
  * @global array $wp_settings
101 101
  */
102 102
 if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) :
103
-	?>
103
+    ?>
104 104
 <h2 class="title"><?php _e( 'Embeds' ); ?></h2>
105 105
 <table class="form-table" role="presentation">
106 106
 	<?php do_settings_fields( 'media', 'embeds' ); ?>
@@ -111,22 +111,22 @@  discard block
 block discarded – undo
111 111
 <h2 class="title"><?php _e( 'Uploading Files' ); ?></h2>
112 112
 <table class="form-table" role="presentation">
113 113
 	<?php
114
-	/*
114
+    /*
115 115
 	 * If upload_url_path is not the default (empty),
116 116
 	 * or upload_path is not the default ('wp-content/uploads' or empty),
117 117
 	 * they can be edited, otherwise they're locked.
118 118
 	 */
119
-	if ( get_option( 'upload_url_path' )
120
-		|| get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) :
121
-		?>
119
+    if ( get_option( 'upload_url_path' )
120
+        || get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) :
121
+        ?>
122 122
 <tr>
123 123
 <th scope="row"><label for="upload_path"><?php _e( 'Store uploads in this folder' ); ?></label></th>
124 124
 <td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr( get_option( 'upload_path' ) ); ?>" class="regular-text code" />
125 125
 <p class="description">
126 126
 		<?php
127
-		/* translators: %s: wp-content/uploads */
128
-		printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
129
-		?>
127
+        /* translators: %s: wp-content/uploads */
128
+        printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
129
+        ?>
130 130
 </p>
131 131
 </td>
132 132
 </tr>
Please login to merge, or discard this patch.
Spacing   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -9,37 +9,37 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12
-if ( ! current_user_can( 'manage_options' ) ) {
13
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
12
+if (!current_user_can('manage_options')) {
13
+	wp_die(__('Sorry, you are not allowed to manage options for this site.'));
14 14
 }
15 15
 
16 16
 // Used in the HTML title tag.
17
-$title       = __( 'Media Settings' );
17
+$title       = __('Media Settings');
18 18
 $parent_file = 'options-general.php';
19 19
 
20
-$media_options_help = '<p>' . __( 'You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.' ) . '</p>';
20
+$media_options_help = '<p>' . __('You can set maximum sizes for images inserted into your written content; you can also insert an image as Full Size.') . '</p>';
21 21
 
22
-if ( ! is_multisite()
23
-	&& ( get_option( 'upload_url_path' )
24
-		|| get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) )
22
+if (!is_multisite()
23
+	&& (get_option('upload_url_path')
24
+		|| get_option('upload_path') && 'wp-content/uploads' !== get_option('upload_path'))
25 25
 ) {
26
-	$media_options_help .= '<p>' . __( 'Uploading Files allows you to choose the folder and path for storing your uploaded files.' ) . '</p>';
26
+	$media_options_help .= '<p>' . __('Uploading Files allows you to choose the folder and path for storing your uploaded files.') . '</p>';
27 27
 }
28 28
 
29
-$media_options_help .= '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>';
29
+$media_options_help .= '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>';
30 30
 
31 31
 get_current_screen()->add_help_tab(
32 32
 	array(
33 33
 		'id'      => 'overview',
34
-		'title'   => __( 'Overview' ),
34
+		'title'   => __('Overview'),
35 35
 		'content' => $media_options_help,
36 36
 	)
37 37
 );
38 38
 
39 39
 get_current_screen()->set_help_sidebar(
40
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
41
-	'<p>' . __( '<a href="https://wordpress.org/support/article/settings-media-screen/">Documentation on Media Settings</a>' ) . '</p>' .
42
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
40
+	'<p><strong>' . __('For more information:') . '</strong></p>' .
41
+	'<p>' . __('<a href="https://wordpress.org/support/article/settings-media-screen/">Documentation on Media Settings</a>') . '</p>' .
42
+	'<p>' . __('<a href="https://wordpress.org/support/">Support</a>') . '</p>'
43 43
 );
44 44
 
45 45
 require_once ABSPATH . 'wp-admin/admin-header.php';
@@ -47,68 +47,68 @@  discard block
 block discarded – undo
47 47
 ?>
48 48
 
49 49
 <div class="wrap">
50
-<h1><?php echo esc_html( $title ); ?></h1>
50
+<h1><?php echo esc_html($title); ?></h1>
51 51
 
52 52
 <form action="options.php" method="post">
53
-<?php settings_fields( 'media' ); ?>
53
+<?php settings_fields('media'); ?>
54 54
 
55
-<h2 class="title"><?php _e( 'Image sizes' ); ?></h2>
56
-<p><?php _e( 'The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.' ); ?></p>
55
+<h2 class="title"><?php _e('Image sizes'); ?></h2>
56
+<p><?php _e('The sizes listed below determine the maximum dimensions in pixels to use when adding an image to the Media Library.'); ?></p>
57 57
 
58 58
 <table class="form-table" role="presentation">
59 59
 <tr>
60
-<th scope="row"><?php _e( 'Thumbnail size' ); ?></th>
61
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Thumbnail size' ); ?></span></legend>
62
-<label for="thumbnail_size_w"><?php _e( 'Width' ); ?></label>
63
-<input name="thumbnail_size_w" type="number" step="1" min="0" id="thumbnail_size_w" value="<?php form_option( 'thumbnail_size_w' ); ?>" class="small-text" />
60
+<th scope="row"><?php _e('Thumbnail size'); ?></th>
61
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Thumbnail size'); ?></span></legend>
62
+<label for="thumbnail_size_w"><?php _e('Width'); ?></label>
63
+<input name="thumbnail_size_w" type="number" step="1" min="0" id="thumbnail_size_w" value="<?php form_option('thumbnail_size_w'); ?>" class="small-text" />
64 64
 <br />
65
-<label for="thumbnail_size_h"><?php _e( 'Height' ); ?></label>
66
-<input name="thumbnail_size_h" type="number" step="1" min="0" id="thumbnail_size_h" value="<?php form_option( 'thumbnail_size_h' ); ?>" class="small-text" />
65
+<label for="thumbnail_size_h"><?php _e('Height'); ?></label>
66
+<input name="thumbnail_size_h" type="number" step="1" min="0" id="thumbnail_size_h" value="<?php form_option('thumbnail_size_h'); ?>" class="small-text" />
67 67
 </fieldset>
68
-<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked( '1', get_option( 'thumbnail_crop' ) ); ?>/>
69
-<label for="thumbnail_crop"><?php _e( 'Crop thumbnail to exact dimensions (normally thumbnails are proportional)' ); ?></label>
68
+<input name="thumbnail_crop" type="checkbox" id="thumbnail_crop" value="1" <?php checked('1', get_option('thumbnail_crop')); ?>/>
69
+<label for="thumbnail_crop"><?php _e('Crop thumbnail to exact dimensions (normally thumbnails are proportional)'); ?></label>
70 70
 </td>
71 71
 </tr>
72 72
 
73 73
 <tr>
74
-<th scope="row"><?php _e( 'Medium size' ); ?></th>
75
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Medium size' ); ?></span></legend>
76
-<label for="medium_size_w"><?php _e( 'Max Width' ); ?></label>
77
-<input name="medium_size_w" type="number" step="1" min="0" id="medium_size_w" value="<?php form_option( 'medium_size_w' ); ?>" class="small-text" />
74
+<th scope="row"><?php _e('Medium size'); ?></th>
75
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Medium size'); ?></span></legend>
76
+<label for="medium_size_w"><?php _e('Max Width'); ?></label>
77
+<input name="medium_size_w" type="number" step="1" min="0" id="medium_size_w" value="<?php form_option('medium_size_w'); ?>" class="small-text" />
78 78
 <br />
79
-<label for="medium_size_h"><?php _e( 'Max Height' ); ?></label>
80
-<input name="medium_size_h" type="number" step="1" min="0" id="medium_size_h" value="<?php form_option( 'medium_size_h' ); ?>" class="small-text" />
79
+<label for="medium_size_h"><?php _e('Max Height'); ?></label>
80
+<input name="medium_size_h" type="number" step="1" min="0" id="medium_size_h" value="<?php form_option('medium_size_h'); ?>" class="small-text" />
81 81
 </fieldset></td>
82 82
 </tr>
83 83
 
84 84
 <tr>
85
-<th scope="row"><?php _e( 'Large size' ); ?></th>
86
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'Large size' ); ?></span></legend>
87
-<label for="large_size_w"><?php _e( 'Max Width' ); ?></label>
88
-<input name="large_size_w" type="number" step="1" min="0" id="large_size_w" value="<?php form_option( 'large_size_w' ); ?>" class="small-text" />
85
+<th scope="row"><?php _e('Large size'); ?></th>
86
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('Large size'); ?></span></legend>
87
+<label for="large_size_w"><?php _e('Max Width'); ?></label>
88
+<input name="large_size_w" type="number" step="1" min="0" id="large_size_w" value="<?php form_option('large_size_w'); ?>" class="small-text" />
89 89
 <br />
90
-<label for="large_size_h"><?php _e( 'Max Height' ); ?></label>
91
-<input name="large_size_h" type="number" step="1" min="0" id="large_size_h" value="<?php form_option( 'large_size_h' ); ?>" class="small-text" />
90
+<label for="large_size_h"><?php _e('Max Height'); ?></label>
91
+<input name="large_size_h" type="number" step="1" min="0" id="large_size_h" value="<?php form_option('large_size_h'); ?>" class="small-text" />
92 92
 </fieldset></td>
93 93
 </tr>
94 94
 
95
-<?php do_settings_fields( 'media', 'default' ); ?>
95
+<?php do_settings_fields('media', 'default'); ?>
96 96
 </table>
97 97
 
98 98
 <?php
99 99
 /**
100 100
  * @global array $wp_settings
101 101
  */
102
-if ( isset( $GLOBALS['wp_settings']['media']['embeds'] ) ) :
102
+if (isset($GLOBALS['wp_settings']['media']['embeds'])) :
103 103
 	?>
104
-<h2 class="title"><?php _e( 'Embeds' ); ?></h2>
104
+<h2 class="title"><?php _e('Embeds'); ?></h2>
105 105
 <table class="form-table" role="presentation">
106
-	<?php do_settings_fields( 'media', 'embeds' ); ?>
106
+	<?php do_settings_fields('media', 'embeds'); ?>
107 107
 </table>
108 108
 <?php endif; ?>
109 109
 
110
-<?php if ( ! is_multisite() ) : ?>
111
-<h2 class="title"><?php _e( 'Uploading Files' ); ?></h2>
110
+<?php if (!is_multisite()) : ?>
111
+<h2 class="title"><?php _e('Uploading Files'); ?></h2>
112 112
 <table class="form-table" role="presentation">
113 113
 	<?php
114 114
 	/*
@@ -116,25 +116,25 @@  discard block
 block discarded – undo
116 116
 	 * or upload_path is not the default ('wp-content/uploads' or empty),
117 117
 	 * they can be edited, otherwise they're locked.
118 118
 	 */
119
-	if ( get_option( 'upload_url_path' )
120
-		|| get_option( 'upload_path' ) && 'wp-content/uploads' !== get_option( 'upload_path' ) ) :
119
+	if (get_option('upload_url_path')
120
+		|| get_option('upload_path') && 'wp-content/uploads' !== get_option('upload_path')) :
121 121
 		?>
122 122
 <tr>
123
-<th scope="row"><label for="upload_path"><?php _e( 'Store uploads in this folder' ); ?></label></th>
124
-<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr( get_option( 'upload_path' ) ); ?>" class="regular-text code" />
123
+<th scope="row"><label for="upload_path"><?php _e('Store uploads in this folder'); ?></label></th>
124
+<td><input name="upload_path" type="text" id="upload_path" value="<?php echo esc_attr(get_option('upload_path')); ?>" class="regular-text code" />
125 125
 <p class="description">
126 126
 		<?php
127 127
 		/* translators: %s: wp-content/uploads */
128
-		printf( __( 'Default is %s' ), '<code>wp-content/uploads</code>' );
128
+		printf(__('Default is %s'), '<code>wp-content/uploads</code>');
129 129
 		?>
130 130
 </p>
131 131
 </td>
132 132
 </tr>
133 133
 
134 134
 <tr>
135
-<th scope="row"><label for="upload_url_path"><?php _e( 'Full URL path to files' ); ?></label></th>
136
-<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr( get_option( 'upload_url_path' ) ); ?>" class="regular-text code" />
137
-<p class="description"><?php _e( 'Configuring this is optional. By default, it should be blank.' ); ?></p>
135
+<th scope="row"><label for="upload_url_path"><?php _e('Full URL path to files'); ?></label></th>
136
+<td><input name="upload_url_path" type="text" id="upload_url_path" value="<?php echo esc_attr(get_option('upload_url_path')); ?>" class="regular-text code" />
137
+<p class="description"><?php _e('Configuring this is optional. By default, it should be blank.'); ?></p>
138 138
 </td>
139 139
 </tr>
140 140
 <tr>
@@ -144,17 +144,17 @@  discard block
 block discarded – undo
144 144
 <td class="td-full">
145 145
 <?php endif; ?>
146 146
 <label for="uploads_use_yearmonth_folders">
147
-<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked( '1', get_option( 'uploads_use_yearmonth_folders' ) ); ?> />
148
-	<?php _e( 'Organize my uploads into month- and year-based folders' ); ?>
147
+<input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked('1', get_option('uploads_use_yearmonth_folders')); ?> />
148
+	<?php _e('Organize my uploads into month- and year-based folders'); ?>
149 149
 </label>
150 150
 </td>
151 151
 </tr>
152 152
 
153
-	<?php do_settings_fields( 'media', 'uploads' ); ?>
153
+	<?php do_settings_fields('media', 'uploads'); ?>
154 154
 </table>
155 155
 <?php endif; ?>
156 156
 
157
-<?php do_settings_sections( 'media' ); ?>
157
+<?php do_settings_sections('media'); ?>
158 158
 
159 159
 <?php submit_button(); ?>
160 160
 
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,10 +139,13 @@
 block discarded – undo
139 139
 </tr>
140 140
 <tr>
141 141
 <td colspan="2" class="td-full">
142
-<?php else : ?>
142
+<?php else {
143
+    : ?>
143 144
 <tr>
144 145
 <td class="td-full">
145
-<?php endif; ?>
146
+<?php endif;
147
+}
148
+?>
146 149
 <label for="uploads_use_yearmonth_folders">
147 150
 <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked( '1', get_option( 'uploads_use_yearmonth_folders' ) ); ?> />
148 151
 	<?php _e( 'Organize my uploads into month- and year-based folders' ); ?>
Please login to merge, or discard this patch.
brighty/wp-admin/ms-delete-site.php 2 patches
Indentation   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -10,26 +10,26 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( ! is_multisite() ) {
13
-	wp_die( __( 'Multisite support is not enabled.' ) );
13
+    wp_die( __( 'Multisite support is not enabled.' ) );
14 14
 }
15 15
 
16 16
 if ( ! current_user_can( 'delete_site' ) ) {
17
-	wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
17
+    wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
18 18
 }
19 19
 
20 20
 if ( isset( $_GET['h'] ) && '' !== $_GET['h'] && false !== get_option( 'delete_blog_hash' ) ) {
21
-	if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
22
-		wpmu_delete_blog( get_current_blog_id() );
23
-		wp_die(
24
-			sprintf(
25
-				/* translators: %s: Network title. */
26
-				__( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ),
27
-				get_network()->site_name
28
-			)
29
-		);
30
-	} else {
31
-		wp_die( __( 'Sorry, the link you clicked is stale. Please select another option.' ) );
32
-	}
21
+    if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
22
+        wpmu_delete_blog( get_current_blog_id() );
23
+        wp_die(
24
+            sprintf(
25
+                /* translators: %s: Network title. */
26
+                __( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ),
27
+                get_network()->site_name
28
+            )
29
+        );
30
+    } else {
31
+        wp_die( __( 'Sorry, the link you clicked is stale. Please select another option.' ) );
32
+    }
33 33
 }
34 34
 
35 35
 $blog = get_site();
@@ -45,18 +45,18 @@  discard block
 block discarded – undo
45 45
 echo '<h1>' . esc_html( $title ) . '</h1>';
46 46
 
47 47
 if ( isset( $_POST['action'] ) && 'deleteblog' === $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' === $_POST['confirmdelete'] ) {
48
-	check_admin_referer( 'delete-blog' );
48
+    check_admin_referer( 'delete-blog' );
49 49
 
50
-	$hash = wp_generate_password( 20, false );
51
-	update_option( 'delete_blog_hash', $hash );
50
+    $hash = wp_generate_password( 20, false );
51
+    update_option( 'delete_blog_hash', $hash );
52 52
 
53
-	$url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
53
+    $url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
54 54
 
55
-	$switched_locale = switch_to_locale( get_locale() );
55
+    $switched_locale = switch_to_locale( get_locale() );
56 56
 
57
-	/* translators: Do not translate USERNAME, URL_DELETE, SITENAME, SITEURL: those are placeholders. */
58
-	$content = __(
59
-		"Howdy ###USERNAME###,
57
+    /* translators: Do not translate USERNAME, URL_DELETE, SITENAME, SITEURL: those are placeholders. */
58
+    $content = __(
59
+        "Howdy ###USERNAME###,
60 60
 
61 61
 You recently clicked the 'Delete Site' link on your site and filled in a
62 62
 form on that page.
@@ -72,49 +72,49 @@  discard block
 block discarded – undo
72 72
 Thanks for using the site,
73 73
 All at ###SITENAME###
74 74
 ###SITEURL###"
75
-	);
76
-	/**
77
-	 * Filters the text for the email sent to the site admin when a request to delete a site in a Multisite network is submitted.
78
-	 *
79
-	 * @since 3.0.0
80
-	 *
81
-	 * @param string $content The email text.
82
-	 */
83
-	$content = apply_filters( 'delete_site_email_content', $content );
84
-
85
-	$content = str_replace( '###USERNAME###', $user->user_login, $content );
86
-	$content = str_replace( '###URL_DELETE###', $url_delete, $content );
87
-	$content = str_replace( '###SITENAME###', get_network()->site_name, $content );
88
-	$content = str_replace( '###SITEURL###', network_home_url(), $content );
89
-
90
-	wp_mail(
91
-		get_option( 'admin_email' ),
92
-		sprintf(
93
-			/* translators: %s: Site title. */
94
-			__( '[%s] Delete My Site' ),
95
-			wp_specialchars_decode( get_option( 'blogname' ) )
96
-		),
97
-		$content
98
-	);
99
-
100
-	if ( $switched_locale ) {
101
-		restore_previous_locale();
102
-	}
103
-	?>
75
+    );
76
+    /**
77
+     * Filters the text for the email sent to the site admin when a request to delete a site in a Multisite network is submitted.
78
+     *
79
+     * @since 3.0.0
80
+     *
81
+     * @param string $content The email text.
82
+     */
83
+    $content = apply_filters( 'delete_site_email_content', $content );
84
+
85
+    $content = str_replace( '###USERNAME###', $user->user_login, $content );
86
+    $content = str_replace( '###URL_DELETE###', $url_delete, $content );
87
+    $content = str_replace( '###SITENAME###', get_network()->site_name, $content );
88
+    $content = str_replace( '###SITEURL###', network_home_url(), $content );
89
+
90
+    wp_mail(
91
+        get_option( 'admin_email' ),
92
+        sprintf(
93
+            /* translators: %s: Site title. */
94
+            __( '[%s] Delete My Site' ),
95
+            wp_specialchars_decode( get_option( 'blogname' ) )
96
+        ),
97
+        $content
98
+    );
99
+
100
+    if ( $switched_locale ) {
101
+        restore_previous_locale();
102
+    }
103
+    ?>
104 104
 
105 105
 	<p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.' ); ?></p>
106 106
 
107 107
 	<?php
108 108
 } else {
109
-	?>
109
+    ?>
110 110
 	<p>
111 111
 	<?php
112
-		printf(
113
-			/* translators: %s: Network title. */
114
-			__( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.' ),
115
-			get_network()->site_name
116
-		);
117
-	?>
112
+        printf(
113
+            /* translators: %s: Network title. */
114
+            __( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.' ),
115
+            get_network()->site_name
116
+        );
117
+    ?>
118 118
 	</p>
119 119
 	<p><?php _e( 'Remember, once deleted your site cannot be restored.' ); ?></p>
120 120
 
@@ -123,12 +123,12 @@  discard block
 block discarded – undo
123 123
 		<input type="hidden" name="action" value="deleteblog" />
124 124
 		<p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong>
125 125
 		<?php
126
-			printf(
127
-				/* translators: %s: Site address. */
128
-				__( "I'm sure I want to permanently delete my site, and I am aware I can never get it back or use %s again." ),
129
-				$blog->domain . $blog->path
130
-			);
131
-		?>
126
+            printf(
127
+                /* translators: %s: Site address. */
128
+                __( "I'm sure I want to permanently delete my site, and I am aware I can never get it back or use %s again." ),
129
+                $blog->domain . $blog->path
130
+            );
131
+        ?>
132 132
 		</strong></label></p>
133 133
 		<?php submit_button( __( 'Delete My Site Permanently' ) ); ?>
134 134
 	</form>
Please login to merge, or discard this patch.
Spacing   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -9,26 +9,26 @@  discard block
 block discarded – undo
9 9
 
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12
-if ( ! is_multisite() ) {
13
-	wp_die( __( 'Multisite support is not enabled.' ) );
12
+if (!is_multisite()) {
13
+	wp_die(__('Multisite support is not enabled.'));
14 14
 }
15 15
 
16
-if ( ! current_user_can( 'delete_site' ) ) {
17
-	wp_die( __( 'Sorry, you are not allowed to delete this site.' ) );
16
+if (!current_user_can('delete_site')) {
17
+	wp_die(__('Sorry, you are not allowed to delete this site.'));
18 18
 }
19 19
 
20
-if ( isset( $_GET['h'] ) && '' !== $_GET['h'] && false !== get_option( 'delete_blog_hash' ) ) {
21
-	if ( hash_equals( get_option( 'delete_blog_hash' ), $_GET['h'] ) ) {
22
-		wpmu_delete_blog( get_current_blog_id() );
20
+if (isset($_GET['h']) && '' !== $_GET['h'] && false !== get_option('delete_blog_hash')) {
21
+	if (hash_equals(get_option('delete_blog_hash'), $_GET['h'])) {
22
+		wpmu_delete_blog(get_current_blog_id());
23 23
 		wp_die(
24 24
 			sprintf(
25 25
 				/* translators: %s: Network title. */
26
-				__( 'Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.' ),
26
+				__('Thank you for using %s, your site has been deleted. Happy trails to you until we meet again.'),
27 27
 				get_network()->site_name
28 28
 			)
29 29
 		);
30 30
 	} else {
31
-		wp_die( __( 'Sorry, the link you clicked is stale. Please select another option.' ) );
31
+		wp_die(__('Sorry, the link you clicked is stale. Please select another option.'));
32 32
 	}
33 33
 }
34 34
 
@@ -36,23 +36,23 @@  discard block
 block discarded – undo
36 36
 $user = wp_get_current_user();
37 37
 
38 38
 // Used in the HTML title tag.
39
-$title       = __( 'Delete Site' );
39
+$title       = __('Delete Site');
40 40
 $parent_file = 'tools.php';
41 41
 
42 42
 require_once ABSPATH . 'wp-admin/admin-header.php';
43 43
 
44 44
 echo '<div class="wrap">';
45
-echo '<h1>' . esc_html( $title ) . '</h1>';
45
+echo '<h1>' . esc_html($title) . '</h1>';
46 46
 
47
-if ( isset( $_POST['action'] ) && 'deleteblog' === $_POST['action'] && isset( $_POST['confirmdelete'] ) && '1' === $_POST['confirmdelete'] ) {
48
-	check_admin_referer( 'delete-blog' );
47
+if (isset($_POST['action']) && 'deleteblog' === $_POST['action'] && isset($_POST['confirmdelete']) && '1' === $_POST['confirmdelete']) {
48
+	check_admin_referer('delete-blog');
49 49
 
50
-	$hash = wp_generate_password( 20, false );
51
-	update_option( 'delete_blog_hash', $hash );
50
+	$hash = wp_generate_password(20, false);
51
+	update_option('delete_blog_hash', $hash);
52 52
 
53
-	$url_delete = esc_url( admin_url( 'ms-delete-site.php?h=' . $hash ) );
53
+	$url_delete = esc_url(admin_url('ms-delete-site.php?h=' . $hash));
54 54
 
55
-	$switched_locale = switch_to_locale( get_locale() );
55
+	$switched_locale = switch_to_locale(get_locale());
56 56
 
57 57
 	/* translators: Do not translate USERNAME, URL_DELETE, SITENAME, SITEURL: those are placeholders. */
58 58
 	$content = __(
@@ -80,29 +80,29 @@  discard block
 block discarded – undo
80 80
 	 *
81 81
 	 * @param string $content The email text.
82 82
 	 */
83
-	$content = apply_filters( 'delete_site_email_content', $content );
83
+	$content = apply_filters('delete_site_email_content', $content);
84 84
 
85
-	$content = str_replace( '###USERNAME###', $user->user_login, $content );
86
-	$content = str_replace( '###URL_DELETE###', $url_delete, $content );
87
-	$content = str_replace( '###SITENAME###', get_network()->site_name, $content );
88
-	$content = str_replace( '###SITEURL###', network_home_url(), $content );
85
+	$content = str_replace('###USERNAME###', $user->user_login, $content);
86
+	$content = str_replace('###URL_DELETE###', $url_delete, $content);
87
+	$content = str_replace('###SITENAME###', get_network()->site_name, $content);
88
+	$content = str_replace('###SITEURL###', network_home_url(), $content);
89 89
 
90 90
 	wp_mail(
91
-		get_option( 'admin_email' ),
91
+		get_option('admin_email'),
92 92
 		sprintf(
93 93
 			/* translators: %s: Site title. */
94
-			__( '[%s] Delete My Site' ),
95
-			wp_specialchars_decode( get_option( 'blogname' ) )
94
+			__('[%s] Delete My Site'),
95
+			wp_specialchars_decode(get_option('blogname'))
96 96
 		),
97 97
 		$content
98 98
 	);
99 99
 
100
-	if ( $switched_locale ) {
100
+	if ($switched_locale) {
101 101
 		restore_previous_locale();
102 102
 	}
103 103
 	?>
104 104
 
105
-	<p><?php _e( 'Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.' ); ?></p>
105
+	<p><?php _e('Thank you. Please check your email for a link to confirm your action. Your site will not be deleted until this link is clicked.'); ?></p>
106 106
 
107 107
 	<?php
108 108
 } else {
@@ -111,26 +111,26 @@  discard block
 block discarded – undo
111 111
 	<?php
112 112
 		printf(
113 113
 			/* translators: %s: Network title. */
114
-			__( 'If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.' ),
114
+			__('If you do not want to use your %s site any more, you can delete it using the form below. When you click <strong>Delete My Site Permanently</strong> you will be sent an email with a link in it. Click on this link to delete your site.'),
115 115
 			get_network()->site_name
116 116
 		);
117 117
 	?>
118 118
 	</p>
119
-	<p><?php _e( 'Remember, once deleted your site cannot be restored.' ); ?></p>
119
+	<p><?php _e('Remember, once deleted your site cannot be restored.'); ?></p>
120 120
 
121 121
 	<form method="post" name="deletedirect">
122
-		<?php wp_nonce_field( 'delete-blog' ); ?>
122
+		<?php wp_nonce_field('delete-blog'); ?>
123 123
 		<input type="hidden" name="action" value="deleteblog" />
124 124
 		<p><input id="confirmdelete" type="checkbox" name="confirmdelete" value="1" /> <label for="confirmdelete"><strong>
125 125
 		<?php
126 126
 			printf(
127 127
 				/* translators: %s: Site address. */
128
-				__( "I'm sure I want to permanently delete my site, and I am aware I can never get it back or use %s again." ),
128
+				__("I'm sure I want to permanently delete my site, and I am aware I can never get it back or use %s again."),
129 129
 				$blog->domain . $blog->path
130 130
 			);
131 131
 		?>
132 132
 		</strong></label></p>
133
-		<?php submit_button( __( 'Delete My Site Permanently' ) ); ?>
133
+		<?php submit_button(__('Delete My Site Permanently')); ?>
134 134
 	</form>
135 135
 	<?php
136 136
 }
Please login to merge, or discard this patch.
brighty/wp-admin/options-permalink.php 3 patches
Indentation   +222 added lines, -222 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12 12
 if ( ! current_user_can( 'manage_options' ) ) {
13
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
13
+    wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
14 14
 }
15 15
 
16 16
 // Used in the HTML title tag.
@@ -18,50 +18,50 @@  discard block
 block discarded – undo
18 18
 $parent_file = 'options-general.php';
19 19
 
20 20
 get_current_screen()->add_help_tab(
21
-	array(
22
-		'id'      => 'overview',
23
-		'title'   => __( 'Overview' ),
24
-		'content' => '<p>' . __( 'Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.' ) . '</p>' .
25
-			'<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
26
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
27
-	)
21
+    array(
22
+        'id'      => 'overview',
23
+        'title'   => __( 'Overview' ),
24
+        'content' => '<p>' . __( 'Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.' ) . '</p>' .
25
+            '<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
26
+            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
27
+    )
28 28
 );
29 29
 
30 30
 get_current_screen()->add_help_tab(
31
-	array(
32
-		'id'      => 'permalink-settings',
33
-		'title'   => __( 'Permalink Settings' ),
34
-		'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
35
-			'<p>' . sprintf(
36
-				/* translators: %s: Percent sign (%). */
37
-				__( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %s) will also appear in the custom structure field and your path can be further modified there.' ),
38
-				'<code>%</code>'
39
-			) . '</p>' .
40
-			'<p>' . sprintf(
41
-				/* translators: 1: %category%, 2: %tag% */
42
-				__( 'When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %1$s or %2$s.' ),
43
-				'<code>%category%</code>',
44
-				'<code>%tag%</code>'
45
-			) . '</p>' .
46
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
47
-	)
31
+    array(
32
+        'id'      => 'permalink-settings',
33
+        'title'   => __( 'Permalink Settings' ),
34
+        'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
35
+            '<p>' . sprintf(
36
+                /* translators: %s: Percent sign (%). */
37
+                __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %s) will also appear in the custom structure field and your path can be further modified there.' ),
38
+                '<code>%</code>'
39
+            ) . '</p>' .
40
+            '<p>' . sprintf(
41
+                /* translators: 1: %category%, 2: %tag% */
42
+                __( 'When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %1$s or %2$s.' ),
43
+                '<code>%category%</code>',
44
+                '<code>%tag%</code>'
45
+            ) . '</p>' .
46
+            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
47
+    )
48 48
 );
49 49
 
50 50
 get_current_screen()->add_help_tab(
51
-	array(
52
-		'id'      => 'custom-structures',
53
-		'title'   => __( 'Custom Structures' ),
54
-		'content' => '<p>' . __( 'The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.' ) . '</p>' .
55
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
56
-	)
51
+    array(
52
+        'id'      => 'custom-structures',
53
+        'title'   => __( 'Custom Structures' ),
54
+        'content' => '<p>' . __( 'The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.' ) . '</p>' .
55
+            '<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
56
+    )
57 57
 );
58 58
 
59 59
 $help_sidebar_content = '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
60
-						'<p>' . __( '<a href="https://wordpress.org/support/article/settings-permalinks-screen/">Documentation on Permalinks Settings</a>' ) . '</p>' .
61
-						'<p>' . __( '<a href="https://wordpress.org/support/article/using-permalinks/">Documentation on Using Permalinks</a>' ) . '</p>';
60
+                        '<p>' . __( '<a href="https://wordpress.org/support/article/settings-permalinks-screen/">Documentation on Permalinks Settings</a>' ) . '</p>' .
61
+                        '<p>' . __( '<a href="https://wordpress.org/support/article/using-permalinks/">Documentation on Using Permalinks</a>' ) . '</p>';
62 62
 
63 63
 if ( $is_nginx ) {
64
-	$help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/article/nginx/">Documentation on Nginx configuration</a>.' ) . '</p>';
64
+    $help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/article/nginx/">Documentation on Nginx configuration</a>.' ) . '</p>';
65 65
 }
66 66
 
67 67
 $help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>';
@@ -76,7 +76,7 @@  discard block
 block discarded – undo
76 76
 $prefix      = '';
77 77
 $blog_prefix = '';
78 78
 if ( ! got_url_rewrite() ) {
79
-	$prefix = '/index.php';
79
+    $prefix = '/index.php';
80 80
 }
81 81
 
82 82
 /*
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
  * base prefix, WordPress core can no longer account for the possible collision.
87 87
  */
88 88
 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
89
-	$blog_prefix = '/blog';
89
+    $blog_prefix = '/blog';
90 90
 }
91 91
 
92 92
 $category_base = get_option( 'category_base' );
@@ -96,109 +96,109 @@  discard block
 block discarded – undo
96 96
 $htaccess_update_required = false;
97 97
 
98 98
 if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) {
99
-	check_admin_referer( 'update-permalink' );
99
+    check_admin_referer( 'update-permalink' );
100 100
 
101
-	if ( isset( $_POST['permalink_structure'] ) ) {
102
-		if ( isset( $_POST['selection'] ) && 'custom' !== $_POST['selection'] ) {
103
-			$permalink_structure = $_POST['selection'];
104
-		} else {
105
-			$permalink_structure = $_POST['permalink_structure'];
106
-		}
101
+    if ( isset( $_POST['permalink_structure'] ) ) {
102
+        if ( isset( $_POST['selection'] ) && 'custom' !== $_POST['selection'] ) {
103
+            $permalink_structure = $_POST['selection'];
104
+        } else {
105
+            $permalink_structure = $_POST['permalink_structure'];
106
+        }
107 107
 
108
-		if ( ! empty( $permalink_structure ) ) {
109
-			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
110
-			if ( $prefix && $blog_prefix ) {
111
-				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
112
-			} else {
113
-				$permalink_structure = $blog_prefix . $permalink_structure;
114
-			}
115
-		}
108
+        if ( ! empty( $permalink_structure ) ) {
109
+            $permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
110
+            if ( $prefix && $blog_prefix ) {
111
+                $permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
112
+            } else {
113
+                $permalink_structure = $blog_prefix . $permalink_structure;
114
+            }
115
+        }
116 116
 
117
-		$permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
117
+        $permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
118 118
 
119
-		$wp_rewrite->set_permalink_structure( $permalink_structure );
119
+        $wp_rewrite->set_permalink_structure( $permalink_structure );
120 120
 
121
-		$structure_updated = true;
122
-	}
121
+        $structure_updated = true;
122
+    }
123 123
 
124
-	if ( isset( $_POST['category_base'] ) ) {
125
-		$category_base = $_POST['category_base'];
124
+    if ( isset( $_POST['category_base'] ) ) {
125
+        $category_base = $_POST['category_base'];
126 126
 
127
-		if ( ! empty( $category_base ) ) {
128
-			$category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
129
-		}
127
+        if ( ! empty( $category_base ) ) {
128
+            $category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
129
+        }
130 130
 
131
-		$wp_rewrite->set_category_base( $category_base );
132
-	}
131
+        $wp_rewrite->set_category_base( $category_base );
132
+    }
133 133
 
134
-	if ( isset( $_POST['tag_base'] ) ) {
135
-		$tag_base = $_POST['tag_base'];
134
+    if ( isset( $_POST['tag_base'] ) ) {
135
+        $tag_base = $_POST['tag_base'];
136 136
 
137
-		if ( ! empty( $tag_base ) ) {
138
-			$tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
139
-		}
137
+        if ( ! empty( $tag_base ) ) {
138
+            $tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
139
+        }
140 140
 
141
-		$wp_rewrite->set_tag_base( $tag_base );
142
-	}
141
+        $wp_rewrite->set_tag_base( $tag_base );
142
+    }
143 143
 }
144 144
 
145 145
 if ( $iis7_permalinks ) {
146
-	if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) {
147
-		$writable = true;
148
-	} else {
149
-		$writable = false;
150
-	}
146
+    if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) {
147
+        $writable = true;
148
+    } else {
149
+        $writable = false;
150
+    }
151 151
 } elseif ( $is_nginx ) {
152
-	$writable = false;
152
+    $writable = false;
153 153
 } else {
154
-	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
155
-		$writable = true;
156
-	} else {
157
-		$writable       = false;
158
-		$existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
159
-		$new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
160
-
161
-		$htaccess_update_required = ( $new_rules !== $existing_rules );
162
-	}
154
+    if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
155
+        $writable = true;
156
+    } else {
157
+        $writable       = false;
158
+        $existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
159
+        $new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
160
+
161
+        $htaccess_update_required = ( $new_rules !== $existing_rules );
162
+    }
163 163
 }
164 164
 
165 165
 $using_index_permalinks = $wp_rewrite->using_index_permalinks();
166 166
 
167 167
 if ( $structure_updated ) {
168
-	$message = __( 'Permalink structure updated.' );
169
-
170
-	if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
171
-		if ( $iis7_permalinks ) {
172
-			if ( ! $writable ) {
173
-				$message = sprintf(
174
-					/* translators: %s: web.config */
175
-					__( 'You should update your %s file now.' ),
176
-					'<code>web.config</code>'
177
-				);
178
-			} else {
179
-				$message = sprintf(
180
-					/* translators: %s: web.config */
181
-					__( 'Permalink structure updated. Remove write access on %s file now!' ),
182
-					'<code>web.config</code>'
183
-				);
184
-			}
185
-		} elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
186
-			$message = sprintf(
187
-				/* translators: %s: .htaccess */
188
-				__( 'You should update your %s file now.' ),
189
-				'<code>.htaccess</code>'
190
-			);
191
-		}
192
-	}
193
-
194
-	if ( ! get_settings_errors() ) {
195
-		add_settings_error( 'general', 'settings_updated', $message, 'success' );
196
-	}
197
-
198
-	set_transient( 'settings_errors', get_settings_errors(), 30 );
199
-
200
-	wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
201
-	exit;
168
+    $message = __( 'Permalink structure updated.' );
169
+
170
+    if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
171
+        if ( $iis7_permalinks ) {
172
+            if ( ! $writable ) {
173
+                $message = sprintf(
174
+                    /* translators: %s: web.config */
175
+                    __( 'You should update your %s file now.' ),
176
+                    '<code>web.config</code>'
177
+                );
178
+            } else {
179
+                $message = sprintf(
180
+                    /* translators: %s: web.config */
181
+                    __( 'Permalink structure updated. Remove write access on %s file now!' ),
182
+                    '<code>web.config</code>'
183
+                );
184
+            }
185
+        } elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
186
+            $message = sprintf(
187
+                /* translators: %s: .htaccess */
188
+                __( 'You should update your %s file now.' ),
189
+                '<code>.htaccess</code>'
190
+            );
191
+        }
192
+    }
193
+
194
+    if ( ! get_settings_errors() ) {
195
+        add_settings_error( 'general', 'settings_updated', $message, 'success' );
196
+    }
197
+
198
+    set_transient( 'settings_errors', get_settings_errors(), 30 );
199
+
200
+    wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
201
+    exit;
202 202
 }
203 203
 
204 204
 flush_rewrite_rules();
@@ -213,27 +213,27 @@  discard block
 block discarded – undo
213 213
 
214 214
 	<p>
215 215
 	<?php
216
-		printf(
217
-			/* translators: %s: Documentation URL. */
218
-			__( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ),
219
-			__( 'https://wordpress.org/support/article/using-permalinks/' )
220
-		);
221
-		?>
216
+        printf(
217
+            /* translators: %s: Documentation URL. */
218
+            __( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ),
219
+            __( 'https://wordpress.org/support/article/using-permalinks/' )
220
+        );
221
+        ?>
222 222
 	</p>
223 223
 
224 224
 <?php
225 225
 if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
226
-	$permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
227
-	$category_base       = preg_replace( '|^/?blog|', '', $category_base );
228
-	$tag_base            = preg_replace( '|^/?blog|', '', $tag_base );
226
+    $permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
227
+    $category_base       = preg_replace( '|^/?blog|', '', $category_base );
228
+    $tag_base            = preg_replace( '|^/?blog|', '', $tag_base );
229 229
 }
230 230
 
231 231
 $structures = array(
232
-	0 => '',
233
-	1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
234
-	2 => $prefix . '/%year%/%monthnum%/%postname%/',
235
-	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
236
-	4 => $prefix . '/%postname%/',
232
+    0 => '',
233
+    1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
234
+    2 => $prefix . '/%year%/%monthnum%/%postname%/',
235
+    3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
236
+    4 => $prefix . '/%postname%/',
237 237
 );
238 238
 ?>
239 239
 <h2 class="title"><?php _e( 'Common Settings' ); ?></h2>
@@ -270,51 +270,51 @@  discard block
 block discarded – undo
270 270
 			<div class="available-structure-tags hide-if-no-js">
271 271
 				<div id="custom_selection_updated" aria-live="assertive" class="screen-reader-text"></div>
272 272
 				<?php
273
-				$available_tags = array(
274
-					/* translators: %s: Permalink structure tag. */
275
-					'year'     => __( '%s (The year of the post, four digits, for example 2004.)' ),
276
-					/* translators: %s: Permalink structure tag. */
277
-					'monthnum' => __( '%s (Month of the year, for example 05.)' ),
278
-					/* translators: %s: Permalink structure tag. */
279
-					'day'      => __( '%s (Day of the month, for example 28.)' ),
280
-					/* translators: %s: Permalink structure tag. */
281
-					'hour'     => __( '%s (Hour of the day, for example 15.)' ),
282
-					/* translators: %s: Permalink structure tag. */
283
-					'minute'   => __( '%s (Minute of the hour, for example 43.)' ),
284
-					/* translators: %s: Permalink structure tag. */
285
-					'second'   => __( '%s (Second of the minute, for example 33.)' ),
286
-					/* translators: %s: Permalink structure tag. */
287
-					'post_id'  => __( '%s (The unique ID of the post, for example 423.)' ),
288
-					/* translators: %s: Permalink structure tag. */
289
-					'postname' => __( '%s (The sanitized post title (slug).)' ),
290
-					/* translators: %s: Permalink structure tag. */
291
-					'category' => __( '%s (Category slug. Nested sub-categories appear as nested directories in the URL.)' ),
292
-					/* translators: %s: Permalink structure tag. */
293
-					'author'   => __( '%s (A sanitized version of the author name.)' ),
294
-				);
295
-
296
-				/**
297
-				 * Filters the list of available permalink structure tags on the Permalinks settings page.
298
-				 *
299
-				 * @since 4.9.0
300
-				 *
301
-				 * @param string[] $available_tags An array of key => value pairs of available permalink structure tags.
302
-				 */
303
-				$available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags );
304
-
305
-				/* translators: %s: Permalink structure tag. */
306
-				$structure_tag_added = __( '%s added to permalink structure' );
307
-
308
-				/* translators: %s: Permalink structure tag. */
309
-				$structure_tag_already_used = __( '%s (already used in permalink structure)' );
310
-
311
-				if ( ! empty( $available_tags ) ) :
312
-					?>
273
+                $available_tags = array(
274
+                    /* translators: %s: Permalink structure tag. */
275
+                    'year'     => __( '%s (The year of the post, four digits, for example 2004.)' ),
276
+                    /* translators: %s: Permalink structure tag. */
277
+                    'monthnum' => __( '%s (Month of the year, for example 05.)' ),
278
+                    /* translators: %s: Permalink structure tag. */
279
+                    'day'      => __( '%s (Day of the month, for example 28.)' ),
280
+                    /* translators: %s: Permalink structure tag. */
281
+                    'hour'     => __( '%s (Hour of the day, for example 15.)' ),
282
+                    /* translators: %s: Permalink structure tag. */
283
+                    'minute'   => __( '%s (Minute of the hour, for example 43.)' ),
284
+                    /* translators: %s: Permalink structure tag. */
285
+                    'second'   => __( '%s (Second of the minute, for example 33.)' ),
286
+                    /* translators: %s: Permalink structure tag. */
287
+                    'post_id'  => __( '%s (The unique ID of the post, for example 423.)' ),
288
+                    /* translators: %s: Permalink structure tag. */
289
+                    'postname' => __( '%s (The sanitized post title (slug).)' ),
290
+                    /* translators: %s: Permalink structure tag. */
291
+                    'category' => __( '%s (Category slug. Nested sub-categories appear as nested directories in the URL.)' ),
292
+                    /* translators: %s: Permalink structure tag. */
293
+                    'author'   => __( '%s (A sanitized version of the author name.)' ),
294
+                );
295
+
296
+                /**
297
+                 * Filters the list of available permalink structure tags on the Permalinks settings page.
298
+                 *
299
+                 * @since 4.9.0
300
+                 *
301
+                 * @param string[] $available_tags An array of key => value pairs of available permalink structure tags.
302
+                 */
303
+                $available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags );
304
+
305
+                /* translators: %s: Permalink structure tag. */
306
+                $structure_tag_added = __( '%s added to permalink structure' );
307
+
308
+                /* translators: %s: Permalink structure tag. */
309
+                $structure_tag_already_used = __( '%s (already used in permalink structure)' );
310
+
311
+                if ( ! empty( $available_tags ) ) :
312
+                    ?>
313 313
 					<p><?php _e( 'Available tags:' ); ?></p>
314 314
 					<ul role="list">
315 315
 						<?php
316
-						foreach ( $available_tags as $tag => $explanation ) {
317
-							?>
316
+                        foreach ( $available_tags as $tag => $explanation ) {
317
+                            ?>
318 318
 							<li>
319 319
 								<button type="button"
320 320
 										class="button button-secondary"
@@ -325,8 +325,8 @@  discard block
 block discarded – undo
325 325
 								</button>
326 326
 							</li>
327 327
 							<?php
328
-						}
329
-						?>
328
+                        }
329
+                        ?>
330 330
 					</ul>
331 331
 				<?php endif; ?>
332 332
 			</div>
@@ -360,22 +360,22 @@  discard block
 block discarded – undo
360 360
 </form>
361 361
 <?php if ( ! is_multisite() ) { ?>
362 362
 	<?php
363
-	if ( $iis7_permalinks ) :
364
-		if ( isset( $_POST['submit'] ) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :
365
-			if ( file_exists( $home_path . 'web.config' ) ) :
366
-				?>
363
+    if ( $iis7_permalinks ) :
364
+        if ( isset( $_POST['submit'] ) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :
365
+            if ( file_exists( $home_path . 'web.config' ) ) :
366
+                ?>
367 367
 <p id="iis-description-a">
368 368
 				<?php
369
-				printf(
370
-					/* translators: 1: web.config, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A, 5: Element code. */
371
-					__( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. This is the URL rewrite rule you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this rule inside of the %5$s element in %1$s file.' ),
372
-					'<code>web.config</code>',
373
-					__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
374
-					'<kbd>Ctrl + A</kbd>',
375
-					'<kbd>⌘ + A</kbd>',
376
-					'<code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code>'
377
-				);
378
-				?>
369
+                printf(
370
+                    /* translators: 1: web.config, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A, 5: Element code. */
371
+                    __( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. This is the URL rewrite rule you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this rule inside of the %5$s element in %1$s file.' ),
372
+                    '<code>web.config</code>',
373
+                    __( 'https://wordpress.org/support/article/changing-file-permissions/' ),
374
+                    '<kbd>Ctrl + A</kbd>',
375
+                    '<kbd>⌘ + A</kbd>',
376
+                    '<code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code>'
377
+                );
378
+                ?>
379 379
 </p>
380 380
 <form action="options-permalink.php" method="post">
381 381
 				<?php wp_nonce_field( 'update-permalink' ); ?>
@@ -383,25 +383,25 @@  discard block
 block discarded – undo
383 383
 </form>
384 384
 <p>
385 385
 				<?php
386
-				printf(
387
-					/* translators: %s: web.config */
388
-					__( 'If you temporarily make your %s file writable to generate rewrite rules automatically, do not forget to revert the permissions after the rule has been saved.' ),
389
-					'<code>web.config</code>'
390
-				);
391
-				?>
386
+                printf(
387
+                    /* translators: %s: web.config */
388
+                    __( 'If you temporarily make your %s file writable to generate rewrite rules automatically, do not forget to revert the permissions after the rule has been saved.' ),
389
+                    '<code>web.config</code>'
390
+                );
391
+                ?>
392 392
 </p>
393 393
 		<?php else : ?>
394 394
 <p id="iis-description-b">
395 395
 			<?php
396
-			printf(
397
-				/* translators: 1: Documentation URL, 2: web.config, 3: Ctrl + A, 4: ⌘ + A */
398
-				__( '<strong>Error:</strong> The root directory of your site is not <a href="%1$s">writable</a>, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ),
399
-				__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
400
-				'<code>web.config</code>',
401
-				'<kbd>Ctrl + A</kbd>',
402
-				'<kbd>⌘ + A</kbd>'
403
-			);
404
-			?>
396
+            printf(
397
+                /* translators: 1: Documentation URL, 2: web.config, 3: Ctrl + A, 4: ⌘ + A */
398
+                __( '<strong>Error:</strong> The root directory of your site is not <a href="%1$s">writable</a>, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ),
399
+                __( 'https://wordpress.org/support/article/changing-file-permissions/' ),
400
+                '<code>web.config</code>',
401
+                '<kbd>Ctrl + A</kbd>',
402
+                '<kbd>⌘ + A</kbd>'
403
+            );
404
+            ?>
405 405
 </p>
406 406
 <form action="options-permalink.php" method="post">
407 407
 			<?php wp_nonce_field( 'update-permalink' ); ?>
@@ -409,30 +409,30 @@  discard block
 block discarded – undo
409 409
 </form>
410 410
 <p>
411 411
 			<?php
412
-			printf(
413
-				/* translators: %s: web.config */
414
-				__( 'If you temporarily make your site&#8217;s root directory writable to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ),
415
-				'<code>web.config</code>'
416
-			);
417
-			?>
412
+            printf(
413
+                /* translators: %s: web.config */
414
+                __( 'If you temporarily make your site&#8217;s root directory writable to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ),
415
+                '<code>web.config</code>'
416
+            );
417
+            ?>
418 418
 </p>
419 419
 		<?php endif; ?>
420 420
 	<?php endif; ?>
421 421
 		<?php
422 422
 else :
423
-	if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) :
424
-		?>
423
+    if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) :
424
+        ?>
425 425
 <p id="htaccess-description">
426 426
 		<?php
427
-		printf(
428
-			/* translators: 1: .htaccess, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A */
429
-			__( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ),
430
-			'<code>.htaccess</code>',
431
-			__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
432
-			'<kbd>Ctrl + A</kbd>',
433
-			'<kbd>⌘ + A</kbd>'
434
-		);
435
-		?>
427
+        printf(
428
+            /* translators: 1: .htaccess, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A */
429
+            __( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ),
430
+            '<code>.htaccess</code>',
431
+            __( 'https://wordpress.org/support/article/changing-file-permissions/' ),
432
+            '<kbd>Ctrl + A</kbd>',
433
+            '<kbd>⌘ + A</kbd>'
434
+        );
435
+        ?>
436 436
 </p>
437 437
 <form action="options-permalink.php" method="post">
438 438
 		<?php wp_nonce_field( 'update-permalink' ); ?>
Please login to merge, or discard this patch.
Spacing   +136 added lines, -136 removed lines patch added patch discarded remove patch
@@ -9,73 +9,73 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once __DIR__ . '/admin.php';
11 11
 
12
-if ( ! current_user_can( 'manage_options' ) ) {
13
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
12
+if (!current_user_can('manage_options')) {
13
+	wp_die(__('Sorry, you are not allowed to manage options for this site.'));
14 14
 }
15 15
 
16 16
 // Used in the HTML title tag.
17
-$title       = __( 'Permalink Settings' );
17
+$title       = __('Permalink Settings');
18 18
 $parent_file = 'options-general.php';
19 19
 
20 20
 get_current_screen()->add_help_tab(
21 21
 	array(
22 22
 		'id'      => 'overview',
23
-		'title'   => __( 'Overview' ),
24
-		'content' => '<p>' . __( 'Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.' ) . '</p>' .
25
-			'<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
26
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
23
+		'title'   => __('Overview'),
24
+		'content' => '<p>' . __('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.') . '</p>' .
25
+			'<p>' . __('This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.') . '</p>' .
26
+			'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
27 27
 	)
28 28
 );
29 29
 
30 30
 get_current_screen()->add_help_tab(
31 31
 	array(
32 32
 		'id'      => 'permalink-settings',
33
-		'title'   => __( 'Permalink Settings' ),
34
-		'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
33
+		'title'   => __('Permalink Settings'),
34
+		'content' => '<p>' . __('Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.') . '</p>' .
35 35
 			'<p>' . sprintf(
36 36
 				/* translators: %s: Percent sign (%). */
37
-				__( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %s) will also appear in the custom structure field and your path can be further modified there.' ),
37
+				__('If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by %s) will also appear in the custom structure field and your path can be further modified there.'),
38 38
 				'<code>%</code>'
39 39
 			) . '</p>' .
40 40
 			'<p>' . sprintf(
41 41
 				/* translators: 1: %category%, 2: %tag% */
42
-				__( 'When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %1$s or %2$s.' ),
42
+				__('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes %1$s or %2$s.'),
43 43
 				'<code>%category%</code>',
44 44
 				'<code>%tag%</code>'
45 45
 			) . '</p>' .
46
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
46
+			'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
47 47
 	)
48 48
 );
49 49
 
50 50
 get_current_screen()->add_help_tab(
51 51
 	array(
52 52
 		'id'      => 'custom-structures',
53
-		'title'   => __( 'Custom Structures' ),
54
-		'content' => '<p>' . __( 'The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.' ) . '</p>' .
55
-			'<p>' . __( 'You must click the Save Changes button at the bottom of the screen for new settings to take effect.' ) . '</p>',
53
+		'title'   => __('Custom Structures'),
54
+		'content' => '<p>' . __('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' .
55
+			'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
56 56
 	)
57 57
 );
58 58
 
59
-$help_sidebar_content = '<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
60
-						'<p>' . __( '<a href="https://wordpress.org/support/article/settings-permalinks-screen/">Documentation on Permalinks Settings</a>' ) . '</p>' .
61
-						'<p>' . __( '<a href="https://wordpress.org/support/article/using-permalinks/">Documentation on Using Permalinks</a>' ) . '</p>';
59
+$help_sidebar_content = '<p><strong>' . __('For more information:') . '</strong></p>' .
60
+						'<p>' . __('<a href="https://wordpress.org/support/article/settings-permalinks-screen/">Documentation on Permalinks Settings</a>') . '</p>' .
61
+						'<p>' . __('<a href="https://wordpress.org/support/article/using-permalinks/">Documentation on Using Permalinks</a>') . '</p>';
62 62
 
63
-if ( $is_nginx ) {
64
-	$help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/article/nginx/">Documentation on Nginx configuration</a>.' ) . '</p>';
63
+if ($is_nginx) {
64
+	$help_sidebar_content .= '<p>' . __('<a href="https://wordpress.org/support/article/nginx/">Documentation on Nginx configuration</a>.') . '</p>';
65 65
 }
66 66
 
67
-$help_sidebar_content .= '<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>';
67
+$help_sidebar_content .= '<p>' . __('<a href="https://wordpress.org/support/">Support</a>') . '</p>';
68 68
 
69
-get_current_screen()->set_help_sidebar( $help_sidebar_content );
70
-unset( $help_sidebar_content );
69
+get_current_screen()->set_help_sidebar($help_sidebar_content);
70
+unset($help_sidebar_content);
71 71
 
72 72
 $home_path           = get_home_path();
73 73
 $iis7_permalinks     = iis7_supports_permalinks();
74
-$permalink_structure = get_option( 'permalink_structure' );
74
+$permalink_structure = get_option('permalink_structure');
75 75
 
76 76
 $prefix      = '';
77 77
 $blog_prefix = '';
78
-if ( ! got_url_rewrite() ) {
78
+if (!got_url_rewrite()) {
79 79
 	$prefix = '/index.php';
80 80
 }
81 81
 
@@ -85,119 +85,119 @@  discard block
 block discarded – undo
85 85
  * network. If the `permalink_structure` option has been changed to remove this
86 86
  * base prefix, WordPress core can no longer account for the possible collision.
87 87
  */
88
-if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
88
+if (is_multisite() && !is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) {
89 89
 	$blog_prefix = '/blog';
90 90
 }
91 91
 
92
-$category_base = get_option( 'category_base' );
93
-$tag_base      = get_option( 'tag_base' );
92
+$category_base = get_option('category_base');
93
+$tag_base      = get_option('tag_base');
94 94
 
95 95
 $structure_updated        = false;
96 96
 $htaccess_update_required = false;
97 97
 
98
-if ( isset( $_POST['permalink_structure'] ) || isset( $_POST['category_base'] ) ) {
99
-	check_admin_referer( 'update-permalink' );
98
+if (isset($_POST['permalink_structure']) || isset($_POST['category_base'])) {
99
+	check_admin_referer('update-permalink');
100 100
 
101
-	if ( isset( $_POST['permalink_structure'] ) ) {
102
-		if ( isset( $_POST['selection'] ) && 'custom' !== $_POST['selection'] ) {
101
+	if (isset($_POST['permalink_structure'])) {
102
+		if (isset($_POST['selection']) && 'custom' !== $_POST['selection']) {
103 103
 			$permalink_structure = $_POST['selection'];
104 104
 		} else {
105 105
 			$permalink_structure = $_POST['permalink_structure'];
106 106
 		}
107 107
 
108
-		if ( ! empty( $permalink_structure ) ) {
109
-			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
110
-			if ( $prefix && $blog_prefix ) {
111
-				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
108
+		if (!empty($permalink_structure)) {
109
+			$permalink_structure = preg_replace('#/+#', '/', '/' . str_replace('#', '', $permalink_structure));
110
+			if ($prefix && $blog_prefix) {
111
+				$permalink_structure = $prefix . preg_replace('#^/?index\.php#', '', $permalink_structure);
112 112
 			} else {
113 113
 				$permalink_structure = $blog_prefix . $permalink_structure;
114 114
 			}
115 115
 		}
116 116
 
117
-		$permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
117
+		$permalink_structure = sanitize_option('permalink_structure', $permalink_structure);
118 118
 
119
-		$wp_rewrite->set_permalink_structure( $permalink_structure );
119
+		$wp_rewrite->set_permalink_structure($permalink_structure);
120 120
 
121 121
 		$structure_updated = true;
122 122
 	}
123 123
 
124
-	if ( isset( $_POST['category_base'] ) ) {
124
+	if (isset($_POST['category_base'])) {
125 125
 		$category_base = $_POST['category_base'];
126 126
 
127
-		if ( ! empty( $category_base ) ) {
128
-			$category_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
127
+		if (!empty($category_base)) {
128
+			$category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $category_base));
129 129
 		}
130 130
 
131
-		$wp_rewrite->set_category_base( $category_base );
131
+		$wp_rewrite->set_category_base($category_base);
132 132
 	}
133 133
 
134
-	if ( isset( $_POST['tag_base'] ) ) {
134
+	if (isset($_POST['tag_base'])) {
135 135
 		$tag_base = $_POST['tag_base'];
136 136
 
137
-		if ( ! empty( $tag_base ) ) {
138
-			$tag_base = $blog_prefix . preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
137
+		if (!empty($tag_base)) {
138
+			$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace('#', '', $tag_base));
139 139
 		}
140 140
 
141
-		$wp_rewrite->set_tag_base( $tag_base );
141
+		$wp_rewrite->set_tag_base($tag_base);
142 142
 	}
143 143
 }
144 144
 
145
-if ( $iis7_permalinks ) {
146
-	if ( ( ! file_exists( $home_path . 'web.config' ) && win_is_writable( $home_path ) ) || win_is_writable( $home_path . 'web.config' ) ) {
145
+if ($iis7_permalinks) {
146
+	if ((!file_exists($home_path . 'web.config') && win_is_writable($home_path)) || win_is_writable($home_path . 'web.config')) {
147 147
 		$writable = true;
148 148
 	} else {
149 149
 		$writable = false;
150 150
 	}
151
-} elseif ( $is_nginx ) {
151
+} elseif ($is_nginx) {
152 152
 	$writable = false;
153 153
 } else {
154
-	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
154
+	if ((!file_exists($home_path . '.htaccess') && is_writable($home_path)) || is_writable($home_path . '.htaccess')) {
155 155
 		$writable = true;
156 156
 	} else {
157 157
 		$writable       = false;
158
-		$existing_rules = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
159
-		$new_rules      = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
158
+		$existing_rules = array_filter(extract_from_markers($home_path . '.htaccess', 'WordPress'));
159
+		$new_rules      = array_filter(explode("\n", $wp_rewrite->mod_rewrite_rules()));
160 160
 
161
-		$htaccess_update_required = ( $new_rules !== $existing_rules );
161
+		$htaccess_update_required = ($new_rules !== $existing_rules);
162 162
 	}
163 163
 }
164 164
 
165 165
 $using_index_permalinks = $wp_rewrite->using_index_permalinks();
166 166
 
167
-if ( $structure_updated ) {
168
-	$message = __( 'Permalink structure updated.' );
167
+if ($structure_updated) {
168
+	$message = __('Permalink structure updated.');
169 169
 
170
-	if ( ! is_multisite() && $permalink_structure && ! $using_index_permalinks ) {
171
-		if ( $iis7_permalinks ) {
172
-			if ( ! $writable ) {
170
+	if (!is_multisite() && $permalink_structure && !$using_index_permalinks) {
171
+		if ($iis7_permalinks) {
172
+			if (!$writable) {
173 173
 				$message = sprintf(
174 174
 					/* translators: %s: web.config */
175
-					__( 'You should update your %s file now.' ),
175
+					__('You should update your %s file now.'),
176 176
 					'<code>web.config</code>'
177 177
 				);
178 178
 			} else {
179 179
 				$message = sprintf(
180 180
 					/* translators: %s: web.config */
181
-					__( 'Permalink structure updated. Remove write access on %s file now!' ),
181
+					__('Permalink structure updated. Remove write access on %s file now!'),
182 182
 					'<code>web.config</code>'
183 183
 				);
184 184
 			}
185
-		} elseif ( ! $is_nginx && $htaccess_update_required && ! $writable ) {
185
+		} elseif (!$is_nginx && $htaccess_update_required && !$writable) {
186 186
 			$message = sprintf(
187 187
 				/* translators: %s: .htaccess */
188
-				__( 'You should update your %s file now.' ),
188
+				__('You should update your %s file now.'),
189 189
 				'<code>.htaccess</code>'
190 190
 			);
191 191
 		}
192 192
 	}
193 193
 
194
-	if ( ! get_settings_errors() ) {
195
-		add_settings_error( 'general', 'settings_updated', $message, 'success' );
194
+	if (!get_settings_errors()) {
195
+		add_settings_error('general', 'settings_updated', $message, 'success');
196 196
 	}
197 197
 
198
-	set_transient( 'settings_errors', get_settings_errors(), 30 );
198
+	set_transient('settings_errors', get_settings_errors(), 30);
199 199
 
200
-	wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
200
+	wp_redirect(admin_url('options-permalink.php?settings-updated=true'));
201 201
 	exit;
202 202
 }
203 203
 
@@ -206,91 +206,91 @@  discard block
 block discarded – undo
206 206
 require_once ABSPATH . 'wp-admin/admin-header.php';
207 207
 ?>
208 208
 <div class="wrap">
209
-<h1><?php echo esc_html( $title ); ?></h1>
209
+<h1><?php echo esc_html($title); ?></h1>
210 210
 
211 211
 <form name="form" action="options-permalink.php" method="post">
212
-<?php wp_nonce_field( 'update-permalink' ); ?>
212
+<?php wp_nonce_field('update-permalink'); ?>
213 213
 
214 214
 	<p>
215 215
 	<?php
216 216
 		printf(
217 217
 			/* translators: %s: Documentation URL. */
218
-			__( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.' ),
219
-			__( 'https://wordpress.org/support/article/using-permalinks/' )
218
+			__('WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="%s">number of tags are available</a>, and here are some examples to get you started.'),
219
+			__('https://wordpress.org/support/article/using-permalinks/')
220 220
 		);
221 221
 		?>
222 222
 	</p>
223 223
 
224 224
 <?php
225
-if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
226
-	$permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
227
-	$category_base       = preg_replace( '|^/?blog|', '', $category_base );
228
-	$tag_base            = preg_replace( '|^/?blog|', '', $tag_base );
225
+if (is_multisite() && !is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) {
226
+	$permalink_structure = preg_replace('|^/?blog|', '', $permalink_structure);
227
+	$category_base       = preg_replace('|^/?blog|', '', $category_base);
228
+	$tag_base            = preg_replace('|^/?blog|', '', $tag_base);
229 229
 }
230 230
 
231 231
 $structures = array(
232 232
 	0 => '',
233 233
 	1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
234 234
 	2 => $prefix . '/%year%/%monthnum%/%postname%/',
235
-	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
235
+	3 => $prefix . '/' . _x('archives', 'sample permalink base') . '/%post_id%',
236 236
 	4 => $prefix . '/%postname%/',
237 237
 );
238 238
 ?>
239
-<h2 class="title"><?php _e( 'Common Settings' ); ?></h2>
239
+<h2 class="title"><?php _e('Common Settings'); ?></h2>
240 240
 <table class="form-table permalink-structure">
241 241
 	<tr>
242
-		<th scope="row"><label><input name="selection" type="radio" value="" <?php checked( '', $permalink_structure ); ?> /> <?php _e( 'Plain' ); ?></label></th>
243
-		<td><code><?php echo get_option( 'home' ); ?>/?p=123</code></td>
242
+		<th scope="row"><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e('Plain'); ?></label></th>
243
+		<td><code><?php echo get_option('home'); ?>/?p=123</code></td>
244 244
 	</tr>
245 245
 	<tr>
246
-		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[1] ); ?>" <?php checked( $structures[1], $permalink_structure ); ?> /> <?php _e( 'Day and name' ); ?></label></th>
247
-		<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . gmdate( 'Y' ) . '/' . gmdate( 'm' ) . '/' . gmdate( 'd' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
246
+		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
247
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . gmdate('Y') . '/' . gmdate('m') . '/' . gmdate('d') . '/' . _x('sample-post', 'sample permalink structure') . '/'; ?></code></td>
248 248
 	</tr>
249 249
 	<tr>
250
-		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[2] ); ?>" <?php checked( $structures[2], $permalink_structure ); ?> /> <?php _e( 'Month and name' ); ?></label></th>
251
-		<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . gmdate( 'Y' ) . '/' . gmdate( 'm' ) . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
250
+		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
251
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . gmdate('Y') . '/' . gmdate('m') . '/' . _x('sample-post', 'sample permalink structure') . '/'; ?></code></td>
252 252
 	</tr>
253 253
 	<tr>
254
-		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[3] ); ?>" <?php checked( $structures[3], $permalink_structure ); ?> /> <?php _e( 'Numeric' ); ?></label></th>
255
-		<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td>
254
+		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
255
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x('archives', 'sample permalink base') . '/123'; ?></code></td>
256 256
 	</tr>
257 257
 	<tr>
258
-		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr( $structures[4] ); ?>" <?php checked( $structures[4], $permalink_structure ); ?> /> <?php _e( 'Post name' ); ?></label></th>
259
-		<td><code><?php echo get_option( 'home' ) . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
258
+		<th scope="row"><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th>
259
+		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x('sample-post', 'sample permalink structure') . '/'; ?></code></td>
260 260
 	</tr>
261 261
 	<tr>
262 262
 		<th scope="row">
263
-			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( ! in_array( $permalink_structure, $structures, true ) ); ?> />
264
-			<?php _e( 'Custom Structure' ); ?>
263
+			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked(!in_array($permalink_structure, $structures, true)); ?> />
264
+			<?php _e('Custom Structure'); ?>
265 265
 			</label>
266 266
 		</th>
267 267
 		<td>
268
-			<code><?php echo get_option( 'home' ) . $blog_prefix; ?></code>
269
-			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr( $permalink_structure ); ?>" class="regular-text code" />
268
+			<code><?php echo get_option('home') . $blog_prefix; ?></code>
269
+			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
270 270
 			<div class="available-structure-tags hide-if-no-js">
271 271
 				<div id="custom_selection_updated" aria-live="assertive" class="screen-reader-text"></div>
272 272
 				<?php
273 273
 				$available_tags = array(
274 274
 					/* translators: %s: Permalink structure tag. */
275
-					'year'     => __( '%s (The year of the post, four digits, for example 2004.)' ),
275
+					'year'     => __('%s (The year of the post, four digits, for example 2004.)'),
276 276
 					/* translators: %s: Permalink structure tag. */
277
-					'monthnum' => __( '%s (Month of the year, for example 05.)' ),
277
+					'monthnum' => __('%s (Month of the year, for example 05.)'),
278 278
 					/* translators: %s: Permalink structure tag. */
279
-					'day'      => __( '%s (Day of the month, for example 28.)' ),
279
+					'day'      => __('%s (Day of the month, for example 28.)'),
280 280
 					/* translators: %s: Permalink structure tag. */
281
-					'hour'     => __( '%s (Hour of the day, for example 15.)' ),
281
+					'hour'     => __('%s (Hour of the day, for example 15.)'),
282 282
 					/* translators: %s: Permalink structure tag. */
283
-					'minute'   => __( '%s (Minute of the hour, for example 43.)' ),
283
+					'minute'   => __('%s (Minute of the hour, for example 43.)'),
284 284
 					/* translators: %s: Permalink structure tag. */
285
-					'second'   => __( '%s (Second of the minute, for example 33.)' ),
285
+					'second'   => __('%s (Second of the minute, for example 33.)'),
286 286
 					/* translators: %s: Permalink structure tag. */
287
-					'post_id'  => __( '%s (The unique ID of the post, for example 423.)' ),
287
+					'post_id'  => __('%s (The unique ID of the post, for example 423.)'),
288 288
 					/* translators: %s: Permalink structure tag. */
289
-					'postname' => __( '%s (The sanitized post title (slug).)' ),
289
+					'postname' => __('%s (The sanitized post title (slug).)'),
290 290
 					/* translators: %s: Permalink structure tag. */
291
-					'category' => __( '%s (Category slug. Nested sub-categories appear as nested directories in the URL.)' ),
291
+					'category' => __('%s (Category slug. Nested sub-categories appear as nested directories in the URL.)'),
292 292
 					/* translators: %s: Permalink structure tag. */
293
-					'author'   => __( '%s (A sanitized version of the author name.)' ),
293
+					'author'   => __('%s (A sanitized version of the author name.)'),
294 294
 				);
295 295
 
296 296
 				/**
@@ -300,27 +300,27 @@  discard block
 block discarded – undo
300 300
 				 *
301 301
 				 * @param string[] $available_tags An array of key => value pairs of available permalink structure tags.
302 302
 				 */
303
-				$available_tags = apply_filters( 'available_permalink_structure_tags', $available_tags );
303
+				$available_tags = apply_filters('available_permalink_structure_tags', $available_tags);
304 304
 
305 305
 				/* translators: %s: Permalink structure tag. */
306
-				$structure_tag_added = __( '%s added to permalink structure' );
306
+				$structure_tag_added = __('%s added to permalink structure');
307 307
 
308 308
 				/* translators: %s: Permalink structure tag. */
309
-				$structure_tag_already_used = __( '%s (already used in permalink structure)' );
309
+				$structure_tag_already_used = __('%s (already used in permalink structure)');
310 310
 
311
-				if ( ! empty( $available_tags ) ) :
311
+				if (!empty($available_tags)) :
312 312
 					?>
313
-					<p><?php _e( 'Available tags:' ); ?></p>
313
+					<p><?php _e('Available tags:'); ?></p>
314 314
 					<ul role="list">
315 315
 						<?php
316
-						foreach ( $available_tags as $tag => $explanation ) {
316
+						foreach ($available_tags as $tag => $explanation) {
317 317
 							?>
318 318
 							<li>
319 319
 								<button type="button"
320 320
 										class="button button-secondary"
321
-										aria-label="<?php echo esc_attr( sprintf( $explanation, $tag ) ); ?>"
322
-										data-added="<?php echo esc_attr( sprintf( $structure_tag_added, $tag ) ); ?>"
323
-										data-used="<?php echo esc_attr( sprintf( $structure_tag_already_used, $tag ) ); ?>">
321
+										aria-label="<?php echo esc_attr(sprintf($explanation, $tag)); ?>"
322
+										data-added="<?php echo esc_attr(sprintf($structure_tag_added, $tag)); ?>"
323
+										data-used="<?php echo esc_attr(sprintf($structure_tag_already_used, $tag)); ?>">
324 324
 									<?php echo '%' . $tag . '%'; ?>
325 325
 								</button>
326 326
 							</li>
@@ -334,43 +334,43 @@  discard block
 block discarded – undo
334 334
 	</tr>
335 335
 </table>
336 336
 
337
-<h2 class="title"><?php _e( 'Optional' ); ?></h2>
337
+<h2 class="title"><?php _e('Optional'); ?></h2>
338 338
 <p>
339 339
 <?php
340 340
 /* translators: %s: Placeholder that must come at the start of the URL. */
341
-printf( __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix );
341
+printf(__('If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.'), get_option('home') . $blog_prefix . $prefix);
342 342
 ?>
343 343
 </p>
344 344
 
345 345
 <table class="form-table" role="presentation">
346 346
 	<tr>
347
-		<th><label for="category_base"><?php /* translators: Prefix for category permalinks. */ _e( 'Category base' ); ?></label></th>
348
-		<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>
347
+		<th><label for="category_base"><?php /* translators: Prefix for category permalinks. */ _e('Category base'); ?></label></th>
348
+		<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr($category_base); ?>" class="regular-text code" /></td>
349 349
 	</tr>
350 350
 	<tr>
351
-		<th><label for="tag_base"><?php _e( 'Tag base' ); ?></label></th>
352
-		<td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr( $tag_base ); ?>" class="regular-text code" /></td>
351
+		<th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
352
+		<td><?php echo $blog_prefix; ?> <input name="tag_base" id="tag_base" type="text" value="<?php echo esc_attr($tag_base); ?>" class="regular-text code" /></td>
353 353
 	</tr>
354
-	<?php do_settings_fields( 'permalink', 'optional' ); ?>
354
+	<?php do_settings_fields('permalink', 'optional'); ?>
355 355
 </table>
356 356
 
357
-<?php do_settings_sections( 'permalink' ); ?>
357
+<?php do_settings_sections('permalink'); ?>
358 358
 
359 359
 <?php submit_button(); ?>
360 360
 </form>
361
-<?php if ( ! is_multisite() ) { ?>
361
+<?php if (!is_multisite()) { ?>
362 362
 	<?php
363
-	if ( $iis7_permalinks ) :
364
-		if ( isset( $_POST['submit'] ) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :
365
-			if ( file_exists( $home_path . 'web.config' ) ) :
363
+	if ($iis7_permalinks) :
364
+		if (isset($_POST['submit']) && $permalink_structure && !$using_index_permalinks && !$writable) :
365
+			if (file_exists($home_path . 'web.config')) :
366 366
 				?>
367 367
 <p id="iis-description-a">
368 368
 				<?php
369 369
 				printf(
370 370
 					/* translators: 1: web.config, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A, 5: Element code. */
371
-					__( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. This is the URL rewrite rule you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this rule inside of the %5$s element in %1$s file.' ),
371
+					__('<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. This is the URL rewrite rule you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this rule inside of the %5$s element in %1$s file.'),
372 372
 					'<code>web.config</code>',
373
-					__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
373
+					__('https://wordpress.org/support/article/changing-file-permissions/'),
374 374
 					'<kbd>Ctrl + A</kbd>',
375 375
 					'<kbd>⌘ + A</kbd>',
376 376
 					'<code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code>'
@@ -378,14 +378,14 @@  discard block
 block discarded – undo
378 378
 				?>
379 379
 </p>
380 380
 <form action="options-permalink.php" method="post">
381
-				<?php wp_nonce_field( 'update-permalink' ); ?>
382
-	<p><label for="rules"><?php _e( 'Rewrite rules:' ); ?></label><br /><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly" aria-describedby="iis-description-a"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p>
381
+				<?php wp_nonce_field('update-permalink'); ?>
382
+	<p><label for="rules"><?php _e('Rewrite rules:'); ?></label><br /><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly" aria-describedby="iis-description-a"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules()); ?></textarea></p>
383 383
 </form>
384 384
 <p>
385 385
 				<?php
386 386
 				printf(
387 387
 					/* translators: %s: web.config */
388
-					__( 'If you temporarily make your %s file writable to generate rewrite rules automatically, do not forget to revert the permissions after the rule has been saved.' ),
388
+					__('If you temporarily make your %s file writable to generate rewrite rules automatically, do not forget to revert the permissions after the rule has been saved.'),
389 389
 					'<code>web.config</code>'
390 390
 				);
391 391
 				?>
@@ -395,8 +395,8 @@  discard block
 block discarded – undo
395 395
 			<?php
396 396
 			printf(
397 397
 				/* translators: 1: Documentation URL, 2: web.config, 3: Ctrl + A, 4: ⌘ + A */
398
-				__( '<strong>Error:</strong> The root directory of your site is not <a href="%1$s">writable</a>, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.' ),
399
-				__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
398
+				__('<strong>Error:</strong> The root directory of your site is not <a href="%1$s">writable</a>, so creating a file automatically was not possible. This is the URL rewrite rule you should have in your %2$s file. Create a new file called %2$s in the root directory of your site. Click in the field and press %3$s (or %4$s on Mac) to select all. Then insert this code into the %2$s file.'),
399
+				__('https://wordpress.org/support/article/changing-file-permissions/'),
400 400
 				'<code>web.config</code>',
401 401
 				'<kbd>Ctrl + A</kbd>',
402 402
 				'<kbd>⌘ + A</kbd>'
@@ -404,14 +404,14 @@  discard block
 block discarded – undo
404 404
 			?>
405 405
 </p>
406 406
 <form action="options-permalink.php" method="post">
407
-			<?php wp_nonce_field( 'update-permalink' ); ?>
408
-	<p><label for="rules"><?php _e( 'Rewrite rules:' ); ?></label><br /><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly" aria-describedby="iis-description-b"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules( true ) ); ?></textarea></p>
407
+			<?php wp_nonce_field('update-permalink'); ?>
408
+	<p><label for="rules"><?php _e('Rewrite rules:'); ?></label><br /><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly" aria-describedby="iis-description-b"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules(true)); ?></textarea></p>
409 409
 </form>
410 410
 <p>
411 411
 			<?php
412 412
 			printf(
413 413
 				/* translators: %s: web.config */
414
-				__( 'If you temporarily make your site&#8217;s root directory writable to generate the %s file automatically, do not forget to revert the permissions after the file has been created.' ),
414
+				__('If you temporarily make your site&#8217;s root directory writable to generate the %s file automatically, do not forget to revert the permissions after the file has been created.'),
415 415
 				'<code>web.config</code>'
416 416
 			);
417 417
 			?>
@@ -420,23 +420,23 @@  discard block
 block discarded – undo
420 420
 	<?php endif; ?>
421 421
 		<?php
422 422
 else :
423
-	if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) :
423
+	if ($permalink_structure && !$using_index_permalinks && !$writable && $htaccess_update_required) :
424 424
 		?>
425 425
 <p id="htaccess-description">
426 426
 		<?php
427 427
 		printf(
428 428
 			/* translators: 1: .htaccess, 2: Documentation URL, 3: Ctrl + A, 4: ⌘ + A */
429
-			__( '<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.' ),
429
+			__('<strong>Error:</strong> Your %1$s file is not <a href="%2$s">writable</a>, so updating it automatically was not possible. These are the mod_rewrite rules you should have in your %1$s file. Click in the field and press %3$s (or %4$s on Mac) to select all.'),
430 430
 			'<code>.htaccess</code>',
431
-			__( 'https://wordpress.org/support/article/changing-file-permissions/' ),
431
+			__('https://wordpress.org/support/article/changing-file-permissions/'),
432 432
 			'<kbd>Ctrl + A</kbd>',
433 433
 			'<kbd>⌘ + A</kbd>'
434 434
 		);
435 435
 		?>
436 436
 </p>
437 437
 <form action="options-permalink.php" method="post">
438
-		<?php wp_nonce_field( 'update-permalink' ); ?>
439
-	<p><label for="rules"><?php _e( 'Rewrite rules:' ); ?></label><br /><textarea rows="8" class="large-text readonly" name="rules" id="rules" readonly="readonly" aria-describedby="htaccess-description"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p>
438
+		<?php wp_nonce_field('update-permalink'); ?>
439
+	<p><label for="rules"><?php _e('Rewrite rules:'); ?></label><br /><textarea rows="8" class="large-text readonly" name="rules" id="rules" readonly="readonly" aria-describedby="htaccess-description"><?php echo esc_textarea($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
440 440
 </form>
441 441
 	<?php endif; ?>
442 442
 <?php endif; ?>
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -390,7 +390,8 @@  discard block
 block discarded – undo
390 390
 				);
391 391
 				?>
392 392
 </p>
393
-		<?php else : ?>
393
+		<?php else {
394
+    : ?>
394 395
 <p id="iis-description-b">
395 396
 			<?php
396 397
 			printf(
@@ -401,6 +402,7 @@  discard block
 block discarded – undo
401 402
 				'<kbd>Ctrl + A</kbd>',
402 403
 				'<kbd>⌘ + A</kbd>'
403 404
 			);
405
+}
404 406
 			?>
405 407
 </p>
406 408
 <form action="options-permalink.php" method="post">
@@ -419,7 +421,8 @@  discard block
 block discarded – undo
419 421
 		<?php endif; ?>
420 422
 	<?php endif; ?>
421 423
 		<?php
422
-else :
424
+else {
425
+    :
423 426
 	if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) :
424 427
 		?>
425 428
 <p id="htaccess-description">
@@ -432,6 +435,7 @@  discard block
 block discarded – undo
432 435
 			'<kbd>Ctrl + A</kbd>',
433 436
 			'<kbd>⌘ + A</kbd>'
434 437
 		);
438
+}
435 439
 		?>
436 440
 </p>
437 441
 <form action="options-permalink.php" method="post">
Please login to merge, or discard this patch.
brighty/wp-admin/customize.php 3 patches
Indentation   +81 added lines, -81 removed lines patch added patch discarded remove patch
@@ -13,11 +13,11 @@  discard block
 block discarded – undo
13 13
 require_once __DIR__ . '/admin.php';
14 14
 
15 15
 if ( ! current_user_can( 'customize' ) ) {
16
-	wp_die(
17
-		'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
18
-		'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
19
-		403
20
-	);
16
+    wp_die(
17
+        '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
18
+        '<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
19
+        403
20
+    );
21 21
 }
22 22
 
23 23
 /**
@@ -27,22 +27,22 @@  discard block
 block discarded – undo
27 27
 global $wp_scripts, $wp_customize;
28 28
 
29 29
 if ( $wp_customize->changeset_post_id() ) {
30
-	$changeset_post = get_post( $wp_customize->changeset_post_id() );
31
-
32
-	if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
33
-		wp_die(
34
-			'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
35
-			'<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
36
-			403
37
-		);
38
-	}
39
-
40
-	$missed_schedule = (
41
-		'future' === $changeset_post->post_status &&
42
-		get_post_time( 'G', true, $changeset_post ) < time()
43
-	);
44
-	if ( $missed_schedule ) {
45
-		/*
30
+    $changeset_post = get_post( $wp_customize->changeset_post_id() );
31
+
32
+    if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
33
+        wp_die(
34
+            '<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
35
+            '<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
36
+            403
37
+        );
38
+    }
39
+
40
+    $missed_schedule = (
41
+        'future' === $changeset_post->post_status &&
42
+        get_post_time( 'G', true, $changeset_post ) < time()
43
+    );
44
+    if ( $missed_schedule ) {
45
+        /*
46 46
 		 * Note that an Ajax request spawns here instead of just calling `wp_publish_post( $changeset_post->ID )`.
47 47
 		 *
48 48
 		 * Because WP_Customize_Manager is not instantiated for customize.php with the `settings_previewed=false`
@@ -51,49 +51,49 @@  discard block
 block discarded – undo
51 51
 		 *
52 52
 		 * By opening an Ajax request, this is avoided and the changeset is published. See #39221.
53 53
 		 */
54
-		$nonces       = $wp_customize->get_nonces();
55
-		$request_args = array(
56
-			'nonce'                      => $nonces['save'],
57
-			'customize_changeset_uuid'   => $wp_customize->changeset_uuid(),
58
-			'wp_customize'               => 'on',
59
-			'customize_changeset_status' => 'publish',
60
-		);
61
-		ob_start();
62
-		?>
54
+        $nonces       = $wp_customize->get_nonces();
55
+        $request_args = array(
56
+            'nonce'                      => $nonces['save'],
57
+            'customize_changeset_uuid'   => $wp_customize->changeset_uuid(),
58
+            'wp_customize'               => 'on',
59
+            'customize_changeset_status' => 'publish',
60
+        );
61
+        ob_start();
62
+        ?>
63 63
 		<?php wp_print_scripts( array( 'wp-util' ) ); ?>
64 64
 		<script>
65 65
 			wp.ajax.post( 'customize_save', <?php echo wp_json_encode( $request_args ); ?> );
66 66
 		</script>
67 67
 		<?php
68
-		$script = ob_get_clean();
69
-
70
-		wp_die(
71
-			'<h1>' . __( 'Your scheduled changes just published' ) . '</h1>' .
72
-			'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>' . $script,
73
-			200
74
-		);
75
-	}
76
-
77
-	if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
78
-		wp_die(
79
-			'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
80
-			'<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
81
-			'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
82
-			403
83
-		);
84
-	}
68
+        $script = ob_get_clean();
69
+
70
+        wp_die(
71
+            '<h1>' . __( 'Your scheduled changes just published' ) . '</h1>' .
72
+            '<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>' . $script,
73
+            200
74
+        );
75
+    }
76
+
77
+    if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
78
+        wp_die(
79
+            '<h1>' . __( 'Something went wrong.' ) . '</h1>' .
80
+            '<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
81
+            '<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
82
+            403
83
+        );
84
+    }
85 85
 }
86 86
 
87 87
 
88 88
 wp_reset_vars( array( 'url', 'return', 'autofocus' ) );
89 89
 if ( ! empty( $url ) ) {
90
-	$wp_customize->set_preview_url( wp_unslash( $url ) );
90
+    $wp_customize->set_preview_url( wp_unslash( $url ) );
91 91
 }
92 92
 if ( ! empty( $return ) ) {
93
-	$wp_customize->set_return_url( wp_unslash( $return ) );
93
+    $wp_customize->set_return_url( wp_unslash( $return ) );
94 94
 }
95 95
 if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
96
-	$wp_customize->set_autofocus( wp_unslash( $autofocus ) );
96
+    $wp_customize->set_autofocus( wp_unslash( $autofocus ) );
97 97
 }
98 98
 
99 99
 $registered             = $wp_scripts->registered;
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 $body_class = 'wp-core-ui wp-customizer js';
132 132
 
133 133
 if ( wp_is_mobile() ) :
134
-	$body_class .= ' mobile';
135
-	add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
134
+    $body_class .= ' mobile';
135
+    add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
136 136
 endif;
137 137
 
138 138
 if ( $wp_customize->is_ios() ) {
139
-	$body_class .= ' ios';
139
+    $body_class .= ' ios';
140 140
 }
141 141
 
142 142
 if ( is_rtl() ) {
143
-	$body_class .= ' rtl';
143
+    $body_class .= ' rtl';
144 144
 }
145 145
 $body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
146 146
 
147 147
 if ( wp_use_widgets_block_editor() ) {
148
-	$body_class .= ' wp-embed-responsive';
148
+    $body_class .= ' wp-embed-responsive';
149 149
 }
150 150
 
151 151
 $admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading&hellip;' ) );
@@ -186,9 +186,9 @@  discard block
 block discarded – undo
186 186
 	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
187 187
 		<div id="customize-header-actions" class="wp-full-overlay-header">
188 188
 			<?php
189
-			$compatible_wp  = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
190
-			$compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
191
-			?>
189
+            $compatible_wp  = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
190
+            $compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
191
+            ?>
192 192
 			<?php if ( $compatible_wp && $compatible_php ) : ?>
193 193
 				<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
194 194
 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
@@ -226,22 +226,22 @@  discard block
 block discarded – undo
226 226
 					<div class="accordion-section-title">
227 227
 						<span class="preview-notice">
228 228
 						<?php
229
-							/* translators: %s: The site/panel title in the Customizer. */
230
-							printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
231
-						?>
229
+                            /* translators: %s: The site/panel title in the Customizer. */
230
+                            printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
231
+                        ?>
232 232
 						</span>
233 233
 						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
234 234
 					</div>
235 235
 					<div class="customize-panel-description">
236 236
 						<p>
237 237
 							<?php
238
-							_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
239
-							?>
238
+                            _e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
239
+                            ?>
240 240
 						</p>
241 241
 						<p>
242 242
 							<?php
243
-							_e( '<a href="https://wordpress.org/support/article/appearance-customize-screen/">Documentation on Customizer</a>' );
244
-							?>
243
+                            _e( '<a href="https://wordpress.org/support/article/appearance-customize-screen/">Documentation on Customizer</a>' );
244
+                            ?>
245 245
 						</p>
246 246
 					</div>
247 247
 				</div>
@@ -263,15 +263,15 @@  discard block
 block discarded – undo
263 263
 				<div class="devices">
264 264
 					<?php foreach ( (array) $previewable_devices as $device => $settings ) : ?>
265 265
 						<?php
266
-						if ( empty( $settings['label'] ) ) {
267
-							continue;
268
-						}
269
-						$active = ! empty( $settings['default'] );
270
-						$class  = 'preview-' . $device;
271
-						if ( $active ) {
272
-							$class .= ' active';
273
-						}
274
-						?>
266
+                        if ( empty( $settings['label'] ) ) {
267
+                            continue;
268
+                        }
269
+                        $active = ! empty( $settings['default'] );
270
+                        $class  = 'preview-' . $device;
271
+                        if ( $active ) {
272
+                            $class .= ' active';
273
+                        }
274
+                        ?>
275 275
 						<button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ); ?>" data-device="<?php echo esc_attr( $device ); ?>">
276 276
 							<span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span>
277 277
 						</button>
@@ -284,13 +284,13 @@  discard block
 block discarded – undo
284 284
 	<div id="customize-preview" class="wp-full-overlay-main"></div>
285 285
 	<?php
286 286
 
287
-	/**
288
-	 * Prints templates, control scripts, and settings in the footer.
289
-	 *
290
-	 * @since 3.4.0
291
-	 */
292
-	do_action( 'customize_controls_print_footer_scripts' );
293
-	?>
287
+    /**
288
+     * Prints templates, control scripts, and settings in the footer.
289
+     *
290
+     * @since 3.4.0
291
+     */
292
+    do_action( 'customize_controls_print_footer_scripts' );
293
+    ?>
294 294
 </div>
295 295
 </body>
296 296
 </html>
Please login to merge, or discard this patch.
Spacing   +74 added lines, -74 removed lines patch added patch discarded remove patch
@@ -7,15 +7,15 @@  discard block
 block discarded – undo
7 7
  * @since 3.4.0
8 8
  */
9 9
 
10
-define( 'IFRAME_REQUEST', true );
10
+define('IFRAME_REQUEST', true);
11 11
 
12 12
 /** Load WordPress Administration Bootstrap */
13 13
 require_once __DIR__ . '/admin.php';
14 14
 
15
-if ( ! current_user_can( 'customize' ) ) {
15
+if (!current_user_can('customize')) {
16 16
 	wp_die(
17
-		'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
18
-		'<p>' . __( 'Sorry, you are not allowed to customize this site.' ) . '</p>',
17
+		'<h1>' . __('You need a higher level of permission.') . '</h1>' .
18
+		'<p>' . __('Sorry, you are not allowed to customize this site.') . '</p>',
19 19
 		403
20 20
 	);
21 21
 }
@@ -26,22 +26,22 @@  discard block
 block discarded – undo
26 26
  */
27 27
 global $wp_scripts, $wp_customize;
28 28
 
29
-if ( $wp_customize->changeset_post_id() ) {
30
-	$changeset_post = get_post( $wp_customize->changeset_post_id() );
29
+if ($wp_customize->changeset_post_id()) {
30
+	$changeset_post = get_post($wp_customize->changeset_post_id());
31 31
 
32
-	if ( ! current_user_can( get_post_type_object( 'customize_changeset' )->cap->edit_post, $changeset_post->ID ) ) {
32
+	if (!current_user_can(get_post_type_object('customize_changeset')->cap->edit_post, $changeset_post->ID)) {
33 33
 		wp_die(
34
-			'<h1>' . __( 'You need a higher level of permission.' ) . '</h1>' .
35
-			'<p>' . __( 'Sorry, you are not allowed to edit this changeset.' ) . '</p>',
34
+			'<h1>' . __('You need a higher level of permission.') . '</h1>' .
35
+			'<p>' . __('Sorry, you are not allowed to edit this changeset.') . '</p>',
36 36
 			403
37 37
 		);
38 38
 	}
39 39
 
40 40
 	$missed_schedule = (
41 41
 		'future' === $changeset_post->post_status &&
42
-		get_post_time( 'G', true, $changeset_post ) < time()
42
+		get_post_time('G', true, $changeset_post) < time()
43 43
 	);
44
-	if ( $missed_schedule ) {
44
+	if ($missed_schedule) {
45 45
 		/*
46 46
 		 * Note that an Ajax request spawns here instead of just calling `wp_publish_post( $changeset_post->ID )`.
47 47
 		 *
@@ -60,101 +60,101 @@  discard block
 block discarded – undo
60 60
 		);
61 61
 		ob_start();
62 62
 		?>
63
-		<?php wp_print_scripts( array( 'wp-util' ) ); ?>
63
+		<?php wp_print_scripts(array('wp-util')); ?>
64 64
 		<script>
65
-			wp.ajax.post( 'customize_save', <?php echo wp_json_encode( $request_args ); ?> );
65
+			wp.ajax.post( 'customize_save', <?php echo wp_json_encode($request_args); ?> );
66 66
 		</script>
67 67
 		<?php
68 68
 		$script = ob_get_clean();
69 69
 
70 70
 		wp_die(
71
-			'<h1>' . __( 'Your scheduled changes just published' ) . '</h1>' .
72
-			'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>' . $script,
71
+			'<h1>' . __('Your scheduled changes just published') . '</h1>' .
72
+			'<p><a href="' . esc_url(remove_query_arg('changeset_uuid')) . '">' . __('Customize New Changes') . '</a></p>' . $script,
73 73
 			200
74 74
 		);
75 75
 	}
76 76
 
77
-	if ( in_array( get_post_status( $changeset_post->ID ), array( 'publish', 'trash' ), true ) ) {
77
+	if (in_array(get_post_status($changeset_post->ID), array('publish', 'trash'), true)) {
78 78
 		wp_die(
79
-			'<h1>' . __( 'Something went wrong.' ) . '</h1>' .
80
-			'<p>' . __( 'This changeset cannot be further modified.' ) . '</p>' .
81
-			'<p><a href="' . esc_url( remove_query_arg( 'changeset_uuid' ) ) . '">' . __( 'Customize New Changes' ) . '</a></p>',
79
+			'<h1>' . __('Something went wrong.') . '</h1>' .
80
+			'<p>' . __('This changeset cannot be further modified.') . '</p>' .
81
+			'<p><a href="' . esc_url(remove_query_arg('changeset_uuid')) . '">' . __('Customize New Changes') . '</a></p>',
82 82
 			403
83 83
 		);
84 84
 	}
85 85
 }
86 86
 
87 87
 
88
-wp_reset_vars( array( 'url', 'return', 'autofocus' ) );
89
-if ( ! empty( $url ) ) {
90
-	$wp_customize->set_preview_url( wp_unslash( $url ) );
88
+wp_reset_vars(array('url', 'return', 'autofocus'));
89
+if (!empty($url)) {
90
+	$wp_customize->set_preview_url(wp_unslash($url));
91 91
 }
92
-if ( ! empty( $return ) ) {
93
-	$wp_customize->set_return_url( wp_unslash( $return ) );
92
+if (!empty($return)) {
93
+	$wp_customize->set_return_url(wp_unslash($return));
94 94
 }
95
-if ( ! empty( $autofocus ) && is_array( $autofocus ) ) {
96
-	$wp_customize->set_autofocus( wp_unslash( $autofocus ) );
95
+if (!empty($autofocus) && is_array($autofocus)) {
96
+	$wp_customize->set_autofocus(wp_unslash($autofocus));
97 97
 }
98 98
 
99 99
 $registered             = $wp_scripts->registered;
100 100
 $wp_scripts             = new WP_Scripts;
101 101
 $wp_scripts->registered = $registered;
102 102
 
103
-add_action( 'customize_controls_print_scripts', 'print_head_scripts', 20 );
104
-add_action( 'customize_controls_print_footer_scripts', '_wp_footer_scripts' );
105
-add_action( 'customize_controls_print_styles', 'print_admin_styles', 20 );
103
+add_action('customize_controls_print_scripts', 'print_head_scripts', 20);
104
+add_action('customize_controls_print_footer_scripts', '_wp_footer_scripts');
105
+add_action('customize_controls_print_styles', 'print_admin_styles', 20);
106 106
 
107 107
 /**
108 108
  * Fires when Customizer controls are initialized, before scripts are enqueued.
109 109
  *
110 110
  * @since 3.4.0
111 111
  */
112
-do_action( 'customize_controls_init' );
112
+do_action('customize_controls_init');
113 113
 
114
-wp_enqueue_script( 'heartbeat' );
115
-wp_enqueue_script( 'customize-controls' );
116
-wp_enqueue_style( 'customize-controls' );
114
+wp_enqueue_script('heartbeat');
115
+wp_enqueue_script('customize-controls');
116
+wp_enqueue_style('customize-controls');
117 117
 
118 118
 /**
119 119
  * Enqueue Customizer control scripts.
120 120
  *
121 121
  * @since 3.4.0
122 122
  */
123
-do_action( 'customize_controls_enqueue_scripts' );
123
+do_action('customize_controls_enqueue_scripts');
124 124
 
125 125
 // Let's roll.
126
-header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
126
+header('Content-Type: ' . get_option('html_type') . '; charset=' . get_option('blog_charset'));
127 127
 
128 128
 wp_user_settings();
129 129
 _wp_admin_html_begin();
130 130
 
131 131
 $body_class = 'wp-core-ui wp-customizer js';
132 132
 
133
-if ( wp_is_mobile() ) :
133
+if (wp_is_mobile()) :
134 134
 	$body_class .= ' mobile';
135
-	add_filter( 'admin_viewport_meta', '_customizer_mobile_viewport_meta' );
135
+	add_filter('admin_viewport_meta', '_customizer_mobile_viewport_meta');
136 136
 endif;
137 137
 
138
-if ( $wp_customize->is_ios() ) {
138
+if ($wp_customize->is_ios()) {
139 139
 	$body_class .= ' ios';
140 140
 }
141 141
 
142
-if ( is_rtl() ) {
142
+if (is_rtl()) {
143 143
 	$body_class .= ' rtl';
144 144
 }
145
-$body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
145
+$body_class .= ' locale-' . sanitize_html_class(strtolower(str_replace('_', '-', get_user_locale())));
146 146
 
147
-if ( wp_use_widgets_block_editor() ) {
147
+if (wp_use_widgets_block_editor()) {
148 148
 	$body_class .= ' wp-embed-responsive';
149 149
 }
150 150
 
151
-$admin_title = sprintf( $wp_customize->get_document_title_template(), __( 'Loading&hellip;' ) );
151
+$admin_title = sprintf($wp_customize->get_document_title_template(), __('Loading&hellip;'));
152 152
 
153 153
 ?>
154
-<title><?php echo esc_html( $admin_title ); ?></title>
154
+<title><?php echo esc_html($admin_title); ?></title>
155 155
 
156 156
 <script type="text/javascript">
157
-var ajaxurl = <?php echo wp_json_encode( admin_url( 'admin-ajax.php', 'relative' ) ); ?>,
157
+var ajaxurl = <?php echo wp_json_encode(admin_url('admin-ajax.php', 'relative')); ?>,
158 158
 	pagenow = 'customize';
159 159
 </script>
160 160
 
@@ -164,50 +164,50 @@  discard block
 block discarded – undo
164 164
  *
165 165
  * @since 3.4.0
166 166
  */
167
-do_action( 'customize_controls_print_styles' );
167
+do_action('customize_controls_print_styles');
168 168
 
169 169
 /**
170 170
  * Fires when Customizer control scripts are printed.
171 171
  *
172 172
  * @since 3.4.0
173 173
  */
174
-do_action( 'customize_controls_print_scripts' );
174
+do_action('customize_controls_print_scripts');
175 175
 
176 176
 /**
177 177
  * Fires in head section of Customizer controls.
178 178
  *
179 179
  * @since 5.5.0
180 180
  */
181
-do_action( 'customize_controls_head' );
181
+do_action('customize_controls_head');
182 182
 ?>
183 183
 </head>
184
-<body class="<?php echo esc_attr( $body_class ); ?>">
184
+<body class="<?php echo esc_attr($body_class); ?>">
185 185
 <div class="wp-full-overlay expanded">
186 186
 	<form id="customize-controls" class="wrap wp-full-overlay-sidebar">
187 187
 		<div id="customize-header-actions" class="wp-full-overlay-header">
188 188
 			<?php
189
-			$compatible_wp  = is_wp_version_compatible( $wp_customize->theme()->get( 'RequiresWP' ) );
190
-			$compatible_php = is_php_version_compatible( $wp_customize->theme()->get( 'RequiresPHP' ) );
189
+			$compatible_wp  = is_wp_version_compatible($wp_customize->theme()->get('RequiresWP'));
190
+			$compatible_php = is_php_version_compatible($wp_customize->theme()->get('RequiresPHP'));
191 191
 			?>
192
-			<?php if ( $compatible_wp && $compatible_php ) : ?>
193
-				<?php $save_text = $wp_customize->is_theme_active() ? __( 'Publish' ) : __( 'Activate &amp; Publish' ); ?>
192
+			<?php if ($compatible_wp && $compatible_php) : ?>
193
+				<?php $save_text = $wp_customize->is_theme_active() ? __('Publish') : __('Activate &amp; Publish'); ?>
194 194
 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper" >
195
-					<?php submit_button( $save_text, 'primary save', 'save', false ); ?>
196
-					<button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
195
+					<?php submit_button($save_text, 'primary save', 'save', false); ?>
196
+					<button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e('Publish Settings'); ?>" aria-expanded="false" disabled></button>
197 197
 				</div>
198 198
 			<?php else : ?>
199
-				<?php $save_text = _x( 'Cannot Activate', 'theme' ); ?>
199
+				<?php $save_text = _x('Cannot Activate', 'theme'); ?>
200 200
 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper disabled" >
201
-					<button class="button button-primary disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
201
+					<button class="button button-primary disabled" aria-label="<?php esc_attr_e('Publish Settings'); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
202 202
 				</div>
203 203
 			<?php endif; ?>
204 204
 			<span class="spinner"></span>
205 205
 			<button type="button" class="customize-controls-preview-toggle">
206
-				<span class="controls"><?php _e( 'Customize' ); ?></span>
207
-				<span class="preview"><?php _e( 'Preview' ); ?></span>
206
+				<span class="controls"><?php _e('Customize'); ?></span>
207
+				<span class="preview"><?php _e('Preview'); ?></span>
208 208
 			</button>
209
-			<a class="customize-controls-close" href="<?php echo esc_url( $wp_customize->get_return_url() ); ?>">
210
-				<span class="screen-reader-text"><?php _e( 'Close the Customizer and go back to the previous page' ); ?></span>
209
+			<a class="customize-controls-close" href="<?php echo esc_url($wp_customize->get_return_url()); ?>">
210
+				<span class="screen-reader-text"><?php _e('Close the Customizer and go back to the previous page'); ?></span>
211 211
 			</a>
212 212
 		</div>
213 213
 
@@ -227,20 +227,20 @@  discard block
 block discarded – undo
227 227
 						<span class="preview-notice">
228 228
 						<?php
229 229
 							/* translators: %s: The site/panel title in the Customizer. */
230
-							printf( __( 'You are customizing %s' ), '<strong class="panel-title site-title">' . get_bloginfo( 'name', 'display' ) . '</strong>' );
230
+							printf(__('You are customizing %s'), '<strong class="panel-title site-title">' . get_bloginfo('name', 'display') . '</strong>');
231 231
 						?>
232 232
 						</span>
233
-						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e( 'Help' ); ?></span></button>
233
+						<button type="button" class="customize-help-toggle dashicons dashicons-editor-help" aria-expanded="false"><span class="screen-reader-text"><?php _e('Help'); ?></span></button>
234 234
 					</div>
235 235
 					<div class="customize-panel-description">
236 236
 						<p>
237 237
 							<?php
238
-							_e( 'The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.' );
238
+							_e('The Customizer allows you to preview changes to your site before publishing them. You can navigate to different pages on your site within the preview. Edit shortcuts are shown for some editable elements. The Customizer is intended for use with non-block themes.');
239 239
 							?>
240 240
 						</p>
241 241
 						<p>
242 242
 							<?php
243
-							_e( '<a href="https://wordpress.org/support/article/appearance-customize-screen/">Documentation on Customizer</a>' );
243
+							_e('<a href="https://wordpress.org/support/article/appearance-customize-screen/">Documentation on Customizer</a>');
244 244
 							?>
245 245
 						</p>
246 246
 					</div>
@@ -253,27 +253,27 @@  discard block
 block discarded – undo
253 253
 		</div>
254 254
 
255 255
 		<div id="customize-footer-actions" class="wp-full-overlay-footer">
256
-			<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php echo esc_attr_x( 'Hide Controls', 'label for hide controls button without length constraints' ); ?>">
256
+			<button type="button" class="collapse-sidebar button" aria-expanded="true" aria-label="<?php echo esc_attr_x('Hide Controls', 'label for hide controls button without length constraints'); ?>">
257 257
 				<span class="collapse-sidebar-arrow"></span>
258
-				<span class="collapse-sidebar-label"><?php _ex( 'Hide Controls', 'short (~12 characters) label for hide controls button' ); ?></span>
258
+				<span class="collapse-sidebar-label"><?php _ex('Hide Controls', 'short (~12 characters) label for hide controls button'); ?></span>
259 259
 			</button>
260 260
 			<?php $previewable_devices = $wp_customize->get_previewable_devices(); ?>
261
-			<?php if ( ! empty( $previewable_devices ) ) : ?>
261
+			<?php if (!empty($previewable_devices)) : ?>
262 262
 			<div class="devices-wrapper">
263 263
 				<div class="devices">
264
-					<?php foreach ( (array) $previewable_devices as $device => $settings ) : ?>
264
+					<?php foreach ((array) $previewable_devices as $device => $settings) : ?>
265 265
 						<?php
266
-						if ( empty( $settings['label'] ) ) {
266
+						if (empty($settings['label'])) {
267 267
 							continue;
268 268
 						}
269
-						$active = ! empty( $settings['default'] );
269
+						$active = !empty($settings['default']);
270 270
 						$class  = 'preview-' . $device;
271
-						if ( $active ) {
271
+						if ($active) {
272 272
 							$class .= ' active';
273 273
 						}
274 274
 						?>
275
-						<button type="button" class="<?php echo esc_attr( $class ); ?>" aria-pressed="<?php echo esc_attr( $active ); ?>" data-device="<?php echo esc_attr( $device ); ?>">
276
-							<span class="screen-reader-text"><?php echo esc_html( $settings['label'] ); ?></span>
275
+						<button type="button" class="<?php echo esc_attr($class); ?>" aria-pressed="<?php echo esc_attr($active); ?>" data-device="<?php echo esc_attr($device); ?>">
276
+							<span class="screen-reader-text"><?php echo esc_html($settings['label']); ?></span>
277 277
 						</button>
278 278
 					<?php endforeach; ?>
279 279
 				</div>
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 *
290 290
 	 * @since 3.4.0
291 291
 	 */
292
-	do_action( 'customize_controls_print_footer_scripts' );
292
+	do_action('customize_controls_print_footer_scripts');
293 293
 	?>
294 294
 </div>
295 295
 </body>
Please login to merge, or discard this patch.
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -195,8 +195,11 @@
 block discarded – undo
195 195
 					<?php submit_button( $save_text, 'primary save', 'save', false ); ?>
196 196
 					<button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
197 197
 				</div>
198
-			<?php else : ?>
199
-				<?php $save_text = _x( 'Cannot Activate', 'theme' ); ?>
198
+			<?php else {
199
+    : ?>
200
+				<?php $save_text = _x( 'Cannot Activate', 'theme' );
201
+}
202
+?>
200 203
 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper disabled" >
201 204
 					<button class="button button-primary disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
202 205
 				</div>
Please login to merge, or discard this patch.
brighty/wp-admin/widgets-form-blocks.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@  discard block
 block discarded – undo
8 8
 
9 9
 // Don't load directly.
10 10
 if ( ! defined( 'ABSPATH' ) ) {
11
-	die( '-1' );
11
+    die( '-1' );
12 12
 }
13 13
 
14 14
 // Flag that we're loading the block editor.
@@ -18,16 +18,16 @@  discard block
 block discarded – undo
18 18
 $block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-widgets' ) );
19 19
 
20 20
 $preload_paths = array(
21
-	array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
22
-	'/wp/v2/widget-types?context=edit&per_page=-1',
23
-	'/wp/v2/sidebars?context=edit&per_page=-1',
24
-	'/wp/v2/widgets?context=edit&per_page=-1&_embed=about',
21
+    array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
22
+    '/wp/v2/widget-types?context=edit&per_page=-1',
23
+    '/wp/v2/sidebars?context=edit&per_page=-1',
24
+    '/wp/v2/widgets?context=edit&per_page=-1&_embed=about',
25 25
 );
26 26
 block_editor_rest_api_preload( $preload_paths, $block_editor_context );
27 27
 
28 28
 $editor_settings = get_block_editor_settings(
29
-	array_merge( get_legacy_widget_block_editor_settings(), array( 'styles' => get_block_editor_theme_styles() ) ),
30
-	$block_editor_context
29
+    array_merge( get_legacy_widget_block_editor_settings(), array( 'styles' => get_block_editor_theme_styles() ) ),
30
+    $block_editor_context
31 31
 );
32 32
 
33 33
 // The widgets editor does not support the Block Directory, so don't load any of
@@ -36,25 +36,25 @@  discard block
 block discarded – undo
36 36
 remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
37 37
 
38 38
 wp_add_inline_script(
39
-	'wp-edit-widgets',
40
-	sprintf(
41
-		'wp.domReady( function() {
39
+    'wp-edit-widgets',
40
+    sprintf(
41
+        'wp.domReady( function() {
42 42
 			wp.editWidgets.initialize( "widgets-editor", %s );
43 43
 		} );',
44
-		wp_json_encode( $editor_settings )
45
-	)
44
+        wp_json_encode( $editor_settings )
45
+    )
46 46
 );
47 47
 
48 48
 // Preload server-registered block schemas.
49 49
 wp_add_inline_script(
50
-	'wp-blocks',
51
-	'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
50
+    'wp-blocks',
51
+    'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
52 52
 );
53 53
 
54 54
 wp_add_inline_script(
55
-	'wp-blocks',
56
-	sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
57
-	'after'
55
+    'wp-blocks',
56
+    sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
57
+    'after'
58 58
 );
59 59
 
60 60
 wp_enqueue_script( 'wp-edit-widgets' );
Please login to merge, or discard this patch.
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -7,33 +7,33 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 // Don't load directly.
10
-if ( ! defined( 'ABSPATH' ) ) {
11
-	die( '-1' );
10
+if (!defined('ABSPATH')) {
11
+	die('-1');
12 12
 }
13 13
 
14 14
 // Flag that we're loading the block editor.
15 15
 $current_screen = get_current_screen();
16
-$current_screen->is_block_editor( true );
16
+$current_screen->is_block_editor(true);
17 17
 
18
-$block_editor_context = new WP_Block_Editor_Context( array( 'name' => 'core/edit-widgets' ) );
18
+$block_editor_context = new WP_Block_Editor_Context(array('name' => 'core/edit-widgets'));
19 19
 
20 20
 $preload_paths = array(
21
-	array( rest_get_route_for_post_type_items( 'attachment' ), 'OPTIONS' ),
21
+	array(rest_get_route_for_post_type_items('attachment'), 'OPTIONS'),
22 22
 	'/wp/v2/widget-types?context=edit&per_page=-1',
23 23
 	'/wp/v2/sidebars?context=edit&per_page=-1',
24 24
 	'/wp/v2/widgets?context=edit&per_page=-1&_embed=about',
25 25
 );
26
-block_editor_rest_api_preload( $preload_paths, $block_editor_context );
26
+block_editor_rest_api_preload($preload_paths, $block_editor_context);
27 27
 
28 28
 $editor_settings = get_block_editor_settings(
29
-	array_merge( get_legacy_widget_block_editor_settings(), array( 'styles' => get_block_editor_theme_styles() ) ),
29
+	array_merge(get_legacy_widget_block_editor_settings(), array('styles' => get_block_editor_theme_styles())),
30 30
 	$block_editor_context
31 31
 );
32 32
 
33 33
 // The widgets editor does not support the Block Directory, so don't load any of
34 34
 // its assets. This also prevents 'wp-editor' from being enqueued which we
35 35
 // cannot load in the widgets screen because many widget scripts rely on `wp.editor`.
36
-remove_action( 'enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets' );
36
+remove_action('enqueue_block_editor_assets', 'wp_enqueue_editor_block_directory_assets');
37 37
 
38 38
 wp_add_inline_script(
39 39
 	'wp-edit-widgets',
@@ -41,42 +41,42 @@  discard block
 block discarded – undo
41 41
 		'wp.domReady( function() {
42 42
 			wp.editWidgets.initialize( "widgets-editor", %s );
43 43
 		} );',
44
-		wp_json_encode( $editor_settings )
44
+		wp_json_encode($editor_settings)
45 45
 	)
46 46
 );
47 47
 
48 48
 // Preload server-registered block schemas.
49 49
 wp_add_inline_script(
50 50
 	'wp-blocks',
51
-	'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode( get_block_editor_server_block_settings() ) . ');'
51
+	'wp.blocks.unstable__bootstrapServerSideBlockDefinitions(' . wp_json_encode(get_block_editor_server_block_settings()) . ');'
52 52
 );
53 53
 
54 54
 wp_add_inline_script(
55 55
 	'wp-blocks',
56
-	sprintf( 'wp.blocks.setCategories( %s );', wp_json_encode( get_block_categories( $block_editor_context ) ) ),
56
+	sprintf('wp.blocks.setCategories( %s );', wp_json_encode(get_block_categories($block_editor_context))),
57 57
 	'after'
58 58
 );
59 59
 
60
-wp_enqueue_script( 'wp-edit-widgets' );
61
-wp_enqueue_script( 'admin-widgets' );
62
-wp_enqueue_style( 'wp-edit-widgets' );
60
+wp_enqueue_script('wp-edit-widgets');
61
+wp_enqueue_script('admin-widgets');
62
+wp_enqueue_style('wp-edit-widgets');
63 63
 
64 64
 /** This action is documented in wp-admin/edit-form-blocks.php */
65
-do_action( 'enqueue_block_editor_assets' );
65
+do_action('enqueue_block_editor_assets');
66 66
 
67 67
 /** This action is documented in wp-admin/widgets-form.php */
68
-do_action( 'sidebar_admin_setup' );
68
+do_action('sidebar_admin_setup');
69 69
 
70 70
 require_once ABSPATH . 'wp-admin/admin-header.php';
71 71
 
72 72
 /** This action is documented in wp-admin/widgets-form.php */
73
-do_action( 'widgets_admin_page' );
73
+do_action('widgets_admin_page');
74 74
 ?>
75 75
 
76 76
 <div id="widgets-editor" class="blocks-widgets-container"></div>
77 77
 
78 78
 <?php
79 79
 /** This action is documented in wp-admin/widgets-form.php */
80
-do_action( 'sidebar_admin_page' );
80
+do_action('sidebar_admin_page');
81 81
 
82 82
 require_once ABSPATH . 'wp-admin/admin-footer.php';
Please login to merge, or discard this patch.