Completed
Push — master ( d488ab...6453e7 )
by Stephen
53:31
created
src/wp-admin/includes/translation-install.php 2 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Translation Install Administration API
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * WordPress Translation Install Administration API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 
10 10
 /**
Please login to merge, or discard this patch.
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -16,11 +16,11 @@  discard block
 block discarded – undo
16 16
  * @param array|object $args Translation API arguments. Optional.
17 17
  * @return object|WP_Error On success an object of translations, WP_Error on failure.
18 18
  */
19
-function translations_api( $type, $args = null ) {
20
-	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
19
+function translations_api($type, $args = null) {
20
+	include(ABSPATH.WPINC.'/version.php'); // include an unmodified $wp_version
21 21
 
22
-	if ( ! in_array( $type, array( 'plugins', 'themes', 'core' ) ) ) {
23
-		return	new WP_Error( 'invalid_type', __( 'Invalid translation type.' ) );
22
+	if ( ! in_array($type, array('plugins', 'themes', 'core'))) {
23
+		return	new WP_Error('invalid_type', __('Invalid translation type.'));
24 24
 	}
25 25
 
26 26
 	/**
@@ -32,12 +32,12 @@  discard block
 block discarded – undo
32 32
 	 * @param string      $type   The type of translations being requested.
33 33
 	 * @param object      $args   Translation API arguments.
34 34
 	 */
35
-	$res = apply_filters( 'translations_api', false, $type, $args );
35
+	$res = apply_filters('translations_api', false, $type, $args);
36 36
 
37
-	if ( false === $res ) {
38
-		$url = $http_url = 'http://api.wordpress.org/translations/' . $type . '/1.0/';
39
-		if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) {
40
-			$url = set_url_scheme( $url, 'https' );
37
+	if (false === $res) {
38
+		$url = $http_url = 'http://api.wordpress.org/translations/'.$type.'/1.0/';
39
+		if ($ssl = wp_http_supports(array('ssl'))) {
40
+			$url = set_url_scheme($url, 'https');
41 41
 		}
42 42
 
43 43
 		$options = array(
@@ -49,24 +49,24 @@  discard block
 block discarded – undo
49 49
 			),
50 50
 		);
51 51
 
52
-		if ( 'core' !== $type ) {
52
+		if ('core' !== $type) {
53 53
 			$options['body']['slug'] = $args['slug']; // Plugin or theme slug
54 54
 		}
55 55
 
56
-		$request = wp_remote_post( $url, $options );
56
+		$request = wp_remote_post($url, $options);
57 57
 
58
-		if ( $ssl && is_wp_error( $request ) ) {
59
-			trigger_error( __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ) . ' ' . __( '(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)' ), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE );
58
+		if ($ssl && is_wp_error($request)) {
59
+			trigger_error(__('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.').' '.__('(WordPress could not establish a secure connection to WordPress.org. Please contact your server administrator.)'), headers_sent() || WP_DEBUG ? E_USER_WARNING : E_USER_NOTICE);
60 60
 
61
-			$request = wp_remote_post( $http_url, $options );
61
+			$request = wp_remote_post($http_url, $options);
62 62
 		}
63 63
 
64
-		if ( is_wp_error( $request ) ) {
65
-			$res = new WP_Error( 'translations_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), $request->get_error_message() );
64
+		if (is_wp_error($request)) {
65
+			$res = new WP_Error('translations_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), $request->get_error_message());
66 66
 		} else {
67
-			$res = json_decode( wp_remote_retrieve_body( $request ), true );
68
-			if ( ! is_object( $res ) && ! is_array( $res ) ) {
69
-				$res = new WP_Error( 'translations_api_failed', __( 'An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.' ), wp_remote_retrieve_body( $request ) );
67
+			$res = json_decode(wp_remote_retrieve_body($request), true);
68
+			if ( ! is_object($res) && ! is_array($res)) {
69
+				$res = new WP_Error('translations_api_failed', __('An unexpected error occurred. Something may be wrong with WordPress.org or this server&#8217;s configuration. If you continue to have problems, please try the <a href="https://wordpress.org/support/">support forums</a>.'), wp_remote_retrieve_body($request));
70 70
 			}
71 71
 		}
72 72
 	}
@@ -80,7 +80,7 @@  discard block
 block discarded – undo
80 80
 	 * @param string          $type The type of translations being requested.
81 81
 	 * @param object          $args Translation API arguments.
82 82
 	 */
83
-	return apply_filters( 'translations_api_result', $res, $type, $args );
83
+	return apply_filters('translations_api_result', $res, $type, $args);
84 84
 }
85 85
 
86 86
 /**
@@ -94,26 +94,26 @@  discard block
 block discarded – undo
94 94
  *               in an error, an empty array will be returned.
95 95
  */
96 96
 function wp_get_available_translations() {
97
-	if ( ! defined( 'WP_INSTALLING' ) && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) {
97
+	if ( ! defined('WP_INSTALLING') && false !== ($translations = get_site_transient('available_translations'))) {
98 98
 		return $translations;
99 99
 	}
100 100
 
101
-	include( ABSPATH . WPINC . '/version.php' ); // include an unmodified $wp_version
101
+	include(ABSPATH.WPINC.'/version.php'); // include an unmodified $wp_version
102 102
 
103
-	$api = translations_api( 'core', array( 'version' => $wp_version ) );
103
+	$api = translations_api('core', array('version' => $wp_version));
104 104
 
105
-	if ( is_wp_error( $api ) || empty( $api['translations'] ) ) {
105
+	if (is_wp_error($api) || empty($api['translations'])) {
106 106
 		return array();
107 107
 	}
108 108
 
109 109
 	$translations = array();
110 110
 	// Key the array with the language code for now.
111
-	foreach ( $api['translations'] as $translation ) {
112
-		$translations[ $translation['language'] ] = $translation;
111
+	foreach ($api['translations'] as $translation) {
112
+		$translations[$translation['language']] = $translation;
113 113
 	}
114 114
 
115
-	if ( ! defined( 'WP_INSTALLING' ) ) {
116
-		set_site_transient( 'available_translations', $translations, 3 * HOUR_IN_SECONDS );
115
+	if ( ! defined('WP_INSTALLING')) {
116
+		set_site_transient('available_translations', $translations, 3 * HOUR_IN_SECONDS);
117 117
 	}
118 118
 
119 119
 	return $translations;
@@ -128,7 +128,7 @@  discard block
 block discarded – undo
128 128
  *
129 129
  * @param array $languages Array of available languages (populated via the Translation API).
130 130
  */
131
-function wp_install_language_form( $languages ) {
131
+function wp_install_language_form($languages) {
132 132
 	global $wp_local_package;
133 133
 
134 134
 	$installed_languages = get_available_languages();
@@ -138,27 +138,27 @@  discard block
 block discarded – undo
138 138
 	echo '<option value="" lang="en" selected="selected" data-continue="Continue" data-installed="1">English (United States)</option>';
139 139
 	echo "\n";
140 140
 
141
-	if ( ! empty( $wp_local_package ) && isset( $languages[ $wp_local_package ] ) ) {
142
-		if ( isset( $languages[ $wp_local_package ] ) ) {
143
-			$language = $languages[ $wp_local_package ];
144
-			printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
145
-				esc_attr( $language['language'] ),
146
-				esc_attr( current( $language['iso'] ) ),
147
-				esc_attr( $language['strings']['continue'] ),
148
-				in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
149
-				esc_html( $language['native_name'] ) );
150
-
151
-			unset( $languages[ $wp_local_package ] );
141
+	if ( ! empty($wp_local_package) && isset($languages[$wp_local_package])) {
142
+		if (isset($languages[$wp_local_package])) {
143
+			$language = $languages[$wp_local_package];
144
+			printf('<option value="%s" lang="%s" data-continue="%s"%s>%s</option>'."\n",
145
+				esc_attr($language['language']),
146
+				esc_attr(current($language['iso'])),
147
+				esc_attr($language['strings']['continue']),
148
+				in_array($language['language'], $installed_languages) ? ' data-installed="1"' : '',
149
+				esc_html($language['native_name']));
150
+
151
+			unset($languages[$wp_local_package]);
152 152
 		}
153 153
 	}
154 154
 
155
-	foreach ( $languages as $language ) {
156
-		printf( '<option value="%s" lang="%s" data-continue="%s"%s>%s</option>' . "\n",
157
-			esc_attr( $language['language'] ),
158
-			esc_attr( current( $language['iso'] ) ),
159
-			esc_attr( $language['strings']['continue'] ),
160
-			in_array( $language['language'], $installed_languages ) ? ' data-installed="1"' : '',
161
-			esc_html( $language['native_name'] ) );
155
+	foreach ($languages as $language) {
156
+		printf('<option value="%s" lang="%s" data-continue="%s"%s>%s</option>'."\n",
157
+			esc_attr($language['language']),
158
+			esc_attr(current($language['iso'])),
159
+			esc_attr($language['strings']['continue']),
160
+			in_array($language['language'], $installed_languages) ? ' data-installed="1"' : '',
161
+			esc_html($language['native_name']));
162 162
 	}
163 163
 	echo "</select>\n";
164 164
 	echo '<p class="step"><span class="spinner"></span><input id="language-continue" type="submit" class="button button-primary button-large" value="Continue" /></p>';
@@ -175,40 +175,40 @@  discard block
 block discarded – undo
175 175
  * @return string|bool Returns the language code if successfully downloaded
176 176
  *                     (or already installed), or false on failure.
177 177
  */
178
-function wp_download_language_pack( $download ) {
178
+function wp_download_language_pack($download) {
179 179
 	// Check if the translation is already installed.
180
-	if ( in_array( $download, get_available_languages() ) ) {
180
+	if (in_array($download, get_available_languages())) {
181 181
 		return $download;
182 182
 	}
183 183
 
184
-	if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
184
+	if (defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS) {
185 185
 		return false;
186 186
 	}
187 187
 
188 188
 	// Confirm the translation is one we can download.
189 189
 	$translations = wp_get_available_translations();
190
-	if ( ! $translations ) {
190
+	if ( ! $translations) {
191 191
 		return false;
192 192
 	}
193
-	foreach ( $translations as $translation ) {
194
-		if ( $translation['language'] === $download ) {
193
+	foreach ($translations as $translation) {
194
+		if ($translation['language'] === $download) {
195 195
 			$translation_to_load = true;
196 196
 			break;
197 197
 		}
198 198
 	}
199 199
 
200
-	if ( empty( $translation_to_load ) ) {
200
+	if (empty($translation_to_load)) {
201 201
 		return false;
202 202
 	}
203 203
 	$translation = (object) $translation;
204 204
 
205
-	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
205
+	require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
206 206
 	$skin = new Automatic_Upgrader_Skin;
207
-	$upgrader = new Language_Pack_Upgrader( $skin );
207
+	$upgrader = new Language_Pack_Upgrader($skin);
208 208
 	$translation->type = 'core';
209
-	$result = $upgrader->upgrade( $translation, array( 'clear_update_cache' => false ) );
209
+	$result = $upgrader->upgrade($translation, array('clear_update_cache' => false));
210 210
 
211
-	if ( ! $result || is_wp_error( $result ) ) {
211
+	if ( ! $result || is_wp_error($result)) {
212 212
 		return false;
213 213
 	}
214 214
 
@@ -224,18 +224,18 @@  discard block
 block discarded – undo
224 224
  * @return bool Returns true on success, false on failure.
225 225
  */
226 226
 function wp_can_install_language_pack() {
227
-	if ( defined( 'DISALLOW_FILE_MODS' ) && DISALLOW_FILE_MODS ) {
227
+	if (defined('DISALLOW_FILE_MODS') && DISALLOW_FILE_MODS) {
228 228
 		return false;
229 229
 	}
230 230
 
231
-	require_once ABSPATH . 'wp-admin/includes/class-wp-upgrader.php';
231
+	require_once ABSPATH.'wp-admin/includes/class-wp-upgrader.php';
232 232
 	$skin = new Automatic_Upgrader_Skin;
233
-	$upgrader = new Language_Pack_Upgrader( $skin );
233
+	$upgrader = new Language_Pack_Upgrader($skin);
234 234
 	$upgrader->init();
235 235
 
236
-	$check = $upgrader->fs_connect( array( WP_CONTENT_DIR, WP_LANG_DIR ) );
236
+	$check = $upgrader->fs_connect(array(WP_CONTENT_DIR, WP_LANG_DIR));
237 237
 
238
-	if ( ! $check || is_wp_error( $check ) ) {
238
+	if ( ! $check || is_wp_error($check)) {
239 239
 		return false;
240 240
 	}
241 241
 
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-importer.php 3 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WP_Importer base class
4
- */
3
+	 * WP_Importer base class
4
+	 */
5 5
 class WP_Importer {
6 6
 	/**
7 7
 	 * Class Constructor
Please login to merge, or discard this patch.
Spacing   +71 added lines, -71 removed lines patch added patch discarded remove patch
@@ -18,7 +18,7 @@  discard block
 block discarded – undo
18 18
 	 * @param string $bid
19 19
 	 * @return array
20 20
 	 */
21
-	public function get_imported_posts( $importer_name, $bid ) {
21
+	public function get_imported_posts($importer_name, $bid) {
22 22
 		global $wpdb;
23 23
 
24 24
 		$hashtable = array();
@@ -28,23 +28,23 @@  discard block
 block discarded – undo
28 28
 
29 29
 		// Grab all posts in chunks
30 30
 		do {
31
-			$meta_key = $importer_name . '_' . $bid . '_permalink';
32
-			$sql = $wpdb->prepare( "SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '%s' LIMIT %d,%d", $meta_key, $offset, $limit );
33
-			$results = $wpdb->get_results( $sql );
31
+			$meta_key = $importer_name.'_'.$bid.'_permalink';
32
+			$sql = $wpdb->prepare("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = '%s' LIMIT %d,%d", $meta_key, $offset, $limit);
33
+			$results = $wpdb->get_results($sql);
34 34
 
35 35
 			// Increment offset
36
-			$offset = ( $limit + $offset );
36
+			$offset = ($limit + $offset);
37 37
 
38
-			if ( !empty( $results ) ) {
39
-				foreach ( $results as $r ) {
38
+			if ( ! empty($results)) {
39
+				foreach ($results as $r) {
40 40
 					// Set permalinks into array
41
-					$hashtable[$r->meta_value] = intval( $r->post_id );
41
+					$hashtable[$r->meta_value] = intval($r->post_id);
42 42
 				}
43 43
 			}
44
-		} while ( count( $results ) == $limit );
44
+		} while (count($results) == $limit);
45 45
 
46 46
 		// Unset to save memory.
47
-		unset( $results, $r );
47
+		unset($results, $r);
48 48
 
49 49
 		return $hashtable;
50 50
 	}
@@ -58,22 +58,22 @@  discard block
 block discarded – undo
58 58
 	 * @param string $bid
59 59
 	 * @return int
60 60
 	 */
61
-	public function count_imported_posts( $importer_name, $bid ) {
61
+	public function count_imported_posts($importer_name, $bid) {
62 62
 		global $wpdb;
63 63
 
64 64
 		$count = 0;
65 65
 
66 66
 		// Get count of permalinks
67
-		$meta_key = $importer_name . '_' . $bid . '_permalink';
68
-		$sql = $wpdb->prepare( "SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = '%s'", $meta_key );
67
+		$meta_key = $importer_name.'_'.$bid.'_permalink';
68
+		$sql = $wpdb->prepare("SELECT COUNT( post_id ) AS cnt FROM $wpdb->postmeta WHERE meta_key = '%s'", $meta_key);
69 69
 
70
-		$result = $wpdb->get_results( $sql );
70
+		$result = $wpdb->get_results($sql);
71 71
 
72
-		if ( !empty( $result ) )
73
-			$count = intval( $result[0]->cnt );
72
+		if ( ! empty($result))
73
+			$count = intval($result[0]->cnt);
74 74
 
75 75
 		// Unset to save memory.
76
-		unset( $results );
76
+		unset($results);
77 77
 
78 78
 		return $count;
79 79
 	}
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
 	 * @param string $bid
87 87
 	 * @return array
88 88
 	 */
89
-	public function get_imported_comments( $bid ) {
89
+	public function get_imported_comments($bid) {
90 90
 		global $wpdb;
91 91
 
92 92
 		$hashtable = array();
@@ -96,28 +96,28 @@  discard block
 block discarded – undo
96 96
 
97 97
 		// Grab all comments in chunks
98 98
 		do {
99
-			$sql = $wpdb->prepare( "SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit );
100
-			$results = $wpdb->get_results( $sql );
99
+			$sql = $wpdb->prepare("SELECT comment_ID, comment_agent FROM $wpdb->comments LIMIT %d,%d", $offset, $limit);
100
+			$results = $wpdb->get_results($sql);
101 101
 
102 102
 			// Increment offset
103
-			$offset = ( $limit + $offset );
103
+			$offset = ($limit + $offset);
104 104
 
105
-			if ( !empty( $results ) ) {
106
-				foreach ( $results as $r ) {
105
+			if ( ! empty($results)) {
106
+				foreach ($results as $r) {
107 107
 					// Explode comment_agent key
108
-					list ( $ca_bid, $source_comment_id ) = explode( '-', $r->comment_agent );
109
-					$source_comment_id = intval( $source_comment_id );
108
+					list ($ca_bid, $source_comment_id) = explode('-', $r->comment_agent);
109
+					$source_comment_id = intval($source_comment_id);
110 110
 
111 111
 					// Check if this comment came from this blog
112
-					if ( $bid == $ca_bid ) {
113
-						$hashtable[$source_comment_id] = intval( $r->comment_ID );
112
+					if ($bid == $ca_bid) {
113
+						$hashtable[$source_comment_id] = intval($r->comment_ID);
114 114
 					}
115 115
 				}
116 116
 			}
117
-		} while ( count( $results ) == $limit );
117
+		} while (count($results) == $limit);
118 118
 
119 119
 		// Unset to save memory.
120
-		unset( $results, $r );
120
+		unset($results, $r);
121 121
 
122 122
 		return $hashtable;
123 123
 	}
@@ -127,28 +127,28 @@  discard block
 block discarded – undo
127 127
 	 * @param int $blog_id
128 128
 	 * @return int|void
129 129
 	 */
130
-	public function set_blog( $blog_id ) {
131
-		if ( is_numeric( $blog_id ) ) {
130
+	public function set_blog($blog_id) {
131
+		if (is_numeric($blog_id)) {
132 132
 			$blog_id = (int) $blog_id;
133 133
 		} else {
134
-			$blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id );
135
-			if ( ( !$parsed = parse_url( $blog ) ) || empty( $parsed['host'] ) ) {
136
-				fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
134
+			$blog = 'http://'.preg_replace('#^https?://#', '', $blog_id);
135
+			if (( ! $parsed = parse_url($blog)) || empty($parsed['host'])) {
136
+				fwrite(STDERR, "Error: can not determine blog_id from $blog_id\n");
137 137
 				exit();
138 138
 			}
139
-			if ( empty( $parsed['path'] ) )
139
+			if (empty($parsed['path']))
140 140
 				$parsed['path'] = '/';
141
-			$blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) );
142
-			if ( !$blog ) {
143
-				fwrite( STDERR, "Error: Could not find blog\n" );
141
+			$blog = get_blog_details(array('domain' => $parsed['host'], 'path' => $parsed['path']));
142
+			if ( ! $blog) {
143
+				fwrite(STDERR, "Error: Could not find blog\n");
144 144
 				exit();
145 145
 			}
146 146
 			$blog_id = (int) $blog->blog_id;
147 147
 		}
148 148
 
149
-		if ( function_exists( 'is_multisite' ) ) {
150
-			if ( is_multisite() )
151
-				switch_to_blog( $blog_id );
149
+		if (function_exists('is_multisite')) {
150
+			if (is_multisite())
151
+				switch_to_blog($blog_id);
152 152
 		}
153 153
 
154 154
 		return $blog_id;
@@ -159,15 +159,15 @@  discard block
 block discarded – undo
159 159
 	 * @param int $user_id
160 160
 	 * @return int|void
161 161
 	 */
162
-	public function set_user( $user_id ) {
163
-		if ( is_numeric( $user_id ) ) {
162
+	public function set_user($user_id) {
163
+		if (is_numeric($user_id)) {
164 164
 			$user_id = (int) $user_id;
165 165
 		} else {
166
-			$user_id = (int) username_exists( $user_id );
166
+			$user_id = (int) username_exists($user_id);
167 167
 		}
168 168
 
169
-		if ( !$user_id || !wp_set_current_user( $user_id ) ) {
170
-			fwrite( STDERR, "Error: can not find user\n" );
169
+		if ( ! $user_id || ! wp_set_current_user($user_id)) {
170
+			fwrite(STDERR, "Error: can not find user\n");
171 171
 			exit();
172 172
 		}
173 173
 
@@ -181,8 +181,8 @@  discard block
 block discarded – undo
181 181
 	 * @param string $b
182 182
 	 * @return int
183 183
 	 */
184
-	public function cmpr_strlen( $a, $b ) {
185
-		return strlen( $b ) - strlen( $a );
184
+	public function cmpr_strlen($a, $b) {
185
+		return strlen($b) - strlen($a);
186 186
 	}
187 187
 
188 188
 	/**
@@ -194,20 +194,20 @@  discard block
 block discarded – undo
194 194
 	 * @param bool   $head
195 195
 	 * @return array
196 196
 	 */
197
-	public function get_page( $url, $username = '', $password = '', $head = false ) {
197
+	public function get_page($url, $username = '', $password = '', $head = false) {
198 198
 		// Increase the timeout
199
-		add_filter( 'http_request_timeout', array( $this, 'bump_request_timeout' ) );
199
+		add_filter('http_request_timeout', array($this, 'bump_request_timeout'));
200 200
 
201 201
 		$headers = array();
202 202
 		$args = array();
203
-		if ( true === $head )
203
+		if (true === $head)
204 204
 			$args['method'] = 'HEAD';
205
-		if ( !empty( $username ) && !empty( $password ) )
206
-			$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
205
+		if ( ! empty($username) && ! empty($password))
206
+			$headers['Authorization'] = 'Basic '.base64_encode("$username:$password");
207 207
 
208 208
 		$args['headers'] = $headers;
209 209
 
210
-		return wp_safe_remote_request( $url, $args );
210
+		return wp_safe_remote_request($url, $args);
211 211
 	}
212 212
 
213 213
 	/**
@@ -216,7 +216,7 @@  discard block
 block discarded – undo
216 216
 	 * @param int $val
217 217
 	 * @return int
218 218
 	 */
219
-	public function bump_request_timeout( $val ) {
219
+	public function bump_request_timeout($val) {
220 220
 		return 60;
221 221
 	}
222 222
 
@@ -226,8 +226,8 @@  discard block
 block discarded – undo
226 226
 	 * @return bool
227 227
 	 */
228 228
 	public function is_user_over_quota() {
229
-		if ( function_exists( 'upload_is_user_over_quota' ) ) {
230
-			if ( upload_is_user_over_quota() ) {
229
+		if (function_exists('upload_is_user_over_quota')) {
230
+			if (upload_is_user_over_quota()) {
231 231
 				return true;
232 232
 			}
233 233
 		}
@@ -241,8 +241,8 @@  discard block
 block discarded – undo
241 241
 	 * @param string $string
242 242
 	 * @return string
243 243
 	 */
244
-	public function min_whitespace( $string ) {
245
-		return preg_replace( '|[\r\n\t ]+|', ' ', $string );
244
+	public function min_whitespace($string) {
245
+		return preg_replace('|[\r\n\t ]+|', ' ', $string);
246 246
 	}
247 247
 
248 248
 	/**
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
  * @param bool   $required
269 269
  * @return mixed
270 270
  */
271
-function get_cli_args( $param, $required = false ) {
271
+function get_cli_args($param, $required = false) {
272 272
 	$args = $_SERVER['argv'];
273 273
 
274 274
 	$out = array();
@@ -276,40 +276,40 @@  discard block
 block discarded – undo
276 276
 	$last_arg = null;
277 277
 	$return = null;
278 278
 
279
-	$il = sizeof( $args );
279
+	$il = sizeof($args);
280 280
 
281
-	for ( $i = 1, $il; $i < $il; $i++ ) {
282
-		if ( (bool) preg_match( "/^--(.+)/", $args[$i], $match ) ) {
283
-			$parts = explode( "=", $match[1] );
284
-			$key = preg_replace( "/[^a-z0-9]+/", "", $parts[0] );
281
+	for ($i = 1, $il; $i < $il; $i++) {
282
+		if ((bool) preg_match("/^--(.+)/", $args[$i], $match)) {
283
+			$parts = explode("=", $match[1]);
284
+			$key = preg_replace("/[^a-z0-9]+/", "", $parts[0]);
285 285
 
286
-			if ( isset( $parts[1] ) ) {
286
+			if (isset($parts[1])) {
287 287
 				$out[$key] = $parts[1];
288 288
 			} else {
289 289
 				$out[$key] = true;
290 290
 			}
291 291
 
292 292
 			$last_arg = $key;
293
-		} elseif ( (bool) preg_match( "/^-([a-zA-Z0-9]+)/", $args[$i], $match ) ) {
294
-			for ( $j = 0, $jl = strlen( $match[1] ); $j < $jl; $j++ ) {
293
+		} elseif ((bool) preg_match("/^-([a-zA-Z0-9]+)/", $args[$i], $match)) {
294
+			for ($j = 0, $jl = strlen($match[1]); $j < $jl; $j++) {
295 295
 				$key = $match[1]{$j};
296 296
 				$out[$key] = true;
297 297
 			}
298 298
 
299 299
 			$last_arg = $key;
300
-		} elseif ( $last_arg !== null ) {
300
+		} elseif ($last_arg !== null) {
301 301
 			$out[$last_arg] = $args[$i];
302 302
 		}
303 303
 	}
304 304
 
305 305
 	// Check array for specified param
306
-	if ( isset( $out[$param] ) ) {
306
+	if (isset($out[$param])) {
307 307
 		// Set return value
308 308
 		$return = $out[$param];
309 309
 	}
310 310
 
311 311
 	// Check for missing required param
312
-	if ( !isset( $out[$param] ) && $required ) {
312
+	if ( ! isset($out[$param]) && $required) {
313 313
 		// Display message and exit
314 314
 		echo "\"$param\" parameter is required but was not specified\n";
315 315
 		exit();
Please login to merge, or discard this patch.
Braces   +15 added lines, -10 removed lines patch added patch discarded remove patch
@@ -69,8 +69,9 @@  discard block
 block discarded – undo
69 69
 
70 70
 		$result = $wpdb->get_results( $sql );
71 71
 
72
-		if ( !empty( $result ) )
73
-			$count = intval( $result[0]->cnt );
72
+		if ( !empty( $result ) ) {
73
+					$count = intval( $result[0]->cnt );
74
+		}
74 75
 
75 76
 		// Unset to save memory.
76 77
 		unset( $results );
@@ -136,8 +137,9 @@  discard block
 block discarded – undo
136 137
 				fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" );
137 138
 				exit();
138 139
 			}
139
-			if ( empty( $parsed['path'] ) )
140
-				$parsed['path'] = '/';
140
+			if ( empty( $parsed['path'] ) ) {
141
+							$parsed['path'] = '/';
142
+			}
141 143
 			$blog = get_blog_details( array( 'domain' => $parsed['host'], 'path' => $parsed['path'] ) );
142 144
 			if ( !$blog ) {
143 145
 				fwrite( STDERR, "Error: Could not find blog\n" );
@@ -147,8 +149,9 @@  discard block
 block discarded – undo
147 149
 		}
148 150
 
149 151
 		if ( function_exists( 'is_multisite' ) ) {
150
-			if ( is_multisite() )
151
-				switch_to_blog( $blog_id );
152
+			if ( is_multisite() ) {
153
+							switch_to_blog( $blog_id );
154
+			}
152 155
 		}
153 156
 
154 157
 		return $blog_id;
@@ -200,10 +203,12 @@  discard block
 block discarded – undo
200 203
 
201 204
 		$headers = array();
202 205
 		$args = array();
203
-		if ( true === $head )
204
-			$args['method'] = 'HEAD';
205
-		if ( !empty( $username ) && !empty( $password ) )
206
-			$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
206
+		if ( true === $head ) {
207
+					$args['method'] = 'HEAD';
208
+		}
209
+		if ( !empty( $username ) && !empty( $password ) ) {
210
+					$headers['Authorization'] = 'Basic ' . base64_encode( "$username:$password" );
211
+		}
207 212
 
208 213
 		$args['headers'] = $headers;
209 214
 
Please login to merge, or discard this patch.
src/wp-admin/includes/export.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Export Administration API
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * WordPress Export Administration API
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /**
10 10
  * Version number for the export format.
Please login to merge, or discard this patch.
Spacing   +139 added lines, -139 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
  *
14 14
  * @since 2.5.0
15 15
  */
16
-define( 'WXR_VERSION', '1.2' );
16
+define('WXR_VERSION', '1.2');
17 17
 
18 18
 /**
19 19
  * Generates the WXR export file for download.
@@ -25,13 +25,13 @@  discard block
 block discarded – undo
25 25
  *
26 26
  * @param array $args Filters defining what should be included in the export.
27 27
  */
28
-function export_wp( $args = array() ) {
28
+function export_wp($args = array()) {
29 29
 	global $wpdb, $post;
30 30
 
31
-	$defaults = array( 'content' => 'all', 'author' => false, 'category' => false,
31
+	$defaults = array('content' => 'all', 'author' => false, 'category' => false,
32 32
 		'start_date' => false, 'end_date' => false, 'status' => false,
33 33
 	);
34
-	$args = wp_parse_args( $args, $defaults );
34
+	$args = wp_parse_args($args, $defaults);
35 35
 
36 36
 	/**
37 37
 	 * Fires at the beginning of an export, before any headers are sent.
@@ -40,88 +40,88 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param array $args An array of export arguments.
42 42
 	 */
43
-	do_action( 'export_wp', $args );
43
+	do_action('export_wp', $args);
44 44
 
45
-	$sitename = sanitize_key( get_bloginfo( 'name' ) );
46
-	if ( ! empty($sitename) ) $sitename .= '.';
47
-	$filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml';
45
+	$sitename = sanitize_key(get_bloginfo('name'));
46
+	if ( ! empty($sitename)) $sitename .= '.';
47
+	$filename = $sitename.'wordpress.'.date('Y-m-d').'.xml';
48 48
 
49
-	header( 'Content-Description: File Transfer' );
50
-	header( 'Content-Disposition: attachment; filename=' . $filename );
51
-	header( 'Content-Type: text/xml; charset=' . get_option( 'blog_charset' ), true );
49
+	header('Content-Description: File Transfer');
50
+	header('Content-Disposition: attachment; filename='.$filename);
51
+	header('Content-Type: text/xml; charset='.get_option('blog_charset'), true);
52 52
 
53
-	if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) {
54
-		$ptype = get_post_type_object( $args['content'] );
55
-		if ( ! $ptype->can_export )
53
+	if ('all' != $args['content'] && post_type_exists($args['content'])) {
54
+		$ptype = get_post_type_object($args['content']);
55
+		if ( ! $ptype->can_export)
56 56
 			$args['content'] = 'post';
57 57
 
58
-		$where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
58
+		$where = $wpdb->prepare("{$wpdb->posts}.post_type = %s", $args['content']);
59 59
 	} else {
60
-		$post_types = get_post_types( array( 'can_export' => true ) );
61
-		$esses = array_fill( 0, count($post_types), '%s' );
62
-		$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
60
+		$post_types = get_post_types(array('can_export' => true));
61
+		$esses = array_fill(0, count($post_types), '%s');
62
+		$where = $wpdb->prepare("{$wpdb->posts}.post_type IN (".implode(',', $esses).')', $post_types);
63 63
 	}
64 64
 
65
-	if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) )
66
-		$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
65
+	if ($args['status'] && ('post' == $args['content'] || 'page' == $args['content']))
66
+		$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_status = %s", $args['status']);
67 67
 	else
68 68
 		$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
69 69
 
70 70
 	$join = '';
71
-	if ( $args['category'] && 'post' == $args['content'] ) {
72
-		if ( $term = term_exists( $args['category'], 'category' ) ) {
71
+	if ($args['category'] && 'post' == $args['content']) {
72
+		if ($term = term_exists($args['category'], 'category')) {
73 73
 			$join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)";
74
-			$where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] );
74
+			$where .= $wpdb->prepare(" AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id']);
75 75
 		}
76 76
 	}
77 77
 
78
-	if ( 'post' == $args['content'] || 'page' == $args['content'] ) {
79
-		if ( $args['author'] )
80
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
78
+	if ('post' == $args['content'] || 'page' == $args['content']) {
79
+		if ($args['author'])
80
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_author = %d", $args['author']);
81 81
 
82
-		if ( $args['start_date'] )
83
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
82
+		if ($args['start_date'])
83
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_date >= %s", date('Y-m-d', strtotime($args['start_date'])));
84 84
 
85
-		if ( $args['end_date'] )
86
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
85
+		if ($args['end_date'])
86
+			$where .= $wpdb->prepare(" AND {$wpdb->posts}.post_date < %s", date('Y-m-d', strtotime('+1 month', strtotime($args['end_date']))));
87 87
 	}
88 88
 
89 89
 	// Grab a snapshot of post IDs, just in case it changes during the export.
90
-	$post_ids = $wpdb->get_col( "SELECT ID FROM {$wpdb->posts} $join WHERE $where" );
90
+	$post_ids = $wpdb->get_col("SELECT ID FROM {$wpdb->posts} $join WHERE $where");
91 91
 
92 92
 	/*
93 93
 	 * Get the requested terms ready, empty unless posts filtered by category
94 94
 	 * or all content.
95 95
 	 */
96 96
 	$cats = $tags = $terms = array();
97
-	if ( isset( $term ) && $term ) {
98
-		$cat = get_term( $term['term_id'], 'category' );
99
-		$cats = array( $cat->term_id => $cat );
100
-		unset( $term, $cat );
101
-	} elseif ( 'all' == $args['content'] ) {
102
-		$categories = (array) get_categories( array( 'get' => 'all' ) );
103
-		$tags = (array) get_tags( array( 'get' => 'all' ) );
97
+	if (isset($term) && $term) {
98
+		$cat = get_term($term['term_id'], 'category');
99
+		$cats = array($cat->term_id => $cat);
100
+		unset($term, $cat);
101
+	} elseif ('all' == $args['content']) {
102
+		$categories = (array) get_categories(array('get' => 'all'));
103
+		$tags = (array) get_tags(array('get' => 'all'));
104 104
 
105
-		$custom_taxonomies = get_taxonomies( array( '_builtin' => false ) );
106
-		$custom_terms = (array) get_terms( $custom_taxonomies, array( 'get' => 'all' ) );
105
+		$custom_taxonomies = get_taxonomies(array('_builtin' => false));
106
+		$custom_terms = (array) get_terms($custom_taxonomies, array('get' => 'all'));
107 107
 
108 108
 		// Put categories in order with no child going before its parent.
109
-		while ( $cat = array_shift( $categories ) ) {
110
-			if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
109
+		while ($cat = array_shift($categories)) {
110
+			if ($cat->parent == 0 || isset($cats[$cat->parent]))
111 111
 				$cats[$cat->term_id] = $cat;
112 112
 			else
113 113
 				$categories[] = $cat;
114 114
 		}
115 115
 
116 116
 		// Put terms in order with no child going before its parent.
117
-		while ( $t = array_shift( $custom_terms ) ) {
118
-			if ( $t->parent == 0 || isset( $terms[$t->parent] ) )
117
+		while ($t = array_shift($custom_terms)) {
118
+			if ($t->parent == 0 || isset($terms[$t->parent]))
119 119
 				$terms[$t->term_id] = $t;
120 120
 			else
121 121
 				$custom_terms[] = $t;
122 122
 		}
123 123
 
124
-		unset( $categories, $custom_taxonomies, $custom_terms );
124
+		unset($categories, $custom_taxonomies, $custom_terms);
125 125
 	}
126 126
 
127 127
 	/**
@@ -132,12 +132,12 @@  discard block
 block discarded – undo
132 132
 	 * @param string $str String to wrap in XML CDATA tag.
133 133
 	 * @return string
134 134
 	 */
135
-	function wxr_cdata( $str ) {
136
-		if ( ! seems_utf8( $str ) ) {
137
-			$str = utf8_encode( $str );
135
+	function wxr_cdata($str) {
136
+		if ( ! seems_utf8($str)) {
137
+			$str = utf8_encode($str);
138 138
 		}
139 139
 		// $str = ent2ncr(esc_html($str));
140
-		$str = '<![CDATA[' . str_replace( ']]>', ']]]]><![CDATA[>', $str ) . ']]>';
140
+		$str = '<![CDATA['.str_replace(']]>', ']]]]><![CDATA[>', $str).']]>';
141 141
 
142 142
 		return $str;
143 143
 	}
@@ -151,11 +151,11 @@  discard block
 block discarded – undo
151 151
 	 */
152 152
 	function wxr_site_url() {
153 153
 		// Multisite: the base URL.
154
-		if ( is_multisite() )
154
+		if (is_multisite())
155 155
 			return network_home_url();
156 156
 		// WordPress (single site): the blog URL.
157 157
 		else
158
-			return get_bloginfo_rss( 'url' );
158
+			return get_bloginfo_rss('url');
159 159
 	}
160 160
 
161 161
 	/**
@@ -165,11 +165,11 @@  discard block
 block discarded – undo
165 165
 	 *
166 166
 	 * @param object $category Category Object
167 167
 	 */
168
-	function wxr_cat_name( $category ) {
169
-		if ( empty( $category->name ) )
168
+	function wxr_cat_name($category) {
169
+		if (empty($category->name))
170 170
 			return;
171 171
 
172
-		echo '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_name>';
172
+		echo '<wp:cat_name>'.wxr_cdata($category->name).'</wp:cat_name>';
173 173
 	}
174 174
 
175 175
 	/**
@@ -179,11 +179,11 @@  discard block
 block discarded – undo
179 179
 	 *
180 180
 	 * @param object $category Category Object
181 181
 	 */
182
-	function wxr_category_description( $category ) {
183
-		if ( empty( $category->description ) )
182
+	function wxr_category_description($category) {
183
+		if (empty($category->description))
184 184
 			return;
185 185
 
186
-		echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>';
186
+		echo '<wp:category_description>'.wxr_cdata($category->description).'</wp:category_description>';
187 187
 	}
188 188
 
189 189
 	/**
@@ -193,11 +193,11 @@  discard block
 block discarded – undo
193 193
 	 *
194 194
 	 * @param object $tag Tag Object
195 195
 	 */
196
-	function wxr_tag_name( $tag ) {
197
-		if ( empty( $tag->name ) )
196
+	function wxr_tag_name($tag) {
197
+		if (empty($tag->name))
198 198
 			return;
199 199
 
200
-		echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp:tag_name>';
200
+		echo '<wp:tag_name>'.wxr_cdata($tag->name).'</wp:tag_name>';
201 201
 	}
202 202
 
203 203
 	/**
@@ -207,11 +207,11 @@  discard block
 block discarded – undo
207 207
 	 *
208 208
 	 * @param object $tag Tag Object
209 209
 	 */
210
-	function wxr_tag_description( $tag ) {
211
-		if ( empty( $tag->description ) )
210
+	function wxr_tag_description($tag) {
211
+		if (empty($tag->description))
212 212
 			return;
213 213
 
214
-		echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>';
214
+		echo '<wp:tag_description>'.wxr_cdata($tag->description).'</wp:tag_description>';
215 215
 	}
216 216
 
217 217
 	/**
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 	 *
222 222
 	 * @param object $term Term Object
223 223
 	 */
224
-	function wxr_term_name( $term ) {
225
-		if ( empty( $term->name ) )
224
+	function wxr_term_name($term) {
225
+		if (empty($term->name))
226 226
 			return;
227 227
 
228
-		echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>';
228
+		echo '<wp:term_name>'.wxr_cdata($term->name).'</wp:term_name>';
229 229
 	}
230 230
 
231 231
 	/**
@@ -235,11 +235,11 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @param object $term Term Object
237 237
 	 */
238
-	function wxr_term_description( $term ) {
239
-		if ( empty( $term->description ) )
238
+	function wxr_term_description($term) {
239
+		if (empty($term->description))
240 240
 			return;
241 241
 
242
-		echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>';
242
+		echo '<wp:term_description>'.wxr_cdata($term->description).'</wp:term_description>';
243 243
 	}
244 244
 
245 245
 	/**
@@ -251,31 +251,31 @@  discard block
 block discarded – undo
251 251
 	 *
252 252
 	 * @param array $post_ids Array of post IDs to filter the query by. Optional.
253 253
 	 */
254
-	function wxr_authors_list( array $post_ids = null ) {
254
+	function wxr_authors_list(array $post_ids = null) {
255 255
 		global $wpdb;
256 256
 
257
-		if ( !empty( $post_ids ) ) {
258
-			$post_ids = array_map( 'absint', $post_ids );
259
-			$and = 'AND ID IN ( ' . implode( ', ', $post_ids ) . ')';
257
+		if ( ! empty($post_ids)) {
258
+			$post_ids = array_map('absint', $post_ids);
259
+			$and = 'AND ID IN ( '.implode(', ', $post_ids).')';
260 260
 		} else {
261 261
 			$and = '';
262 262
 		}
263 263
 
264 264
 		$authors = array();
265
-		$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
266
-		foreach ( (array) $results as $result )
267
-			$authors[] = get_userdata( $result->post_author );
265
+		$results = $wpdb->get_results("SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and");
266
+		foreach ((array) $results as $result)
267
+			$authors[] = get_userdata($result->post_author);
268 268
 
269
-		$authors = array_filter( $authors );
269
+		$authors = array_filter($authors);
270 270
 
271
-		foreach ( $authors as $author ) {
271
+		foreach ($authors as $author) {
272 272
 			echo "\t<wp:author>";
273
-			echo '<wp:author_id>' . $author->ID . '</wp:author_id>';
274
-			echo '<wp:author_login>' . $author->user_login . '</wp:author_login>';
275
-			echo '<wp:author_email>' . $author->user_email . '</wp:author_email>';
276
-			echo '<wp:author_display_name>' . wxr_cdata( $author->display_name ) . '</wp:author_display_name>';
277
-			echo '<wp:author_first_name>' . wxr_cdata( $author->user_firstname ) . '</wp:author_first_name>';
278
-			echo '<wp:author_last_name>' . wxr_cdata( $author->user_lastname ) . '</wp:author_last_name>';
273
+			echo '<wp:author_id>'.$author->ID.'</wp:author_id>';
274
+			echo '<wp:author_login>'.$author->user_login.'</wp:author_login>';
275
+			echo '<wp:author_email>'.$author->user_email.'</wp:author_email>';
276
+			echo '<wp:author_display_name>'.wxr_cdata($author->display_name).'</wp:author_display_name>';
277
+			echo '<wp:author_first_name>'.wxr_cdata($author->user_firstname).'</wp:author_first_name>';
278
+			echo '<wp:author_last_name>'.wxr_cdata($author->user_lastname).'</wp:author_last_name>';
279 279
 			echo "</wp:author>\n";
280 280
 		}
281 281
 	}
@@ -287,12 +287,12 @@  discard block
 block discarded – undo
287 287
 	 */
288 288
 	function wxr_nav_menu_terms() {
289 289
 		$nav_menus = wp_get_nav_menus();
290
-		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
290
+		if (empty($nav_menus) || ! is_array($nav_menus))
291 291
 			return;
292 292
 
293
-		foreach ( $nav_menus as $menu ) {
293
+		foreach ($nav_menus as $menu) {
294 294
 			echo "\t<wp:term><wp:term_id>{$menu->term_id}</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug>{$menu->slug}</wp:term_slug>";
295
-			wxr_term_name( $menu );
295
+			wxr_term_name($menu);
296 296
 			echo "</wp:term>\n";
297 297
 		}
298 298
 	}
@@ -305,13 +305,13 @@  discard block
 block discarded – undo
305 305
 	function wxr_post_taxonomy() {
306 306
 		$post = get_post();
307 307
 
308
-		$taxonomies = get_object_taxonomies( $post->post_type );
309
-		if ( empty( $taxonomies ) )
308
+		$taxonomies = get_object_taxonomies($post->post_type);
309
+		if (empty($taxonomies))
310 310
 			return;
311
-		$terms = wp_get_object_terms( $post->ID, $taxonomies );
311
+		$terms = wp_get_object_terms($post->ID, $taxonomies);
312 312
 
313
-		foreach ( (array) $terms as $term ) {
314
-			echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">" . wxr_cdata( $term->name ) . "</category>\n";
313
+		foreach ((array) $terms as $term) {
314
+			echo "\t\t<category domain=\"{$term->taxonomy}\" nicename=\"{$term->slug}\">".wxr_cdata($term->name)."</category>\n";
315 315
 		}
316 316
 	}
317 317
 
@@ -321,14 +321,14 @@  discard block
 block discarded – undo
321 321
 	 * @param string $meta_key
322 322
 	 * @return bool
323 323
 	 */
324
-	function wxr_filter_postmeta( $return_me, $meta_key ) {
325
-		if ( '_edit_lock' == $meta_key )
324
+	function wxr_filter_postmeta($return_me, $meta_key) {
325
+		if ('_edit_lock' == $meta_key)
326 326
 			$return_me = true;
327 327
 		return $return_me;
328 328
 	}
329
-	add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
329
+	add_filter('wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2);
330 330
 
331
-	echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . "\" ?>\n";
331
+	echo '<?xml version="1.0" encoding="'.get_bloginfo('charset')."\" ?>\n";
332 332
 
333 333
 	?>
334 334
 <!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your site. -->
@@ -348,7 +348,7 @@  discard block
 block discarded – undo
348 348
 <!-- 7. WordPress will then import each of the posts, pages, comments, categories, etc. -->
349 349
 <!--    contained in this file into your site. -->
350 350
 
351
-<?php the_generator( 'export' ); ?>
351
+<?php the_generator('export'); ?>
352 352
 <rss version="2.0"
353 353
 	xmlns:excerpt="http://wordpress.org/export/<?php echo WXR_VERSION; ?>/excerpt/"
354 354
 	xmlns:content="http://purl.org/rss/1.0/modules/content/"
@@ -358,34 +358,34 @@  discard block
 block discarded – undo
358 358
 >
359 359
 
360 360
 <channel>
361
-	<title><?php bloginfo_rss( 'name' ); ?></title>
362
-	<link><?php bloginfo_rss( 'url' ); ?></link>
363
-	<description><?php bloginfo_rss( 'description' ); ?></description>
364
-	<pubDate><?php echo date( 'D, d M Y H:i:s +0000' ); ?></pubDate>
365
-	<language><?php bloginfo_rss( 'language' ); ?></language>
361
+	<title><?php bloginfo_rss('name'); ?></title>
362
+	<link><?php bloginfo_rss('url'); ?></link>
363
+	<description><?php bloginfo_rss('description'); ?></description>
364
+	<pubDate><?php echo date('D, d M Y H:i:s +0000'); ?></pubDate>
365
+	<language><?php bloginfo_rss('language'); ?></language>
366 366
 	<wp:wxr_version><?php echo WXR_VERSION; ?></wp:wxr_version>
367 367
 	<wp:base_site_url><?php echo wxr_site_url(); ?></wp:base_site_url>
368
-	<wp:base_blog_url><?php bloginfo_rss( 'url' ); ?></wp:base_blog_url>
368
+	<wp:base_blog_url><?php bloginfo_rss('url'); ?></wp:base_blog_url>
369 369
 
370
-<?php wxr_authors_list( $post_ids ); ?>
370
+<?php wxr_authors_list($post_ids); ?>
371 371
 
372
-<?php foreach ( $cats as $c ) : ?>
373
-	<wp:category><wp:term_id><?php echo $c->term_id ?></wp:term_id><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->slug : ''; ?></wp:category_parent><?php wxr_cat_name( $c ); ?><?php wxr_category_description( $c ); ?></wp:category>
372
+<?php foreach ($cats as $c) : ?>
373
+	<wp:category><wp:term_id><?php echo $c->term_id ?></wp:term_id><wp:category_nicename><?php echo $c->slug; ?></wp:category_nicename><wp:category_parent><?php echo $c->parent ? $cats[$c->parent]->slug : ''; ?></wp:category_parent><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category>
374 374
 <?php endforeach; ?>
375
-<?php foreach ( $tags as $t ) : ?>
376
-	<wp:tag><wp:term_id><?php echo $t->term_id ?></wp:term_id><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name( $t ); ?><?php wxr_tag_description( $t ); ?></wp:tag>
375
+<?php foreach ($tags as $t) : ?>
376
+	<wp:tag><wp:term_id><?php echo $t->term_id ?></wp:term_id><wp:tag_slug><?php echo $t->slug; ?></wp:tag_slug><?php wxr_tag_name($t); ?><?php wxr_tag_description($t); ?></wp:tag>
377 377
 <?php endforeach; ?>
378
-<?php foreach ( $terms as $t ) : ?>
379
-	<wp:term><wp:term_id><?php echo $t->term_id ?></wp:term_id><wp:term_taxonomy><?php echo $t->taxonomy; ?></wp:term_taxonomy><wp:term_slug><?php echo $t->slug; ?></wp:term_slug><wp:term_parent><?php echo $t->parent ? $terms[$t->parent]->slug : ''; ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term>
378
+<?php foreach ($terms as $t) : ?>
379
+	<wp:term><wp:term_id><?php echo $t->term_id ?></wp:term_id><wp:term_taxonomy><?php echo $t->taxonomy; ?></wp:term_taxonomy><wp:term_slug><?php echo $t->slug; ?></wp:term_slug><wp:term_parent><?php echo $t->parent ? $terms[$t->parent]->slug : ''; ?></wp:term_parent><?php wxr_term_name($t); ?><?php wxr_term_description($t); ?></wp:term>
380 380
 <?php endforeach; ?>
381
-<?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?>
381
+<?php if ('all' == $args['content']) wxr_nav_menu_terms(); ?>
382 382
 
383 383
 	<?php
384 384
 	/** This action is documented in wp-includes/feed-rss2.php */
385
-	do_action( 'rss2_head' );
385
+	do_action('rss2_head');
386 386
 	?>
387 387
 
388
-<?php if ( $post_ids ) {
388
+<?php if ($post_ids) {
389 389
 	/**
390 390
 	 * @global WP_Query $wp_query
391 391
 	 */
@@ -395,23 +395,23 @@  discard block
 block discarded – undo
395 395
 	$wp_query->in_the_loop = true;
396 396
 
397 397
 	// Fetch 20 posts at a time rather than loading the entire table into memory.
398
-	while ( $next_posts = array_splice( $post_ids, 0, 20 ) ) {
399
-	$where = 'WHERE ID IN (' . join( ',', $next_posts ) . ')';
400
-	$posts = $wpdb->get_results( "SELECT * FROM {$wpdb->posts} $where" );
398
+	while ($next_posts = array_splice($post_ids, 0, 20)) {
399
+	$where = 'WHERE ID IN ('.join(',', $next_posts).')';
400
+	$posts = $wpdb->get_results("SELECT * FROM {$wpdb->posts} $where");
401 401
 
402 402
 	// Begin Loop.
403
-	foreach ( $posts as $post ) {
404
-		setup_postdata( $post );
405
-		$is_sticky = is_sticky( $post->ID ) ? 1 : 0;
403
+	foreach ($posts as $post) {
404
+		setup_postdata($post);
405
+		$is_sticky = is_sticky($post->ID) ? 1 : 0;
406 406
 ?>
407 407
 	<item>
408 408
 		<title><?php
409 409
 			/** This filter is documented in wp-includes/feed.php */
410
-			echo apply_filters( 'the_title_rss', $post->post_title );
410
+			echo apply_filters('the_title_rss', $post->post_title);
411 411
 		?></title>
412 412
 		<link><?php the_permalink_rss() ?></link>
413
-		<pubDate><?php echo mysql2date( 'D, d M Y H:i:s +0000', get_post_time( 'Y-m-d H:i:s', true ), false ); ?></pubDate>
414
-		<dc:creator><?php echo wxr_cdata( get_the_author_meta( 'login' ) ); ?></dc:creator>
413
+		<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
414
+		<dc:creator><?php echo wxr_cdata(get_the_author_meta('login')); ?></dc:creator>
415 415
 		<guid isPermaLink="false"><?php the_guid(); ?></guid>
416 416
 		<description></description>
417 417
 		<content:encoded><?php
@@ -422,7 +422,7 @@  discard block
 block discarded – undo
422 422
 			 *
423 423
 			 * @param string $post_content Content of the current post.
424 424
 			 */
425
-			echo wxr_cdata( apply_filters( 'the_content_export', $post->post_content ) );
425
+			echo wxr_cdata(apply_filters('the_content_export', $post->post_content));
426 426
 		?></content:encoded>
427 427
 		<excerpt:encoded><?php
428 428
 			/**
@@ -432,7 +432,7 @@  discard block
 block discarded – undo
432 432
 			 *
433 433
 			 * @param string $post_excerpt Excerpt for the current post.
434 434
 			 */
435
-			echo wxr_cdata( apply_filters( 'the_excerpt_export', $post->post_excerpt ) );
435
+			echo wxr_cdata(apply_filters('the_excerpt_export', $post->post_excerpt));
436 436
 		?></excerpt:encoded>
437 437
 		<wp:post_id><?php echo $post->ID; ?></wp:post_id>
438 438
 		<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
@@ -446,12 +446,12 @@  discard block
 block discarded – undo
446 446
 		<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
447 447
 		<wp:post_password><?php echo $post->post_password; ?></wp:post_password>
448 448
 		<wp:is_sticky><?php echo $is_sticky; ?></wp:is_sticky>
449
-<?php	if ( $post->post_type == 'attachment' ) : ?>
450
-		<wp:attachment_url><?php echo wp_get_attachment_url( $post->ID ); ?></wp:attachment_url>
449
+<?php	if ($post->post_type == 'attachment') : ?>
450
+		<wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url>
451 451
 <?php 	endif; ?>
452 452
 <?php 	wxr_post_taxonomy(); ?>
453
-<?php	$postmeta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID ) );
454
-		foreach ( $postmeta as $meta ) :
453
+<?php	$postmeta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID));
454
+		foreach ($postmeta as $meta) :
455 455
 			/**
456 456
 			 * Filter whether to selectively skip post meta used for WXR exports.
457 457
 			 *
@@ -464,32 +464,32 @@  discard block
 block discarded – undo
464 464
 			 * @param string $meta_key Current meta key.
465 465
 			 * @param object $meta     Current meta object.
466 466
 			 */
467
-			if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) )
467
+			if (apply_filters('wxr_export_skip_postmeta', false, $meta->meta_key, $meta))
468 468
 				continue;
469 469
 		?>
470 470
 		<wp:postmeta>
471 471
 			<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
472
-			<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
472
+			<wp:meta_value><?php echo wxr_cdata($meta->meta_value); ?></wp:meta_value>
473 473
 		</wp:postmeta>
474 474
 <?php	endforeach;
475 475
 
476
-		$comments = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID ) );
477
-		foreach ( $comments as $c ) : ?>
476
+		$comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved <> 'spam'", $post->ID));
477
+		foreach ($comments as $c) : ?>
478 478
 		<wp:comment>
479 479
 			<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
480
-			<wp:comment_author><?php echo wxr_cdata( $c->comment_author ); ?></wp:comment_author>
480
+			<wp:comment_author><?php echo wxr_cdata($c->comment_author); ?></wp:comment_author>
481 481
 			<wp:comment_author_email><?php echo $c->comment_author_email; ?></wp:comment_author_email>
482
-			<wp:comment_author_url><?php echo esc_url_raw( $c->comment_author_url ); ?></wp:comment_author_url>
482
+			<wp:comment_author_url><?php echo esc_url_raw($c->comment_author_url); ?></wp:comment_author_url>
483 483
 			<wp:comment_author_IP><?php echo $c->comment_author_IP; ?></wp:comment_author_IP>
484 484
 			<wp:comment_date><?php echo $c->comment_date; ?></wp:comment_date>
485 485
 			<wp:comment_date_gmt><?php echo $c->comment_date_gmt; ?></wp:comment_date_gmt>
486
-			<wp:comment_content><?php echo wxr_cdata( $c->comment_content ) ?></wp:comment_content>
486
+			<wp:comment_content><?php echo wxr_cdata($c->comment_content) ?></wp:comment_content>
487 487
 			<wp:comment_approved><?php echo $c->comment_approved; ?></wp:comment_approved>
488 488
 			<wp:comment_type><?php echo $c->comment_type; ?></wp:comment_type>
489 489
 			<wp:comment_parent><?php echo $c->comment_parent; ?></wp:comment_parent>
490 490
 			<wp:comment_user_id><?php echo $c->user_id; ?></wp:comment_user_id>
491
-<?php		$c_meta = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID ) );
492
-			foreach ( $c_meta as $meta ) :
491
+<?php		$c_meta = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $c->comment_ID));
492
+			foreach ($c_meta as $meta) :
493 493
 				/**
494 494
 				 * Filter whether to selectively skip comment meta used for WXR exports.
495 495
 				 *
@@ -502,13 +502,13 @@  discard block
 block discarded – undo
502 502
 				 * @param string $meta_key Current meta key.
503 503
 				 * @param object $meta     Current meta object.
504 504
 				 */
505
-				if ( apply_filters( 'wxr_export_skip_commentmeta', false, $meta->meta_key, $meta ) ) {
505
+				if (apply_filters('wxr_export_skip_commentmeta', false, $meta->meta_key, $meta)) {
506 506
 					continue;
507 507
 				}
508 508
 			?>
509 509
 			<wp:commentmeta>
510 510
 				<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
511
-				<wp:meta_value><?php echo wxr_cdata( $meta->meta_value ); ?></wp:meta_value>
511
+				<wp:meta_value><?php echo wxr_cdata($meta->meta_value); ?></wp:meta_value>
512 512
 			</wp:commentmeta>
513 513
 <?php		endforeach; ?>
514 514
 		</wp:comment>
Please login to merge, or discard this patch.
Braces   +73 added lines, -48 removed lines patch added patch discarded remove patch
@@ -43,7 +43,9 @@  discard block
 block discarded – undo
43 43
 	do_action( 'export_wp', $args );
44 44
 
45 45
 	$sitename = sanitize_key( get_bloginfo( 'name' ) );
46
-	if ( ! empty($sitename) ) $sitename .= '.';
46
+	if ( ! empty($sitename) ) {
47
+		$sitename .= '.';
48
+	}
47 49
 	$filename = $sitename . 'wordpress.' . date( 'Y-m-d' ) . '.xml';
48 50
 
49 51
 	header( 'Content-Description: File Transfer' );
@@ -52,8 +54,9 @@  discard block
 block discarded – undo
52 54
 
53 55
 	if ( 'all' != $args['content'] && post_type_exists( $args['content'] ) ) {
54 56
 		$ptype = get_post_type_object( $args['content'] );
55
-		if ( ! $ptype->can_export )
56
-			$args['content'] = 'post';
57
+		if ( ! $ptype->can_export ) {
58
+					$args['content'] = 'post';
59
+		}
57 60
 
58 61
 		$where = $wpdb->prepare( "{$wpdb->posts}.post_type = %s", $args['content'] );
59 62
 	} else {
@@ -62,10 +65,11 @@  discard block
 block discarded – undo
62 65
 		$where = $wpdb->prepare( "{$wpdb->posts}.post_type IN (" . implode( ',', $esses ) . ')', $post_types );
63 66
 	}
64 67
 
65
-	if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) )
66
-		$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
67
-	else
68
-		$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
68
+	if ( $args['status'] && ( 'post' == $args['content'] || 'page' == $args['content'] ) ) {
69
+			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_status = %s", $args['status'] );
70
+	} else {
71
+			$where .= " AND {$wpdb->posts}.post_status != 'auto-draft'";
72
+	}
69 73
 
70 74
 	$join = '';
71 75
 	if ( $args['category'] && 'post' == $args['content'] ) {
@@ -76,14 +80,17 @@  discard block
 block discarded – undo
76 80
 	}
77 81
 
78 82
 	if ( 'post' == $args['content'] || 'page' == $args['content'] ) {
79
-		if ( $args['author'] )
80
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
83
+		if ( $args['author'] ) {
84
+					$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_author = %d", $args['author'] );
85
+		}
81 86
 
82
-		if ( $args['start_date'] )
83
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
87
+		if ( $args['start_date'] ) {
88
+					$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date >= %s", date( 'Y-m-d', strtotime($args['start_date']) ) );
89
+		}
84 90
 
85
-		if ( $args['end_date'] )
86
-			$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
91
+		if ( $args['end_date'] ) {
92
+					$where .= $wpdb->prepare( " AND {$wpdb->posts}.post_date < %s", date( 'Y-m-d', strtotime('+1 month', strtotime($args['end_date'])) ) );
93
+		}
87 94
 	}
88 95
 
89 96
 	// Grab a snapshot of post IDs, just in case it changes during the export.
@@ -107,18 +114,20 @@  discard block
 block discarded – undo
107 114
 
108 115
 		// Put categories in order with no child going before its parent.
109 116
 		while ( $cat = array_shift( $categories ) ) {
110
-			if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) )
111
-				$cats[$cat->term_id] = $cat;
112
-			else
113
-				$categories[] = $cat;
117
+			if ( $cat->parent == 0 || isset( $cats[$cat->parent] ) ) {
118
+							$cats[$cat->term_id] = $cat;
119
+			} else {
120
+							$categories[] = $cat;
121
+			}
114 122
 		}
115 123
 
116 124
 		// Put terms in order with no child going before its parent.
117 125
 		while ( $t = array_shift( $custom_terms ) ) {
118
-			if ( $t->parent == 0 || isset( $terms[$t->parent] ) )
119
-				$terms[$t->term_id] = $t;
120
-			else
121
-				$custom_terms[] = $t;
126
+			if ( $t->parent == 0 || isset( $terms[$t->parent] ) ) {
127
+							$terms[$t->term_id] = $t;
128
+			} else {
129
+							$custom_terms[] = $t;
130
+			}
122 131
 		}
123 132
 
124 133
 		unset( $categories, $custom_taxonomies, $custom_terms );
@@ -151,11 +160,13 @@  discard block
 block discarded – undo
151 160
 	 */
152 161
 	function wxr_site_url() {
153 162
 		// Multisite: the base URL.
154
-		if ( is_multisite() )
155
-			return network_home_url();
163
+		if ( is_multisite() ) {
164
+					return network_home_url();
165
+		}
156 166
 		// WordPress (single site): the blog URL.
157
-		else
158
-			return get_bloginfo_rss( 'url' );
167
+		else {
168
+					return get_bloginfo_rss( 'url' );
169
+		}
159 170
 	}
160 171
 
161 172
 	/**
@@ -166,8 +177,9 @@  discard block
 block discarded – undo
166 177
 	 * @param object $category Category Object
167 178
 	 */
168 179
 	function wxr_cat_name( $category ) {
169
-		if ( empty( $category->name ) )
170
-			return;
180
+		if ( empty( $category->name ) ) {
181
+					return;
182
+		}
171 183
 
172 184
 		echo '<wp:cat_name>' . wxr_cdata( $category->name ) . '</wp:cat_name>';
173 185
 	}
@@ -180,8 +192,9 @@  discard block
 block discarded – undo
180 192
 	 * @param object $category Category Object
181 193
 	 */
182 194
 	function wxr_category_description( $category ) {
183
-		if ( empty( $category->description ) )
184
-			return;
195
+		if ( empty( $category->description ) ) {
196
+					return;
197
+		}
185 198
 
186 199
 		echo '<wp:category_description>' . wxr_cdata( $category->description ) . '</wp:category_description>';
187 200
 	}
@@ -194,8 +207,9 @@  discard block
 block discarded – undo
194 207
 	 * @param object $tag Tag Object
195 208
 	 */
196 209
 	function wxr_tag_name( $tag ) {
197
-		if ( empty( $tag->name ) )
198
-			return;
210
+		if ( empty( $tag->name ) ) {
211
+					return;
212
+		}
199 213
 
200 214
 		echo '<wp:tag_name>' . wxr_cdata( $tag->name ) . '</wp:tag_name>';
201 215
 	}
@@ -208,8 +222,9 @@  discard block
 block discarded – undo
208 222
 	 * @param object $tag Tag Object
209 223
 	 */
210 224
 	function wxr_tag_description( $tag ) {
211
-		if ( empty( $tag->description ) )
212
-			return;
225
+		if ( empty( $tag->description ) ) {
226
+					return;
227
+		}
213 228
 
214 229
 		echo '<wp:tag_description>' . wxr_cdata( $tag->description ) . '</wp:tag_description>';
215 230
 	}
@@ -222,8 +237,9 @@  discard block
 block discarded – undo
222 237
 	 * @param object $term Term Object
223 238
 	 */
224 239
 	function wxr_term_name( $term ) {
225
-		if ( empty( $term->name ) )
226
-			return;
240
+		if ( empty( $term->name ) ) {
241
+					return;
242
+		}
227 243
 
228 244
 		echo '<wp:term_name>' . wxr_cdata( $term->name ) . '</wp:term_name>';
229 245
 	}
@@ -236,8 +252,9 @@  discard block
 block discarded – undo
236 252
 	 * @param object $term Term Object
237 253
 	 */
238 254
 	function wxr_term_description( $term ) {
239
-		if ( empty( $term->description ) )
240
-			return;
255
+		if ( empty( $term->description ) ) {
256
+					return;
257
+		}
241 258
 
242 259
 		echo '<wp:term_description>' . wxr_cdata( $term->description ) . '</wp:term_description>';
243 260
 	}
@@ -263,8 +280,9 @@  discard block
 block discarded – undo
263 280
 
264 281
 		$authors = array();
265 282
 		$results = $wpdb->get_results( "SELECT DISTINCT post_author FROM $wpdb->posts WHERE post_status != 'auto-draft' $and" );
266
-		foreach ( (array) $results as $result )
267
-			$authors[] = get_userdata( $result->post_author );
283
+		foreach ( (array) $results as $result ) {
284
+					$authors[] = get_userdata( $result->post_author );
285
+		}
268 286
 
269 287
 		$authors = array_filter( $authors );
270 288
 
@@ -287,8 +305,9 @@  discard block
 block discarded – undo
287 305
 	 */
288 306
 	function wxr_nav_menu_terms() {
289 307
 		$nav_menus = wp_get_nav_menus();
290
-		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) )
291
-			return;
308
+		if ( empty( $nav_menus ) || ! is_array( $nav_menus ) ) {
309
+					return;
310
+		}
292 311
 
293 312
 		foreach ( $nav_menus as $menu ) {
294 313
 			echo "\t<wp:term><wp:term_id>{$menu->term_id}</wp:term_id><wp:term_taxonomy>nav_menu</wp:term_taxonomy><wp:term_slug>{$menu->slug}</wp:term_slug>";
@@ -306,8 +325,9 @@  discard block
 block discarded – undo
306 325
 		$post = get_post();
307 326
 
308 327
 		$taxonomies = get_object_taxonomies( $post->post_type );
309
-		if ( empty( $taxonomies ) )
310
-			return;
328
+		if ( empty( $taxonomies ) ) {
329
+					return;
330
+		}
311 331
 		$terms = wp_get_object_terms( $post->ID, $taxonomies );
312 332
 
313 333
 		foreach ( (array) $terms as $term ) {
@@ -322,8 +342,9 @@  discard block
 block discarded – undo
322 342
 	 * @return bool
323 343
 	 */
324 344
 	function wxr_filter_postmeta( $return_me, $meta_key ) {
325
-		if ( '_edit_lock' == $meta_key )
326
-			$return_me = true;
345
+		if ( '_edit_lock' == $meta_key ) {
346
+					$return_me = true;
347
+		}
327 348
 		return $return_me;
328 349
 	}
329 350
 	add_filter( 'wxr_export_skip_postmeta', 'wxr_filter_postmeta', 10, 2 );
@@ -378,7 +399,10 @@  discard block
 block discarded – undo
378 399
 <?php foreach ( $terms as $t ) : ?>
379 400
 	<wp:term><wp:term_id><?php echo $t->term_id ?></wp:term_id><wp:term_taxonomy><?php echo $t->taxonomy; ?></wp:term_taxonomy><wp:term_slug><?php echo $t->slug; ?></wp:term_slug><wp:term_parent><?php echo $t->parent ? $terms[$t->parent]->slug : ''; ?></wp:term_parent><?php wxr_term_name( $t ); ?><?php wxr_term_description( $t ); ?></wp:term>
380 401
 <?php endforeach; ?>
381
-<?php if ( 'all' == $args['content'] ) wxr_nav_menu_terms(); ?>
402
+<?php if ( 'all' == $args['content'] ) {
403
+	wxr_nav_menu_terms();
404
+}
405
+?>
382 406
 
383 407
 	<?php
384 408
 	/** This action is documented in wp-includes/feed-rss2.php */
@@ -464,8 +488,9 @@  discard block
 block discarded – undo
464 488
 			 * @param string $meta_key Current meta key.
465 489
 			 * @param object $meta     Current meta object.
466 490
 			 */
467
-			if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) )
468
-				continue;
491
+			if ( apply_filters( 'wxr_export_skip_postmeta', false, $meta->meta_key, $meta ) ) {
492
+							continue;
493
+			}
469 494
 		?>
470 495
 		<wp:postmeta>
471 496
 			<wp:meta_key><?php echo $meta->meta_key; ?></wp:meta_key>
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-media-list-table.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Media Library List Table class.
4
- *
5
- * @package WordPress
6
- * @subpackage List_Table
7
- * @since 3.1.0
8
- * @access private
9
- */
3
+	 * Media Library List Table class.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage List_Table
7
+	 * @since 3.1.0
8
+	 * @access private
9
+	 */
10 10
 class WP_Media_List_Table extends WP_List_Table {
11 11
 
12 12
 	private $detached;
Please login to merge, or discard this patch.
Spacing   +173 added lines, -173 removed lines patch added patch discarded remove patch
@@ -23,18 +23,18 @@  discard block
 block discarded – undo
23 23
 	 *
24 24
 	 * @param array $args An associative array of arguments.
25 25
 	 */
26
-	public function __construct( $args = array() ) {
27
-		$this->detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] );
26
+	public function __construct($args = array()) {
27
+		$this->detached = (isset($_REQUEST['attachment-filter']) && 'detached' === $_REQUEST['attachment-filter']);
28 28
 
29 29
 		$this->modes = array(
30
-			'list' => __( 'List View' ),
31
-			'grid' => __( 'Grid View' )
30
+			'list' => __('List View'),
31
+			'grid' => __('Grid View')
32 32
 		);
33 33
 
34
-		parent::__construct( array(
34
+		parent::__construct(array(
35 35
 			'plural' => 'media',
36
-			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
37
-		) );
36
+			'screen' => isset($args['screen']) ? $args['screen'] : null,
37
+		));
38 38
 	}
39 39
 
40 40
 	/**
@@ -55,17 +55,17 @@  discard block
 block discarded – undo
55 55
 	public function prepare_items() {
56 56
 		global $wp_query, $post_mime_types, $avail_post_mime_types, $mode;
57 57
 
58
-		list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST );
58
+		list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query($_REQUEST);
59 59
 
60
- 		$this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' == $_REQUEST['attachment-filter'];
60
+ 		$this->is_trash = isset($_REQUEST['attachment-filter']) && 'trash' == $_REQUEST['attachment-filter'];
61 61
 
62
- 		$mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode'];
62
+ 		$mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode'];
63 63
 
64
-		$this->set_pagination_args( array(
64
+		$this->set_pagination_args(array(
65 65
 			'total_items' => $wp_query->found_posts,
66 66
 			'total_pages' => $wp_query->max_num_pages,
67 67
 			'per_page' => $wp_query->query_vars['posts_per_page'],
68
-		) );
68
+		));
69 69
 	}
70 70
 
71 71
 	/**
@@ -81,30 +81,30 @@  discard block
 block discarded – undo
81 81
 		$type_links = array();
82 82
 		$_num_posts = (array) wp_count_attachments();
83 83
 		$_total_posts = array_sum($_num_posts) - $_num_posts['trash'];
84
-		$total_orphans = $wpdb->get_var( "SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1" );
84
+		$total_orphans = $wpdb->get_var("SELECT COUNT( * ) FROM $wpdb->posts WHERE post_type = 'attachment' AND post_status != 'trash' AND post_parent < 1");
85 85
 		$matches = wp_match_mime_types(array_keys($post_mime_types), array_keys($_num_posts));
86 86
 		$num_posts = array();
87
-		foreach ( $matches as $type => $reals ) {
88
-			foreach ( $reals as $real ) {
89
-				$num_posts[$type] = ( isset( $num_posts[$type] ) ) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
87
+		foreach ($matches as $type => $reals) {
88
+			foreach ($reals as $real) {
89
+				$num_posts[$type] = (isset($num_posts[$type])) ? $num_posts[$type] + $_num_posts[$real] : $_num_posts[$real];
90 90
 			}
91 91
 		}
92
-		$selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : '';
93
-		$type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>';
94
-		foreach ( $post_mime_types as $mime_type => $label ) {
95
-			if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
92
+		$selected = empty($_GET['attachment-filter']) ? ' selected="selected"' : '';
93
+		$type_links['all'] = "<option value=''$selected>".sprintf(_nx('All (%s)', 'All (%s)', $_total_posts, 'uploaded files'), number_format_i18n($_total_posts)).'</option>';
94
+		foreach ($post_mime_types as $mime_type => $label) {
95
+			if ( ! wp_match_mime_types($mime_type, $avail_post_mime_types))
96 96
 				continue;
97 97
 
98 98
 			$selected = '';
99
-			if ( !empty( $_GET['attachment-filter'] ) && strpos( $_GET['attachment-filter'], 'post_mime_type:' ) === 0 && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $_GET['attachment-filter'] ) ) )
99
+			if ( ! empty($_GET['attachment-filter']) && strpos($_GET['attachment-filter'], 'post_mime_type:') === 0 && wp_match_mime_types($mime_type, str_replace('post_mime_type:', '', $_GET['attachment-filter'])))
100 100
 				$selected = ' selected="selected"';
101
-			if ( !empty( $num_posts[$mime_type] ) )
102
-				$type_links[$mime_type] = '<option value="post_mime_type:' . esc_attr( $mime_type ) . '"' . $selected . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</option>';
101
+			if ( ! empty($num_posts[$mime_type]))
102
+				$type_links[$mime_type] = '<option value="post_mime_type:'.esc_attr($mime_type).'"'.$selected.'>'.sprintf(translate_nooped_plural($label[2], $num_posts[$mime_type]), number_format_i18n($num_posts[$mime_type])).'</option>';
103 103
 		}
104
-		$type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</option>';
104
+		$type_links['detached'] = '<option value="detached"'.($this->detached ? ' selected="selected"' : '').'>'.sprintf(_nx('Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files'), number_format_i18n($total_orphans)).'</option>';
105 105
 
106
-		if ( !empty($_num_posts['trash']) )
107
-			$type_links['trash'] = '<option value="trash"' . ( (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ) ? ' selected="selected"' : '') . '>' . sprintf( _nx( 'Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</option>';
106
+		if ( ! empty($_num_posts['trash']))
107
+			$type_links['trash'] = '<option value="trash"'.((isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash') ? ' selected="selected"' : '').'>'.sprintf(_nx('Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files'), number_format_i18n($_num_posts['trash'])).'</option>';
108 108
 
109 109
 		return $type_links;
110 110
 	}
@@ -115,19 +115,19 @@  discard block
 block discarded – undo
115 115
 	 */
116 116
 	protected function get_bulk_actions() {
117 117
 		$actions = array();
118
-		if ( MEDIA_TRASH ) {
119
-			if ( $this->is_trash ) {
120
-				$actions['untrash'] = __( 'Restore' );
121
-				$actions['delete'] = __( 'Delete Permanently' );
118
+		if (MEDIA_TRASH) {
119
+			if ($this->is_trash) {
120
+				$actions['untrash'] = __('Restore');
121
+				$actions['delete'] = __('Delete Permanently');
122 122
 			} else {
123
-				$actions['trash'] = __( 'Trash' );
123
+				$actions['trash'] = __('Trash');
124 124
 			}
125 125
 		} else {
126
-			$actions['delete'] = __( 'Delete Permanently' );
126
+			$actions['delete'] = __('Delete Permanently');
127 127
 		}
128 128
 
129
-		if ( $this->detached )
130
-			$actions['attach'] = __( 'Attach to a post' );
129
+		if ($this->detached)
130
+			$actions['attach'] = __('Attach to a post');
131 131
 
132 132
 		return $actions;
133 133
 	}
@@ -135,26 +135,26 @@  discard block
 block discarded – undo
135 135
 	/**
136 136
 	 * @param string $which
137 137
 	 */
138
-	protected function extra_tablenav( $which ) {
139
-		if ( 'bar' !== $which ) {
138
+	protected function extra_tablenav($which) {
139
+		if ('bar' !== $which) {
140 140
 			return;
141 141
 		}
142 142
 ?>
143 143
 		<div class="actions">
144 144
 <?php
145
-		if ( ! is_singular() ) {
146
-			if ( ! $this->is_trash ) {
147
-				$this->months_dropdown( 'attachment' );
145
+		if ( ! is_singular()) {
146
+			if ( ! $this->is_trash) {
147
+				$this->months_dropdown('attachment');
148 148
 			}
149 149
 
150 150
 			/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
151
-			do_action( 'restrict_manage_posts', $this->screen->post_type );
151
+			do_action('restrict_manage_posts', $this->screen->post_type);
152 152
 			
153
-			submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
153
+			submit_button(__('Filter'), 'button', 'filter_action', false, array('id' => 'post-query-submit'));
154 154
 		}
155 155
 
156
-		if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) {
157
-			submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
156
+		if ($this->is_trash && current_user_can('edit_others_posts')) {
157
+			submit_button(__('Empty Trash'), 'apply', 'delete_all', false);
158 158
 		} ?>
159 159
 		</div>
160 160
 <?php
@@ -165,13 +165,13 @@  discard block
 block discarded – undo
165 165
 	 * @return string
166 166
 	 */
167 167
 	public function current_action() {
168
-		if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) )
168
+		if (isset($_REQUEST['found_post_id']) && isset($_REQUEST['media']))
169 169
 			return 'attach';
170 170
 
171
-		if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) )
171
+		if (isset($_REQUEST['parent_post_id']) && isset($_REQUEST['media']))
172 172
 			return 'detach';
173 173
 
174
-		if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
174
+		if (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2']))
175 175
 			return 'delete_all';
176 176
 
177 177
 		return parent::current_action();
@@ -189,7 +189,7 @@  discard block
 block discarded – undo
189 189
 	 * @access public
190 190
 	 */
191 191
 	public function no_items() {
192
-		_e( 'No media attachments found.' );
192
+		_e('No media attachments found.');
193 193
 	}
194 194
 
195 195
 	/**
@@ -204,13 +204,13 @@  discard block
 block discarded – undo
204 204
 ?>
205 205
 <div class="wp-filter">
206 206
 	<div class="filter-items">
207
-		<?php $this->view_switcher( $mode ); ?>
207
+		<?php $this->view_switcher($mode); ?>
208 208
 
209
-		<label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label>
209
+		<label for="attachment-filter" class="screen-reader-text"><?php _e('Filter by type'); ?></label>
210 210
 		<select class="attachment-filters" name="attachment-filter" id="attachment-filter">
211 211
 			<?php
212
-			if ( ! empty( $views ) ) {
213
-				foreach ( $views as $class => $view ) {
212
+			if ( ! empty($views)) {
213
+				foreach ($views as $class => $view) {
214 214
 					echo "\t$view\n";
215 215
 				}
216 216
 			}
@@ -218,15 +218,15 @@  discard block
 block discarded – undo
218 218
 		</select>
219 219
 
220 220
 <?php
221
-		$this->extra_tablenav( 'bar' );
221
+		$this->extra_tablenav('bar');
222 222
 
223 223
 		/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
224
-		$views = apply_filters( "views_{$this->screen->id}", array() );
224
+		$views = apply_filters("views_{$this->screen->id}", array());
225 225
 
226 226
 		// Back compat for pre-4.0 view links.
227
-		if ( ! empty( $views ) ) {
227
+		if ( ! empty($views)) {
228 228
 			echo '<ul class="filter-links">';
229
-			foreach ( $views as $class => $view ) {
229
+			foreach ($views as $class => $view) {
230 230
 				echo "<li class='$class'>$view</li>";
231 231
 			}
232 232
 			echo '</ul>';
@@ -235,8 +235,8 @@  discard block
 block discarded – undo
235 235
 	</div>
236 236
 
237 237
 	<div class="search-form">
238
-		<label for="media-search-input" class="screen-reader-text"><?php esc_html_e( 'Search Media' ); ?></label>
239
-		<input type="search" placeholder="<?php esc_attr_e( 'Search' ) ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div>
238
+		<label for="media-search-input" class="screen-reader-text"><?php esc_html_e('Search Media'); ?></label>
239
+		<input type="search" placeholder="<?php esc_attr_e('Search') ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div>
240 240
 	</div>
241 241
 	<?php
242 242
 	}
@@ -249,11 +249,11 @@  discard block
 block discarded – undo
249 249
 		$posts_columns = array();
250 250
 		$posts_columns['cb'] = '<input type="checkbox" />';
251 251
 		/* translators: column name */
252
-		$posts_columns['title'] = _x( 'File', 'column name' );
253
-		$posts_columns['author'] = __( 'Author' );
252
+		$posts_columns['title'] = _x('File', 'column name');
253
+		$posts_columns['author'] = __('Author');
254 254
 
255
-		$taxonomies = get_taxonomies_for_attachments( 'objects' );
256
-		$taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
255
+		$taxonomies = get_taxonomies_for_attachments('objects');
256
+		$taxonomies = wp_filter_object_list($taxonomies, array('show_admin_column' => true), 'and', 'name');
257 257
 
258 258
 		/**
259 259
 		 * Filter the taxonomy columns for attachments in the Media list table.
@@ -263,28 +263,28 @@  discard block
 block discarded – undo
263 263
 		 * @param array  $taxonomies An array of registered taxonomies to show for attachments.
264 264
 		 * @param string $post_type  The post type. Default 'attachment'.
265 265
 		 */
266
-		$taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' );
267
-		$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
266
+		$taxonomies = apply_filters('manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment');
267
+		$taxonomies = array_filter($taxonomies, 'taxonomy_exists');
268 268
 
269
-		foreach ( $taxonomies as $taxonomy ) {
270
-			if ( 'category' == $taxonomy )
269
+		foreach ($taxonomies as $taxonomy) {
270
+			if ('category' == $taxonomy)
271 271
 				$column_key = 'categories';
272
-			elseif ( 'post_tag' == $taxonomy )
272
+			elseif ('post_tag' == $taxonomy)
273 273
 				$column_key = 'tags';
274 274
 			else
275
-				$column_key = 'taxonomy-' . $taxonomy;
275
+				$column_key = 'taxonomy-'.$taxonomy;
276 276
 
277
-			$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
277
+			$posts_columns[$column_key] = get_taxonomy($taxonomy)->labels->name;
278 278
 		}
279 279
 
280 280
 		/* translators: column name */
281
-		if ( !$this->detached ) {
282
-			$posts_columns['parent'] = _x( 'Uploaded to', 'column name' );
283
-			if ( post_type_supports( 'attachment', 'comments' ) )
284
-				$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
281
+		if ( ! $this->detached) {
282
+			$posts_columns['parent'] = _x('Uploaded to', 'column name');
283
+			if (post_type_supports('attachment', 'comments'))
284
+				$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="'.esc_attr__('Comments').'"><span class="screen-reader-text">'.__('Comments').'</span></span>';
285 285
 		}
286 286
 		/* translators: column name */
287
-		$posts_columns['date'] = _x( 'Date', 'column name' );
287
+		$posts_columns['date'] = _x('Date', 'column name');
288 288
 		/**
289 289
 		 * Filter the Media list table columns.
290 290
 		 *
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		 * @param bool  $detached      Whether the list table contains media not attached
295 295
 		 *                             to any posts. Default true.
296 296
 		 */
297
-		return apply_filters( 'manage_media_columns', $posts_columns, $this->detached );
297
+		return apply_filters('manage_media_columns', $posts_columns, $this->detached);
298 298
 	}
299 299
 
300 300
 	/**
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 			'author'   => 'author',
308 308
 			'parent'   => 'parent',
309 309
 			'comments' => 'comment_count',
310
-			'date'     => array( 'date', true ),
310
+			'date'     => array('date', true),
311 311
 		);
312 312
 	}
313 313
 
@@ -319,10 +319,10 @@  discard block
 block discarded – undo
319 319
 	 *
320 320
 	 * @param WP_Post $post The current WP_Post object.
321 321
 	 */
322
-	public function column_cb( $post ) {
323
-		if ( current_user_can( 'edit_post', $post->ID ) ) { ?>
322
+	public function column_cb($post) {
323
+		if (current_user_can('edit_post', $post->ID)) { ?>
324 324
 			<label class="screen-reader-text" for="cb-select-<?php echo $post->ID; ?>"><?php
325
-				echo sprintf( __( 'Select %s' ), _draft_or_post_title() );
325
+				echo sprintf(__('Select %s'), _draft_or_post_title());
326 326
 			?></label>
327 327
 			<input type="checkbox" name="media[]" id="cb-select-<?php echo $post->ID; ?>" value="<?php echo $post->ID; ?>" />
328 328
 		<?php }
@@ -336,15 +336,15 @@  discard block
 block discarded – undo
336 336
 	 *
337 337
 	 * @param WP_Post $post The current WP_Post object.
338 338
 	 */
339
-	public function column_title( $post ) {
340
-		list( $mime ) = explode( '/', $post->post_mime_type );
339
+	public function column_title($post) {
340
+		list($mime) = explode('/', $post->post_mime_type);
341 341
 
342 342
 		$title = _draft_or_post_title();
343
-		$thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) );
343
+		$thumb = wp_get_attachment_image($post->ID, array(60, 60), true, array('alt' => ''));
344 344
 		$link_start = $link_end = '';
345 345
 
346
-		if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) {
347
-			$link_start = '<a href="' . get_edit_post_link( $post->ID ) . '">';
346
+		if (current_user_can('edit_post', $post->ID) && ! $this->is_trash) {
347
+			$link_start = '<a href="'.get_edit_post_link($post->ID).'">';
348 348
 			$link_end = '</a>';
349 349
 		}
350 350
 
@@ -353,16 +353,16 @@  discard block
 block discarded – undo
353 353
 		?>
354 354
 		<strong<?php echo $class; ?>>
355 355
 			<?php echo $link_start; ?>
356
-				<?php if ( $thumb ) : ?>
357
-				<span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span>
356
+				<?php if ($thumb) : ?>
357
+				<span class="media-icon <?php echo sanitize_html_class($mime.'-icon'); ?>"><?php echo $thumb; ?></span>
358 358
 				<?php endif; ?>
359 359
 
360 360
 				<span aria-hidden="true"><?php echo $title; ?></span>
361
-				<span class="screen-reader-text"><?php printf( __( 'Edit &#8220;%s&#8221;' ), $title ); ?></span>
361
+				<span class="screen-reader-text"><?php printf(__('Edit &#8220;%s&#8221;'), $title); ?></span>
362 362
 			<?php echo $link_end; ?>
363
-			<?php _media_states( $post ); ?>
363
+			<?php _media_states($post); ?>
364 364
 		</strong>
365
-		<p class="filename"><span class="screen-reader-text"><?php _e( 'File name:' ); ?> </span><?php echo wp_basename( $post->guid ); ?></p>
365
+		<p class="filename"><span class="screen-reader-text"><?php _e('File name:'); ?> </span><?php echo wp_basename($post->guid); ?></p>
366 366
 		<?php
367 367
 	}
368 368
 
@@ -374,9 +374,9 @@  discard block
 block discarded – undo
374 374
 	 *
375 375
 	 * @param WP_Post $post The current WP_Post object.
376 376
 	 */
377
-	public function column_author( $post ) {
378
-		printf( '<a href="%s">%s</a>',
379
-			esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ),
377
+	public function column_author($post) {
378
+		printf('<a href="%s">%s</a>',
379
+			esc_url(add_query_arg(array('author' => get_the_author_meta('ID')), 'upload.php')),
380 380
 			get_the_author()
381 381
 		);
382 382
 	}
@@ -389,7 +389,7 @@  discard block
 block discarded – undo
389 389
 	 *
390 390
 	 * @param WP_Post $post The current WP_Post object.
391 391
 	 */
392
-	public function column_desc( $post ) {
392
+	public function column_desc($post) {
393 393
 		echo has_excerpt() ? $post->post_excerpt : '';
394 394
 	}
395 395
 
@@ -401,20 +401,20 @@  discard block
 block discarded – undo
401 401
 	 *
402 402
 	 * @param WP_Post $post The current WP_Post object.
403 403
 	 */
404
-	public function column_date( $post ) {
405
-		if ( '0000-00-00 00:00:00' == $post->post_date ) {
406
-			$h_time = __( 'Unpublished' );
404
+	public function column_date($post) {
405
+		if ('0000-00-00 00:00:00' == $post->post_date) {
406
+			$h_time = __('Unpublished');
407 407
 		} else {
408 408
 			$m_time = $post->post_date;
409
-			$time = get_post_time( 'G', true, $post, false );
410
-			if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) {
411
-				if ( $t_diff < 0 ) {
412
-					$h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
409
+			$time = get_post_time('G', true, $post, false);
410
+			if ((abs($t_diff = time() - $time)) < DAY_IN_SECONDS) {
411
+				if ($t_diff < 0) {
412
+					$h_time = sprintf(__('%s from now'), human_time_diff($time));
413 413
 				} else {
414
-					$h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
414
+					$h_time = sprintf(__('%s ago'), human_time_diff($time));
415 415
 				}
416 416
 			} else {
417
-				$h_time = mysql2date( __( 'Y/m/d' ), $m_time );
417
+				$h_time = mysql2date(__('Y/m/d'), $m_time);
418 418
 			}
419 419
 		}
420 420
 
@@ -429,43 +429,43 @@  discard block
 block discarded – undo
429 429
 	 *
430 430
 	 * @param WP_Post $post The current WP_Post object.
431 431
 	 */
432
-	public function column_parent( $post ) {
433
-		$user_can_edit = current_user_can( 'edit_post', $post->ID );
432
+	public function column_parent($post) {
433
+		$user_can_edit = current_user_can('edit_post', $post->ID);
434 434
 
435
-		if ( $post->post_parent > 0 ) {
436
-			$parent = get_post( $post->post_parent );
435
+		if ($post->post_parent > 0) {
436
+			$parent = get_post($post->post_parent);
437 437
 		} else {
438 438
 			$parent = false;
439 439
 		}
440 440
 
441
-		if ( $parent ) {
442
-			$title = _draft_or_post_title( $post->post_parent );
443
-			$parent_type = get_post_type_object( $parent->post_type );
441
+		if ($parent) {
442
+			$title = _draft_or_post_title($post->post_parent);
443
+			$parent_type = get_post_type_object($parent->post_type);
444 444
 ?>
445 445
 			<strong>
446
-			<?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?>
447
-				<a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
446
+			<?php if ($parent_type && $parent_type->show_ui && current_user_can('edit_post', $post->post_parent)) { ?>
447
+				<a href="<?php echo get_edit_post_link($post->post_parent); ?>">
448 448
 					<?php echo $title ?></a><?php
449 449
 			} else {
450 450
 				echo $title;
451 451
 			} ?></strong>,
452
-			<?php echo get_the_time( __( 'Y/m/d' ) ); ?><br />
452
+			<?php echo get_the_time(__('Y/m/d')); ?><br />
453 453
 			<?php
454
-			if ( $user_can_edit ):
455
-				$detach_url = add_query_arg( array(
454
+			if ($user_can_edit):
455
+				$detach_url = add_query_arg(array(
456 456
 					'parent_post_id' => $post->post_parent,
457 457
 					'media[]' => $post->ID,
458
-					'_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] )
459
-				), 'upload.php' ); ?>
460
-			<a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e( 'Detach' ); ?></a>
458
+					'_wpnonce' => wp_create_nonce('bulk-'.$this->_args['plural'])
459
+				), 'upload.php'); ?>
460
+			<a class="hide-if-no-js detach-from-parent" href="<?php echo $detach_url ?>"><?php _e('Detach'); ?></a>
461 461
 			<?php endif;
462 462
 		} else {
463
-			_e( '(Unattached)' ); ?><br />
464
-			<?php if ( $user_can_edit ) { ?>
463
+			_e('(Unattached)'); ?><br />
464
+			<?php if ($user_can_edit) { ?>
465 465
 				<a class="hide-if-no-js"
466 466
 					onclick="findPosts.open( 'media[]','<?php echo $post->ID ?>' ); return false;"
467 467
 					href="#the-list">
468
-					<?php _e( 'Attach' ); ?></a>
468
+					<?php _e('Attach'); ?></a>
469 469
 			<?php }
470 470
 		}
471 471
 	}
@@ -478,11 +478,11 @@  discard block
 block discarded – undo
478 478
 	 *
479 479
 	 * @param WP_Post $post The current WP_Post object.
480 480
 	 */
481
-	public function column_comments( $post ) {
481
+	public function column_comments($post) {
482 482
 		echo '<div class="post-com-count-wrapper">';
483 483
 
484
-		$pending_comments = get_pending_comments_num( $post->ID );
485
-		$this->comments_bubble( $post->ID, $pending_comments );
484
+		$pending_comments = get_pending_comments_num($post->ID);
485
+		$this->comments_bubble($post->ID, $pending_comments);
486 486
 
487 487
 		echo '</div>';
488 488
 	}
@@ -496,35 +496,35 @@  discard block
 block discarded – undo
496 496
 	 * @param WP_Post $post        The current WP_Post object.
497 497
 	 * @param string  $column_name Current column name.
498 498
 	 */
499
-	public function column_default( $post, $column_name ) {
500
-		if ( 'categories' == $column_name ) {
499
+	public function column_default($post, $column_name) {
500
+		if ('categories' == $column_name) {
501 501
 			$taxonomy = 'category';
502
-		} elseif ( 'tags' == $column_name ) {
502
+		} elseif ('tags' == $column_name) {
503 503
 			$taxonomy = 'post_tag';
504
-		} elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) {
505
-			$taxonomy = substr( $column_name, 9 );
504
+		} elseif (0 === strpos($column_name, 'taxonomy-')) {
505
+			$taxonomy = substr($column_name, 9);
506 506
 		} else {
507 507
 			$taxonomy = false;
508 508
 		}
509 509
 
510
-		if ( $taxonomy ) {
511
-			$terms = get_the_terms( $post->ID, $taxonomy );
512
-			if ( is_array( $terms ) ) {
510
+		if ($taxonomy) {
511
+			$terms = get_the_terms($post->ID, $taxonomy);
512
+			if (is_array($terms)) {
513 513
 				$out = array();
514
-				foreach ( $terms as $t ) {
514
+				foreach ($terms as $t) {
515 515
 					$posts_in_term_qv = array();
516 516
 					$posts_in_term_qv['taxonomy'] = $taxonomy;
517 517
 					$posts_in_term_qv['term'] = $t->slug;
518 518
 
519
-					$out[] = sprintf( '<a href="%s">%s</a>',
520
-						esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ),
521
-						esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
519
+					$out[] = sprintf('<a href="%s">%s</a>',
520
+						esc_url(add_query_arg($posts_in_term_qv, 'upload.php')),
521
+						esc_html(sanitize_term_field('name', $t->name, $t->term_id, $taxonomy, 'display'))
522 522
 					);
523 523
 				}
524 524
 				/* translators: used between list items, there is a space after the comma */
525
-				echo join( __( ', ' ), $out );
525
+				echo join(__(', '), $out);
526 526
 			} else {
527
-				echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>';
527
+				echo '<span aria-hidden="true">&#8212;</span><span class="screen-reader-text">'.get_taxonomy($taxonomy)->labels->no_terms.'</span>';
528 528
 			}
529 529
 
530 530
 			return;
@@ -540,7 +540,7 @@  discard block
 block discarded – undo
540 540
 		 * @param string $column_name Name of the custom column.
541 541
 		 * @param int    $post_id     Attachment ID.
542 542
 		 */
543
-		do_action( 'manage_media_custom_column', $column_name, $post->ID );
543
+		do_action('manage_media_custom_column', $column_name, $post->ID);
544 544
 	}
545 545
 
546 546
 	/**
@@ -550,19 +550,19 @@  discard block
 block discarded – undo
550 550
 	public function display_rows() {
551 551
 		global $post;
552 552
 
553
-		add_filter( 'the_title','esc_html' );
553
+		add_filter('the_title', 'esc_html');
554 554
 
555
-		while ( have_posts() ) : the_post();
555
+		while (have_posts()) : the_post();
556 556
 			if (
557
-				( $this->is_trash && $post->post_status != 'trash' )
558
-				|| ( ! $this->is_trash && $post->post_status == 'trash' )
557
+				($this->is_trash && $post->post_status != 'trash')
558
+				|| ( ! $this->is_trash && $post->post_status == 'trash')
559 559
 			) {
560 560
 				continue;
561 561
 			}
562
-			$post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';
562
+			$post_owner = (get_current_user_id() == $post->post_author) ? 'self' : 'other';
563 563
 		?>
564
-			<tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>">
565
-				<?php $this->single_row_columns( $post ); ?>
564
+			<tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim(' author-'.$post_owner.' status-'.$post->post_status); ?>">
565
+				<?php $this->single_row_columns($post); ?>
566 566
 			</tr>
567 567
 		<?php
568 568
 		endwhile;
@@ -586,39 +586,39 @@  discard block
 block discarded – undo
586 586
 	 *
587 587
 	 * @return array
588 588
 	 */
589
-	private function _get_row_actions( $post, $att_title ) {
589
+	private function _get_row_actions($post, $att_title) {
590 590
 		$actions = array();
591 591
 
592
-		if ( $this->detached ) {
593
-			if ( current_user_can( 'edit_post', $post->ID ) )
594
-				$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>';
595
-			if ( current_user_can( 'delete_post', $post->ID ) )
596
-				if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
597
-					$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
592
+		if ($this->detached) {
593
+			if (current_user_can('edit_post', $post->ID))
594
+				$actions['edit'] = '<a href="'.get_edit_post_link($post->ID).'">'.__('Edit').'</a>';
595
+			if (current_user_can('delete_post', $post->ID))
596
+				if (EMPTY_TRASH_DAYS && MEDIA_TRASH) {
597
+					$actions['trash'] = "<a class='submitdelete' href='".wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_'.$post->ID)."'>".__('Trash')."</a>";
598 598
 				} else {
599
-					$delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
600
-					$actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
599
+					$delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
600
+					$actions['delete'] = "<a class='submitdelete'$delete_ays href='".wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_'.$post->ID)."'>".__('Delete Permanently')."</a>";
601 601
 				}
602
-			$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
603
-			if ( current_user_can( 'edit_post', $post->ID ) )
604
-				$actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>';
602
+			$actions['view'] = '<a href="'.get_permalink($post->ID).'" title="'.esc_attr(sprintf(__('View &#8220;%s&#8221;'), $att_title)).'" rel="permalink">'.__('View').'</a>';
603
+			if (current_user_can('edit_post', $post->ID))
604
+				$actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__('Attach').'</a>';
605 605
 		}
606 606
 		else {
607
-			if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )
608
-				$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>';
609
-			if ( current_user_can( 'delete_post', $post->ID ) ) {
610
-				if ( $this->is_trash )
611
-					$actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
612
-				elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
613
-					$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
614
-				if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
615
-					$delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
616
-					$actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
607
+			if (current_user_can('edit_post', $post->ID) && ! $this->is_trash)
608
+				$actions['edit'] = '<a href="'.get_edit_post_link($post->ID).'">'.__('Edit').'</a>';
609
+			if (current_user_can('delete_post', $post->ID)) {
610
+				if ($this->is_trash)
611
+					$actions['untrash'] = "<a class='submitdelete' href='".wp_nonce_url("post.php?action=untrash&amp;post=$post->ID", 'untrash-post_'.$post->ID)."'>".__('Restore')."</a>";
612
+				elseif (EMPTY_TRASH_DAYS && MEDIA_TRASH)
613
+					$actions['trash'] = "<a class='submitdelete' href='".wp_nonce_url("post.php?action=trash&amp;post=$post->ID", 'trash-post_'.$post->ID)."'>".__('Trash')."</a>";
614
+				if ($this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH) {
615
+					$delete_ays = ( ! $this->is_trash && ! MEDIA_TRASH) ? " onclick='return showNotice.warn();'" : '';
616
+					$actions['delete'] = "<a class='submitdelete'$delete_ays href='".wp_nonce_url("post.php?action=delete&amp;post=$post->ID", 'delete-post_'.$post->ID)."'>".__('Delete Permanently')."</a>";
617 617
 				}
618 618
 			}
619
-			if ( !$this->is_trash ) {
620
-				$title =_draft_or_post_title( $post->post_parent );
621
-				$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
619
+			if ( ! $this->is_trash) {
620
+				$title = _draft_or_post_title($post->post_parent);
621
+				$actions['view'] = '<a href="'.get_permalink($post->ID).'" title="'.esc_attr(sprintf(__('View &#8220;%s&#8221;'), $title)).'" rel="permalink">'.__('View').'</a>';
622 622
 			}
623 623
 		}
624 624
 
@@ -633,7 +633,7 @@  discard block
 block discarded – undo
633 633
 		 * @param bool    $detached Whether the list table contains media not attached
634 634
 		 *                          to any posts. Default true.
635 635
 		 */
636
-		return apply_filters( 'media_row_actions', $actions, $post, $this->detached );
636
+		return apply_filters('media_row_actions', $actions, $post, $this->detached);
637 637
 	}
638 638
 
639 639
 	/**
@@ -647,12 +647,12 @@  discard block
 block discarded – undo
647 647
 	 * @param string $primary     Primary column name.
648 648
 	 * @return string Row actions output for media attachments.
649 649
 	 */
650
-	protected function handle_row_actions( $post, $column_name, $primary ) {
651
-		if ( $primary !== $column_name ) {
650
+	protected function handle_row_actions($post, $column_name, $primary) {
651
+		if ($primary !== $column_name) {
652 652
 			return '';
653 653
 		}
654 654
 
655 655
 		$att_title = _draft_or_post_title();
656
-		return $this->row_actions( $this->_get_row_actions( $post, $att_title ) );
656
+		return $this->row_actions($this->_get_row_actions($post, $att_title));
657 657
 	}
658 658
 }
Please login to merge, or discard this patch.
Braces   +52 added lines, -38 removed lines patch added patch discarded remove patch
@@ -92,19 +92,23 @@  discard block
 block discarded – undo
92 92
 		$selected = empty( $_GET['attachment-filter'] ) ? ' selected="selected"' : '';
93 93
 		$type_links['all'] = "<option value=''$selected>" . sprintf( _nx( 'All (%s)', 'All (%s)', $_total_posts, 'uploaded files' ), number_format_i18n( $_total_posts ) ) . '</option>';
94 94
 		foreach ( $post_mime_types as $mime_type => $label ) {
95
-			if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) )
96
-				continue;
95
+			if ( !wp_match_mime_types($mime_type, $avail_post_mime_types) ) {
96
+							continue;
97
+			}
97 98
 
98 99
 			$selected = '';
99
-			if ( !empty( $_GET['attachment-filter'] ) && strpos( $_GET['attachment-filter'], 'post_mime_type:' ) === 0 && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $_GET['attachment-filter'] ) ) )
100
-				$selected = ' selected="selected"';
101
-			if ( !empty( $num_posts[$mime_type] ) )
102
-				$type_links[$mime_type] = '<option value="post_mime_type:' . esc_attr( $mime_type ) . '"' . $selected . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</option>';
100
+			if ( !empty( $_GET['attachment-filter'] ) && strpos( $_GET['attachment-filter'], 'post_mime_type:' ) === 0 && wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $_GET['attachment-filter'] ) ) ) {
101
+							$selected = ' selected="selected"';
102
+			}
103
+			if ( !empty( $num_posts[$mime_type] ) ) {
104
+							$type_links[$mime_type] = '<option value="post_mime_type:' . esc_attr( $mime_type ) . '"' . $selected . '>' . sprintf( translate_nooped_plural( $label[2], $num_posts[$mime_type] ), number_format_i18n( $num_posts[$mime_type] )) . '</option>';
105
+			}
103 106
 		}
104 107
 		$type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . sprintf( _nx( 'Unattached (%s)', 'Unattached (%s)', $total_orphans, 'detached files' ), number_format_i18n( $total_orphans ) ) . '</option>';
105 108
 
106
-		if ( !empty($_num_posts['trash']) )
107
-			$type_links['trash'] = '<option value="trash"' . ( (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ) ? ' selected="selected"' : '') . '>' . sprintf( _nx( 'Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</option>';
109
+		if ( !empty($_num_posts['trash']) ) {
110
+					$type_links['trash'] = '<option value="trash"' . ( (isset($_GET['attachment-filter']) && $_GET['attachment-filter'] == 'trash' ) ? ' selected="selected"' : '') . '>' . sprintf( _nx( 'Trash (%s)', 'Trash (%s)', $_num_posts['trash'], 'uploaded files' ), number_format_i18n( $_num_posts['trash'] ) ) . '</option>';
111
+		}
108 112
 
109 113
 		return $type_links;
110 114
 	}
@@ -126,8 +130,9 @@  discard block
 block discarded – undo
126 130
 			$actions['delete'] = __( 'Delete Permanently' );
127 131
 		}
128 132
 
129
-		if ( $this->detached )
130
-			$actions['attach'] = __( 'Attach to a post' );
133
+		if ( $this->detached ) {
134
+					$actions['attach'] = __( 'Attach to a post' );
135
+		}
131 136
 
132 137
 		return $actions;
133 138
 	}
@@ -165,14 +170,17 @@  discard block
 block discarded – undo
165 170
 	 * @return string
166 171
 	 */
167 172
 	public function current_action() {
168
-		if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) )
169
-			return 'attach';
173
+		if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) {
174
+					return 'attach';
175
+		}
170 176
 
171
-		if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) )
172
-			return 'detach';
177
+		if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) {
178
+					return 'detach';
179
+		}
173 180
 
174
-		if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
175
-			return 'delete_all';
181
+		if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) {
182
+					return 'delete_all';
183
+		}
176 184
 
177 185
 		return parent::current_action();
178 186
 	}
@@ -267,12 +275,13 @@  discard block
 block discarded – undo
267 275
 		$taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
268 276
 
269 277
 		foreach ( $taxonomies as $taxonomy ) {
270
-			if ( 'category' == $taxonomy )
271
-				$column_key = 'categories';
272
-			elseif ( 'post_tag' == $taxonomy )
273
-				$column_key = 'tags';
274
-			else
275
-				$column_key = 'taxonomy-' . $taxonomy;
278
+			if ( 'category' == $taxonomy ) {
279
+							$column_key = 'categories';
280
+			} elseif ( 'post_tag' == $taxonomy ) {
281
+							$column_key = 'tags';
282
+			} else {
283
+							$column_key = 'taxonomy-' . $taxonomy;
284
+			}
276 285
 
277 286
 			$posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
278 287
 		}
@@ -280,8 +289,9 @@  discard block
 block discarded – undo
280 289
 		/* translators: column name */
281 290
 		if ( !$this->detached ) {
282 291
 			$posts_columns['parent'] = _x( 'Uploaded to', 'column name' );
283
-			if ( post_type_supports( 'attachment', 'comments' ) )
284
-				$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
292
+			if ( post_type_supports( 'attachment', 'comments' ) ) {
293
+							$posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>';
294
+			}
285 295
 		}
286 296
 		/* translators: column name */
287 297
 		$posts_columns['date'] = _x( 'Date', 'column name' );
@@ -590,27 +600,31 @@  discard block
 block discarded – undo
590 600
 		$actions = array();
591 601
 
592 602
 		if ( $this->detached ) {
593
-			if ( current_user_can( 'edit_post', $post->ID ) )
594
-				$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>';
595
-			if ( current_user_can( 'delete_post', $post->ID ) )
596
-				if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
603
+			if ( current_user_can( 'edit_post', $post->ID ) ) {
604
+							$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>';
605
+			}
606
+			if ( current_user_can( 'delete_post', $post->ID ) ) {
607
+							if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
597 608
 					$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
609
+			}
598 610
 				} else {
599 611
 					$delete_ays = !MEDIA_TRASH ? " onclick='return showNotice.warn();'" : '';
600 612
 					$actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
601 613
 				}
602 614
 			$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $att_title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
603
-			if ( current_user_can( 'edit_post', $post->ID ) )
604
-				$actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>';
605
-		}
606
-		else {
607
-			if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash )
608
-				$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>';
615
+			if ( current_user_can( 'edit_post', $post->ID ) ) {
616
+							$actions['attach'] = '<a href="#the-list" onclick="findPosts.open( \'media[]\',\''.$post->ID.'\' );return false;" class="hide-if-no-js">'.__( 'Attach' ).'</a>';
617
+			}
618
+		} else {
619
+			if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) {
620
+							$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID ) . '">' . __( 'Edit' ) . '</a>';
621
+			}
609 622
 			if ( current_user_can( 'delete_post', $post->ID ) ) {
610
-				if ( $this->is_trash )
611
-					$actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
612
-				elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH )
613
-					$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
623
+				if ( $this->is_trash ) {
624
+									$actions['untrash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=untrash&amp;post=$post->ID", 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
625
+				} elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) {
626
+									$actions['trash'] = "<a class='submitdelete' href='" . wp_nonce_url( "post.php?action=trash&amp;post=$post->ID", 'trash-post_' . $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
627
+				}
614 628
 				if ( $this->is_trash || !EMPTY_TRASH_DAYS || !MEDIA_TRASH ) {
615 629
 					$delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : '';
616 630
 					$actions['delete'] = "<a class='submitdelete'$delete_ays href='" . wp_nonce_url( "post.php?action=delete&amp;post=$post->ID", 'delete-post_' . $post->ID ) . "'>" . __( 'Delete Permanently' ) . "</a>";
Please login to merge, or discard this patch.
src/wp-admin/edit.php 3 patches
Indentation   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Edit Posts Administration Screen.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Edit Posts Administration Screen.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -252,7 +252,7 @@  discard block
 block discarded – undo
252 252
 $bulk_messages['post'] = array(
253 253
 	'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
254 254
 	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
255
-	                   _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
255
+					   _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
256 256
 	'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
257 257
 	'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
258 258
 	'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
@@ -260,7 +260,7 @@  discard block
 block discarded – undo
260 260
 $bulk_messages['page'] = array(
261 261
 	'updated'   => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
262 262
 	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
263
-	                   _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
263
+					   _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
264 264
 	'deleted'   => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
265 265
 	'trashed'   => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
266 266
 	'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
Please login to merge, or discard this patch.
Spacing   +140 added lines, -142 removed lines patch added patch discarded remove patch
@@ -7,13 +7,13 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( ! $typenow )
13
-	wp_die( __( 'Invalid post type' ) );
12
+if ( ! $typenow)
13
+	wp_die(__('Invalid post type'));
14 14
 
15
-if ( 'attachment' === $typenow ) {
16
-	if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
15
+if ('attachment' === $typenow) {
16
+	if (wp_redirect(admin_url('upload.php'))) {
17 17
 		exit;
18 18
 	}
19 19
 }
@@ -25,27 +25,27 @@  discard block
 block discarded – undo
25 25
 global $post_type, $post_type_object;
26 26
 
27 27
 $post_type = $typenow;
28
-$post_type_object = get_post_type_object( $post_type );
28
+$post_type_object = get_post_type_object($post_type);
29 29
 
30
-if ( ! $post_type_object )
31
-	wp_die( __( 'Invalid post type' ) );
30
+if ( ! $post_type_object)
31
+	wp_die(__('Invalid post type'));
32 32
 
33
-if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
34
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
33
+if ( ! current_user_can($post_type_object->cap->edit_posts))
34
+	wp_die(__('Cheatin&#8217; uh?'), 403);
35 35
 
36 36
 $wp_list_table = _get_list_table('WP_Posts_List_Table');
37 37
 $pagenum = $wp_list_table->get_pagenum();
38 38
 
39 39
 // Back-compat for viewing comments of an entry
40
-foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
41
-	if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
42
-		wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
40
+foreach (array('p', 'attachment_id', 'page_id') as $_redirect) {
41
+	if ( ! empty($_REQUEST[$_redirect])) {
42
+		wp_redirect(admin_url('edit-comments.php?p='.absint($_REQUEST[$_redirect])));
43 43
 		exit;
44 44
 	}
45 45
 }
46
-unset( $_redirect );
46
+unset($_redirect);
47 47
 
48
-if ( 'post' != $post_type ) {
48
+if ('post' != $post_type) {
49 49
 	$parent_file = "edit.php?post_type=$post_type";
50 50
 	$submenu_file = "edit.php?post_type=$post_type";
51 51
 	$post_new_file = "post-new.php?post_type=$post_type";
@@ -57,66 +57,66 @@  discard block
 block discarded – undo
57 57
 
58 58
 $doaction = $wp_list_table->current_action();
59 59
 
60
-if ( $doaction ) {
60
+if ($doaction) {
61 61
 	check_admin_referer('bulk-posts');
62 62
 
63
-	$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() );
64
-	if ( ! $sendback )
65
-		$sendback = admin_url( $parent_file );
66
-	$sendback = add_query_arg( 'paged', $pagenum, $sendback );
67
-	if ( strpos($sendback, 'post.php') !== false )
63
+	$sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer());
64
+	if ( ! $sendback)
65
+		$sendback = admin_url($parent_file);
66
+	$sendback = add_query_arg('paged', $pagenum, $sendback);
67
+	if (strpos($sendback, 'post.php') !== false)
68 68
 		$sendback = admin_url($post_new_file);
69 69
 
70
-	if ( 'delete_all' == $doaction ) {
70
+	if ('delete_all' == $doaction) {
71 71
 		// Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
72 72
 		$post_status = preg_replace('/[^a-z0-9_-]+/i', '', $_REQUEST['post_status']);
73 73
 		// Validate the post status exists.
74
-		if ( get_post_status_object( $post_status ) ) {
75
-			$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
74
+		if (get_post_status_object($post_status)) {
75
+			$post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status));
76 76
 		}
77 77
 		$doaction = 'delete';
78
-	} elseif ( isset( $_REQUEST['media'] ) ) {
78
+	} elseif (isset($_REQUEST['media'])) {
79 79
 		$post_ids = $_REQUEST['media'];
80
-	} elseif ( isset( $_REQUEST['ids'] ) ) {
81
-		$post_ids = explode( ',', $_REQUEST['ids'] );
82
-	} elseif ( !empty( $_REQUEST['post'] ) ) {
80
+	} elseif (isset($_REQUEST['ids'])) {
81
+		$post_ids = explode(',', $_REQUEST['ids']);
82
+	} elseif ( ! empty($_REQUEST['post'])) {
83 83
 		$post_ids = array_map('intval', $_REQUEST['post']);
84 84
 	}
85 85
 
86
-	if ( !isset( $post_ids ) ) {
87
-		wp_redirect( $sendback );
86
+	if ( ! isset($post_ids)) {
87
+		wp_redirect($sendback);
88 88
 		exit;
89 89
 	}
90 90
 
91
-	switch ( $doaction ) {
91
+	switch ($doaction) {
92 92
 		case 'trash':
93 93
 			$trashed = $locked = 0;
94 94
 
95
-			foreach( (array) $post_ids as $post_id ) {
96
-				if ( !current_user_can( 'delete_post', $post_id) )
97
-					wp_die( __('You are not allowed to move this item to the Trash.') );
95
+			foreach ((array) $post_ids as $post_id) {
96
+				if ( ! current_user_can('delete_post', $post_id))
97
+					wp_die(__('You are not allowed to move this item to the Trash.'));
98 98
 
99
-				if ( wp_check_post_lock( $post_id ) ) {
99
+				if (wp_check_post_lock($post_id)) {
100 100
 					$locked++;
101 101
 					continue;
102 102
 				}
103 103
 
104
-				if ( !wp_trash_post($post_id) )
105
-					wp_die( __('Error in moving to Trash.') );
104
+				if ( ! wp_trash_post($post_id))
105
+					wp_die(__('Error in moving to Trash.'));
106 106
 
107 107
 				$trashed++;
108 108
 			}
109 109
 
110
-			$sendback = add_query_arg( array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked ), $sendback );
110
+			$sendback = add_query_arg(array('trashed' => $trashed, 'ids' => join(',', $post_ids), 'locked' => $locked), $sendback);
111 111
 			break;
112 112
 		case 'untrash':
113 113
 			$untrashed = 0;
114
-			foreach( (array) $post_ids as $post_id ) {
115
-				if ( !current_user_can( 'delete_post', $post_id) )
116
-					wp_die( __('You are not allowed to restore this item from the Trash.') );
114
+			foreach ((array) $post_ids as $post_id) {
115
+				if ( ! current_user_can('delete_post', $post_id))
116
+					wp_die(__('You are not allowed to restore this item from the Trash.'));
117 117
 
118
-				if ( !wp_untrash_post($post_id) )
119
-					wp_die( __('Error in restoring from Trash.') );
118
+				if ( ! wp_untrash_post($post_id))
119
+					wp_die(__('Error in restoring from Trash.'));
120 120
 
121 121
 				$untrashed++;
122 122
 			}
@@ -124,43 +124,43 @@  discard block
 block discarded – undo
124 124
 			break;
125 125
 		case 'delete':
126 126
 			$deleted = 0;
127
-			foreach( (array) $post_ids as $post_id ) {
127
+			foreach ((array) $post_ids as $post_id) {
128 128
 				$post_del = get_post($post_id);
129 129
 
130
-				if ( !current_user_can( 'delete_post', $post_id ) )
131
-					wp_die( __('You are not allowed to delete this item.') );
130
+				if ( ! current_user_can('delete_post', $post_id))
131
+					wp_die(__('You are not allowed to delete this item.'));
132 132
 
133
-				if ( $post_del->post_type == 'attachment' ) {
134
-					if ( ! wp_delete_attachment($post_id) )
135
-						wp_die( __('Error in deleting.') );
133
+				if ($post_del->post_type == 'attachment') {
134
+					if ( ! wp_delete_attachment($post_id))
135
+						wp_die(__('Error in deleting.'));
136 136
 				} else {
137
-					if ( !wp_delete_post($post_id) )
138
-						wp_die( __('Error in deleting.') );
137
+					if ( ! wp_delete_post($post_id))
138
+						wp_die(__('Error in deleting.'));
139 139
 				}
140 140
 				$deleted++;
141 141
 			}
142 142
 			$sendback = add_query_arg('deleted', $deleted, $sendback);
143 143
 			break;
144 144
 		case 'edit':
145
-			if ( isset($_REQUEST['bulk_edit']) ) {
145
+			if (isset($_REQUEST['bulk_edit'])) {
146 146
 				$done = bulk_edit_posts($_REQUEST);
147 147
 
148
-				if ( is_array($done) ) {
149
-					$done['updated'] = count( $done['updated'] );
150
-					$done['skipped'] = count( $done['skipped'] );
151
-					$done['locked'] = count( $done['locked'] );
152
-					$sendback = add_query_arg( $done, $sendback );
148
+				if (is_array($done)) {
149
+					$done['updated'] = count($done['updated']);
150
+					$done['skipped'] = count($done['skipped']);
151
+					$done['locked'] = count($done['locked']);
152
+					$sendback = add_query_arg($done, $sendback);
153 153
 				}
154 154
 			}
155 155
 			break;
156 156
 	}
157 157
 
158
-	$sendback = remove_query_arg( array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback );
158
+	$sendback = remove_query_arg(array('action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view'), $sendback);
159 159
 
160 160
 	wp_redirect($sendback);
161 161
 	exit();
162
-} elseif ( ! empty($_REQUEST['_wp_http_referer']) ) {
163
-	 wp_redirect( remove_query_arg( array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']) ) );
162
+} elseif ( ! empty($_REQUEST['_wp_http_referer'])) {
163
+	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
164 164
 	 exit;
165 165
 }
166 166
 
@@ -171,99 +171,97 @@  discard block
 block discarded – undo
171 171
 
172 172
 $title = $post_type_object->labels->name;
173 173
 
174
-if ( 'post' == $post_type ) {
175
-	get_current_screen()->add_help_tab( array(
174
+if ('post' == $post_type) {
175
+	get_current_screen()->add_help_tab(array(
176 176
 	'id'		=> 'overview',
177 177
 	'title'		=> __('Overview'),
178 178
 	'content'	=>
179
-		'<p>' . __('This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.') . '</p>'
180
-	) );
181
-	get_current_screen()->add_help_tab( array(
179
+		'<p>'.__('This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.').'</p>'
180
+	));
181
+	get_current_screen()->add_help_tab(array(
182 182
 	'id'		=> 'screen-content',
183 183
 	'title'		=> __('Screen Content'),
184 184
 	'content'	=>
185
-		'<p>' . __('You can customize the display of this screen&#8217;s contents in a number of ways:') . '</p>' .
186
-		'<ul>' .
187
-			'<li>' . __('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.') . '</li>' .
188
-			'<li>' . __('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.') . '</li>' .
189
-			'<li>' . __('You can view posts in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.') . '</li>' .
190
-			'<li>' . __('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.') . '</li>' .
185
+		'<p>'.__('You can customize the display of this screen&#8217;s contents in a number of ways:').'</p>'.
186
+		'<ul>'.
187
+			'<li>'.__('You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.').'</li>'.
188
+			'<li>'.__('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.').'</li>'.
189
+			'<li>'.__('You can view posts in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.').'</li>'.
190
+			'<li>'.__('You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.').'</li>'.
191 191
 		'</ul>'
192
-	) );
193
-	get_current_screen()->add_help_tab( array(
192
+	));
193
+	get_current_screen()->add_help_tab(array(
194 194
 	'id'		=> 'action-links',
195 195
 	'title'		=> __('Available Actions'),
196 196
 	'content'	=>
197
-		'<p>' . __('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:') . '</p>' .
198
-		'<ul>' .
199
-			'<li>' . __('<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.') . '</li>' .
200
-			'<li>' . __('<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.') . '</li>' .
201
-			'<li>' . __('<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.') . '</li>' .
202
-			'<li>' . __('<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.') . '</li>' .
197
+		'<p>'.__('Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:').'</p>'.
198
+		'<ul>'.
199
+			'<li>'.__('<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.').'</li>'.
200
+			'<li>'.__('<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.').'</li>'.
201
+			'<li>'.__('<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.').'</li>'.
202
+			'<li>'.__('<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.').'</li>'.
203 203
 		'</ul>'
204
-	) );
205
-	get_current_screen()->add_help_tab( array(
204
+	));
205
+	get_current_screen()->add_help_tab(array(
206 206
 	'id'		=> 'bulk-actions',
207 207
 	'title'		=> __('Bulk Actions'),
208 208
 	'content'	=>
209
-		'<p>' . __('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.') . '</p>' .
210
-				'<p>' . __('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.') . '</p>'
211
-	) );
209
+		'<p>'.__('You can also edit or move multiple posts to the trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk Actions menu and click Apply.').'</p>'.
210
+				'<p>'.__('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.').'</p>'
211
+	));
212 212
 
213 213
 	get_current_screen()->set_help_sidebar(
214
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
215
-	'<p>' . __('<a href="https://codex.wordpress.org/Posts_Screen" target="_blank">Documentation on Managing Posts</a>') . '</p>' .
216
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
214
+	'<p><strong>'.__('For more information:').'</strong></p>'.
215
+	'<p>'.__('<a href="https://codex.wordpress.org/Posts_Screen" target="_blank">Documentation on Managing Posts</a>').'</p>'.
216
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
217 217
 	);
218 218
 
219
-} elseif ( 'page' == $post_type ) {
220
-	get_current_screen()->add_help_tab( array(
219
+} elseif ('page' == $post_type) {
220
+	get_current_screen()->add_help_tab(array(
221 221
 	'id'		=> 'overview',
222 222
 	'title'		=> __('Overview'),
223 223
 	'content'	=>
224
-		'<p>' . __('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.') . '</p>'
225
-	) );
226
-	get_current_screen()->add_help_tab( array(
224
+		'<p>'.__('Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.').'</p>'
225
+	));
226
+	get_current_screen()->add_help_tab(array(
227 227
 	'id'		=> 'managing-pages',
228 228
 	'title'		=> __('Managing Pages'),
229 229
 	'content'	=>
230
-		'<p>' . __('Managing pages is very similar to managing posts, and the screens can be customized in the same way.') . '</p>' .
231
-		'<p>' . __('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.') . '</p>'
232
-	) );
230
+		'<p>'.__('Managing pages is very similar to managing posts, and the screens can be customized in the same way.').'</p>'.
231
+		'<p>'.__('You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.').'</p>'
232
+	));
233 233
 
234 234
 	get_current_screen()->set_help_sidebar(
235
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
236
-	'<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen" target="_blank">Documentation on Managing Pages</a>') . '</p>' .
237
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
235
+	'<p><strong>'.__('For more information:').'</strong></p>'.
236
+	'<p>'.__('<a href="https://codex.wordpress.org/Pages_Screen" target="_blank">Documentation on Managing Pages</a>').'</p>'.
237
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
238 238
 	);
239 239
 }
240 240
 
241
-add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
241
+add_screen_option('per_page', array('default' => 20, 'option' => 'edit_'.$post_type.'_per_page'));
242 242
 
243 243
 $bulk_counts = array(
244
-	'updated'   => isset( $_REQUEST['updated'] )   ? absint( $_REQUEST['updated'] )   : 0,
245
-	'locked'    => isset( $_REQUEST['locked'] )    ? absint( $_REQUEST['locked'] )    : 0,
246
-	'deleted'   => isset( $_REQUEST['deleted'] )   ? absint( $_REQUEST['deleted'] )   : 0,
247
-	'trashed'   => isset( $_REQUEST['trashed'] )   ? absint( $_REQUEST['trashed'] )   : 0,
248
-	'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0,
244
+	'updated'   => isset($_REQUEST['updated']) ? absint($_REQUEST['updated']) : 0,
245
+	'locked'    => isset($_REQUEST['locked']) ? absint($_REQUEST['locked']) : 0,
246
+	'deleted'   => isset($_REQUEST['deleted']) ? absint($_REQUEST['deleted']) : 0,
247
+	'trashed'   => isset($_REQUEST['trashed']) ? absint($_REQUEST['trashed']) : 0,
248
+	'untrashed' => isset($_REQUEST['untrashed']) ? absint($_REQUEST['untrashed']) : 0,
249 249
 );
250 250
 
251 251
 $bulk_messages = array();
252 252
 $bulk_messages['post'] = array(
253
-	'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
254
-	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
255
-	                   _n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
256
-	'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
257
-	'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
258
-	'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
253
+	'updated'   => _n('%s post updated.', '%s posts updated.', $bulk_counts['updated']),
254
+	'locked'    => (1 == $bulk_counts['locked']) ? __('1 post not updated, somebody is editing it.') : _n('%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked']),
255
+	'deleted'   => _n('%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted']),
256
+	'trashed'   => _n('%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed']),
257
+	'untrashed' => _n('%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed']),
259 258
 );
260 259
 $bulk_messages['page'] = array(
261
-	'updated'   => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
262
-	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
263
-	                   _n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
264
-	'deleted'   => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
265
-	'trashed'   => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
266
-	'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
260
+	'updated'   => _n('%s page updated.', '%s pages updated.', $bulk_counts['updated']),
261
+	'locked'    => (1 == $bulk_counts['locked']) ? __('1 page not updated, somebody is editing it.') : _n('%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked']),
262
+	'deleted'   => _n('%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted']),
263
+	'trashed'   => _n('%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed']),
264
+	'untrashed' => _n('%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed']),
267 265
 );
268 266
 
269 267
 /**
@@ -277,51 +275,51 @@  discard block
 block discarded – undo
277 275
  *                             keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'.
278 276
  * @param array $bulk_counts   Array of item counts for each message, used to build internationalized strings.
279 277
  */
280
-$bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts );
281
-$bulk_counts = array_filter( $bulk_counts );
278
+$bulk_messages = apply_filters('bulk_post_updated_messages', $bulk_messages, $bulk_counts);
279
+$bulk_counts = array_filter($bulk_counts);
282 280
 
283
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
281
+require_once(ABSPATH.'wp-admin/admin-header.php');
284 282
 ?>
285 283
 <div class="wrap">
286 284
 <h1><?php
287
-echo esc_html( $post_type_object->labels->name );
288
-if ( current_user_can( $post_type_object->cap->create_posts ) )
289
-	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
290
-if ( ! empty( $_REQUEST['s'] ) )
291
-	printf( ' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() );
285
+echo esc_html($post_type_object->labels->name);
286
+if (current_user_can($post_type_object->cap->create_posts))
287
+	echo ' <a href="'.esc_url(admin_url($post_new_file)).'" class="page-title-action">'.esc_html($post_type_object->labels->add_new).'</a>';
288
+if ( ! empty($_REQUEST['s']))
289
+	printf(' <span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', get_search_query());
292 290
 ?></h1>
293 291
 
294 292
 <?php
295 293
 // If we have a bulk message to issue:
296 294
 $messages = array();
297
-foreach ( $bulk_counts as $message => $count ) {
298
-	if ( isset( $bulk_messages[ $post_type ][ $message ] ) )
299
-		$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
300
-	elseif ( isset( $bulk_messages['post'][ $message ] ) )
301
-		$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
302
-
303
-	if ( $message == 'trashed' && isset( $_REQUEST['ids'] ) ) {
304
-		$ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
305
-		$messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts" ) ) . '">' . __('Undo') . '</a>';
295
+foreach ($bulk_counts as $message => $count) {
296
+	if (isset($bulk_messages[$post_type][$message]))
297
+		$messages[] = sprintf($bulk_messages[$post_type][$message], number_format_i18n($count));
298
+	elseif (isset($bulk_messages['post'][$message]))
299
+		$messages[] = sprintf($bulk_messages['post'][$message], number_format_i18n($count));
300
+
301
+	if ($message == 'trashed' && isset($_REQUEST['ids'])) {
302
+		$ids = preg_replace('/[^0-9,]/', '', $_REQUEST['ids']);
303
+		$messages[] = '<a href="'.esc_url(wp_nonce_url("edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", "bulk-posts")).'">'.__('Undo').'</a>';
306 304
 	}
307 305
 }
308 306
 
309
-if ( $messages )
310
-	echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';
311
-unset( $messages );
307
+if ($messages)
308
+	echo '<div id="message" class="updated notice is-dismissible"><p>'.join(' ', $messages).'</p></div>';
309
+unset($messages);
312 310
 
313
-$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] );
311
+$_SERVER['REQUEST_URI'] = remove_query_arg(array('locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed'), $_SERVER['REQUEST_URI']);
314 312
 ?>
315 313
 
316 314
 <?php $wp_list_table->views(); ?>
317 315
 
318 316
 <form id="posts-filter" method="get">
319 317
 
320
-<?php $wp_list_table->search_box( $post_type_object->labels->search_items, 'post' ); ?>
318
+<?php $wp_list_table->search_box($post_type_object->labels->search_items, 'post'); ?>
321 319
 
322
-<input type="hidden" name="post_status" class="post_status_page" value="<?php echo !empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
320
+<input type="hidden" name="post_status" class="post_status_page" value="<?php echo ! empty($_REQUEST['post_status']) ? esc_attr($_REQUEST['post_status']) : 'all'; ?>" />
323 321
 <input type="hidden" name="post_type" class="post_type_page" value="<?php echo $post_type; ?>" />
324
-<?php if ( ! empty( $_REQUEST['show_sticky'] ) ) { ?>
322
+<?php if ( ! empty($_REQUEST['show_sticky'])) { ?>
325 323
 <input type="hidden" name="show_sticky" value="1" />
326 324
 <?php } ?>
327 325
 
@@ -330,7 +328,7 @@  discard block
 block discarded – undo
330 328
 </form>
331 329
 
332 330
 <?php
333
-if ( $wp_list_table->has_items() )
331
+if ($wp_list_table->has_items())
334 332
 	$wp_list_table->inline_edit();
335 333
 ?>
336 334
 
@@ -339,4 +337,4 @@  discard block
 block discarded – undo
339 337
 </div>
340 338
 
341 339
 <?php
342
-include( ABSPATH . 'wp-admin/admin-footer.php' );
340
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +46 added lines, -29 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
12
-if ( ! $typenow )
12
+if ( ! $typenow ) {
13 13
 	wp_die( __( 'Invalid post type' ) );
14
+}
14 15
 
15 16
 if ( 'attachment' === $typenow ) {
16 17
 	if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
@@ -27,11 +28,13 @@  discard block
 block discarded – undo
27 28
 $post_type = $typenow;
28 29
 $post_type_object = get_post_type_object( $post_type );
29 30
 
30
-if ( ! $post_type_object )
31
+if ( ! $post_type_object ) {
31 32
 	wp_die( __( 'Invalid post type' ) );
33
+}
32 34
 
33
-if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
35
+if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
34 36
 	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
37
+}
35 38
 
36 39
 $wp_list_table = _get_list_table('WP_Posts_List_Table');
37 40
 $pagenum = $wp_list_table->get_pagenum();
@@ -61,11 +64,13 @@  discard block
 block discarded – undo
61 64
 	check_admin_referer('bulk-posts');
62 65
 
63 66
 	$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'locked', 'ids'), wp_get_referer() );
64
-	if ( ! $sendback )
65
-		$sendback = admin_url( $parent_file );
67
+	if ( ! $sendback ) {
68
+			$sendback = admin_url( $parent_file );
69
+	}
66 70
 	$sendback = add_query_arg( 'paged', $pagenum, $sendback );
67
-	if ( strpos($sendback, 'post.php') !== false )
68
-		$sendback = admin_url($post_new_file);
71
+	if ( strpos($sendback, 'post.php') !== false ) {
72
+			$sendback = admin_url($post_new_file);
73
+	}
69 74
 
70 75
 	if ( 'delete_all' == $doaction ) {
71 76
 		// Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
@@ -93,16 +98,18 @@  discard block
 block discarded – undo
93 98
 			$trashed = $locked = 0;
94 99
 
95 100
 			foreach( (array) $post_ids as $post_id ) {
96
-				if ( !current_user_can( 'delete_post', $post_id) )
97
-					wp_die( __('You are not allowed to move this item to the Trash.') );
101
+				if ( !current_user_can( 'delete_post', $post_id) ) {
102
+									wp_die( __('You are not allowed to move this item to the Trash.') );
103
+				}
98 104
 
99 105
 				if ( wp_check_post_lock( $post_id ) ) {
100 106
 					$locked++;
101 107
 					continue;
102 108
 				}
103 109
 
104
-				if ( !wp_trash_post($post_id) )
105
-					wp_die( __('Error in moving to Trash.') );
110
+				if ( !wp_trash_post($post_id) ) {
111
+									wp_die( __('Error in moving to Trash.') );
112
+				}
106 113
 
107 114
 				$trashed++;
108 115
 			}
@@ -112,11 +119,13 @@  discard block
 block discarded – undo
112 119
 		case 'untrash':
113 120
 			$untrashed = 0;
114 121
 			foreach( (array) $post_ids as $post_id ) {
115
-				if ( !current_user_can( 'delete_post', $post_id) )
116
-					wp_die( __('You are not allowed to restore this item from the Trash.') );
122
+				if ( !current_user_can( 'delete_post', $post_id) ) {
123
+									wp_die( __('You are not allowed to restore this item from the Trash.') );
124
+				}
117 125
 
118
-				if ( !wp_untrash_post($post_id) )
119
-					wp_die( __('Error in restoring from Trash.') );
126
+				if ( !wp_untrash_post($post_id) ) {
127
+									wp_die( __('Error in restoring from Trash.') );
128
+				}
120 129
 
121 130
 				$untrashed++;
122 131
 			}
@@ -127,15 +136,18 @@  discard block
 block discarded – undo
127 136
 			foreach( (array) $post_ids as $post_id ) {
128 137
 				$post_del = get_post($post_id);
129 138
 
130
-				if ( !current_user_can( 'delete_post', $post_id ) )
131
-					wp_die( __('You are not allowed to delete this item.') );
139
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
140
+									wp_die( __('You are not allowed to delete this item.') );
141
+				}
132 142
 
133 143
 				if ( $post_del->post_type == 'attachment' ) {
134
-					if ( ! wp_delete_attachment($post_id) )
135
-						wp_die( __('Error in deleting.') );
144
+					if ( ! wp_delete_attachment($post_id) ) {
145
+											wp_die( __('Error in deleting.') );
146
+					}
136 147
 				} else {
137
-					if ( !wp_delete_post($post_id) )
138
-						wp_die( __('Error in deleting.') );
148
+					if ( !wp_delete_post($post_id) ) {
149
+											wp_die( __('Error in deleting.') );
150
+					}
139 151
 				}
140 152
 				$deleted++;
141 153
 			}
@@ -285,20 +297,23 @@  discard block
 block discarded – undo
285 297
 <div class="wrap">
286 298
 <h1><?php
287 299
 echo esc_html( $post_type_object->labels->name );
288
-if ( current_user_can( $post_type_object->cap->create_posts ) )
300
+if ( current_user_can( $post_type_object->cap->create_posts ) ) {
289 301
 	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
290
-if ( ! empty( $_REQUEST['s'] ) )
302
+}
303
+if ( ! empty( $_REQUEST['s'] ) ) {
291 304
 	printf( ' <span class="subtitle">' . __('Search results for &#8220;%s&#8221;') . '</span>', get_search_query() );
305
+}
292 306
 ?></h1>
293 307
 
294 308
 <?php
295 309
 // If we have a bulk message to issue:
296 310
 $messages = array();
297 311
 foreach ( $bulk_counts as $message => $count ) {
298
-	if ( isset( $bulk_messages[ $post_type ][ $message ] ) )
299
-		$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
300
-	elseif ( isset( $bulk_messages['post'][ $message ] ) )
301
-		$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
312
+	if ( isset( $bulk_messages[ $post_type ][ $message ] ) ) {
313
+			$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
314
+	} elseif ( isset( $bulk_messages['post'][ $message ] ) ) {
315
+			$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
316
+	}
302 317
 
303 318
 	if ( $message == 'trashed' && isset( $_REQUEST['ids'] ) ) {
304 319
 		$ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
@@ -306,8 +321,9 @@  discard block
 block discarded – undo
306 321
 	}
307 322
 }
308 323
 
309
-if ( $messages )
324
+if ( $messages ) {
310 325
 	echo '<div id="message" class="updated notice is-dismissible"><p>' . join( ' ', $messages ) . '</p></div>';
326
+}
311 327
 unset( $messages );
312 328
 
313 329
 $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'locked', 'skipped', 'updated', 'deleted', 'trashed', 'untrashed' ), $_SERVER['REQUEST_URI'] );
@@ -330,8 +346,9 @@  discard block
 block discarded – undo
330 346
 </form>
331 347
 
332 348
 <?php
333
-if ( $wp_list_table->has_items() )
349
+if ( $wp_list_table->has_items() ) {
334 350
 	$wp_list_table->inline_edit();
351
+}
335 352
 ?>
336 353
 
337 354
 <div id="ajax-response"></div>
Please login to merge, or discard this patch.
src/wp-admin/nav-menus.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * WordPress Administration for Navigation Menus
4
- * Interface functions
5
- *
6
- * @version 2.0.0
7
- *
8
- * @package WordPress
9
- * @subpackage Administration
10
- */
3
+	 * WordPress Administration for Navigation Menus
4
+	 * Interface functions
5
+	 *
6
+	 * @version 2.0.0
7
+	 *
8
+	 * @package WordPress
9
+	 * @subpackage Administration
10
+	 */
11 11
 
12 12
 /** Load WordPress Administration Bootstrap */
13 13
 require_once( dirname( __FILE__ ) . '/admin.php' );
Please login to merge, or discard this patch.
Spacing   +309 added lines, -309 removed lines patch added patch discarded remove patch
@@ -10,22 +10,22 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 /** Load WordPress Administration Bootstrap */
13
-require_once( dirname( __FILE__ ) . '/admin.php' );
13
+require_once(dirname(__FILE__).'/admin.php');
14 14
 
15 15
 // Load all the nav menu interface functions
16
-require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
16
+require_once(ABSPATH.'wp-admin/includes/nav-menu.php');
17 17
 
18
-if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
19
-	wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
18
+if ( ! current_theme_supports('menus') && ! current_theme_supports('widgets'))
19
+	wp_die(__('Your theme does not support navigation menus or widgets.'));
20 20
 
21 21
 // Permissions Check
22
-if ( ! current_user_can('edit_theme_options') )
23
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
22
+if ( ! current_user_can('edit_theme_options'))
23
+	wp_die(__('Cheatin&#8217; uh?'), 403);
24 24
 
25
-wp_enqueue_script( 'nav-menu' );
25
+wp_enqueue_script('nav-menu');
26 26
 
27
-if ( wp_is_mobile() )
28
-	wp_enqueue_script( 'jquery-touch-punch' );
27
+if (wp_is_mobile())
28
+	wp_enqueue_script('jquery-touch-punch');
29 29
 
30 30
 // Container for any messages displayed to the user
31 31
 $messages = array();
@@ -34,42 +34,42 @@  discard block
 block discarded – undo
34 34
 $nav_menu_selected_title = '';
35 35
 
36 36
 // The menu id of the current menu being edited
37
-$nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0;
37
+$nav_menu_selected_id = isset($_REQUEST['menu']) ? (int) $_REQUEST['menu'] : 0;
38 38
 
39 39
 // Get existing menu locations assignments
40 40
 $locations = get_registered_nav_menus();
41 41
 $menu_locations = get_nav_menu_locations();
42
-$num_locations = count( array_keys( $locations ) );
42
+$num_locations = count(array_keys($locations));
43 43
 
44 44
 // Allowed actions: add, update, delete
45
-$action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit';
45
+$action = isset($_REQUEST['action']) ? $_REQUEST['action'] : 'edit';
46 46
 
47
-switch ( $action ) {
47
+switch ($action) {
48 48
 	case 'add-menu-item':
49
-		check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' );
50
-		if ( isset( $_REQUEST['nav-menu-locations'] ) )
51
-			set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) );
52
-		elseif ( isset( $_REQUEST['menu-item'] ) )
53
-			wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] );
49
+		check_admin_referer('add-menu_item', 'menu-settings-column-nonce');
50
+		if (isset($_REQUEST['nav-menu-locations']))
51
+			set_theme_mod('nav_menu_locations', array_map('absint', $_REQUEST['menu-locations']));
52
+		elseif (isset($_REQUEST['menu-item']))
53
+			wp_save_nav_menu_items($nav_menu_selected_id, $_REQUEST['menu-item']);
54 54
 		break;
55 55
 	case 'move-down-menu-item' :
56 56
 
57 57
 		// Moving down a menu item is the same as moving up the next in order.
58
-		check_admin_referer( 'move-menu_item' );
59
-		$menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
60
-		if ( is_nav_menu_item( $menu_item_id ) ) {
61
-			$menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
62
-			if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
58
+		check_admin_referer('move-menu_item');
59
+		$menu_item_id = isset($_REQUEST['menu-item']) ? (int) $_REQUEST['menu-item'] : 0;
60
+		if (is_nav_menu_item($menu_item_id)) {
61
+			$menus = isset($_REQUEST['menu']) ? array((int) $_REQUEST['menu']) : wp_get_object_terms($menu_item_id, 'nav_menu', array('fields' => 'ids'));
62
+			if ( ! is_wp_error($menus) && ! empty($menus[0])) {
63 63
 				$menu_id = (int) $menus[0];
64
-				$ordered_menu_items = wp_get_nav_menu_items( $menu_id );
65
-				$menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
64
+				$ordered_menu_items = wp_get_nav_menu_items($menu_id);
65
+				$menu_item_data = (array) wp_setup_nav_menu_item(get_post($menu_item_id));
66 66
 
67 67
 				// Set up the data we need in one pass through the array of menu items.
68 68
 				$dbids_to_orders = array();
69 69
 				$orders_to_dbids = array();
70
-				foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
71
-					if ( isset( $ordered_menu_item_object->ID ) ) {
72
-						if ( isset( $ordered_menu_item_object->menu_order ) ) {
70
+				foreach ((array) $ordered_menu_items as $ordered_menu_item_object) {
71
+					if (isset($ordered_menu_item_object->ID)) {
72
+						if (isset($ordered_menu_item_object->menu_order)) {
73 73
 							$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
74 74
 							$orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
75 75
 						}
@@ -78,28 +78,28 @@  discard block
 block discarded – undo
78 78
 
79 79
 				// Get next in order.
80 80
 				if (
81
-					isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1] )
81
+					isset($orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1])
82 82
 				) {
83 83
 					$next_item_id = $orders_to_dbids[$dbids_to_orders[$menu_item_id] + 1];
84
-					$next_item_data = (array) wp_setup_nav_menu_item( get_post( $next_item_id ) );
84
+					$next_item_data = (array) wp_setup_nav_menu_item(get_post($next_item_id));
85 85
 
86 86
 					// If not siblings of same parent, bubble menu item up but keep order.
87 87
 					if (
88
-						! empty( $menu_item_data['menu_item_parent'] ) &&
88
+						! empty($menu_item_data['menu_item_parent']) &&
89 89
 						(
90
-							empty( $next_item_data['menu_item_parent'] ) ||
90
+							empty($next_item_data['menu_item_parent']) ||
91 91
 							$next_item_data['menu_item_parent'] != $menu_item_data['menu_item_parent']
92 92
 						)
93 93
 					) {
94 94
 
95
-						$parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
95
+						$parent_db_id = in_array($menu_item_data['menu_item_parent'], $orders_to_dbids) ? (int) $menu_item_data['menu_item_parent'] : 0;
96 96
 
97
-						$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
97
+						$parent_object = wp_setup_nav_menu_item(get_post($parent_db_id));
98 98
 
99
-						if ( ! is_wp_error( $parent_object ) ) {
99
+						if ( ! is_wp_error($parent_object)) {
100 100
 							$parent_data = (array) $parent_object;
101 101
 							$menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
102
-							update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
102
+							update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']);
103 103
 
104 104
 						}
105 105
 
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 						$menu_item_data['menu_order'] = $menu_item_data['menu_order'] + 1;
110 110
 
111 111
 						$menu_item_data['menu_item_parent'] = $next_item_data['ID'];
112
-						update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
112
+						update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']);
113 113
 
114 114
 						wp_update_post($menu_item_data);
115 115
 						wp_update_post($next_item_data);
@@ -117,32 +117,32 @@  discard block
 block discarded – undo
117 117
 
118 118
 				// The item is last but still has a parent, so bubble up.
119 119
 				} elseif (
120
-					! empty( $menu_item_data['menu_item_parent'] ) &&
121
-					in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids )
120
+					! empty($menu_item_data['menu_item_parent']) &&
121
+					in_array($menu_item_data['menu_item_parent'], $orders_to_dbids)
122 122
 				) {
123
-					$menu_item_data['menu_item_parent'] = (int) get_post_meta( $menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true);
124
-					update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
123
+					$menu_item_data['menu_item_parent'] = (int) get_post_meta($menu_item_data['menu_item_parent'], '_menu_item_menu_item_parent', true);
124
+					update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']);
125 125
 				}
126 126
 			}
127 127
 		}
128 128
 
129 129
 		break;
130 130
 	case 'move-up-menu-item' :
131
-		check_admin_referer( 'move-menu_item' );
132
-		$menu_item_id = isset( $_REQUEST['menu-item'] ) ? (int) $_REQUEST['menu-item'] : 0;
133
-		if ( is_nav_menu_item( $menu_item_id ) ) {
134
-			$menus = isset( $_REQUEST['menu'] ) ? array( (int) $_REQUEST['menu'] ) : wp_get_object_terms( $menu_item_id, 'nav_menu', array( 'fields' => 'ids' ) );
135
-			if ( ! is_wp_error( $menus ) && ! empty( $menus[0] ) ) {
131
+		check_admin_referer('move-menu_item');
132
+		$menu_item_id = isset($_REQUEST['menu-item']) ? (int) $_REQUEST['menu-item'] : 0;
133
+		if (is_nav_menu_item($menu_item_id)) {
134
+			$menus = isset($_REQUEST['menu']) ? array((int) $_REQUEST['menu']) : wp_get_object_terms($menu_item_id, 'nav_menu', array('fields' => 'ids'));
135
+			if ( ! is_wp_error($menus) && ! empty($menus[0])) {
136 136
 				$menu_id = (int) $menus[0];
137
-				$ordered_menu_items = wp_get_nav_menu_items( $menu_id );
138
-				$menu_item_data = (array) wp_setup_nav_menu_item( get_post( $menu_item_id ) );
137
+				$ordered_menu_items = wp_get_nav_menu_items($menu_id);
138
+				$menu_item_data = (array) wp_setup_nav_menu_item(get_post($menu_item_id));
139 139
 
140 140
 				// Set up the data we need in one pass through the array of menu items.
141 141
 				$dbids_to_orders = array();
142 142
 				$orders_to_dbids = array();
143
-				foreach( (array) $ordered_menu_items as $ordered_menu_item_object ) {
144
-					if ( isset( $ordered_menu_item_object->ID ) ) {
145
-						if ( isset( $ordered_menu_item_object->menu_order ) ) {
143
+				foreach ((array) $ordered_menu_items as $ordered_menu_item_object) {
144
+					if (isset($ordered_menu_item_object->ID)) {
145
+						if (isset($ordered_menu_item_object->menu_order)) {
146 146
 							$dbids_to_orders[$ordered_menu_item_object->ID] = $ordered_menu_item_object->menu_order;
147 147
 							$orders_to_dbids[$ordered_menu_item_object->menu_order] = $ordered_menu_item_object->ID;
148 148
 						}
@@ -150,19 +150,19 @@  discard block
 block discarded – undo
150 150
 				}
151 151
 
152 152
 				// If this menu item is not first.
153
-				if ( ! empty( $dbids_to_orders[$menu_item_id] ) && ! empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ) {
153
+				if ( ! empty($dbids_to_orders[$menu_item_id]) && ! empty($orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1])) {
154 154
 
155 155
 					// If this menu item is a child of the previous.
156 156
 					if (
157
-						! empty( $menu_item_data['menu_item_parent'] ) &&
158
-						in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) &&
159
-						isset( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) &&
160
-						( $menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] )
157
+						! empty($menu_item_data['menu_item_parent']) &&
158
+						in_array($menu_item_data['menu_item_parent'], array_keys($dbids_to_orders)) &&
159
+						isset($orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]) &&
160
+						($menu_item_data['menu_item_parent'] == $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1])
161 161
 					) {
162
-						$parent_db_id = in_array( $menu_item_data['menu_item_parent'], $orders_to_dbids ) ? (int) $menu_item_data['menu_item_parent'] : 0;
163
-						$parent_object = wp_setup_nav_menu_item( get_post( $parent_db_id ) );
162
+						$parent_db_id = in_array($menu_item_data['menu_item_parent'], $orders_to_dbids) ? (int) $menu_item_data['menu_item_parent'] : 0;
163
+						$parent_object = wp_setup_nav_menu_item(get_post($parent_db_id));
164 164
 
165
-						if ( ! is_wp_error( $parent_object ) ) {
165
+						if ( ! is_wp_error($parent_object)) {
166 166
 							$parent_data = (array) $parent_object;
167 167
 
168 168
 							/*
@@ -170,9 +170,9 @@  discard block
 block discarded – undo
170 170
 							 * make menu item a child also of it.
171 171
 							 */
172 172
 							if (
173
-								! empty( $dbids_to_orders[$parent_db_id] ) &&
174
-								! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] ) &&
175
-								! empty( $parent_data['menu_item_parent'] )
173
+								! empty($dbids_to_orders[$parent_db_id]) &&
174
+								! empty($orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1]) &&
175
+								! empty($parent_data['menu_item_parent'])
176 176
 							) {
177 177
 								$menu_item_data['menu_item_parent'] = $parent_data['menu_item_parent'];
178 178
 
@@ -181,11 +181,11 @@  discard block
 block discarded – undo
181 181
 							 * make menu item a child of that something's parent
182 182
 							 */
183 183
 							} elseif (
184
-								! empty( $dbids_to_orders[$parent_db_id] ) &&
185
-								! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] )
184
+								! empty($dbids_to_orders[$parent_db_id]) &&
185
+								! empty($orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1])
186 186
 							) {
187
-								$_possible_parent_id = (int) get_post_meta( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true);
188
-								if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) )
187
+								$_possible_parent_id = (int) get_post_meta($orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true);
188
+								if (in_array($_possible_parent_id, array_keys($dbids_to_orders)))
189 189
 									$menu_item_data['menu_item_parent'] = $_possible_parent_id;
190 190
 								else
191 191
 									$menu_item_data['menu_item_parent'] = 0;
@@ -202,22 +202,22 @@  discard block
 block discarded – undo
202 202
 							$menu_item_data['menu_order'] = $menu_item_data['menu_order'] - 1;
203 203
 
204 204
 							// Save changes.
205
-							update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
205
+							update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']);
206 206
 							wp_update_post($menu_item_data);
207 207
 							wp_update_post($parent_data);
208 208
 						}
209 209
 
210 210
 					// Else this menu item is not a child of the previous.
211 211
 					} elseif (
212
-						empty( $menu_item_data['menu_order'] ) ||
213
-						empty( $menu_item_data['menu_item_parent'] ) ||
214
-						! in_array( $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ) ) ||
215
-						empty( $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] ) ||
212
+						empty($menu_item_data['menu_order']) ||
213
+						empty($menu_item_data['menu_item_parent']) ||
214
+						! in_array($menu_item_data['menu_item_parent'], array_keys($dbids_to_orders)) ||
215
+						empty($orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1]) ||
216 216
 						$orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1] != $menu_item_data['menu_item_parent']
217 217
 					) {
218 218
 						// Just make it a child of the previous; keep the order.
219 219
 						$menu_item_data['menu_item_parent'] = (int) $orders_to_dbids[$dbids_to_orders[$menu_item_id] - 1];
220
-						update_post_meta( $menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent'] );
220
+						update_post_meta($menu_item_data['ID'], '_menu_item_menu_item_parent', (int) $menu_item_data['menu_item_parent']);
221 221
 						wp_update_post($menu_item_data);
222 222
 					}
223 223
 				}
@@ -228,244 +228,244 @@  discard block
 block discarded – undo
228 228
 	case 'delete-menu-item':
229 229
 		$menu_item_id = (int) $_REQUEST['menu-item'];
230 230
 
231
-		check_admin_referer( 'delete-menu_item_' . $menu_item_id );
231
+		check_admin_referer('delete-menu_item_'.$menu_item_id);
232 232
 
233
-		if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) )
234
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';
233
+		if (is_nav_menu_item($menu_item_id) && wp_delete_post($menu_item_id, true))
234
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('The menu item has been successfully deleted.').'</p></div>';
235 235
 		break;
236 236
 
237 237
 	case 'delete':
238
-		check_admin_referer( 'delete-nav_menu-' . $nav_menu_selected_id );
239
-		if ( is_nav_menu( $nav_menu_selected_id ) ) {
240
-			$deletion = wp_delete_nav_menu( $nav_menu_selected_id );
238
+		check_admin_referer('delete-nav_menu-'.$nav_menu_selected_id);
239
+		if (is_nav_menu($nav_menu_selected_id)) {
240
+			$deletion = wp_delete_nav_menu($nav_menu_selected_id);
241 241
 		} else {
242 242
 			// Reset the selected menu.
243 243
 			$nav_menu_selected_id = 0;
244
-			unset( $_REQUEST['menu'] );
244
+			unset($_REQUEST['menu']);
245 245
 		}
246 246
 
247
-		if ( ! isset( $deletion ) )
247
+		if ( ! isset($deletion))
248 248
 			break;
249 249
 
250
-		if ( is_wp_error( $deletion ) )
251
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>';
250
+		if (is_wp_error($deletion))
251
+			$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$deletion->get_error_message().'</p></div>';
252 252
 		else
253
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>';
253
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('The menu has been successfully deleted.').'</p></div>';
254 254
 		break;
255 255
 
256 256
 	case 'delete_menus':
257
-		check_admin_referer( 'nav_menus_bulk_actions' );
258
-		foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) {
259
-			if ( ! is_nav_menu( $menu_id_to_delete ) )
257
+		check_admin_referer('nav_menus_bulk_actions');
258
+		foreach ($_REQUEST['delete_menus'] as $menu_id_to_delete) {
259
+			if ( ! is_nav_menu($menu_id_to_delete))
260 260
 				continue;
261 261
 
262
-			$deletion = wp_delete_nav_menu( $menu_id_to_delete );
263
-			if ( is_wp_error( $deletion ) ) {
264
-				$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>';
262
+			$deletion = wp_delete_nav_menu($menu_id_to_delete);
263
+			if (is_wp_error($deletion)) {
264
+				$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$deletion->get_error_message().'</p></div>';
265 265
 				$deletion_error = true;
266 266
 			}
267 267
 		}
268 268
 
269
-		if ( empty( $deletion_error ) )
270
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>';
269
+		if (empty($deletion_error))
270
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Selected menus have been successfully deleted.').'</p></div>';
271 271
 		break;
272 272
 
273 273
 	case 'update':
274
-		check_admin_referer( 'update-nav_menu', 'update-nav-menu-nonce' );
274
+		check_admin_referer('update-nav_menu', 'update-nav-menu-nonce');
275 275
 
276 276
 		// Remove menu locations that have been unchecked.
277
-		foreach ( $locations as $location => $description ) {
278
-			if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id )
279
-				unset( $menu_locations[ $location ] );
277
+		foreach ($locations as $location => $description) {
278
+			if ((empty($_POST['menu-locations']) || empty($_POST['menu-locations'][$location])) && isset($menu_locations[$location]) && $menu_locations[$location] == $nav_menu_selected_id)
279
+				unset($menu_locations[$location]);
280 280
 		}
281 281
 
282 282
 		// Merge new and existing menu locations if any new ones are set.
283
-		if ( isset( $_POST['menu-locations'] ) ) {
284
-			$new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
285
-			$menu_locations = array_merge( $menu_locations, $new_menu_locations );
283
+		if (isset($_POST['menu-locations'])) {
284
+			$new_menu_locations = array_map('absint', $_POST['menu-locations']);
285
+			$menu_locations = array_merge($menu_locations, $new_menu_locations);
286 286
 		}
287 287
 
288 288
 		// Set menu locations.
289
-		set_theme_mod( 'nav_menu_locations', $menu_locations );
289
+		set_theme_mod('nav_menu_locations', $menu_locations);
290 290
 
291 291
 		// Add Menu.
292
-		if ( 0 == $nav_menu_selected_id ) {
293
-			$new_menu_title = trim( esc_html( $_POST['menu-name'] ) );
292
+		if (0 == $nav_menu_selected_id) {
293
+			$new_menu_title = trim(esc_html($_POST['menu-name']));
294 294
 
295
-			if ( $new_menu_title ) {
296
-				$_nav_menu_selected_id = wp_update_nav_menu_object( 0, array('menu-name' => $new_menu_title) );
295
+			if ($new_menu_title) {
296
+				$_nav_menu_selected_id = wp_update_nav_menu_object(0, array('menu-name' => $new_menu_title));
297 297
 
298
-				if ( is_wp_error( $_nav_menu_selected_id ) ) {
299
-					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
298
+				if (is_wp_error($_nav_menu_selected_id)) {
299
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$_nav_menu_selected_id->get_error_message().'</p></div>';
300 300
 				} else {
301
-					$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
301
+					$_menu_object = wp_get_nav_menu_object($_nav_menu_selected_id);
302 302
 					$nav_menu_selected_id = $_nav_menu_selected_id;
303 303
 					$nav_menu_selected_title = $_menu_object->name;
304
-					if ( isset( $_REQUEST['menu-item'] ) )
305
-						wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) );
306
-					if ( isset( $_REQUEST['zero-menu-state'] ) ) {
304
+					if (isset($_REQUEST['menu-item']))
305
+						wp_save_nav_menu_items($nav_menu_selected_id, absint($_REQUEST['menu-item']));
306
+					if (isset($_REQUEST['zero-menu-state'])) {
307 307
 						// If there are menu items, add them
308
-						wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title );
308
+						wp_nav_menu_update_menu_items($nav_menu_selected_id, $nav_menu_selected_title);
309 309
 						// Auto-save nav_menu_locations
310 310
 						$locations = get_nav_menu_locations();
311
-						foreach ( $locations as $location => $menu_id ) {
312
-								$locations[ $location ] = $nav_menu_selected_id;
311
+						foreach ($locations as $location => $menu_id) {
312
+								$locations[$location] = $nav_menu_selected_id;
313 313
 								break; // There should only be 1
314 314
 						}
315
-						set_theme_mod( 'nav_menu_locations', $locations );
315
+						set_theme_mod('nav_menu_locations', $locations);
316 316
 					}
317
-					if ( isset( $_REQUEST['use-location'] ) ) {
317
+					if (isset($_REQUEST['use-location'])) {
318 318
 						$locations = get_registered_nav_menus();
319 319
 						$menu_locations = get_nav_menu_locations();
320
-						if ( isset( $locations[ $_REQUEST['use-location'] ] ) )
321
-							$menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id;
322
-						set_theme_mod( 'nav_menu_locations', $menu_locations );
320
+						if (isset($locations[$_REQUEST['use-location']]))
321
+							$menu_locations[$_REQUEST['use-location']] = $nav_menu_selected_id;
322
+						set_theme_mod('nav_menu_locations', $menu_locations);
323 323
 					}
324 324
 
325 325
 					// $messages[] = '<div id="message" class="updated"><p>' . sprintf( __( '<strong>%s</strong> has been created.' ), $nav_menu_selected_title ) . '</p></div>';
326
-					wp_redirect( admin_url( 'nav-menus.php?menu=' . $_nav_menu_selected_id ) );
326
+					wp_redirect(admin_url('nav-menus.php?menu='.$_nav_menu_selected_id));
327 327
 					exit();
328 328
 				}
329 329
 			} else {
330
-				$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
330
+				$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('Please enter a valid menu name.').'</p></div>';
331 331
 			}
332 332
 
333 333
 		// Update existing menu.
334 334
 		} else {
335 335
 
336
-			$_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
336
+			$_menu_object = wp_get_nav_menu_object($nav_menu_selected_id);
337 337
 
338
-			$menu_title = trim( esc_html( $_POST['menu-name'] ) );
339
-			if ( ! $menu_title ) {
340
-				$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . __( 'Please enter a valid menu name.' ) . '</p></div>';
338
+			$menu_title = trim(esc_html($_POST['menu-name']));
339
+			if ( ! $menu_title) {
340
+				$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.__('Please enter a valid menu name.').'</p></div>';
341 341
 				$menu_title = $_menu_object->name;
342 342
 			}
343 343
 
344
-			if ( ! is_wp_error( $_menu_object ) ) {
345
-				$_nav_menu_selected_id = wp_update_nav_menu_object( $nav_menu_selected_id, array( 'menu-name' => $menu_title ) );
346
-				if ( is_wp_error( $_nav_menu_selected_id ) ) {
344
+			if ( ! is_wp_error($_menu_object)) {
345
+				$_nav_menu_selected_id = wp_update_nav_menu_object($nav_menu_selected_id, array('menu-name' => $menu_title));
346
+				if (is_wp_error($_nav_menu_selected_id)) {
347 347
 					$_menu_object = $_nav_menu_selected_id;
348
-					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $_nav_menu_selected_id->get_error_message() . '</p></div>';
348
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>'.$_nav_menu_selected_id->get_error_message().'</p></div>';
349 349
 				} else {
350
-					$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
350
+					$_menu_object = wp_get_nav_menu_object($_nav_menu_selected_id);
351 351
 					$nav_menu_selected_title = $_menu_object->name;
352 352
 				}
353 353
 			}
354 354
 
355 355
 			// Update menu items.
356
-			if ( ! is_wp_error( $_menu_object ) ) {
357
-				$messages = array_merge( $messages, wp_nav_menu_update_menu_items( $_nav_menu_selected_id, $nav_menu_selected_title ) );
356
+			if ( ! is_wp_error($_menu_object)) {
357
+				$messages = array_merge($messages, wp_nav_menu_update_menu_items($_nav_menu_selected_id, $nav_menu_selected_title));
358 358
 
359 359
 				// If the menu ID changed, redirect to the new URL.
360
-				if ( $nav_menu_selected_id != $_nav_menu_selected_id ) {
361
-					wp_redirect( admin_url( 'nav-menus.php?menu=' . intval( $_nav_menu_selected_id ) ) );
360
+				if ($nav_menu_selected_id != $_nav_menu_selected_id) {
361
+					wp_redirect(admin_url('nav-menus.php?menu='.intval($_nav_menu_selected_id)));
362 362
 					exit();
363 363
 				}
364 364
 			}
365 365
 		}
366 366
 		break;
367 367
 	case 'locations':
368
-		if ( ! $num_locations ) {
369
-			wp_redirect( admin_url( 'nav-menus.php' ) );
368
+		if ( ! $num_locations) {
369
+			wp_redirect(admin_url('nav-menus.php'));
370 370
 			exit();
371 371
 		}
372 372
 
373
-		add_filter( 'screen_options_show_screen', '__return_false' );
373
+		add_filter('screen_options_show_screen', '__return_false');
374 374
 
375
-		if ( isset( $_POST['menu-locations'] ) ) {
376
-			check_admin_referer( 'save-menu-locations' );
375
+		if (isset($_POST['menu-locations'])) {
376
+			check_admin_referer('save-menu-locations');
377 377
 
378
-			$new_menu_locations = array_map( 'absint', $_POST['menu-locations'] );
379
-			$menu_locations = array_merge( $menu_locations, $new_menu_locations );
378
+			$new_menu_locations = array_map('absint', $_POST['menu-locations']);
379
+			$menu_locations = array_merge($menu_locations, $new_menu_locations);
380 380
 			// Set menu locations
381
-			set_theme_mod( 'nav_menu_locations', $menu_locations );
381
+			set_theme_mod('nav_menu_locations', $menu_locations);
382 382
 
383
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Menu locations updated.' ) . '</p></div>';
383
+			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>'.__('Menu locations updated.').'</p></div>';
384 384
 		}
385 385
 		break;
386 386
 }
387 387
 
388 388
 // Get all nav menus.
389 389
 $nav_menus = wp_get_nav_menus();
390
-$menu_count = count( $nav_menus );
390
+$menu_count = count($nav_menus);
391 391
 
392 392
 // Are we on the add new screen?
393
-$add_new_screen = ( isset( $_GET['menu'] ) && 0 == $_GET['menu'] ) ? true : false;
393
+$add_new_screen = (isset($_GET['menu']) && 0 == $_GET['menu']) ? true : false;
394 394
 
395
-$locations_screen = ( isset( $_GET['action'] ) && 'locations' == $_GET['action'] ) ? true : false;
395
+$locations_screen = (isset($_GET['action']) && 'locations' == $_GET['action']) ? true : false;
396 396
 
397 397
 /*
398 398
  * If we have one theme location, and zero menus, we take them right
399 399
  * into editing their first menu.
400 400
  */
401
-$page_count = wp_count_posts( 'page' );
402
-$one_theme_location_no_menus = ( 1 == count( get_registered_nav_menus() ) && ! $add_new_screen && empty( $nav_menus ) && ! empty( $page_count->publish ) ) ? true : false;
401
+$page_count = wp_count_posts('page');
402
+$one_theme_location_no_menus = (1 == count(get_registered_nav_menus()) && ! $add_new_screen && empty($nav_menus) && ! empty($page_count->publish)) ? true : false;
403 403
 
404 404
 $nav_menus_l10n = array(
405 405
 	'oneThemeLocationNoMenus' => $one_theme_location_no_menus,
406
-	'moveUp'       => __( 'Move up one' ),
407
-	'moveDown'     => __( 'Move down one' ),
408
-	'moveToTop'    => __( 'Move to the top' ),
406
+	'moveUp'       => __('Move up one'),
407
+	'moveDown'     => __('Move down one'),
408
+	'moveToTop'    => __('Move to the top'),
409 409
 	/* translators: %s: previous item name */
410
-	'moveUnder'    => __( 'Move under %s' ),
410
+	'moveUnder'    => __('Move under %s'),
411 411
 	/* translators: %s: previous item name */
412
-	'moveOutFrom'  => __( 'Move out from under %s' ),
412
+	'moveOutFrom'  => __('Move out from under %s'),
413 413
 	/* translators: %s: previous item name */
414
-	'under'        => __( 'Under %s' ),
414
+	'under'        => __('Under %s'),
415 415
 	/* translators: %s: previous item name */
416
-	'outFrom'      => __( 'Out from under %s' ),
416
+	'outFrom'      => __('Out from under %s'),
417 417
 	/* translators: 1: item name, 2: item position, 3: total number of items */
418
-	'menuFocus'    => __( '%1$s. Menu item %2$d of %3$d.' ),
418
+	'menuFocus'    => __('%1$s. Menu item %2$d of %3$d.'),
419 419
 	/* translators: 1: item name, 2: item position, 3: parent item name */
420
-	'subMenuFocus' => __( '%1$s. Sub item number %2$d under %3$s.' ),
420
+	'subMenuFocus' => __('%1$s. Sub item number %2$d under %3$s.'),
421 421
 );
422
-wp_localize_script( 'nav-menu', 'menus', $nav_menus_l10n );
422
+wp_localize_script('nav-menu', 'menus', $nav_menus_l10n);
423 423
 
424 424
 /*
425 425
  * Redirect to add screen if there are no menus and this users has either zero,
426 426
  * or more than 1 theme locations.
427 427
  */
428
-if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus )
429
-	wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) );
428
+if (0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus)
429
+	wp_redirect(admin_url('nav-menus.php?action=edit&menu=0'));
430 430
 
431 431
 // Get recently edited nav menu.
432
-$recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
433
-if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) )
432
+$recently_edited = absint(get_user_option('nav_menu_recently_edited'));
433
+if (empty($recently_edited) && is_nav_menu($nav_menu_selected_id))
434 434
 	$recently_edited = $nav_menu_selected_id;
435 435
 
436 436
 // Use $recently_edited if none are selected.
437
-if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) )
437
+if (empty($nav_menu_selected_id) && ! isset($_GET['menu']) && is_nav_menu($recently_edited))
438 438
 	$nav_menu_selected_id = $recently_edited;
439 439
 
440 440
 // On deletion of menu, if another menu exists, show it.
441
-if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] )
441
+if ( ! $add_new_screen && 0 < $menu_count && isset($_GET['action']) && 'delete' == $_GET['action'])
442 442
 	$nav_menu_selected_id = $nav_menus[0]->term_id;
443 443
 
444 444
 // Set $nav_menu_selected_id to 0 if no menus.
445
-if ( $one_theme_location_no_menus ) {
445
+if ($one_theme_location_no_menus) {
446 446
 	$nav_menu_selected_id = 0;
447
-} elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) {
447
+} elseif (empty($nav_menu_selected_id) && ! empty($nav_menus) && ! $add_new_screen) {
448 448
 	// if we have no selection yet, and we have menus, set to the first one in the list.
449 449
 	$nav_menu_selected_id = $nav_menus[0]->term_id;
450 450
 }
451 451
 
452 452
 // Update the user's setting.
453
-if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )
454
-	update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
453
+if ($nav_menu_selected_id != $recently_edited && is_nav_menu($nav_menu_selected_id))
454
+	update_user_meta($current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id);
455 455
 
456 456
 // If there's a menu, get its name.
457
-if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) {
458
-	$_menu_object = wp_get_nav_menu_object( $nav_menu_selected_id );
459
-	$nav_menu_selected_title = ! is_wp_error( $_menu_object ) ? $_menu_object->name : '';
457
+if ( ! $nav_menu_selected_title && is_nav_menu($nav_menu_selected_id)) {
458
+	$_menu_object = wp_get_nav_menu_object($nav_menu_selected_id);
459
+	$nav_menu_selected_title = ! is_wp_error($_menu_object) ? $_menu_object->name : '';
460 460
 }
461 461
 
462 462
 // Generate truncated menu names.
463
-foreach( (array) $nav_menus as $key => $_nav_menu ) {
464
-	$nav_menus[$key]->truncated_name = wp_html_excerpt( $_nav_menu->name, 40, '&hellip;' );
463
+foreach ((array) $nav_menus as $key => $_nav_menu) {
464
+	$nav_menus[$key]->truncated_name = wp_html_excerpt($_nav_menu->name, 40, '&hellip;');
465 465
 }
466 466
 
467 467
 // Retrieve menu locations.
468
-if ( current_theme_supports( 'menus' ) ) {
468
+if (current_theme_supports('menus')) {
469 469
 	$locations = get_registered_nav_menus();
470 470
 	$menu_locations = get_nav_menu_locations();
471 471
 }
@@ -480,9 +480,9 @@  discard block
 block discarded – undo
480 480
 $_wp_nav_menu_max_depth = 0;
481 481
 
482 482
 // Calling wp_get_nav_menu_to_edit generates $_wp_nav_menu_max_depth.
483
-if ( is_nav_menu( $nav_menu_selected_id ) ) {
484
-	$menu_items = wp_get_nav_menu_items( $nav_menu_selected_id, array( 'post_status' => 'any' ) );
485
-	$edit_markup = wp_get_nav_menu_to_edit( $nav_menu_selected_id );
483
+if (is_nav_menu($nav_menu_selected_id)) {
484
+	$menu_items = wp_get_nav_menu_items($nav_menu_selected_id, array('post_status' => 'any'));
485
+	$edit_markup = wp_get_nav_menu_to_edit($nav_menu_selected_id);
486 486
 }
487 487
 
488 488
 /**
@@ -492,7 +492,7 @@  discard block
 block discarded – undo
492 492
  * @param string $classes
493 493
  * @return string
494 494
  */
495
-function wp_nav_menu_max_depth( $classes ) {
495
+function wp_nav_menu_max_depth($classes) {
496 496
 	global $_wp_nav_menu_max_depth;
497 497
 	return "$classes menu-max-depth-$_wp_nav_menu_max_depth";
498 498
 }
@@ -502,138 +502,138 @@  discard block
 block discarded – undo
502 502
 wp_nav_menu_setup();
503 503
 wp_initial_nav_menu_meta_boxes();
504 504
 
505
-if ( ! current_theme_supports( 'menus' ) && ! $num_locations )
506
-	$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%s">Widgets</a> screen.' ), admin_url( 'widgets.php' ) ) . '</p></div>';
505
+if ( ! current_theme_supports('menus') && ! $num_locations)
506
+	$messages[] = '<div id="message" class="updated"><p>'.sprintf(__('Your theme does not natively support menus, but you can use them in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%s">Widgets</a> screen.'), admin_url('widgets.php')).'</p></div>';
507 507
 
508
-if ( ! $locations_screen ) : // Main tab
509
-	$overview  = '<p>' . __( 'This screen is used for managing your custom navigation menus.' ) . '</p>';
510
-	$overview .= '<p>' . sprintf( __( 'Menus can be displayed in locations defined by your theme, even used in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.' ), admin_url( 'widgets.php' ), 'Twenty Fifteen', 'Twenty Fourteen' ) . '</p>';
511
-	$overview .= '<p>' . __( 'From this screen you can:' ) . '</p>';
512
-	$overview .= '<ul><li>' . __( 'Create, edit, and delete menus' ) . '</li>';
513
-	$overview .= '<li>' . __( 'Add, organize, and modify individual menu items' ) . '</li></ul>';
508
+if ( ! $locations_screen) : // Main tab
509
+	$overview  = '<p>'.__('This screen is used for managing your custom navigation menus.').'</p>';
510
+	$overview .= '<p>'.sprintf(__('Menus can be displayed in locations defined by your theme, even used in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%1$s">Widgets</a> screen. If your theme does not support the custom menus feature (the default themes, %2$s and %3$s, do), you can learn about adding this support by following the Documentation link to the side.'), admin_url('widgets.php'), 'Twenty Fifteen', 'Twenty Fourteen').'</p>';
511
+	$overview .= '<p>'.__('From this screen you can:').'</p>';
512
+	$overview .= '<ul><li>'.__('Create, edit, and delete menus').'</li>';
513
+	$overview .= '<li>'.__('Add, organize, and modify individual menu items').'</li></ul>';
514 514
 
515
-	get_current_screen()->add_help_tab( array(
515
+	get_current_screen()->add_help_tab(array(
516 516
 		'id'      => 'overview',
517
-		'title'   => __( 'Overview' ),
517
+		'title'   => __('Overview'),
518 518
 		'content' => $overview
519
-	) );
519
+	));
520 520
 
521
-	$menu_management  = '<p>' . __( 'The menu management box at the top of the screen is used to control which menu is opened in the editor below.' ) . '</p>';
522
-	$menu_management .= '<ul><li>' . __( 'To edit an existing menu, <strong>choose a menu from the drop down and click Select</strong>' ) . '</li>';
523
-	$menu_management .= '<li>' . __( 'If you haven&#8217;t yet created any menus, <strong>click the &#8217;create a new menu&#8217; link</strong> to get started' ) . '</li></ul>';
524
-	$menu_management .= '<p>' . __( 'You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.' ) . '</p>';
521
+	$menu_management  = '<p>'.__('The menu management box at the top of the screen is used to control which menu is opened in the editor below.').'</p>';
522
+	$menu_management .= '<ul><li>'.__('To edit an existing menu, <strong>choose a menu from the drop down and click Select</strong>').'</li>';
523
+	$menu_management .= '<li>'.__('If you haven&#8217;t yet created any menus, <strong>click the &#8217;create a new menu&#8217; link</strong> to get started').'</li></ul>';
524
+	$menu_management .= '<p>'.__('You can assign theme locations to individual menus by <strong>selecting the desired settings</strong> at the bottom of the menu editor. To assign menus to all theme locations at once, <strong>visit the Manage Locations tab</strong> at the top of the screen.').'</p>';
525 525
 
526
-	get_current_screen()->add_help_tab( array(
526
+	get_current_screen()->add_help_tab(array(
527 527
 		'id'      => 'menu-management',
528
-		'title'   => __( 'Menu Management' ),
528
+		'title'   => __('Menu Management'),
529 529
 		'content' => $menu_management
530
-	) );
530
+	));
531 531
 
532
-	$editing_menus  = '<p>' . __( 'Each custom menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.' ) . '</p>';
533
-	$editing_menus .= '<p>' . __( '<strong>Clicking the arrow to the right of any menu item</strong> in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.' ) . '</p>';
534
-	$editing_menus .= '<ul><li>' . __( 'Add one or several items at once by <strong>selecting the checkbox next to each item and clicking Add to Menu</strong>' ) . '</li>';
535
-	$editing_menus .= '<li>' . __( 'To add a custom link, <strong>expand the Custom Links section, enter a URL and link text, and click Add to Menu</strong>' ) .'</li>';
536
-	$editing_menus .= '<li>' . __( 'To reorganize menu items, <strong>drag and drop items with your mouse or use your keyboard</strong>. Drag or move a menu item a little to the right to make it a submenu' ) . '</li>';
537
-	$editing_menus .= '<li>' . __( 'Delete a menu item by <strong>expanding it and clicking the Remove link</strong>' ) . '</li></ul>';
532
+	$editing_menus  = '<p>'.__('Each custom menu may contain a mix of links to pages, categories, custom URLs or other content types. Menu links are added by selecting items from the expanding boxes in the left-hand column below.').'</p>';
533
+	$editing_menus .= '<p>'.__('<strong>Clicking the arrow to the right of any menu item</strong> in the editor will reveal a standard group of settings. Additional settings such as link target, CSS classes, link relationships, and link descriptions can be enabled and disabled via the Screen Options tab.').'</p>';
534
+	$editing_menus .= '<ul><li>'.__('Add one or several items at once by <strong>selecting the checkbox next to each item and clicking Add to Menu</strong>').'</li>';
535
+	$editing_menus .= '<li>'.__('To add a custom link, <strong>expand the Custom Links section, enter a URL and link text, and click Add to Menu</strong>').'</li>';
536
+	$editing_menus .= '<li>'.__('To reorganize menu items, <strong>drag and drop items with your mouse or use your keyboard</strong>. Drag or move a menu item a little to the right to make it a submenu').'</li>';
537
+	$editing_menus .= '<li>'.__('Delete a menu item by <strong>expanding it and clicking the Remove link</strong>').'</li></ul>';
538 538
 
539
-	get_current_screen()->add_help_tab( array(
539
+	get_current_screen()->add_help_tab(array(
540 540
 		'id'      => 'editing-menus',
541
-		'title'   => __( 'Editing Menus' ),
541
+		'title'   => __('Editing Menus'),
542 542
 		'content' => $editing_menus
543
-	) );
543
+	));
544 544
 else : // Locations Tab.
545
-	$locations_overview  = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>';
546
-	$locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location&#8217;s drop down.</strong> When you&#8217;re finished, <strong>click Save Changes</strong>' ) . '</li>';
547
-	$locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent &#8217;Edit&#8217; link</strong>' ) . '</li>';
548
-	$locations_overview .= '<li>' . __( 'To add a new menu instead of assigning an existing one, <strong>click the &#8217;Use new menu&#8217; link</strong>. Your new menu will be automatically assigned to that theme location' ) . '</li></ul>';
545
+	$locations_overview  = '<p>'.__('This screen is used for globally assigning menus to locations defined by your theme.').'</p>';
546
+	$locations_overview .= '<ul><li>'.__('To assign menus to one or more theme locations, <strong>select a menu from each location&#8217;s drop down.</strong> When you&#8217;re finished, <strong>click Save Changes</strong>').'</li>';
547
+	$locations_overview .= '<li>'.__('To edit a menu currently assigned to a theme location, <strong>click the adjacent &#8217;Edit&#8217; link</strong>').'</li>';
548
+	$locations_overview .= '<li>'.__('To add a new menu instead of assigning an existing one, <strong>click the &#8217;Use new menu&#8217; link</strong>. Your new menu will be automatically assigned to that theme location').'</li></ul>';
549 549
 
550
-	get_current_screen()->add_help_tab( array(
550
+	get_current_screen()->add_help_tab(array(
551 551
 		'id'      => 'locations-overview',
552
-		'title'   => __( 'Overview' ),
552
+		'title'   => __('Overview'),
553 553
 		'content' => $locations_overview
554
-	) );
554
+	));
555 555
 endif;
556 556
 
557 557
 get_current_screen()->set_help_sidebar(
558
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
559
-	'<p>' . __('<a href="https://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>') . '</p>' .
560
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
558
+	'<p><strong>'.__('For more information:').'</strong></p>'.
559
+	'<p>'.__('<a href="https://codex.wordpress.org/Appearance_Menus_Screen" target="_blank">Documentation on Menus</a>').'</p>'.
560
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
561 561
 );
562 562
 
563 563
 // Get the admin header.
564
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
564
+require_once(ABSPATH.'wp-admin/admin-header.php');
565 565
 ?>
566 566
 <div class="wrap">
567
-	<h1><?php echo esc_html( __( 'Menus' ) ); ?>
567
+	<h1><?php echo esc_html(__('Menus')); ?>
568 568
 		<?php
569
-		if ( current_user_can( 'customize' ) ) :
570
-			$focus = $locations_screen ? array( 'section' => 'menu_locations' ) : array( 'panel' => 'nav_menus' );
569
+		if (current_user_can('customize')) :
570
+			$focus = $locations_screen ? array('section' => 'menu_locations') : array('panel' => 'nav_menus');
571 571
 			printf(
572 572
 				' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>',
573
-				esc_url( add_query_arg( array(
574
-					array( 'autofocus' => $focus ),
575
-					'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ),
576
-				), admin_url( 'customize.php' ) ) ),
577
-				__( 'Manage in Customizer' )
573
+				esc_url(add_query_arg(array(
574
+					array('autofocus' => $focus),
575
+					'return' => urlencode(wp_unslash($_SERVER['REQUEST_URI'])),
576
+				), admin_url('customize.php'))),
577
+				__('Manage in Customizer')
578 578
 			);
579 579
 		endif;
580 580
 		?>
581 581
 	</h1>
582 582
 	<h2 class="nav-tab-wrapper">
583
-		<a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
584
-		<?php if ( $num_locations && $menu_count ) : ?>
585
-			<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
583
+		<a href="<?php echo admin_url('nav-menus.php'); ?>" class="nav-tab<?php if ( ! isset($_GET['action']) || isset($_GET['action']) && 'locations' != $_GET['action']) echo ' nav-tab-active'; ?>"><?php esc_html_e('Edit Menus'); ?></a>
584
+		<?php if ($num_locations && $menu_count) : ?>
585
+			<a href="<?php echo esc_url(add_query_arg(array('action' => 'locations'), admin_url('nav-menus.php'))); ?>" class="nav-tab<?php if ($locations_screen) echo ' nav-tab-active'; ?>"><?php esc_html_e('Manage Locations'); ?></a>
586 586
 		<?php
587 587
 			endif;
588 588
 		?>
589 589
 	</h2>
590 590
 	<?php
591
-	foreach( $messages as $message ) :
592
-		echo $message . "\n";
591
+	foreach ($messages as $message) :
592
+		echo $message."\n";
593 593
 	endforeach;
594 594
 	?>
595 595
 	<?php
596
-	if ( $locations_screen ) :
597
-		if ( 1 == $num_locations ) {
598
-			echo '<p>' . __( 'Your theme supports one menu. Select which menu you would like to use.' ) . '</p>';
596
+	if ($locations_screen) :
597
+		if (1 == $num_locations) {
598
+			echo '<p>'.__('Your theme supports one menu. Select which menu you would like to use.').'</p>';
599 599
 		} else {
600
-			echo '<p>' .  sprintf( _n( 'Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations ), number_format_i18n( $num_locations ) ) . '</p>';
600
+			echo '<p>'.sprintf(_n('Your theme supports %s menu. Select which menu appears in each location.', 'Your theme supports %s menus. Select which menu appears in each location.', $num_locations), number_format_i18n($num_locations)).'</p>';
601 601
 		}
602 602
 	?>
603 603
 	<div id="menu-locations-wrap">
604
-		<form method="post" action="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>">
604
+		<form method="post" action="<?php echo esc_url(add_query_arg(array('action' => 'locations'), admin_url('nav-menus.php'))); ?>">
605 605
 			<table class="widefat fixed" id="menu-locations-table">
606 606
 				<thead>
607 607
 				<tr>
608
-					<th scope="col" class="manage-column column-locations"><?php _e( 'Theme Location' ); ?></th>
609
-					<th scope="col" class="manage-column column-menus"><?php _e( 'Assigned Menu' ); ?></th>
608
+					<th scope="col" class="manage-column column-locations"><?php _e('Theme Location'); ?></th>
609
+					<th scope="col" class="manage-column column-menus"><?php _e('Assigned Menu'); ?></th>
610 610
 				</tr>
611 611
 				</thead>
612 612
 				<tbody class="menu-locations">
613
-				<?php foreach ( $locations as $_location => $_name ) { ?>
613
+				<?php foreach ($locations as $_location => $_name) { ?>
614 614
 					<tr class="menu-locations-row">
615 615
 						<td class="menu-location-title"><label for="locations-<?php echo $_location; ?>"><?php echo $_name; ?></label></td>
616 616
 						<td class="menu-location-menus">
617 617
 							<select name="menu-locations[<?php echo $_location; ?>]" id="locations-<?php echo $_location; ?>">
618
-								<option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select a Menu' ) ); ?></option>
619
-								<?php foreach ( $nav_menus as $menu ) : ?>
620
-									<?php $selected = isset( $menu_locations[$_location] ) && $menu_locations[$_location] == $menu->term_id; ?>
621
-									<option <?php if ( $selected ) echo 'data-orig="true"'; ?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>">
622
-										<?php echo wp_html_excerpt( $menu->name, 40, '&hellip;' ); ?>
618
+								<option value="0"><?php printf('&mdash; %s &mdash;', esc_html__('Select a Menu')); ?></option>
619
+								<?php foreach ($nav_menus as $menu) : ?>
620
+									<?php $selected = isset($menu_locations[$_location]) && $menu_locations[$_location] == $menu->term_id; ?>
621
+									<option <?php if ($selected) echo 'data-orig="true"'; ?> <?php selected($selected); ?> value="<?php echo $menu->term_id; ?>">
622
+										<?php echo wp_html_excerpt($menu->name, 40, '&hellip;'); ?>
623 623
 									</option>
624 624
 								<?php endforeach; ?>
625 625
 							</select>
626 626
 							<div class="locations-row-links">
627
-								<?php if ( isset( $menu_locations[ $_location ] ) && 0 != $menu_locations[ $_location ] ) : ?>
627
+								<?php if (isset($menu_locations[$_location]) && 0 != $menu_locations[$_location]) : ?>
628 628
 								<span class="locations-edit-menu-link">
629
-									<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => $menu_locations[$_location] ), admin_url( 'nav-menus.php' ) ) ); ?>">
630
-										<span aria-hidden="true"><?php _ex( 'Edit', 'menu' ); ?></span><span class="screen-reader-text"><?php _e( 'Edit selected menu' ); ?></span>
629
+									<a href="<?php echo esc_url(add_query_arg(array('action' => 'edit', 'menu' => $menu_locations[$_location]), admin_url('nav-menus.php'))); ?>">
630
+										<span aria-hidden="true"><?php _ex('Edit', 'menu'); ?></span><span class="screen-reader-text"><?php _e('Edit selected menu'); ?></span>
631 631
 									</a>
632 632
 								</span>
633 633
 								<?php endif; ?>
634 634
 								<span class="locations-add-menu-link">
635
-									<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0, 'use-location' => $_location ), admin_url( 'nav-menus.php' ) ) ); ?>">
636
-										<?php _ex( 'Use new menu', 'menu' ); ?>
635
+									<a href="<?php echo esc_url(add_query_arg(array('action' => 'edit', 'menu' => 0, 'use-location' => $_location), admin_url('nav-menus.php'))); ?>">
636
+										<?php _ex('Use new menu', 'menu'); ?>
637 637
 									</a>
638 638
 								</span>
639 639
 							</div><!-- .locations-row-links -->
@@ -642,9 +642,9 @@  discard block
 block discarded – undo
642 642
 				<?php } // foreach ?>
643 643
 				</tbody>
644 644
 			</table>
645
-			<p class="button-controls"><?php submit_button( __( 'Save Changes' ), 'primary left', 'nav-menu-locations', false ); ?></p>
646
-			<?php wp_nonce_field( 'save-menu-locations' ); ?>
647
-			<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
645
+			<p class="button-controls"><?php submit_button(__('Save Changes'), 'primary left', 'nav-menu-locations', false); ?></p>
646
+			<?php wp_nonce_field('save-menu-locations'); ?>
647
+			<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr($nav_menu_selected_id); ?>" />
648 648
 		</form>
649 649
 	</div><!-- #menu-locations-wrap -->
650 650
 	<?php
@@ -653,31 +653,31 @@  discard block
 block discarded – undo
653 653
 	 *
654 654
 	 * @since 3.6.0
655 655
 	 */
656
-	do_action( 'after_menu_locations_table' ); ?>
656
+	do_action('after_menu_locations_table'); ?>
657 657
 	<?php else : ?>
658 658
 	<div class="manage-menus">
659
- 		<?php if ( $menu_count < 2 ) : ?>
659
+ 		<?php if ($menu_count < 2) : ?>
660 660
 		<span class="add-edit-menu-action">
661
-			<?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?>
661
+			<?php printf(__('Edit your menu below, or <a href="%s">create a new menu</a>.'), esc_url(add_query_arg(array('action' => 'edit', 'menu' => 0), admin_url('nav-menus.php')))); ?>
662 662
 		</span><!-- /add-edit-menu-action -->
663 663
 		<?php else : ?>
664
-			<form method="get" action="<?php echo admin_url( 'nav-menus.php' ); ?>">
664
+			<form method="get" action="<?php echo admin_url('nav-menus.php'); ?>">
665 665
 			<input type="hidden" name="action" value="edit" />
666
-			<label for="select-menu-to-edit" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label>
666
+			<label for="select-menu-to-edit" class="selected-menu"><?php _e('Select a menu to edit:'); ?></label>
667 667
 			<select name="menu" id="select-menu-to-edit">
668
-				<?php if ( $add_new_screen ) : ?>
669
-					<option value="0" selected="selected"><?php _e( '&mdash; Select &mdash;' ); ?></option>
668
+				<?php if ($add_new_screen) : ?>
669
+					<option value="0" selected="selected"><?php _e('&mdash; Select &mdash;'); ?></option>
670 670
 				<?php endif; ?>
671
-				<?php foreach( (array) $nav_menus as $_nav_menu ) : ?>
672
-					<option value="<?php echo esc_attr( $_nav_menu->term_id ); ?>" <?php selected( $_nav_menu->term_id, $nav_menu_selected_id ); ?>>
671
+				<?php foreach ((array) $nav_menus as $_nav_menu) : ?>
672
+					<option value="<?php echo esc_attr($_nav_menu->term_id); ?>" <?php selected($_nav_menu->term_id, $nav_menu_selected_id); ?>>
673 673
 						<?php
674
-						echo esc_html( $_nav_menu->truncated_name ) ;
674
+						echo esc_html($_nav_menu->truncated_name);
675 675
 
676
-						if ( ! empty( $menu_locations ) && in_array( $_nav_menu->term_id, $menu_locations ) ) {
676
+						if ( ! empty($menu_locations) && in_array($_nav_menu->term_id, $menu_locations)) {
677 677
 							$locations_assigned_to_this_menu = array();
678
-							foreach ( array_keys( $menu_locations, $_nav_menu->term_id ) as $menu_location_key ) {
679
-								if ( isset( $locations[ $menu_location_key ] ) ) {
680
-									$locations_assigned_to_this_menu[] = $locations[ $menu_location_key ];
678
+							foreach (array_keys($menu_locations, $_nav_menu->term_id) as $menu_location_key) {
679
+								if (isset($locations[$menu_location_key])) {
680
+									$locations_assigned_to_this_menu[] = $locations[$menu_location_key];
681 681
 								}
682 682
 							}
683 683
 
@@ -688,13 +688,13 @@  discard block
 block discarded – undo
688 688
 							 *
689 689
 							 * @param int $locations Number of menu locations to list. Default 3.
690 690
 							 */
691
-							$assigned_locations = array_slice( $locations_assigned_to_this_menu, 0, absint( apply_filters( 'wp_nav_locations_listed_per_menu', 3 ) ) );
691
+							$assigned_locations = array_slice($locations_assigned_to_this_menu, 0, absint(apply_filters('wp_nav_locations_listed_per_menu', 3)));
692 692
 
693 693
 							// Adds ellipses following the number of locations defined in $assigned_locations.
694
-							if ( ! empty( $assigned_locations ) ) {
695
-								printf( ' (%1$s%2$s)',
696
-									implode( ', ', $assigned_locations ),
697
-									count( $locations_assigned_to_this_menu ) > count( $assigned_locations ) ? ' &hellip;' : ''
694
+							if ( ! empty($assigned_locations)) {
695
+								printf(' (%1$s%2$s)',
696
+									implode(', ', $assigned_locations),
697
+									count($locations_assigned_to_this_menu) > count($assigned_locations) ? ' &hellip;' : ''
698 698
 								);
699 699
 							}
700 700
 						}
@@ -702,100 +702,100 @@  discard block
 block discarded – undo
702 702
 					</option>
703 703
 				<?php endforeach; ?>
704 704
 			</select>
705
-			<span class="submit-btn"><input type="submit" class="button-secondary" value="<?php esc_attr_e( 'Select' ); ?>"></span>
705
+			<span class="submit-btn"><input type="submit" class="button-secondary" value="<?php esc_attr_e('Select'); ?>"></span>
706 706
 			<span class="add-new-menu-action">
707
-				<?php printf( __( 'or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?>
707
+				<?php printf(__('or <a href="%s">create a new menu</a>.'), esc_url(add_query_arg(array('action' => 'edit', 'menu' => 0), admin_url('nav-menus.php')))); ?>
708 708
 			</span><!-- /add-new-menu-action -->
709 709
 		</form>
710 710
 	<?php endif; ?>
711 711
 	</div><!-- /manage-menus -->
712 712
 	<div id="nav-menus-frame">
713
-	<div id="menu-settings-column" class="metabox-holder<?php if ( isset( $_GET['menu'] ) && '0' == $_GET['menu'] ) { echo ' metabox-holder-disabled'; } ?>">
713
+	<div id="menu-settings-column" class="metabox-holder<?php if (isset($_GET['menu']) && '0' == $_GET['menu']) { echo ' metabox-holder-disabled'; } ?>">
714 714
 
715 715
 		<div class="clear"></div>
716 716
 
717 717
 		<form id="nav-menu-meta" class="nav-menu-meta" method="post" enctype="multipart/form-data">
718
-			<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
718
+			<input type="hidden" name="menu" id="nav-menu-meta-object-id" value="<?php echo esc_attr($nav_menu_selected_id); ?>" />
719 719
 			<input type="hidden" name="action" value="add-menu-item" />
720
-			<?php wp_nonce_field( 'add-menu_item', 'menu-settings-column-nonce' ); ?>
721
-			<?php do_accordion_sections( 'nav-menus', 'side', null ); ?>
720
+			<?php wp_nonce_field('add-menu_item', 'menu-settings-column-nonce'); ?>
721
+			<?php do_accordion_sections('nav-menus', 'side', null); ?>
722 722
 		</form>
723 723
 
724 724
 	</div><!-- /#menu-settings-column -->
725 725
 	<div id="menu-management-liquid">
726 726
 		<div id="menu-management">
727 727
 			<form id="update-nav-menu" method="post" enctype="multipart/form-data">
728
-				<div class="menu-edit <?php if ( $add_new_screen ) echo 'blank-slate'; ?>">
728
+				<div class="menu-edit <?php if ($add_new_screen) echo 'blank-slate'; ?>">
729 729
 					<?php
730
-					wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
731
-					wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
732
-					wp_nonce_field( 'update-nav_menu', 'update-nav-menu-nonce' );
730
+					wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false);
731
+					wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false);
732
+					wp_nonce_field('update-nav_menu', 'update-nav-menu-nonce');
733 733
 
734
-					if ( $one_theme_location_no_menus ) { ?>
734
+					if ($one_theme_location_no_menus) { ?>
735 735
 						<input type="hidden" name="zero-menu-state" value="true" />
736 736
 					<?php } ?>
737 737
  					<input type="hidden" name="action" value="update" />
738
-					<input type="hidden" name="menu" id="menu" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" />
738
+					<input type="hidden" name="menu" id="menu" value="<?php echo esc_attr($nav_menu_selected_id); ?>" />
739 739
 					<div id="nav-menu-header">
740 740
 						<div class="major-publishing-actions">
741 741
 							<label class="menu-name-label howto open-label" for="menu-name">
742
-								<span><?php _e( 'Menu Name' ); ?></span>
743
-								<input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e( 'Enter menu name here' ); ?>" value="<?php if ( $one_theme_location_no_menus ) _e( 'Menu 1' ); else echo esc_attr( $nav_menu_selected_title ); ?>" />
742
+								<span><?php _e('Menu Name'); ?></span>
743
+								<input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e('Enter menu name here'); ?>" value="<?php if ($one_theme_location_no_menus) _e('Menu 1'); else echo esc_attr($nav_menu_selected_title); ?>" />
744 744
 							</label>
745 745
 							<div class="publishing-action">
746
-								<?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
746
+								<?php submit_button(empty($nav_menu_selected_id) ? __('Create Menu') : __('Save Menu'), 'button-primary menu-save', 'save_menu', false, array('id' => 'save_menu_header')); ?>
747 747
 							</div><!-- END .publishing-action -->
748 748
 						</div><!-- END .major-publishing-actions -->
749 749
 					</div><!-- END .nav-menu-header -->
750 750
 					<div id="post-body">
751 751
 						<div id="post-body-content">
752
-							<?php if ( ! $add_new_screen ) : ?>
753
-							<h3><?php _e( 'Menu Structure' ); ?></h3>
754
-							<?php $starter_copy = ( $one_theme_location_no_menus ) ? __( 'Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.' ) : __( 'Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.' ); ?>
755
-							<div class="drag-instructions post-body-plain" <?php if ( isset( $menu_items ) && 0 == count( $menu_items ) ) { ?>style="display: none;"<?php } ?>>
752
+							<?php if ( ! $add_new_screen) : ?>
753
+							<h3><?php _e('Menu Structure'); ?></h3>
754
+							<?php $starter_copy = ($one_theme_location_no_menus) ? __('Edit your default menu by adding or removing items. Drag each item into the order you prefer. Click Create Menu to save your changes.') : __('Drag each item into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.'); ?>
755
+							<div class="drag-instructions post-body-plain" <?php if (isset($menu_items) && 0 == count($menu_items)) { ?>style="display: none;"<?php } ?>>
756 756
 								<p><?php echo $starter_copy; ?></p>
757 757
 							</div>
758 758
 							<?php
759
-							if ( isset( $edit_markup ) && ! is_wp_error( $edit_markup ) ) {
759
+							if (isset($edit_markup) && ! is_wp_error($edit_markup)) {
760 760
 								echo $edit_markup;
761 761
 							} else {
762 762
 							?>
763 763
 							<ul class="menu" id="menu-to-edit"></ul>
764 764
 							<?php } ?>
765 765
 							<?php endif; ?>
766
-							<?php if ( $add_new_screen ) : ?>
767
-								<p class="post-body-plain"><?php _e( 'Give your menu a name above, then click Create Menu.' ); ?></p>
768
-								<?php if ( isset( $_GET['use-location'] ) ) : ?>
769
-									<input type="hidden" name="use-location" value="<?php echo esc_attr( $_GET['use-location'] ); ?>" />
766
+							<?php if ($add_new_screen) : ?>
767
+								<p class="post-body-plain"><?php _e('Give your menu a name above, then click Create Menu.'); ?></p>
768
+								<?php if (isset($_GET['use-location'])) : ?>
769
+									<input type="hidden" name="use-location" value="<?php echo esc_attr($_GET['use-location']); ?>" />
770 770
 								<?php endif; ?>
771 771
 							<?php endif; ?>
772
-							<div class="menu-settings" <?php if ( $one_theme_location_no_menus ) { ?>style="display: none;"<?php } ?>>
773
-								<h3><?php _e( 'Menu Settings' ); ?></h3>
772
+							<div class="menu-settings" <?php if ($one_theme_location_no_menus) { ?>style="display: none;"<?php } ?>>
773
+								<h3><?php _e('Menu Settings'); ?></h3>
774 774
 								<?php
775
-								if ( ! isset( $auto_add ) ) {
776
-									$auto_add = get_option( 'nav_menu_options' );
777
-									if ( ! isset( $auto_add['auto_add'] ) )
775
+								if ( ! isset($auto_add)) {
776
+									$auto_add = get_option('nav_menu_options');
777
+									if ( ! isset($auto_add['auto_add']))
778 778
 										$auto_add = false;
779
-									elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
779
+									elseif (false !== array_search($nav_menu_selected_id, $auto_add['auto_add']))
780 780
 										$auto_add = true;
781 781
 									else
782 782
 										$auto_add = false;
783 783
 								} ?>
784 784
 
785 785
 								<dl class="auto-add-pages">
786
-									<dt class="howto"><?php _e( 'Auto add pages' ); ?></dt>
787
-									<dd class="checkbox-input"><input type="checkbox"<?php checked( $auto_add ); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf( __('Automatically add new top-level pages to this menu' ), esc_url( admin_url( 'edit.php?post_type=page' ) ) ); ?></label></dd>
786
+									<dt class="howto"><?php _e('Auto add pages'); ?></dt>
787
+									<dd class="checkbox-input"><input type="checkbox"<?php checked($auto_add); ?> name="auto-add-pages" id="auto-add-pages" value="1" /> <label for="auto-add-pages"><?php printf(__('Automatically add new top-level pages to this menu'), esc_url(admin_url('edit.php?post_type=page'))); ?></label></dd>
788 788
 								</dl>
789 789
 
790
-								<?php if ( current_theme_supports( 'menus' ) ) : ?>
790
+								<?php if (current_theme_supports('menus')) : ?>
791 791
 
792 792
 									<dl class="menu-theme-locations">
793
-										<dt class="howto"><?php _e( 'Theme locations' ); ?></dt>
794
-										<?php foreach ( $locations as $location => $description ) : ?>
793
+										<dt class="howto"><?php _e('Theme locations'); ?></dt>
794
+										<?php foreach ($locations as $location => $description) : ?>
795 795
 										<dd class="checkbox-input">
796
-											<input type="checkbox"<?php checked( isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ); ?> name="menu-locations[<?php echo esc_attr( $location ); ?>]" id="locations-<?php echo esc_attr( $location ); ?>" value="<?php echo esc_attr( $nav_menu_selected_id ); ?>" /> <label for="locations-<?php echo esc_attr( $location ); ?>"><?php echo $description; ?></label>
797
-											<?php if ( ! empty( $menu_locations[ $location ] ) && $menu_locations[ $location ] != $nav_menu_selected_id ) : ?>
798
-											<span class="theme-location-set"> <?php printf( __( "(Currently set to: %s)" ), wp_get_nav_menu_object( $menu_locations[ $location ] )->name ); ?> </span>
796
+											<input type="checkbox"<?php checked(isset($menu_locations[$location]) && $menu_locations[$location] == $nav_menu_selected_id); ?> name="menu-locations[<?php echo esc_attr($location); ?>]" id="locations-<?php echo esc_attr($location); ?>" value="<?php echo esc_attr($nav_menu_selected_id); ?>" /> <label for="locations-<?php echo esc_attr($location); ?>"><?php echo $description; ?></label>
797
+											<?php if ( ! empty($menu_locations[$location]) && $menu_locations[$location] != $nav_menu_selected_id) : ?>
798
+											<span class="theme-location-set"> <?php printf(__("(Currently set to: %s)"), wp_get_nav_menu_object($menu_locations[$location])->name); ?> </span>
799 799
 											<?php endif; ?>
800 800
 										</dd>
801 801
 										<?php endforeach; ?>
@@ -808,13 +808,13 @@  discard block
 block discarded – undo
808 808
 					</div><!-- /#post-body -->
809 809
 					<div id="nav-menu-footer">
810 810
 						<div class="major-publishing-actions">
811
-							<?php if ( 0 != $menu_count && ! $add_new_screen ) : ?>
811
+							<?php if (0 != $menu_count && ! $add_new_screen) : ?>
812 812
 							<span class="delete-action">
813
-								<a class="submitdelete deletion menu-delete" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'action' => 'delete', 'menu' => $nav_menu_selected_id, admin_url() ) ), 'delete-nav_menu-' . $nav_menu_selected_id) ); ?>"><?php _e('Delete Menu'); ?></a>
813
+								<a class="submitdelete deletion menu-delete" href="<?php echo esc_url(wp_nonce_url(add_query_arg(array('action' => 'delete', 'menu' => $nav_menu_selected_id, admin_url())), 'delete-nav_menu-'.$nav_menu_selected_id)); ?>"><?php _e('Delete Menu'); ?></a>
814 814
 							</span><!-- END .delete-action -->
815 815
 							<?php endif; ?>
816 816
 							<div class="publishing-action">
817
-								<?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) ); ?>
817
+								<?php submit_button(empty($nav_menu_selected_id) ? __('Create Menu') : __('Save Menu'), 'button-primary menu-save', 'save_menu', false, array('id' => 'save_menu_footer')); ?>
818 818
 							</div><!-- END .publishing-action -->
819 819
 						</div><!-- END .major-publishing-actions -->
820 820
 					</div><!-- /#nav-menu-footer -->
@@ -825,4 +825,4 @@  discard block
 block discarded – undo
825 825
 	</div><!-- /#nav-menus-frame -->
826 826
 	<?php endif; ?>
827 827
 </div><!-- /.wrap-->
828
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
828
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
Braces   +96 added lines, -51 removed lines patch added patch discarded remove patch
@@ -15,17 +15,20 @@  discard block
 block discarded – undo
15 15
 // Load all the nav menu interface functions
16 16
 require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' );
17 17
 
18
-if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) )
18
+if ( ! current_theme_supports( 'menus' ) && ! current_theme_supports( 'widgets' ) ) {
19 19
 	wp_die( __( 'Your theme does not support navigation menus or widgets.' ) );
20
+}
20 21
 
21 22
 // Permissions Check
22
-if ( ! current_user_can('edit_theme_options') )
23
+if ( ! current_user_can('edit_theme_options') ) {
23 24
 	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
25
+}
24 26
 
25 27
 wp_enqueue_script( 'nav-menu' );
26 28
 
27
-if ( wp_is_mobile() )
29
+if ( wp_is_mobile() ) {
28 30
 	wp_enqueue_script( 'jquery-touch-punch' );
31
+}
29 32
 
30 33
 // Container for any messages displayed to the user
31 34
 $messages = array();
@@ -47,10 +50,11 @@  discard block
 block discarded – undo
47 50
 switch ( $action ) {
48 51
 	case 'add-menu-item':
49 52
 		check_admin_referer( 'add-menu_item', 'menu-settings-column-nonce' );
50
-		if ( isset( $_REQUEST['nav-menu-locations'] ) )
51
-			set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) );
52
-		elseif ( isset( $_REQUEST['menu-item'] ) )
53
-			wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] );
53
+		if ( isset( $_REQUEST['nav-menu-locations'] ) ) {
54
+					set_theme_mod( 'nav_menu_locations', array_map( 'absint', $_REQUEST['menu-locations'] ) );
55
+		} elseif ( isset( $_REQUEST['menu-item'] ) ) {
56
+					wp_save_nav_menu_items( $nav_menu_selected_id, $_REQUEST['menu-item'] );
57
+		}
54 58
 		break;
55 59
 	case 'move-down-menu-item' :
56 60
 
@@ -185,10 +189,11 @@  discard block
 block discarded – undo
185 189
 								! empty( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1] )
186 190
 							) {
187 191
 								$_possible_parent_id = (int) get_post_meta( $orders_to_dbids[$dbids_to_orders[$parent_db_id] - 1], '_menu_item_menu_item_parent', true);
188
-								if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) )
189
-									$menu_item_data['menu_item_parent'] = $_possible_parent_id;
190
-								else
191
-									$menu_item_data['menu_item_parent'] = 0;
192
+								if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ) ) ) {
193
+																	$menu_item_data['menu_item_parent'] = $_possible_parent_id;
194
+								} else {
195
+																	$menu_item_data['menu_item_parent'] = 0;
196
+								}
192 197
 
193 198
 							// Else there isn't something before the parent.
194 199
 							} else {
@@ -230,8 +235,9 @@  discard block
 block discarded – undo
230 235
 
231 236
 		check_admin_referer( 'delete-menu_item_' . $menu_item_id );
232 237
 
233
-		if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) )
234
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';
238
+		if ( is_nav_menu_item( $menu_item_id ) && wp_delete_post( $menu_item_id, true ) ) {
239
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __('The menu item has been successfully deleted.') . '</p></div>';
240
+		}
235 241
 		break;
236 242
 
237 243
 	case 'delete':
@@ -244,20 +250,23 @@  discard block
 block discarded – undo
244 250
 			unset( $_REQUEST['menu'] );
245 251
 		}
246 252
 
247
-		if ( ! isset( $deletion ) )
248
-			break;
253
+		if ( ! isset( $deletion ) ) {
254
+					break;
255
+		}
249 256
 
250
-		if ( is_wp_error( $deletion ) )
251
-			$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>';
252
-		else
253
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>';
257
+		if ( is_wp_error( $deletion ) ) {
258
+					$messages[] = '<div id="message" class="error notice is-dismissible"><p>' . $deletion->get_error_message() . '</p></div>';
259
+		} else {
260
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'The menu has been successfully deleted.' ) . '</p></div>';
261
+		}
254 262
 		break;
255 263
 
256 264
 	case 'delete_menus':
257 265
 		check_admin_referer( 'nav_menus_bulk_actions' );
258 266
 		foreach ( $_REQUEST['delete_menus'] as $menu_id_to_delete ) {
259
-			if ( ! is_nav_menu( $menu_id_to_delete ) )
260
-				continue;
267
+			if ( ! is_nav_menu( $menu_id_to_delete ) ) {
268
+							continue;
269
+			}
261 270
 
262 271
 			$deletion = wp_delete_nav_menu( $menu_id_to_delete );
263 272
 			if ( is_wp_error( $deletion ) ) {
@@ -266,8 +275,9 @@  discard block
 block discarded – undo
266 275
 			}
267 276
 		}
268 277
 
269
-		if ( empty( $deletion_error ) )
270
-			$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>';
278
+		if ( empty( $deletion_error ) ) {
279
+					$messages[] = '<div id="message" class="updated notice is-dismissible"><p>' . __( 'Selected menus have been successfully deleted.' ) . '</p></div>';
280
+		}
271 281
 		break;
272 282
 
273 283
 	case 'update':
@@ -275,8 +285,9 @@  discard block
 block discarded – undo
275 285
 
276 286
 		// Remove menu locations that have been unchecked.
277 287
 		foreach ( $locations as $location => $description ) {
278
-			if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id )
279
-				unset( $menu_locations[ $location ] );
288
+			if ( ( empty( $_POST['menu-locations'] ) || empty( $_POST['menu-locations'][ $location ] ) ) && isset( $menu_locations[ $location ] ) && $menu_locations[ $location ] == $nav_menu_selected_id ) {
289
+							unset( $menu_locations[ $location ] );
290
+			}
280 291
 		}
281 292
 
282 293
 		// Merge new and existing menu locations if any new ones are set.
@@ -301,8 +312,9 @@  discard block
 block discarded – undo
301 312
 					$_menu_object = wp_get_nav_menu_object( $_nav_menu_selected_id );
302 313
 					$nav_menu_selected_id = $_nav_menu_selected_id;
303 314
 					$nav_menu_selected_title = $_menu_object->name;
304
-					if ( isset( $_REQUEST['menu-item'] ) )
305
-						wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) );
315
+					if ( isset( $_REQUEST['menu-item'] ) ) {
316
+											wp_save_nav_menu_items( $nav_menu_selected_id, absint( $_REQUEST['menu-item'] ) );
317
+					}
306 318
 					if ( isset( $_REQUEST['zero-menu-state'] ) ) {
307 319
 						// If there are menu items, add them
308 320
 						wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title );
@@ -317,8 +329,9 @@  discard block
 block discarded – undo
317 329
 					if ( isset( $_REQUEST['use-location'] ) ) {
318 330
 						$locations = get_registered_nav_menus();
319 331
 						$menu_locations = get_nav_menu_locations();
320
-						if ( isset( $locations[ $_REQUEST['use-location'] ] ) )
321
-							$menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id;
332
+						if ( isset( $locations[ $_REQUEST['use-location'] ] ) ) {
333
+													$menu_locations[ $_REQUEST['use-location'] ] = $nav_menu_selected_id;
334
+						}
322 335
 						set_theme_mod( 'nav_menu_locations', $menu_locations );
323 336
 					}
324 337
 
@@ -425,21 +438,25 @@  discard block
 block discarded – undo
425 438
  * Redirect to add screen if there are no menus and this users has either zero,
426 439
  * or more than 1 theme locations.
427 440
  */
428
-if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus )
441
+if ( 0 == $menu_count && ! $add_new_screen && ! $one_theme_location_no_menus ) {
429 442
 	wp_redirect( admin_url( 'nav-menus.php?action=edit&menu=0' ) );
443
+}
430 444
 
431 445
 // Get recently edited nav menu.
432 446
 $recently_edited = absint( get_user_option( 'nav_menu_recently_edited' ) );
433
-if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) )
447
+if ( empty( $recently_edited ) && is_nav_menu( $nav_menu_selected_id ) ) {
434 448
 	$recently_edited = $nav_menu_selected_id;
449
+}
435 450
 
436 451
 // Use $recently_edited if none are selected.
437
-if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) )
452
+if ( empty( $nav_menu_selected_id ) && ! isset( $_GET['menu'] ) && is_nav_menu( $recently_edited ) ) {
438 453
 	$nav_menu_selected_id = $recently_edited;
454
+}
439 455
 
440 456
 // On deletion of menu, if another menu exists, show it.
441
-if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] )
457
+if ( ! $add_new_screen && 0 < $menu_count && isset( $_GET['action'] ) && 'delete' == $_GET['action'] ) {
442 458
 	$nav_menu_selected_id = $nav_menus[0]->term_id;
459
+}
443 460
 
444 461
 // Set $nav_menu_selected_id to 0 if no menus.
445 462
 if ( $one_theme_location_no_menus ) {
@@ -450,8 +467,9 @@  discard block
 block discarded – undo
450 467
 }
451 468
 
452 469
 // Update the user's setting.
453
-if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) )
470
+if ( $nav_menu_selected_id != $recently_edited && is_nav_menu( $nav_menu_selected_id ) ) {
454 471
 	update_user_meta( $current_user->ID, 'nav_menu_recently_edited', $nav_menu_selected_id );
472
+}
455 473
 
456 474
 // If there's a menu, get its name.
457 475
 if ( ! $nav_menu_selected_title && is_nav_menu( $nav_menu_selected_id ) ) {
@@ -502,8 +520,9 @@  discard block
 block discarded – undo
502 520
 wp_nav_menu_setup();
503 521
 wp_initial_nav_menu_meta_boxes();
504 522
 
505
-if ( ! current_theme_supports( 'menus' ) && ! $num_locations )
523
+if ( ! current_theme_supports( 'menus' ) && ! $num_locations ) {
506 524
 	$messages[] = '<div id="message" class="updated"><p>' . sprintf( __( 'Your theme does not natively support menus, but you can use them in sidebars by adding a &#8220;Custom Menu&#8221; widget on the <a href="%s">Widgets</a> screen.' ), admin_url( 'widgets.php' ) ) . '</p></div>';
525
+}
507 526
 
508 527
 if ( ! $locations_screen ) : // Main tab
509 528
 	$overview  = '<p>' . __( 'This screen is used for managing your custom navigation menus.' ) . '</p>';
@@ -541,8 +560,10 @@  discard block
 block discarded – undo
541 560
 		'title'   => __( 'Editing Menus' ),
542 561
 		'content' => $editing_menus
543 562
 	) );
544
-else : // Locations Tab.
563
+else {
564
+	: // Locations Tab.
545 565
 	$locations_overview  = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>';
566
+}
546 567
 	$locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location&#8217;s drop down.</strong> When you&#8217;re finished, <strong>click Save Changes</strong>' ) . '</li>';
547 568
 	$locations_overview .= '<li>' . __( 'To edit a menu currently assigned to a theme location, <strong>click the adjacent &#8217;Edit&#8217; link</strong>' ) . '</li>';
548 569
 	$locations_overview .= '<li>' . __( 'To add a new menu instead of assigning an existing one, <strong>click the &#8217;Use new menu&#8217; link</strong>. Your new menu will be automatically assigned to that theme location' ) . '</li></ul>';
@@ -580,9 +601,15 @@  discard block
 block discarded – undo
580 601
 		?>
581 602
 	</h1>
582 603
 	<h2 class="nav-tab-wrapper">
583
-		<a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
604
+		<a href="<?php echo admin_url( 'nav-menus.php' ); ?>" class="nav-tab<?php if ( ! isset( $_GET['action'] ) || isset( $_GET['action'] ) && 'locations' != $_GET['action'] ) {
605
+	echo ' nav-tab-active';
606
+}
607
+?>"><?php esc_html_e( 'Edit Menus' ); ?></a>
584 608
 		<?php if ( $num_locations && $menu_count ) : ?>
585
-			<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) echo ' nav-tab-active'; ?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
609
+			<a href="<?php echo esc_url( add_query_arg( array( 'action' => 'locations' ), admin_url( 'nav-menus.php' ) ) ); ?>" class="nav-tab<?php if ( $locations_screen ) {
610
+	echo ' nav-tab-active';
611
+}
612
+?>"><?php esc_html_e( 'Manage Locations' ); ?></a>
586 613
 		<?php
587 614
 			endif;
588 615
 		?>
@@ -618,7 +645,10 @@  discard block
 block discarded – undo
618 645
 								<option value="0"><?php printf( '&mdash; %s &mdash;', esc_html__( 'Select a Menu' ) ); ?></option>
619 646
 								<?php foreach ( $nav_menus as $menu ) : ?>
620 647
 									<?php $selected = isset( $menu_locations[$_location] ) && $menu_locations[$_location] == $menu->term_id; ?>
621
-									<option <?php if ( $selected ) echo 'data-orig="true"'; ?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>">
648
+									<option <?php if ( $selected ) {
649
+	echo 'data-orig="true"';
650
+}
651
+?> <?php selected( $selected ); ?> value="<?php echo $menu->term_id; ?>">
622 652
 										<?php echo wp_html_excerpt( $menu->name, 40, '&hellip;' ); ?>
623 653
 									</option>
624 654
 								<?php endforeach; ?>
@@ -654,14 +684,20 @@  discard block
 block discarded – undo
654 684
 	 * @since 3.6.0
655 685
 	 */
656 686
 	do_action( 'after_menu_locations_table' ); ?>
657
-	<?php else : ?>
687
+	<?php else {
688
+	: ?>
658 689
 	<div class="manage-menus">
659 690
  		<?php if ( $menu_count < 2 ) : ?>
660 691
 		<span class="add-edit-menu-action">
661
-			<?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) ); ?>
692
+			<?php printf( __( 'Edit your menu below, or <a href="%s">create a new menu</a>.' ), esc_url( add_query_arg( array( 'action' => 'edit', 'menu' => 0 ), admin_url( 'nav-menus.php' ) ) ) );
693
+}
694
+?>
662 695
 		</span><!-- /add-edit-menu-action -->
663
-		<?php else : ?>
664
-			<form method="get" action="<?php echo admin_url( 'nav-menus.php' ); ?>">
696
+		<?php else {
697
+	: ?>
698
+			<form method="get" action="<?php echo admin_url( 'nav-menus.php' );
699
+}
700
+?>">
665 701
 			<input type="hidden" name="action" value="edit" />
666 702
 			<label for="select-menu-to-edit" class="selected-menu"><?php _e( 'Select a menu to edit:' ); ?></label>
667 703
 			<select name="menu" id="select-menu-to-edit">
@@ -725,7 +761,10 @@  discard block
 block discarded – undo
725 761
 	<div id="menu-management-liquid">
726 762
 		<div id="menu-management">
727 763
 			<form id="update-nav-menu" method="post" enctype="multipart/form-data">
728
-				<div class="menu-edit <?php if ( $add_new_screen ) echo 'blank-slate'; ?>">
764
+				<div class="menu-edit <?php if ( $add_new_screen ) {
765
+	echo 'blank-slate';
766
+}
767
+?>">
729 768
 					<?php
730 769
 					wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false );
731 770
 					wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false );
@@ -740,7 +779,12 @@  discard block
 block discarded – undo
740 779
 						<div class="major-publishing-actions">
741 780
 							<label class="menu-name-label howto open-label" for="menu-name">
742 781
 								<span><?php _e( 'Menu Name' ); ?></span>
743
-								<input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e( 'Enter menu name here' ); ?>" value="<?php if ( $one_theme_location_no_menus ) _e( 'Menu 1' ); else echo esc_attr( $nav_menu_selected_title ); ?>" />
782
+								<input name="menu-name" id="menu-name" type="text" class="menu-name regular-text menu-item-textbox input-with-default-title" title="<?php esc_attr_e( 'Enter menu name here' ); ?>" value="<?php if ( $one_theme_location_no_menus ) {
783
+	_e( 'Menu 1' );
784
+} else {
785
+	echo esc_attr( $nav_menu_selected_title );
786
+}
787
+?>" />
744 788
 							</label>
745 789
 							<div class="publishing-action">
746 790
 								<?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'button-primary menu-save', 'save_menu', false, array( 'id' => 'save_menu_header' ) ); ?>
@@ -774,12 +818,13 @@  discard block
 block discarded – undo
774 818
 								<?php
775 819
 								if ( ! isset( $auto_add ) ) {
776 820
 									$auto_add = get_option( 'nav_menu_options' );
777
-									if ( ! isset( $auto_add['auto_add'] ) )
778
-										$auto_add = false;
779
-									elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) )
780
-										$auto_add = true;
781
-									else
782
-										$auto_add = false;
821
+									if ( ! isset( $auto_add['auto_add'] ) ) {
822
+																			$auto_add = false;
823
+									} elseif ( false !== array_search( $nav_menu_selected_id, $auto_add['auto_add'] ) ) {
824
+																			$auto_add = true;
825
+									} else {
826
+																			$auto_add = false;
827
+									}
783 828
 								} ?>
784 829
 
785 830
 								<dl class="auto-add-pages">
Please login to merge, or discard this patch.
src/wp-admin/post.php 3 patches
Indentation   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -1,12 +1,12 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Edit post administration panel.
4
- *
5
- * Manage Post actions: post, edit, delete, etc.
6
- *
7
- * @package WordPress
8
- * @subpackage Administration
9
- */
3
+								 * Edit post administration panel.
4
+								 *
5
+								 * Manage Post actions: post, edit, delete, etc.
6
+								 *
7
+								 * @package WordPress
8
+								 * @subpackage Administration
9
+								 */
10 10
 
11 11
 /** WordPress Administration Bootstrap */
12 12
 require_once( dirname( __FILE__ ) . '/admin.php' );
@@ -94,8 +94,8 @@  discard block
 block discarded – undo
94 94
 
95 95
 $sendback = wp_get_referer();
96 96
 if ( ! $sendback ||
97
-     strpos( $sendback, 'post.php' ) !== false ||
98
-     strpos( $sendback, 'post-new.php' ) !== false ) {
97
+	 strpos( $sendback, 'post.php' ) !== false ||
98
+	 strpos( $sendback, 'post-new.php' ) !== false ) {
99 99
 	if ( 'attachment' == $post_type ) {
100 100
 		$sendback = admin_url( 'upload.php' );
101 101
 	} else {
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -9,16 +9,16 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 /** WordPress Administration Bootstrap */
12
-require_once( dirname( __FILE__ ) . '/admin.php' );
12
+require_once(dirname(__FILE__).'/admin.php');
13 13
 
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'] ) )
19
+if (isset($_GET['post']))
20 20
  	$post_id = $post_ID = (int) $_GET['post'];
21
-elseif ( isset( $_POST['post_ID'] ) )
21
+elseif (isset($_POST['post_ID']))
22 22
  	$post_id = $post_ID = (int) $_POST['post_ID'];
23 23
 else
24 24
  	$post_id = $post_ID = 0;
@@ -30,12 +30,12 @@  discard block
 block discarded – undo
30 30
  */
31 31
 global $post_type, $post_type_object, $post;
32 32
 
33
-if ( $post_id )
34
-	$post = get_post( $post_id );
33
+if ($post_id)
34
+	$post = get_post($post_id);
35 35
 
36
-if ( $post ) {
36
+if ($post) {
37 37
 	$post_type = $post->post_type;
38
-	$post_type_object = get_post_type_object( $post_type );
38
+	$post_type_object = get_post_type_object($post_type);
39 39
 }
40 40
 
41 41
 /**
@@ -44,11 +44,11 @@  discard block
 block discarded – undo
44 44
  * @param int $post_id Optional. Post ID.
45 45
  */
46 46
 function redirect_post($post_id = '') {
47
-	if ( isset($_POST['save']) || isset($_POST['publish']) ) {
48
-		$status = get_post_status( $post_id );
47
+	if (isset($_POST['save']) || isset($_POST['publish'])) {
48
+		$status = get_post_status($post_id);
49 49
 
50
-		if ( isset( $_POST['publish'] ) ) {
51
-			switch ( $status ) {
50
+		if (isset($_POST['publish'])) {
51
+			switch ($status) {
52 52
 				case 'pending':
53 53
 					$message = 8;
54 54
 					break;
@@ -62,17 +62,17 @@  discard block
 block discarded – undo
62 62
 			$message = 'draft' == $status ? 10 : 1;
63 63
 		}
64 64
 
65
-		$location = add_query_arg( 'message', $message, get_edit_post_link( $post_id, 'url' ) );
66
-	} elseif ( isset($_POST['addmeta']) && $_POST['addmeta'] ) {
67
-		$location = add_query_arg( 'message', 2, wp_get_referer() );
65
+		$location = add_query_arg('message', $message, get_edit_post_link($post_id, 'url'));
66
+	} elseif (isset($_POST['addmeta']) && $_POST['addmeta']) {
67
+		$location = add_query_arg('message', 2, wp_get_referer());
68 68
 		$location = explode('#', $location);
69
-		$location = $location[0] . '#postcustom';
70
-	} elseif ( isset($_POST['deletemeta']) && $_POST['deletemeta'] ) {
71
-		$location = add_query_arg( 'message', 3, wp_get_referer() );
69
+		$location = $location[0].'#postcustom';
70
+	} elseif (isset($_POST['deletemeta']) && $_POST['deletemeta']) {
71
+		$location = add_query_arg('message', 3, wp_get_referer());
72 72
 		$location = explode('#', $location);
73
-		$location = $location[0] . '#postcustom';
73
+		$location = $location[0].'#postcustom';
74 74
 	} else {
75
-		$location = add_query_arg( 'message', 4, get_edit_post_link( $post_id, 'url' ) );
75
+		$location = add_query_arg('message', 4, get_edit_post_link($post_id, 'url'));
76 76
 	}
77 77
 
78 78
 	/**
@@ -83,55 +83,55 @@  discard block
 block discarded – undo
83 83
 	 * @param string $location The destination URL.
84 84
 	 * @param int    $post_id  The post ID.
85 85
 	 */
86
-	wp_redirect( apply_filters( 'redirect_post_location', $location, $post_id ) );
86
+	wp_redirect(apply_filters('redirect_post_location', $location, $post_id));
87 87
 	exit;
88 88
 }
89 89
 
90
-if ( isset( $_POST['deletepost'] ) )
90
+if (isset($_POST['deletepost']))
91 91
 	$action = 'delete';
92
-elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
92
+elseif (isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'])
93 93
 	$action = 'preview';
94 94
 
95 95
 $sendback = wp_get_referer();
96 96
 if ( ! $sendback ||
97
-     strpos( $sendback, 'post.php' ) !== false ||
98
-     strpos( $sendback, 'post-new.php' ) !== false ) {
99
-	if ( 'attachment' == $post_type ) {
100
-		$sendback = admin_url( 'upload.php' );
97
+     strpos($sendback, 'post.php') !== false ||
98
+     strpos($sendback, 'post-new.php') !== false) {
99
+	if ('attachment' == $post_type) {
100
+		$sendback = admin_url('upload.php');
101 101
 	} else {
102
-		$sendback = admin_url( 'edit.php' );
103
-		if ( ! empty( $post_type ) ) {
104
-			$sendback = add_query_arg( 'post_type', $post_type, $sendback );
102
+		$sendback = admin_url('edit.php');
103
+		if ( ! empty($post_type)) {
104
+			$sendback = add_query_arg('post_type', $post_type, $sendback);
105 105
 		}
106 106
 	}
107 107
 } else {
108
-	$sendback = remove_query_arg( array('trashed', 'untrashed', 'deleted', 'ids'), $sendback );
108
+	$sendback = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'ids'), $sendback);
109 109
 }
110 110
 
111
-switch($action) {
111
+switch ($action) {
112 112
 case 'post-quickdraft-save':
113 113
 	// Check nonce and capabilities
114 114
 	$nonce = $_REQUEST['_wpnonce'];
115 115
 	$error_msg = false;
116 116
 
117 117
 	// For output of the quickdraft dashboard widget
118
-	require_once ABSPATH . 'wp-admin/includes/dashboard.php';
118
+	require_once ABSPATH.'wp-admin/includes/dashboard.php';
119 119
 
120
-	if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
121
-		$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
120
+	if ( ! wp_verify_nonce($nonce, 'add-post'))
121
+		$error_msg = __('Unable to submit this form, please refresh and try again.');
122 122
 
123
-	if ( ! current_user_can( 'edit_posts' ) ) {
123
+	if ( ! current_user_can('edit_posts')) {
124 124
 		exit;
125 125
 	}
126 126
 
127
-	if ( $error_msg )
128
-		return wp_dashboard_quick_press( $error_msg );
127
+	if ($error_msg)
128
+		return wp_dashboard_quick_press($error_msg);
129 129
 
130
-	$post = get_post( $_REQUEST['post_ID'] );
131
-	check_admin_referer( 'add-' . $post->post_type );
130
+	$post = get_post($_REQUEST['post_ID']);
131
+	check_admin_referer('add-'.$post->post_type);
132 132
 
133
-	$_POST['comment_status'] = get_default_comment_status( $post->post_type );
134
-	$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
133
+	$_POST['comment_status'] = get_default_comment_status($post->post_type);
134
+	$_POST['ping_status']    = get_default_comment_status($post->post_type, 'pingback');
135 135
 
136 136
 	edit_post();
137 137
 	wp_dashboard_quick_press();
@@ -139,49 +139,49 @@  discard block
 block discarded – undo
139 139
 
140 140
 case 'postajaxpost':
141 141
 case 'post':
142
-	check_admin_referer( 'add-' . $post_type );
142
+	check_admin_referer('add-'.$post_type);
143 143
 	$post_id = 'postajaxpost' == $action ? edit_post() : write_post();
144
-	redirect_post( $post_id );
144
+	redirect_post($post_id);
145 145
 	exit();
146 146
 
147 147
 case 'edit':
148 148
 	$editing = true;
149 149
 
150
-	if ( empty( $post_id ) ) {
151
-		wp_redirect( admin_url('post.php') );
150
+	if (empty($post_id)) {
151
+		wp_redirect(admin_url('post.php'));
152 152
 		exit();
153 153
 	}
154 154
 
155
-	if ( ! $post )
156
-		wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
155
+	if ( ! $post)
156
+		wp_die(__('You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?'));
157 157
 
158
-	if ( ! $post_type_object )
159
-		wp_die( __( 'Unknown post type.' ) );
158
+	if ( ! $post_type_object)
159
+		wp_die(__('Unknown post type.'));
160 160
 
161
-	if ( ! current_user_can( 'edit_post', $post_id ) )
162
-		wp_die( __( 'You are not allowed to edit this item.' ) );
161
+	if ( ! current_user_can('edit_post', $post_id))
162
+		wp_die(__('You are not allowed to edit this item.'));
163 163
 
164
-	if ( 'trash' == $post->post_status )
165
-		wp_die( __( 'You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.' ) );
164
+	if ('trash' == $post->post_status)
165
+		wp_die(__('You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.'));
166 166
 
167
-	if ( ! empty( $_GET['get-post-lock'] ) ) {
168
-		check_admin_referer( 'lock-post_' . $post_id );
169
-		wp_set_post_lock( $post_id );
170
-		wp_redirect( get_edit_post_link( $post_id, 'url' ) );
167
+	if ( ! empty($_GET['get-post-lock'])) {
168
+		check_admin_referer('lock-post_'.$post_id);
169
+		wp_set_post_lock($post_id);
170
+		wp_redirect(get_edit_post_link($post_id, 'url'));
171 171
 		exit();
172 172
 	}
173 173
 
174 174
 	$post_type = $post->post_type;
175
-	if ( 'post' == $post_type ) {
175
+	if ('post' == $post_type) {
176 176
 		$parent_file = "edit.php";
177 177
 		$submenu_file = "edit.php";
178 178
 		$post_new_file = "post-new.php";
179
-	} elseif ( 'attachment' == $post_type ) {
179
+	} elseif ('attachment' == $post_type) {
180 180
 		$parent_file = 'upload.php';
181 181
 		$submenu_file = 'upload.php';
182 182
 		$post_new_file = 'media-new.php';
183 183
 	} else {
184
-		if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
184
+		if (isset($post_type_object) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true)
185 185
 			$parent_file = $post_type_object->show_in_menu;
186 186
 		else
187 187
 			$parent_file = "edit.php?post_type=$post_type";
@@ -189,57 +189,57 @@  discard block
 block discarded – undo
189 189
 		$post_new_file = "post-new.php?post_type=$post_type";
190 190
 	}
191 191
 
192
-	if ( ! wp_check_post_lock( $post->ID ) ) {
193
-		$active_post_lock = wp_set_post_lock( $post->ID );
192
+	if ( ! wp_check_post_lock($post->ID)) {
193
+		$active_post_lock = wp_set_post_lock($post->ID);
194 194
 
195
-		if ( 'attachment' !== $post_type )
195
+		if ('attachment' !== $post_type)
196 196
 			wp_enqueue_script('autosave');
197 197
 	}
198 198
 
199
-	if ( is_multisite() ) {
200
-		add_action( 'admin_footer', '_admin_notice_post_locked' );
199
+	if (is_multisite()) {
200
+		add_action('admin_footer', '_admin_notice_post_locked');
201 201
 	} else {
202
-		$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
202
+		$check_users = get_users(array('fields' => 'ID', 'number' => 2));
203 203
 
204
-		if ( count( $check_users ) > 1 )
205
-			add_action( 'admin_footer', '_admin_notice_post_locked' );
204
+		if (count($check_users) > 1)
205
+			add_action('admin_footer', '_admin_notice_post_locked');
206 206
 
207
-		unset( $check_users );
207
+		unset($check_users);
208 208
 	}
209 209
 
210 210
 	$title = $post_type_object->labels->edit_item;
211 211
 	$post = get_post($post_id, OBJECT, 'edit');
212 212
 
213
-	if ( post_type_supports($post_type, 'comments') ) {
213
+	if (post_type_supports($post_type, 'comments')) {
214 214
 		wp_enqueue_script('admin-comments');
215 215
 		enqueue_comment_hotkeys_js();
216 216
 	}
217 217
 
218
-	include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
218
+	include(ABSPATH.'wp-admin/edit-form-advanced.php');
219 219
 
220 220
 	break;
221 221
 
222 222
 case 'editattachment':
223
-	check_admin_referer('update-post_' . $post_id);
223
+	check_admin_referer('update-post_'.$post_id);
224 224
 
225 225
 	// Don't let these be changed
226 226
 	unset($_POST['guid']);
227 227
 	$_POST['post_type'] = 'attachment';
228 228
 
229 229
 	// Update the thumbnail filename
230
-	$newmeta = wp_get_attachment_metadata( $post_id, true );
230
+	$newmeta = wp_get_attachment_metadata($post_id, true);
231 231
 	$newmeta['thumb'] = $_POST['thumb'];
232 232
 
233
-	wp_update_attachment_metadata( $post_id, $newmeta );
233
+	wp_update_attachment_metadata($post_id, $newmeta);
234 234
 
235 235
 case 'editpost':
236
-	check_admin_referer('update-post_' . $post_id);
236
+	check_admin_referer('update-post_'.$post_id);
237 237
 
238 238
 	$post_id = edit_post();
239 239
 
240 240
 	// Session cookie flag that the post was saved
241
-	if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
242
-		setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS );
241
+	if (isset($_COOKIE['wp-saving-post']) && $_COOKIE['wp-saving-post'] === $post_id.'-check') {
242
+		setcookie('wp-saving-post', $post_id.'-saved', time() + DAY_IN_SECONDS);
243 243
 	}
244 244
 
245 245
 	redirect_post($post_id); // Send user on their way while we keep working
@@ -247,73 +247,73 @@  discard block
 block discarded – undo
247 247
 	exit();
248 248
 
249 249
 case 'trash':
250
-	check_admin_referer('trash-post_' . $post_id);
250
+	check_admin_referer('trash-post_'.$post_id);
251 251
 
252
-	if ( ! $post )
253
-		wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
252
+	if ( ! $post)
253
+		wp_die(__('The item you are trying to move to the Trash no longer exists.'));
254 254
 
255
-	if ( ! $post_type_object )
256
-		wp_die( __( 'Unknown post type.' ) );
255
+	if ( ! $post_type_object)
256
+		wp_die(__('Unknown post type.'));
257 257
 
258
-	if ( ! current_user_can( 'delete_post', $post_id ) )
259
-		wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
258
+	if ( ! current_user_can('delete_post', $post_id))
259
+		wp_die(__('You are not allowed to move this item to the Trash.'));
260 260
 
261
-	if ( $user_id = wp_check_post_lock( $post_id ) ) {
262
-		$user = get_userdata( $user_id );
263
-		wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
261
+	if ($user_id = wp_check_post_lock($post_id)) {
262
+		$user = get_userdata($user_id);
263
+		wp_die(sprintf(__('You cannot move this item to the Trash. %s is currently editing.'), $user->display_name));
264 264
 	}
265 265
 
266
-	if ( ! wp_trash_post( $post_id ) )
267
-		wp_die( __( 'Error in moving to Trash.' ) );
266
+	if ( ! wp_trash_post($post_id))
267
+		wp_die(__('Error in moving to Trash.'));
268 268
 
269
-	wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
269
+	wp_redirect(add_query_arg(array('trashed' => 1, 'ids' => $post_id), $sendback));
270 270
 	exit();
271 271
 
272 272
 case 'untrash':
273
-	check_admin_referer('untrash-post_' . $post_id);
273
+	check_admin_referer('untrash-post_'.$post_id);
274 274
 
275
-	if ( ! $post )
276
-		wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
275
+	if ( ! $post)
276
+		wp_die(__('The item you are trying to restore from the Trash no longer exists.'));
277 277
 
278
-	if ( ! $post_type_object )
279
-		wp_die( __( 'Unknown post type.' ) );
278
+	if ( ! $post_type_object)
279
+		wp_die(__('Unknown post type.'));
280 280
 
281
-	if ( ! current_user_can( 'delete_post', $post_id ) )
282
-		wp_die( __( 'You are not allowed to restore this item from the Trash.' ) );
281
+	if ( ! current_user_can('delete_post', $post_id))
282
+		wp_die(__('You are not allowed to restore this item from the Trash.'));
283 283
 
284
-	if ( ! wp_untrash_post( $post_id ) )
285
-		wp_die( __( 'Error in restoring from Trash.' ) );
284
+	if ( ! wp_untrash_post($post_id))
285
+		wp_die(__('Error in restoring from Trash.'));
286 286
 
287
-	wp_redirect( add_query_arg('untrashed', 1, $sendback) );
287
+	wp_redirect(add_query_arg('untrashed', 1, $sendback));
288 288
 	exit();
289 289
 
290 290
 case 'delete':
291
-	check_admin_referer('delete-post_' . $post_id);
291
+	check_admin_referer('delete-post_'.$post_id);
292 292
 
293
-	if ( ! $post )
294
-		wp_die( __( 'This item has already been deleted.' ) );
293
+	if ( ! $post)
294
+		wp_die(__('This item has already been deleted.'));
295 295
 
296
-	if ( ! $post_type_object )
297
-		wp_die( __( 'Unknown post type.' ) );
296
+	if ( ! $post_type_object)
297
+		wp_die(__('Unknown post type.'));
298 298
 
299
-	if ( ! current_user_can( 'delete_post', $post_id ) )
300
-		wp_die( __( 'You are not allowed to delete this item.' ) );
299
+	if ( ! current_user_can('delete_post', $post_id))
300
+		wp_die(__('You are not allowed to delete this item.'));
301 301
 
302 302
 	$force = ! EMPTY_TRASH_DAYS;
303
-	if ( $post->post_type == 'attachment' ) {
304
-		$force = ( $force || ! MEDIA_TRASH );
305
-		if ( ! wp_delete_attachment( $post_id, $force ) )
306
-			wp_die( __( 'Error in deleting.' ) );
303
+	if ($post->post_type == 'attachment') {
304
+		$force = ($force || ! MEDIA_TRASH);
305
+		if ( ! wp_delete_attachment($post_id, $force))
306
+			wp_die(__('Error in deleting.'));
307 307
 	} else {
308
-		if ( ! wp_delete_post( $post_id, $force ) )
309
-			wp_die( __( 'Error in deleting.' ) );
308
+		if ( ! wp_delete_post($post_id, $force))
309
+			wp_die(__('Error in deleting.'));
310 310
 	}
311 311
 
312
-	wp_redirect( add_query_arg('deleted', 1, $sendback) );
312
+	wp_redirect(add_query_arg('deleted', 1, $sendback));
313 313
 	exit();
314 314
 
315 315
 case 'preview':
316
-	check_admin_referer( 'update-post_' . $post_id );
316
+	check_admin_referer('update-post_'.$post_id);
317 317
 
318 318
 	$url = post_preview();
319 319
 
@@ -321,7 +321,7 @@  discard block
 block discarded – undo
321 321
 	exit();
322 322
 
323 323
 default:
324
-	wp_redirect( admin_url('edit.php') );
324
+	wp_redirect(admin_url('edit.php'));
325 325
 	exit();
326 326
 } // end switch
327
-include( ABSPATH . 'wp-admin/admin-footer.php' );
327
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +77 added lines, -52 removed lines patch added patch discarded remove patch
@@ -16,12 +16,13 @@  discard block
 block discarded – undo
16 16
 
17 17
 wp_reset_vars( array( 'action' ) );
18 18
 
19
-if ( isset( $_GET['post'] ) )
19
+if ( isset( $_GET['post'] ) ) {
20 20
  	$post_id = $post_ID = (int) $_GET['post'];
21
-elseif ( isset( $_POST['post_ID'] ) )
21
+} elseif ( isset( $_POST['post_ID'] ) ) {
22 22
  	$post_id = $post_ID = (int) $_POST['post_ID'];
23
-else
23
+} else {
24 24
  	$post_id = $post_ID = 0;
25
+}
25 26
 
26 27
 /**
27 28
  * @global string  $post_type
@@ -30,8 +31,9 @@  discard block
 block discarded – undo
30 31
  */
31 32
 global $post_type, $post_type_object, $post;
32 33
 
33
-if ( $post_id )
34
+if ( $post_id ) {
34 35
 	$post = get_post( $post_id );
36
+}
35 37
 
36 38
 if ( $post ) {
37 39
 	$post_type = $post->post_type;
@@ -87,10 +89,11 @@  discard block
 block discarded – undo
87 89
 	exit;
88 90
 }
89 91
 
90
-if ( isset( $_POST['deletepost'] ) )
92
+if ( isset( $_POST['deletepost'] ) ) {
91 93
 	$action = 'delete';
92
-elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] )
94
+} elseif ( isset($_POST['wp-preview']) && 'dopreview' == $_POST['wp-preview'] ) {
93 95
 	$action = 'preview';
96
+}
94 97
 
95 98
 $sendback = wp_get_referer();
96 99
 if ( ! $sendback ||
@@ -117,15 +120,17 @@  discard block
 block discarded – undo
117 120
 	// For output of the quickdraft dashboard widget
118 121
 	require_once ABSPATH . 'wp-admin/includes/dashboard.php';
119 122
 
120
-	if ( ! wp_verify_nonce( $nonce, 'add-post' ) )
121
-		$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
123
+	if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
124
+			$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
125
+	}
122 126
 
123 127
 	if ( ! current_user_can( 'edit_posts' ) ) {
124 128
 		exit;
125 129
 	}
126 130
 
127
-	if ( $error_msg )
128
-		return wp_dashboard_quick_press( $error_msg );
131
+	if ( $error_msg ) {
132
+			return wp_dashboard_quick_press( $error_msg );
133
+	}
129 134
 
130 135
 	$post = get_post( $_REQUEST['post_ID'] );
131 136
 	check_admin_referer( 'add-' . $post->post_type );
@@ -152,17 +157,21 @@  discard block
 block discarded – undo
152 157
 		exit();
153 158
 	}
154 159
 
155
-	if ( ! $post )
156
-		wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
160
+	if ( ! $post ) {
161
+			wp_die( __( 'You attempted to edit an item that doesn&#8217;t exist. Perhaps it was deleted?' ) );
162
+	}
157 163
 
158
-	if ( ! $post_type_object )
159
-		wp_die( __( 'Unknown post type.' ) );
164
+	if ( ! $post_type_object ) {
165
+			wp_die( __( 'Unknown post type.' ) );
166
+	}
160 167
 
161
-	if ( ! current_user_can( 'edit_post', $post_id ) )
162
-		wp_die( __( 'You are not allowed to edit this item.' ) );
168
+	if ( ! current_user_can( 'edit_post', $post_id ) ) {
169
+			wp_die( __( 'You are not allowed to edit this item.' ) );
170
+	}
163 171
 
164
-	if ( 'trash' == $post->post_status )
165
-		wp_die( __( 'You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.' ) );
172
+	if ( 'trash' == $post->post_status ) {
173
+			wp_die( __( 'You can&#8217;t edit this item because it is in the Trash. Please restore it and try again.' ) );
174
+	}
166 175
 
167 176
 	if ( ! empty( $_GET['get-post-lock'] ) ) {
168 177
 		check_admin_referer( 'lock-post_' . $post_id );
@@ -181,10 +190,11 @@  discard block
 block discarded – undo
181 190
 		$submenu_file = 'upload.php';
182 191
 		$post_new_file = 'media-new.php';
183 192
 	} else {
184
-		if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true )
185
-			$parent_file = $post_type_object->show_in_menu;
186
-		else
187
-			$parent_file = "edit.php?post_type=$post_type";
193
+		if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
194
+					$parent_file = $post_type_object->show_in_menu;
195
+		} else {
196
+					$parent_file = "edit.php?post_type=$post_type";
197
+		}
188 198
 		$submenu_file = "edit.php?post_type=$post_type";
189 199
 		$post_new_file = "post-new.php?post_type=$post_type";
190 200
 	}
@@ -192,8 +202,9 @@  discard block
 block discarded – undo
192 202
 	if ( ! wp_check_post_lock( $post->ID ) ) {
193 203
 		$active_post_lock = wp_set_post_lock( $post->ID );
194 204
 
195
-		if ( 'attachment' !== $post_type )
196
-			wp_enqueue_script('autosave');
205
+		if ( 'attachment' !== $post_type ) {
206
+					wp_enqueue_script('autosave');
207
+		}
197 208
 	}
198 209
 
199 210
 	if ( is_multisite() ) {
@@ -201,8 +212,9 @@  discard block
 block discarded – undo
201 212
 	} else {
202 213
 		$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
203 214
 
204
-		if ( count( $check_users ) > 1 )
205
-			add_action( 'admin_footer', '_admin_notice_post_locked' );
215
+		if ( count( $check_users ) > 1 ) {
216
+					add_action( 'admin_footer', '_admin_notice_post_locked' );
217
+		}
206 218
 
207 219
 		unset( $check_users );
208 220
 	}
@@ -249,22 +261,26 @@  discard block
 block discarded – undo
249 261
 case 'trash':
250 262
 	check_admin_referer('trash-post_' . $post_id);
251 263
 
252
-	if ( ! $post )
253
-		wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
264
+	if ( ! $post ) {
265
+			wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
266
+	}
254 267
 
255
-	if ( ! $post_type_object )
256
-		wp_die( __( 'Unknown post type.' ) );
268
+	if ( ! $post_type_object ) {
269
+			wp_die( __( 'Unknown post type.' ) );
270
+	}
257 271
 
258
-	if ( ! current_user_can( 'delete_post', $post_id ) )
259
-		wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
272
+	if ( ! current_user_can( 'delete_post', $post_id ) ) {
273
+			wp_die( __( 'You are not allowed to move this item to the Trash.' ) );
274
+	}
260 275
 
261 276
 	if ( $user_id = wp_check_post_lock( $post_id ) ) {
262 277
 		$user = get_userdata( $user_id );
263 278
 		wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
264 279
 	}
265 280
 
266
-	if ( ! wp_trash_post( $post_id ) )
267
-		wp_die( __( 'Error in moving to Trash.' ) );
281
+	if ( ! wp_trash_post( $post_id ) ) {
282
+			wp_die( __( 'Error in moving to Trash.' ) );
283
+	}
268 284
 
269 285
 	wp_redirect( add_query_arg( array('trashed' => 1, 'ids' => $post_id), $sendback ) );
270 286
 	exit();
@@ -272,17 +288,21 @@  discard block
 block discarded – undo
272 288
 case 'untrash':
273 289
 	check_admin_referer('untrash-post_' . $post_id);
274 290
 
275
-	if ( ! $post )
276
-		wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
291
+	if ( ! $post ) {
292
+			wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
293
+	}
277 294
 
278
-	if ( ! $post_type_object )
279
-		wp_die( __( 'Unknown post type.' ) );
295
+	if ( ! $post_type_object ) {
296
+			wp_die( __( 'Unknown post type.' ) );
297
+	}
280 298
 
281
-	if ( ! current_user_can( 'delete_post', $post_id ) )
282
-		wp_die( __( 'You are not allowed to restore this item from the Trash.' ) );
299
+	if ( ! current_user_can( 'delete_post', $post_id ) ) {
300
+			wp_die( __( 'You are not allowed to restore this item from the Trash.' ) );
301
+	}
283 302
 
284
-	if ( ! wp_untrash_post( $post_id ) )
285
-		wp_die( __( 'Error in restoring from Trash.' ) );
303
+	if ( ! wp_untrash_post( $post_id ) ) {
304
+			wp_die( __( 'Error in restoring from Trash.' ) );
305
+	}
286 306
 
287 307
 	wp_redirect( add_query_arg('untrashed', 1, $sendback) );
288 308
 	exit();
@@ -290,23 +310,28 @@  discard block
 block discarded – undo
290 310
 case 'delete':
291 311
 	check_admin_referer('delete-post_' . $post_id);
292 312
 
293
-	if ( ! $post )
294
-		wp_die( __( 'This item has already been deleted.' ) );
313
+	if ( ! $post ) {
314
+			wp_die( __( 'This item has already been deleted.' ) );
315
+	}
295 316
 
296
-	if ( ! $post_type_object )
297
-		wp_die( __( 'Unknown post type.' ) );
317
+	if ( ! $post_type_object ) {
318
+			wp_die( __( 'Unknown post type.' ) );
319
+	}
298 320
 
299
-	if ( ! current_user_can( 'delete_post', $post_id ) )
300
-		wp_die( __( 'You are not allowed to delete this item.' ) );
321
+	if ( ! current_user_can( 'delete_post', $post_id ) ) {
322
+			wp_die( __( 'You are not allowed to delete this item.' ) );
323
+	}
301 324
 
302 325
 	$force = ! EMPTY_TRASH_DAYS;
303 326
 	if ( $post->post_type == 'attachment' ) {
304 327
 		$force = ( $force || ! MEDIA_TRASH );
305
-		if ( ! wp_delete_attachment( $post_id, $force ) )
306
-			wp_die( __( 'Error in deleting.' ) );
328
+		if ( ! wp_delete_attachment( $post_id, $force ) ) {
329
+					wp_die( __( 'Error in deleting.' ) );
330
+		}
307 331
 	} else {
308
-		if ( ! wp_delete_post( $post_id, $force ) )
309
-			wp_die( __( 'Error in deleting.' ) );
332
+		if ( ! wp_delete_post( $post_id, $force ) ) {
333
+					wp_die( __( 'Error in deleting.' ) );
334
+		}
310 335
 	}
311 336
 
312 337
 	wp_redirect( add_query_arg('deleted', 1, $sendback) );
Please login to merge, or discard this patch.
src/wp-admin/ms-options.php 2 patches
Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -1,11 +1,11 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Multisite network settings administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Multisite
7
- * @since 3.0.0
8
- */
3
+	 * Multisite network settings administration panel.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Multisite
7
+	 * @since 3.0.0
8
+	 */
9 9
 
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
Please login to merge, or discard this patch.
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,6 +7,6 @@
 block discarded – undo
7 7
  * @since 3.0.0
8 8
  */
9 9
 
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-wp_redirect( network_admin_url('settings.php') );
12
+wp_redirect(network_admin_url('settings.php'));
Please login to merge, or discard this patch.
src/wp-admin/ms-edit.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
  * @since 3.0.0
8 8
  */
9 9
 
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-wp_redirect( network_admin_url() );
12
+wp_redirect(network_admin_url());
13 13
 exit;
Please login to merge, or discard this patch.