Completed
Push — master ( d99bf9...491baf )
by Stephen
13:47
created
src/wp-admin/user/freedoms.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,6 +8,6 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** Load WordPress Administration Bootstrap */
11
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
+require_once(dirname(__FILE__).'/admin.php');
12 12
 
13
-require( ABSPATH . 'wp-admin/freedoms.php' );
13
+require(ABSPATH.'wp-admin/freedoms.php');
Please login to merge, or discard this patch.
src/wp-admin/user/about.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,6 +8,6 @@
 block discarded – undo
8 8
  */
9 9
 
10 10
 /** Load WordPress Administration Bootstrap */
11
-require_once( dirname( __FILE__ ) . '/admin.php' );
11
+require_once(dirname(__FILE__).'/admin.php');
12 12
 
13
-require( ABSPATH . 'wp-admin/about.php' );
13
+require(ABSPATH.'wp-admin/about.php');
Please login to merge, or discard this patch.
src/wp-admin/includes/image.php 3 patches
Switch Indentation   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -156,12 +156,12 @@
 block discarded – undo
156 156
 		} else {
157 157
 			$ext = '.jpg';
158 158
 			switch ( $metadata['image']['mime'] ) {
159
-			case 'image/gif':
160
-				$ext = '.gif';
161
-				break;
162
-			case 'image/png':
163
-				$ext = '.png';
164
-				break;
159
+				case 'image/gif':
160
+					$ext = '.gif';
161
+					break;
162
+				case 'image/png':
163
+					$ext = '.png';
164
+					break;
165 165
 			}
166 166
 			$basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;
167 167
 			$uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] );
Please login to merge, or discard this patch.
Braces   +44 added lines, -26 removed lines patch added patch discarded remove patch
@@ -37,15 +37,18 @@  discard block
 block discarded – undo
37 37
 	}
38 38
 
39 39
 	$editor = wp_get_image_editor( $src );
40
-	if ( is_wp_error( $editor ) )
41
-		return $editor;
40
+	if ( is_wp_error( $editor ) ) {
41
+			return $editor;
42
+	}
42 43
 
43 44
 	$src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
44
-	if ( is_wp_error( $src ) )
45
-		return $src;
45
+	if ( is_wp_error( $src ) ) {
46
+			return $src;
47
+	}
46 48
 
47
-	if ( ! $dst_file )
48
-		$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
49
+	if ( ! $dst_file ) {
50
+			$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
51
+	}
49 52
 
50 53
 	/*
51 54
 	 * The directory containing the original file may no longer exist when
@@ -56,8 +59,9 @@  discard block
 block discarded – undo
56 59
 	$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
57 60
 
58 61
 	$result = $editor->save( $dst_file );
59
-	if ( is_wp_error( $result ) )
60
-		return $result;
62
+	if ( is_wp_error( $result ) ) {
63
+			return $result;
64
+	}
61 65
 
62 66
 	return $dst_file;
63 67
 }
@@ -131,16 +135,18 @@  discard block
 block discarded – undo
131 135
 		if ( $sizes ) {
132 136
 			$editor = wp_get_image_editor( $file );
133 137
 
134
-			if ( ! is_wp_error( $editor ) )
135
-				$metadata['sizes'] = $editor->multi_resize( $sizes );
138
+			if ( ! is_wp_error( $editor ) ) {
139
+							$metadata['sizes'] = $editor->multi_resize( $sizes );
140
+			}
136 141
 		} else {
137 142
 			$metadata['sizes'] = array();
138 143
 		}
139 144
 
140 145
 		// Fetch additional metadata from EXIF/IPTC.
141 146
 		$image_meta = wp_read_image_metadata( $file );
142
-		if ( $image_meta )
143
-			$metadata['image_meta'] = $image_meta;
147
+		if ( $image_meta ) {
148
+					$metadata['image_meta'] = $image_meta;
149
+		}
144 150
 
145 151
 	} elseif ( wp_attachment_is( 'video', $attachment ) ) {
146 152
 		$metadata = wp_read_video_metadata( $file );
@@ -294,8 +300,9 @@  discard block
 block discarded – undo
294 300
  */
295 301
 function wp_exif_frac2dec($str) {
296 302
 	@list( $n, $d ) = explode( '/', $str );
297
-	if ( !empty($d) )
298
-		return $n / $d;
303
+	if ( !empty($d) ) {
304
+			return $n / $d;
305
+	}
299 306
 	return $str;
300 307
 }
301 308
 
@@ -331,8 +338,9 @@  discard block
 block discarded – undo
331 338
  * @return bool|array False on failure. Image metadata array on success.
332 339
  */
333 340
 function wp_read_image_metadata( $file ) {
334
-	if ( ! file_exists( $file ) )
335
-		return false;
341
+	if ( ! file_exists( $file ) ) {
342
+			return false;
343
+	}
336 344
 
337 345
 	list( , , $sourceImageType ) = getimagesize( $file );
338 346
 
@@ -394,16 +402,23 @@  discard block
 block discarded – undo
394 402
 				$meta['caption'] = $caption;
395 403
 			}
396 404
 
397
-			if ( ! empty( $iptc['2#110'][0] ) ) // credit
405
+			if ( ! empty( $iptc['2#110'][0] ) ) {
406
+				// credit
398 407
 				$meta['credit'] = trim( $iptc['2#110'][0] );
399
-			elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline
408
+			} elseif ( ! empty( $iptc['2#080'][0] ) ) {
409
+				// creator / legacy byline
400 410
 				$meta['credit'] = trim( $iptc['2#080'][0] );
411
+			}
401 412
 
402
-			if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time
413
+			if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) {
414
+				// created date and time
403 415
 				$meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] );
416
+			}
404 417
 
405
-			if ( ! empty( $iptc['2#116'][0] ) ) // copyright
418
+			if ( ! empty( $iptc['2#116'][0] ) ) {
419
+				// copyright
406 420
 				$meta['copyright'] = trim( $iptc['2#116'][0] );
421
+			}
407 422
 
408 423
 			if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array
409 424
 				$meta['keywords'] = array_values( $iptc['2#025'] );
@@ -562,8 +577,9 @@  discard block
 block discarded – undo
562 577
  */
563 578
 function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) {
564 579
 	$filepath = _load_image_to_edit_path( $attachment_id, $size );
565
-	if ( empty( $filepath ) )
566
-		return false;
580
+	if ( empty( $filepath ) ) {
581
+			return false;
582
+	}
567 583
 
568 584
 	switch ( $mime_type ) {
569 585
 		case 'image/jpeg':
@@ -667,8 +683,9 @@  discard block
 block discarded – undo
667 683
  */
668 684
 function _copy_image_file( $attachment_id ) {
669 685
 	$dst_file = $src_file = get_attached_file( $attachment_id );
670
-	if ( ! file_exists( $src_file ) )
671
-		$src_file = _load_image_to_edit_path( $attachment_id );
686
+	if ( ! file_exists( $src_file ) ) {
687
+			$src_file = _load_image_to_edit_path( $attachment_id );
688
+	}
672 689
 
673 690
 	if ( $src_file ) {
674 691
 		$dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
@@ -680,8 +697,9 @@  discard block
 block discarded – undo
680 697
 		 */
681 698
 		wp_mkdir_p( dirname( $dst_file ) );
682 699
 
683
-		if ( ! @copy( $src_file, $dst_file ) )
684
-			$dst_file = false;
700
+		if ( ! @copy( $src_file, $dst_file ) ) {
701
+					$dst_file = false;
702
+		}
685 703
 	} else {
686 704
 		$dst_file = false;
687 705
 	}
Please login to merge, or discard this patch.
Spacing   +190 added lines, -190 removed lines patch added patch discarded remove patch
@@ -22,41 +22,41 @@  discard block
 block discarded – undo
22 22
  * @param string $dst_file Optional. The destination file to write to.
23 23
  * @return string|WP_Error New filepath on success, WP_Error on failure.
24 24
  */
25
-function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
25
+function wp_crop_image($src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false) {
26 26
 	$src_file = $src;
27
-	if ( is_numeric( $src ) ) { // Handle int as attachment ID
28
-		$src_file = get_attached_file( $src );
27
+	if (is_numeric($src)) { // Handle int as attachment ID
28
+		$src_file = get_attached_file($src);
29 29
 
30
-		if ( ! file_exists( $src_file ) ) {
30
+		if ( ! file_exists($src_file)) {
31 31
 			// If the file doesn't exist, attempt a URL fopen on the src link.
32 32
 			// This can occur with certain file replication plugins.
33
-			$src = _load_image_to_edit_path( $src, 'full' );
33
+			$src = _load_image_to_edit_path($src, 'full');
34 34
 		} else {
35 35
 			$src = $src_file;
36 36
 		}
37 37
 	}
38 38
 
39
-	$editor = wp_get_image_editor( $src );
40
-	if ( is_wp_error( $editor ) )
39
+	$editor = wp_get_image_editor($src);
40
+	if (is_wp_error($editor))
41 41
 		return $editor;
42 42
 
43
-	$src = $editor->crop( $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs );
44
-	if ( is_wp_error( $src ) )
43
+	$src = $editor->crop($src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs);
44
+	if (is_wp_error($src))
45 45
 		return $src;
46 46
 
47
-	if ( ! $dst_file )
48
-		$dst_file = str_replace( basename( $src_file ), 'cropped-' . basename( $src_file ), $src_file );
47
+	if ( ! $dst_file)
48
+		$dst_file = str_replace(basename($src_file), 'cropped-'.basename($src_file), $src_file);
49 49
 
50 50
 	/*
51 51
 	 * The directory containing the original file may no longer exist when
52 52
 	 * using a replication plugin.
53 53
 	 */
54
-	wp_mkdir_p( dirname( $dst_file ) );
54
+	wp_mkdir_p(dirname($dst_file));
55 55
 
56
-	$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
56
+	$dst_file = dirname($dst_file).'/'.wp_unique_filename(dirname($dst_file), basename($dst_file));
57 57
 
58
-	$result = $editor->save( $dst_file );
59
-	if ( is_wp_error( $result ) )
58
+	$result = $editor->save($dst_file);
59
+	if (is_wp_error($result))
60 60
 		return $result;
61 61
 
62 62
 	return $dst_file;
@@ -71,15 +71,15 @@  discard block
 block discarded – undo
71 71
  * @param string $file Filepath of the Attached image.
72 72
  * @return mixed Metadata for attachment.
73 73
  */
74
-function wp_generate_attachment_metadata( $attachment_id, $file ) {
75
-	$attachment = get_post( $attachment_id );
74
+function wp_generate_attachment_metadata($attachment_id, $file) {
75
+	$attachment = get_post($attachment_id);
76 76
 
77 77
 	$metadata = array();
78 78
 	$support = false;
79
-	$mime_type = get_post_mime_type( $attachment );
79
+	$mime_type = get_post_mime_type($attachment);
80 80
 
81
-	if ( preg_match( '!^image/!', $mime_type ) && file_is_displayable_image( $file ) ) {
82
-		$imagesize = getimagesize( $file );
81
+	if (preg_match('!^image/!', $mime_type) && file_is_displayable_image($file)) {
82
+		$imagesize = getimagesize($file);
83 83
 		$metadata['width'] = $imagesize[0];
84 84
 		$metadata['height'] = $imagesize[1];
85 85
 
@@ -90,30 +90,30 @@  discard block
 block discarded – undo
90 90
 		$_wp_additional_image_sizes = wp_get_additional_image_sizes();
91 91
 
92 92
 		$sizes = array();
93
-		foreach ( get_intermediate_image_sizes() as $s ) {
94
-			$sizes[$s] = array( 'width' => '', 'height' => '', 'crop' => false );
95
-			if ( isset( $_wp_additional_image_sizes[$s]['width'] ) ) {
93
+		foreach (get_intermediate_image_sizes() as $s) {
94
+			$sizes[$s] = array('width' => '', 'height' => '', 'crop' => false);
95
+			if (isset($_wp_additional_image_sizes[$s]['width'])) {
96 96
 				// For theme-added sizes
97
-				$sizes[$s]['width'] = intval( $_wp_additional_image_sizes[$s]['width'] );
97
+				$sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']);
98 98
 			} else {
99 99
 				// For default sizes set in options
100
-				$sizes[$s]['width'] = get_option( "{$s}_size_w" );
100
+				$sizes[$s]['width'] = get_option("{$s}_size_w");
101 101
 			}
102 102
 
103
-			if ( isset( $_wp_additional_image_sizes[$s]['height'] ) ) {
103
+			if (isset($_wp_additional_image_sizes[$s]['height'])) {
104 104
 				// For theme-added sizes
105
-				$sizes[$s]['height'] = intval( $_wp_additional_image_sizes[$s]['height'] );
105
+				$sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']);
106 106
 			} else {
107 107
 				// For default sizes set in options
108
-				$sizes[$s]['height'] = get_option( "{$s}_size_h" );
108
+				$sizes[$s]['height'] = get_option("{$s}_size_h");
109 109
 			}
110 110
 
111
-			if ( isset( $_wp_additional_image_sizes[$s]['crop'] ) ) {
111
+			if (isset($_wp_additional_image_sizes[$s]['crop'])) {
112 112
 				// For theme-added sizes
113 113
 				$sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop'];
114 114
 			} else {
115 115
 				// For default sizes set in options
116
-				$sizes[$s]['crop'] = get_option( "{$s}_crop" );
116
+				$sizes[$s]['crop'] = get_option("{$s}_crop");
117 117
 			}
118 118
 		}
119 119
 
@@ -126,34 +126,34 @@  discard block
 block discarded – undo
126 126
 		 * @param array $sizes    An associative array of image sizes.
127 127
 		 * @param array $metadata An associative array of image metadata: width, height, file.
128 128
 		 */
129
-		$sizes = apply_filters( 'intermediate_image_sizes_advanced', $sizes, $metadata );
129
+		$sizes = apply_filters('intermediate_image_sizes_advanced', $sizes, $metadata);
130 130
 
131
-		if ( $sizes ) {
132
-			$editor = wp_get_image_editor( $file );
131
+		if ($sizes) {
132
+			$editor = wp_get_image_editor($file);
133 133
 
134
-			if ( ! is_wp_error( $editor ) )
135
-				$metadata['sizes'] = $editor->multi_resize( $sizes );
134
+			if ( ! is_wp_error($editor))
135
+				$metadata['sizes'] = $editor->multi_resize($sizes);
136 136
 		} else {
137 137
 			$metadata['sizes'] = array();
138 138
 		}
139 139
 
140 140
 		// Fetch additional metadata from EXIF/IPTC.
141
-		$image_meta = wp_read_image_metadata( $file );
142
-		if ( $image_meta )
141
+		$image_meta = wp_read_image_metadata($file);
142
+		if ($image_meta)
143 143
 			$metadata['image_meta'] = $image_meta;
144 144
 
145
-	} elseif ( wp_attachment_is( 'video', $attachment ) ) {
146
-		$metadata = wp_read_video_metadata( $file );
147
-		$support = current_theme_supports( 'post-thumbnails', 'attachment:video' ) || post_type_supports( 'attachment:video', 'thumbnail' );
148
-	} elseif ( wp_attachment_is( 'audio', $attachment ) ) {
149
-		$metadata = wp_read_audio_metadata( $file );
150
-		$support = current_theme_supports( 'post-thumbnails', 'attachment:audio' ) || post_type_supports( 'attachment:audio', 'thumbnail' );
145
+	} elseif (wp_attachment_is('video', $attachment)) {
146
+		$metadata = wp_read_video_metadata($file);
147
+		$support = current_theme_supports('post-thumbnails', 'attachment:video') || post_type_supports('attachment:video', 'thumbnail');
148
+	} elseif (wp_attachment_is('audio', $attachment)) {
149
+		$metadata = wp_read_audio_metadata($file);
150
+		$support = current_theme_supports('post-thumbnails', 'attachment:audio') || post_type_supports('attachment:audio', 'thumbnail');
151 151
 	}
152 152
 
153
-	if ( $support && ! empty( $metadata['image']['data'] ) ) {
153
+	if ($support && ! empty($metadata['image']['data'])) {
154 154
 		// Check for existing cover.
155
-		$hash = md5( $metadata['image']['data'] );
156
-		$posts = get_posts( array(
155
+		$hash = md5($metadata['image']['data']);
156
+		$posts = get_posts(array(
157 157
 			'fields' => 'ids',
158 158
 			'post_type' => 'attachment',
159 159
 			'post_mime_type' => $metadata['image']['mime'],
@@ -161,14 +161,14 @@  discard block
 block discarded – undo
161 161
 			'posts_per_page' => 1,
162 162
 			'meta_key' => '_cover_hash',
163 163
 			'meta_value' => $hash
164
-		) );
165
-		$exists = reset( $posts );
164
+		));
165
+		$exists = reset($posts);
166 166
 
167
-		if ( ! empty( $exists ) ) {
168
-			update_post_meta( $attachment_id, '_thumbnail_id', $exists );
167
+		if ( ! empty($exists)) {
168
+			update_post_meta($attachment_id, '_thumbnail_id', $exists);
169 169
 		} else {
170 170
 			$ext = '.jpg';
171
-			switch ( $metadata['image']['mime'] ) {
171
+			switch ($metadata['image']['mime']) {
172 172
 			case 'image/gif':
173 173
 				$ext = '.gif';
174 174
 				break;
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 				$ext = '.png';
177 177
 				break;
178 178
 			}
179
-			$basename = str_replace( '.', '-', basename( $file ) ) . '-image' . $ext;
180
-			$uploaded = wp_upload_bits( $basename, '', $metadata['image']['data'] );
181
-			if ( false === $uploaded['error'] ) {
179
+			$basename = str_replace('.', '-', basename($file)).'-image'.$ext;
180
+			$uploaded = wp_upload_bits($basename, '', $metadata['image']['data']);
181
+			if (false === $uploaded['error']) {
182 182
 				$image_attachment = array(
183 183
 					'post_mime_type' => $metadata['image']['mime'],
184 184
 					'post_type' => 'attachment',
@@ -193,18 +193,18 @@  discard block
 block discarded – undo
193 193
 				 * @param array $metadata         Current attachment metadata.
194 194
 				 * @param array $uploaded         An array containing the thumbnail path and url.
195 195
 				 */
196
-				$image_attachment = apply_filters( 'attachment_thumbnail_args', $image_attachment, $metadata, $uploaded );
196
+				$image_attachment = apply_filters('attachment_thumbnail_args', $image_attachment, $metadata, $uploaded);
197 197
 
198
-				$sub_attachment_id = wp_insert_attachment( $image_attachment, $uploaded['file'] );
199
-				add_post_meta( $sub_attachment_id, '_cover_hash', $hash );
200
-				$attach_data = wp_generate_attachment_metadata( $sub_attachment_id, $uploaded['file'] );
201
-				wp_update_attachment_metadata( $sub_attachment_id, $attach_data );
202
-				update_post_meta( $attachment_id, '_thumbnail_id', $sub_attachment_id );
198
+				$sub_attachment_id = wp_insert_attachment($image_attachment, $uploaded['file']);
199
+				add_post_meta($sub_attachment_id, '_cover_hash', $hash);
200
+				$attach_data = wp_generate_attachment_metadata($sub_attachment_id, $uploaded['file']);
201
+				wp_update_attachment_metadata($sub_attachment_id, $attach_data);
202
+				update_post_meta($attachment_id, '_thumbnail_id', $sub_attachment_id);
203 203
 			}
204 204
 		}
205 205
 	}
206 206
 	// Try to create image thumbnails for PDFs
207
-	else if ( 'application/pdf' === $mime_type ) {
207
+	else if ('application/pdf' === $mime_type) {
208 208
 		$fallback_sizes = array(
209 209
 			'thumbnail',
210 210
 			'medium',
@@ -218,57 +218,57 @@  discard block
 block discarded – undo
218 218
 		 *
219 219
 		 * @param array $fallback_sizes An array of image size names.
220 220
 		 */
221
-		$fallback_sizes = apply_filters( 'fallback_intermediate_image_sizes', $fallback_sizes, $metadata );
221
+		$fallback_sizes = apply_filters('fallback_intermediate_image_sizes', $fallback_sizes, $metadata);
222 222
 
223 223
 		$sizes = array();
224 224
 		$_wp_additional_image_sizes = wp_get_additional_image_sizes();
225 225
 
226
-		foreach ( $fallback_sizes as $s ) {
227
-			if ( isset( $_wp_additional_image_sizes[ $s ]['width'] ) ) {
228
-				$sizes[ $s ]['width'] = intval( $_wp_additional_image_sizes[ $s ]['width'] );
226
+		foreach ($fallback_sizes as $s) {
227
+			if (isset($_wp_additional_image_sizes[$s]['width'])) {
228
+				$sizes[$s]['width'] = intval($_wp_additional_image_sizes[$s]['width']);
229 229
 			} else {
230
-				$sizes[ $s ]['width'] = get_option( "{$s}_size_w" );
230
+				$sizes[$s]['width'] = get_option("{$s}_size_w");
231 231
 			}
232 232
 
233
-			if ( isset( $_wp_additional_image_sizes[ $s ]['height'] ) ) {
234
-				$sizes[ $s ]['height'] = intval( $_wp_additional_image_sizes[ $s ]['height'] );
233
+			if (isset($_wp_additional_image_sizes[$s]['height'])) {
234
+				$sizes[$s]['height'] = intval($_wp_additional_image_sizes[$s]['height']);
235 235
 			} else {
236
-				$sizes[ $s ]['height'] = get_option( "{$s}_size_h" );
236
+				$sizes[$s]['height'] = get_option("{$s}_size_h");
237 237
 			}
238 238
 
239
-			if ( isset( $_wp_additional_image_sizes[ $s ]['crop'] ) ) {
240
-				$sizes[ $s ]['crop'] = $_wp_additional_image_sizes[ $s ]['crop'];
239
+			if (isset($_wp_additional_image_sizes[$s]['crop'])) {
240
+				$sizes[$s]['crop'] = $_wp_additional_image_sizes[$s]['crop'];
241 241
 			} else {
242 242
 				// Force thumbnails to be soft crops.
243
-				if ( ! 'thumbnail' === $s ) {
244
-					$sizes[ $s ]['crop'] = get_option( "{$s}_crop" );
243
+				if ( ! 'thumbnail' === $s) {
244
+					$sizes[$s]['crop'] = get_option("{$s}_crop");
245 245
 				}
246 246
 			}
247 247
 		}
248 248
 
249 249
 		// Only load PDFs in an image editor if we're processing sizes.
250
-		if ( ! empty( $sizes ) ) {
251
-			$editor = wp_get_image_editor( $file );
250
+		if ( ! empty($sizes)) {
251
+			$editor = wp_get_image_editor($file);
252 252
 
253
-			if ( ! is_wp_error( $editor ) ) { // No support for this type of file
253
+			if ( ! is_wp_error($editor)) { // No support for this type of file
254 254
 				/*
255 255
 				 * PDFs may have the same file filename as JPEGs.
256 256
 				 * Ensure the PDF preview image does not overwrite any JPEG images that already exist.
257 257
 				 */
258
-				$dirname = dirname( $file ) . '/';
259
-				$ext = '.' . pathinfo( $file, PATHINFO_EXTENSION );
260
-				$preview_file = $dirname . wp_unique_filename( $dirname, wp_basename( $file, $ext ) . '-pdf.jpg' );
258
+				$dirname = dirname($file).'/';
259
+				$ext = '.'.pathinfo($file, PATHINFO_EXTENSION);
260
+				$preview_file = $dirname.wp_unique_filename($dirname, wp_basename($file, $ext).'-pdf.jpg');
261 261
 
262
-				$uploaded = $editor->save( $preview_file, 'image/jpeg' );
263
-				unset( $editor );
262
+				$uploaded = $editor->save($preview_file, 'image/jpeg');
263
+				unset($editor);
264 264
 
265 265
 				// Resize based on the full size image, rather than the source.
266
-				if ( ! is_wp_error( $uploaded ) ) {
267
-					$editor = wp_get_image_editor( $uploaded['path'] );
268
-					unset( $uploaded['path'] );
266
+				if ( ! is_wp_error($uploaded)) {
267
+					$editor = wp_get_image_editor($uploaded['path']);
268
+					unset($uploaded['path']);
269 269
 
270
-					if ( ! is_wp_error( $editor ) ) {
271
-						$metadata['sizes'] = $editor->multi_resize( $sizes );
270
+					if ( ! is_wp_error($editor)) {
271
+						$metadata['sizes'] = $editor->multi_resize($sizes);
272 272
 						$metadata['sizes']['full'] = $uploaded;
273 273
 					}
274 274
 				}
@@ -277,8 +277,8 @@  discard block
 block discarded – undo
277 277
 	}
278 278
 
279 279
 	// Remove the blob of binary data from the array.
280
-	if ( $metadata ) {
281
-		unset( $metadata['image']['data'] );
280
+	if ($metadata) {
281
+		unset($metadata['image']['data']);
282 282
 	}
283 283
 
284 284
 	/**
@@ -289,7 +289,7 @@  discard block
 block discarded – undo
289 289
 	 * @param array $metadata      An array of attachment meta data.
290 290
 	 * @param int   $attachment_id Current attachment ID.
291 291
 	 */
292
-	return apply_filters( 'wp_generate_attachment_metadata', $metadata, $attachment_id );
292
+	return apply_filters('wp_generate_attachment_metadata', $metadata, $attachment_id);
293 293
 }
294 294
 
295 295
 /**
@@ -301,8 +301,8 @@  discard block
 block discarded – undo
301 301
  * @return int|float
302 302
  */
303 303
 function wp_exif_frac2dec($str) {
304
-	@list( $n, $d ) = explode( '/', $str );
305
-	if ( !empty($d) )
304
+	@list($n, $d) = explode('/', $str);
305
+	if ( ! empty($d))
306 306
 		return $n / $d;
307 307
 	return $str;
308 308
 }
@@ -316,10 +316,10 @@  discard block
 block discarded – undo
316 316
  * @return int
317 317
  */
318 318
 function wp_exif_date2ts($str) {
319
-	@list( $date, $time ) = explode( ' ', trim($str) );
320
-	@list( $y, $m, $d ) = explode( ':', $date );
319
+	@list($date, $time) = explode(' ', trim($str));
320
+	@list($y, $m, $d) = explode(':', $date);
321 321
 
322
-	return strtotime( "{$y}-{$m}-{$d} {$time}" );
322
+	return strtotime("{$y}-{$m}-{$d} {$time}");
323 323
 }
324 324
 
325 325
 /**
@@ -338,11 +338,11 @@  discard block
 block discarded – undo
338 338
  * @param string $file
339 339
  * @return bool|array False on failure. Image metadata array on success.
340 340
  */
341
-function wp_read_image_metadata( $file ) {
342
-	if ( ! file_exists( $file ) )
341
+function wp_read_image_metadata($file) {
342
+	if ( ! file_exists($file))
343 343
 		return false;
344 344
 
345
-	list( , , $sourceImageType ) = getimagesize( $file );
345
+	list(,, $sourceImageType) = getimagesize($file);
346 346
 
347 347
 	/*
348 348
 	 * EXIF contains a bunch of data we'll probably never need formatted in ways
@@ -370,31 +370,31 @@  discard block
 block discarded – undo
370 370
 	 * Read IPTC first, since it might contain data not available in exif such
371 371
 	 * as caption, description etc.
372 372
 	 */
373
-	if ( is_callable( 'iptcparse' ) ) {
374
-		getimagesize( $file, $info );
373
+	if (is_callable('iptcparse')) {
374
+		getimagesize($file, $info);
375 375
 
376
-		if ( ! empty( $info['APP13'] ) ) {
377
-			$iptc = iptcparse( $info['APP13'] );
376
+		if ( ! empty($info['APP13'])) {
377
+			$iptc = iptcparse($info['APP13']);
378 378
 
379 379
 			// Headline, "A brief synopsis of the caption."
380
-			if ( ! empty( $iptc['2#105'][0] ) ) {
381
-				$meta['title'] = trim( $iptc['2#105'][0] );
380
+			if ( ! empty($iptc['2#105'][0])) {
381
+				$meta['title'] = trim($iptc['2#105'][0]);
382 382
 			/*
383 383
 			 * Title, "Many use the Title field to store the filename of the image,
384 384
 			 * though the field may be used in many ways."
385 385
 			 */
386
-			} elseif ( ! empty( $iptc['2#005'][0] ) ) {
387
-				$meta['title'] = trim( $iptc['2#005'][0] );
386
+			} elseif ( ! empty($iptc['2#005'][0])) {
387
+				$meta['title'] = trim($iptc['2#005'][0]);
388 388
 			}
389 389
 
390
-			if ( ! empty( $iptc['2#120'][0] ) ) { // description / legacy caption
391
-				$caption = trim( $iptc['2#120'][0] );
390
+			if ( ! empty($iptc['2#120'][0])) { // description / legacy caption
391
+				$caption = trim($iptc['2#120'][0]);
392 392
 
393 393
 				mbstring_binary_safe_encoding();
394
-				$caption_length = strlen( $caption );
394
+				$caption_length = strlen($caption);
395 395
 				reset_mbstring_encoding();
396 396
 
397
-				if ( empty( $meta['title'] ) && $caption_length < 80 ) {
397
+				if (empty($meta['title']) && $caption_length < 80) {
398 398
 					// Assume the title is stored in 2:120 if it's short.
399 399
 					$meta['title'] = $caption;
400 400
 				}
@@ -402,19 +402,19 @@  discard block
 block discarded – undo
402 402
 				$meta['caption'] = $caption;
403 403
 			}
404 404
 
405
-			if ( ! empty( $iptc['2#110'][0] ) ) // credit
406
-				$meta['credit'] = trim( $iptc['2#110'][0] );
407
-			elseif ( ! empty( $iptc['2#080'][0] ) ) // creator / legacy byline
408
-				$meta['credit'] = trim( $iptc['2#080'][0] );
405
+			if ( ! empty($iptc['2#110'][0])) // credit
406
+				$meta['credit'] = trim($iptc['2#110'][0]);
407
+			elseif ( ! empty($iptc['2#080'][0])) // creator / legacy byline
408
+				$meta['credit'] = trim($iptc['2#080'][0]);
409 409
 
410
-			if ( ! empty( $iptc['2#055'][0] ) && ! empty( $iptc['2#060'][0] ) ) // created date and time
411
-				$meta['created_timestamp'] = strtotime( $iptc['2#055'][0] . ' ' . $iptc['2#060'][0] );
410
+			if ( ! empty($iptc['2#055'][0]) && ! empty($iptc['2#060'][0])) // created date and time
411
+				$meta['created_timestamp'] = strtotime($iptc['2#055'][0].' '.$iptc['2#060'][0]);
412 412
 
413
-			if ( ! empty( $iptc['2#116'][0] ) ) // copyright
414
-				$meta['copyright'] = trim( $iptc['2#116'][0] );
413
+			if ( ! empty($iptc['2#116'][0])) // copyright
414
+				$meta['copyright'] = trim($iptc['2#116'][0]);
415 415
 
416
-			if ( ! empty( $iptc['2#025'][0] ) ) { // keywords array
417
-				$meta['keywords'] = array_values( $iptc['2#025'] );
416
+			if ( ! empty($iptc['2#025'][0])) { // keywords array
417
+				$meta['keywords'] = array_values($iptc['2#025']);
418 418
 			}
419 419
 		 }
420 420
 	}
@@ -426,78 +426,78 @@  discard block
 block discarded – undo
426 426
 	 *
427 427
 	 * @param array $image_types Image types to check for exif data.
428 428
 	 */
429
-	if ( is_callable( 'exif_read_data' ) && in_array( $sourceImageType, apply_filters( 'wp_read_image_metadata_types', array( IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM ) ) ) ) {
430
-		$exif = @exif_read_data( $file );
429
+	if (is_callable('exif_read_data') && in_array($sourceImageType, apply_filters('wp_read_image_metadata_types', array(IMAGETYPE_JPEG, IMAGETYPE_TIFF_II, IMAGETYPE_TIFF_MM)))) {
430
+		$exif = @exif_read_data($file);
431 431
 
432
-		if ( ! empty( $exif['ImageDescription'] ) ) {
432
+		if ( ! empty($exif['ImageDescription'])) {
433 433
 			mbstring_binary_safe_encoding();
434
-			$description_length = strlen( $exif['ImageDescription'] );
434
+			$description_length = strlen($exif['ImageDescription']);
435 435
 			reset_mbstring_encoding();
436 436
 
437
-			if ( empty( $meta['title'] ) && $description_length < 80 ) {
437
+			if (empty($meta['title']) && $description_length < 80) {
438 438
 				// Assume the title is stored in ImageDescription
439
-				$meta['title'] = trim( $exif['ImageDescription'] );
439
+				$meta['title'] = trim($exif['ImageDescription']);
440 440
 			}
441 441
 
442
-			if ( empty( $meta['caption'] ) && ! empty( $exif['COMPUTED']['UserComment'] ) ) {
443
-				$meta['caption'] = trim( $exif['COMPUTED']['UserComment'] );
442
+			if (empty($meta['caption']) && ! empty($exif['COMPUTED']['UserComment'])) {
443
+				$meta['caption'] = trim($exif['COMPUTED']['UserComment']);
444 444
 			}
445 445
 
446
-			if ( empty( $meta['caption'] ) ) {
447
-				$meta['caption'] = trim( $exif['ImageDescription'] );
446
+			if (empty($meta['caption'])) {
447
+				$meta['caption'] = trim($exif['ImageDescription']);
448 448
 			}
449
-		} elseif ( empty( $meta['caption'] ) && ! empty( $exif['Comments'] ) ) {
450
-			$meta['caption'] = trim( $exif['Comments'] );
449
+		} elseif (empty($meta['caption']) && ! empty($exif['Comments'])) {
450
+			$meta['caption'] = trim($exif['Comments']);
451 451
 		}
452 452
 
453
-		if ( empty( $meta['credit'] ) ) {
454
-			if ( ! empty( $exif['Artist'] ) ) {
455
-				$meta['credit'] = trim( $exif['Artist'] );
456
-			} elseif ( ! empty($exif['Author'] ) ) {
457
-				$meta['credit'] = trim( $exif['Author'] );
453
+		if (empty($meta['credit'])) {
454
+			if ( ! empty($exif['Artist'])) {
455
+				$meta['credit'] = trim($exif['Artist']);
456
+			} elseif ( ! empty($exif['Author'])) {
457
+				$meta['credit'] = trim($exif['Author']);
458 458
 			}
459 459
 		}
460 460
 
461
-		if ( empty( $meta['copyright'] ) && ! empty( $exif['Copyright'] ) ) {
462
-			$meta['copyright'] = trim( $exif['Copyright'] );
461
+		if (empty($meta['copyright']) && ! empty($exif['Copyright'])) {
462
+			$meta['copyright'] = trim($exif['Copyright']);
463 463
 		}
464
-		if ( ! empty( $exif['FNumber'] ) ) {
465
-			$meta['aperture'] = round( wp_exif_frac2dec( $exif['FNumber'] ), 2 );
464
+		if ( ! empty($exif['FNumber'])) {
465
+			$meta['aperture'] = round(wp_exif_frac2dec($exif['FNumber']), 2);
466 466
 		}
467
-		if ( ! empty( $exif['Model'] ) ) {
468
-			$meta['camera'] = trim( $exif['Model'] );
467
+		if ( ! empty($exif['Model'])) {
468
+			$meta['camera'] = trim($exif['Model']);
469 469
 		}
470
-		if ( empty( $meta['created_timestamp'] ) && ! empty( $exif['DateTimeDigitized'] ) ) {
471
-			$meta['created_timestamp'] = wp_exif_date2ts( $exif['DateTimeDigitized'] );
470
+		if (empty($meta['created_timestamp']) && ! empty($exif['DateTimeDigitized'])) {
471
+			$meta['created_timestamp'] = wp_exif_date2ts($exif['DateTimeDigitized']);
472 472
 		}
473
-		if ( ! empty( $exif['FocalLength'] ) ) {
474
-			$meta['focal_length'] = (string) wp_exif_frac2dec( $exif['FocalLength'] );
473
+		if ( ! empty($exif['FocalLength'])) {
474
+			$meta['focal_length'] = (string) wp_exif_frac2dec($exif['FocalLength']);
475 475
 		}
476
-		if ( ! empty( $exif['ISOSpeedRatings'] ) ) {
477
-			$meta['iso'] = is_array( $exif['ISOSpeedRatings'] ) ? reset( $exif['ISOSpeedRatings'] ) : $exif['ISOSpeedRatings'];
478
-			$meta['iso'] = trim( $meta['iso'] );
476
+		if ( ! empty($exif['ISOSpeedRatings'])) {
477
+			$meta['iso'] = is_array($exif['ISOSpeedRatings']) ? reset($exif['ISOSpeedRatings']) : $exif['ISOSpeedRatings'];
478
+			$meta['iso'] = trim($meta['iso']);
479 479
 		}
480
-		if ( ! empty( $exif['ExposureTime'] ) ) {
481
-			$meta['shutter_speed'] = (string) wp_exif_frac2dec( $exif['ExposureTime'] );
480
+		if ( ! empty($exif['ExposureTime'])) {
481
+			$meta['shutter_speed'] = (string) wp_exif_frac2dec($exif['ExposureTime']);
482 482
 		}
483
-		if ( ! empty( $exif['Orientation'] ) ) {
483
+		if ( ! empty($exif['Orientation'])) {
484 484
 			$meta['orientation'] = $exif['Orientation'];
485 485
 		}
486 486
 	}
487 487
 
488
-	foreach ( array( 'title', 'caption', 'credit', 'copyright', 'camera', 'iso' ) as $key ) {
489
-		if ( $meta[ $key ] && ! seems_utf8( $meta[ $key ] ) ) {
490
-			$meta[ $key ] = utf8_encode( $meta[ $key ] );
488
+	foreach (array('title', 'caption', 'credit', 'copyright', 'camera', 'iso') as $key) {
489
+		if ($meta[$key] && ! seems_utf8($meta[$key])) {
490
+			$meta[$key] = utf8_encode($meta[$key]);
491 491
 		}
492 492
 	}
493 493
 
494
-	foreach ( $meta['keywords'] as $key => $keyword ) {
495
-		if ( ! seems_utf8( $keyword ) ) {
496
-			$meta['keywords'][ $key ] = utf8_encode( $keyword );
494
+	foreach ($meta['keywords'] as $key => $keyword) {
495
+		if ( ! seems_utf8($keyword)) {
496
+			$meta['keywords'][$key] = utf8_encode($keyword);
497 497
 		}
498 498
 	}
499 499
 
500
-	$meta = wp_kses_post_deep( $meta );
500
+	$meta = wp_kses_post_deep($meta);
501 501
 
502 502
 	/**
503 503
 	 * Filters the array of meta data read from an image's exif data.
@@ -510,7 +510,7 @@  discard block
 block discarded – undo
510 510
 	 * @param int    $sourceImageType Type of image.
511 511
 	 * @param array  $iptc            IPTC data.
512 512
 	 */
513
-	return apply_filters( 'wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc );
513
+	return apply_filters('wp_read_image_metadata', $meta, $file, $sourceImageType, $iptc);
514 514
 
515 515
 }
516 516
 
@@ -524,7 +524,7 @@  discard block
 block discarded – undo
524 524
  */
525 525
 function file_is_valid_image($path) {
526 526
 	$size = @getimagesize($path);
527
-	return !empty($size);
527
+	return ! empty($size);
528 528
 }
529 529
 
530 530
 /**
@@ -536,12 +536,12 @@  discard block
 block discarded – undo
536 536
  * @return bool True if suitable, false if not suitable.
537 537
  */
538 538
 function file_is_displayable_image($path) {
539
-	$displayable_image_types = array( IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP );
539
+	$displayable_image_types = array(IMAGETYPE_GIF, IMAGETYPE_JPEG, IMAGETYPE_PNG, IMAGETYPE_BMP);
540 540
 
541
-	$info = @getimagesize( $path );
542
-	if ( empty( $info ) ) {
541
+	$info = @getimagesize($path);
542
+	if (empty($info)) {
543 543
 		$result = false;
544
-	} elseif ( ! in_array( $info[2], $displayable_image_types ) ) {
544
+	} elseif ( ! in_array($info[2], $displayable_image_types)) {
545 545
 		$result = false;
546 546
 	} else {
547 547
 		$result = true;
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 	 * @param bool   $result Whether the image can be displayed. Default true.
556 556
 	 * @param string $path   Path to the image.
557 557
 	 */
558
-	return apply_filters( 'file_is_displayable_image', $result, $path );
558
+	return apply_filters('file_is_displayable_image', $result, $path);
559 559
 }
560 560
 
561 561
 /**
@@ -568,12 +568,12 @@  discard block
 block discarded – undo
568 568
  * @param string $size Optional. Image size, defaults to 'full'.
569 569
  * @return resource|false The resulting image resource on success, false on failure.
570 570
  */
571
-function load_image_to_edit( $attachment_id, $mime_type, $size = 'full' ) {
572
-	$filepath = _load_image_to_edit_path( $attachment_id, $size );
573
-	if ( empty( $filepath ) )
571
+function load_image_to_edit($attachment_id, $mime_type, $size = 'full') {
572
+	$filepath = _load_image_to_edit_path($attachment_id, $size);
573
+	if (empty($filepath))
574 574
 		return false;
575 575
 
576
-	switch ( $mime_type ) {
576
+	switch ($mime_type) {
577 577
 		case 'image/jpeg':
578 578
 			$image = imagecreatefromjpeg($filepath);
579 579
 			break;
@@ -587,7 +587,7 @@  discard block
 block discarded – undo
587 587
 			$image = false;
588 588
 			break;
589 589
 	}
590
-	if ( is_resource($image) ) {
590
+	if (is_resource($image)) {
591 591
 		/**
592 592
 		 * Filters the current image being loaded for editing.
593 593
 		 *
@@ -597,8 +597,8 @@  discard block
 block discarded – undo
597 597
 		 * @param string   $attachment_id Attachment ID.
598 598
 		 * @param string   $size          Image size.
599 599
 		 */
600
-		$image = apply_filters( 'load_image_to_edit', $image, $attachment_id, $size );
601
-		if ( function_exists('imagealphablending') && function_exists('imagesavealpha') ) {
600
+		$image = apply_filters('load_image_to_edit', $image, $attachment_id, $size);
601
+		if (function_exists('imagealphablending') && function_exists('imagesavealpha')) {
602 602
 			imagealphablending($image, false);
603 603
 			imagesavealpha($image, true);
604 604
 		}
@@ -619,11 +619,11 @@  discard block
 block discarded – undo
619 619
  * @param string $size Optional. Image size, defaults to 'full'.
620 620
  * @return string|false File path or url on success, false on failure.
621 621
  */
622
-function _load_image_to_edit_path( $attachment_id, $size = 'full' ) {
623
-	$filepath = get_attached_file( $attachment_id );
622
+function _load_image_to_edit_path($attachment_id, $size = 'full') {
623
+	$filepath = get_attached_file($attachment_id);
624 624
 
625
-	if ( $filepath && file_exists( $filepath ) ) {
626
-		if ( 'full' != $size && ( $data = image_get_intermediate_size( $attachment_id, $size ) ) ) {
625
+	if ($filepath && file_exists($filepath)) {
626
+		if ('full' != $size && ($data = image_get_intermediate_size($attachment_id, $size))) {
627 627
 			/**
628 628
 			 * Filters the path to the current image.
629 629
 			 *
@@ -635,9 +635,9 @@  discard block
 block discarded – undo
635 635
 			 * @param string $attachment_id Attachment ID.
636 636
 			 * @param string $size          Size of the image.
637 637
 			 */
638
-			$filepath = apply_filters( 'load_image_to_edit_filesystempath', path_join( dirname( $filepath ), $data['file'] ), $attachment_id, $size );
638
+			$filepath = apply_filters('load_image_to_edit_filesystempath', path_join(dirname($filepath), $data['file']), $attachment_id, $size);
639 639
 		}
640
-	} elseif ( function_exists( 'fopen' ) && true == ini_get( 'allow_url_fopen' ) ) {
640
+	} elseif (function_exists('fopen') && true == ini_get('allow_url_fopen')) {
641 641
 		/**
642 642
 		 * Filters the image URL if not in the local filesystem.
643 643
 		 *
@@ -649,7 +649,7 @@  discard block
 block discarded – undo
649 649
 		 * @param string $attachment_id Attachment ID.
650 650
 		 * @param string $size          Size of the image.
651 651
 		 */
652
-		$filepath = apply_filters( 'load_image_to_edit_attachmenturl', wp_get_attachment_url( $attachment_id ), $attachment_id, $size );
652
+		$filepath = apply_filters('load_image_to_edit_attachmenturl', wp_get_attachment_url($attachment_id), $attachment_id, $size);
653 653
 	}
654 654
 
655 655
 	/**
@@ -661,7 +661,7 @@  discard block
 block discarded – undo
661 661
 	 * @param string      $attachment_id Attachment ID.
662 662
 	 * @param string      $size          Size of the image.
663 663
 	 */
664
-	return apply_filters( 'load_image_to_edit_path', $filepath, $attachment_id, $size );
664
+	return apply_filters('load_image_to_edit_path', $filepath, $attachment_id, $size);
665 665
 }
666 666
 
667 667
 /**
@@ -673,22 +673,22 @@  discard block
 block discarded – undo
673 673
  * @param string $attachment_id Attachment ID.
674 674
  * @return string|false New file path on success, false on failure.
675 675
  */
676
-function _copy_image_file( $attachment_id ) {
677
-	$dst_file = $src_file = get_attached_file( $attachment_id );
678
-	if ( ! file_exists( $src_file ) )
679
-		$src_file = _load_image_to_edit_path( $attachment_id );
676
+function _copy_image_file($attachment_id) {
677
+	$dst_file = $src_file = get_attached_file($attachment_id);
678
+	if ( ! file_exists($src_file))
679
+		$src_file = _load_image_to_edit_path($attachment_id);
680 680
 
681
-	if ( $src_file ) {
682
-		$dst_file = str_replace( basename( $dst_file ), 'copy-' . basename( $dst_file ), $dst_file );
683
-		$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
681
+	if ($src_file) {
682
+		$dst_file = str_replace(basename($dst_file), 'copy-'.basename($dst_file), $dst_file);
683
+		$dst_file = dirname($dst_file).'/'.wp_unique_filename(dirname($dst_file), basename($dst_file));
684 684
 
685 685
 		/*
686 686
 		 * The directory containing the original file may no longer
687 687
 		 * exist when using a replication plugin.
688 688
 		 */
689
-		wp_mkdir_p( dirname( $dst_file ) );
689
+		wp_mkdir_p(dirname($dst_file));
690 690
 
691
-		if ( ! @copy( $src_file, $dst_file ) )
691
+		if ( ! @copy($src_file, $dst_file))
692 692
 			$dst_file = false;
693 693
 	} else {
694 694
 		$dst_file = false;
Please login to merge, or discard this patch.
src/wp-admin/includes/revision.php 2 patches
Braces   +24 added lines, -16 removed lines patch added patch discarded remove patch
@@ -19,26 +19,31 @@  discard block
 block discarded – undo
19 19
  *                    Or, false on failure.
20 20
  */
21 21
 function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
22
-	if ( ! $post = get_post( $post ) )
23
-		return false;
22
+	if ( ! $post = get_post( $post ) ) {
23
+			return false;
24
+	}
24 25
 
25 26
 	if ( $compare_from ) {
26
-		if ( ! $compare_from = get_post( $compare_from ) )
27
-			return false;
27
+		if ( ! $compare_from = get_post( $compare_from ) ) {
28
+					return false;
29
+		}
28 30
 	} else {
29 31
 		// If we're dealing with the first revision...
30 32
 		$compare_from = false;
31 33
 	}
32 34
 
33
-	if ( ! $compare_to = get_post( $compare_to ) )
34
-		return false;
35
+	if ( ! $compare_to = get_post( $compare_to ) ) {
36
+			return false;
37
+	}
35 38
 
36 39
 	// If comparing revisions, make sure we're dealing with the right post parent.
37 40
 	// The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
38
-	if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID )
39
-		return false;
40
-	if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID )
41
-		return false;
41
+	if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID ) {
42
+			return false;
43
+	}
44
+	if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID ) {
45
+			return false;
46
+	}
42 47
 
43 48
 	if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
44 49
 		$temp = $compare_from;
@@ -47,10 +52,12 @@  discard block
 block discarded – undo
47 52
 	}
48 53
 
49 54
 	// Add default title if title field is empty
50
-	if ( $compare_from && empty( $compare_from->post_title ) )
51
-		$compare_from->post_title = __( '(no title)' );
52
-	if ( empty( $compare_to->post_title ) )
53
-		$compare_to->post_title = __( '(no title)' );
55
+	if ( $compare_from && empty( $compare_from->post_title ) ) {
56
+			$compare_from->post_title = __( '(no title)' );
57
+	}
58
+	if ( empty( $compare_to->post_title ) ) {
59
+			$compare_to->post_title = __( '(no title)' );
60
+	}
54 61
 
55 62
 	$return = array();
56 63
 
@@ -150,8 +157,9 @@  discard block
 block discarded – undo
150 157
 	// If revisions are disabled, we only want autosaves and the current post.
151 158
 	if ( ! wp_revisions_enabled( $post ) ) {
152 159
 		foreach ( $revisions as $revision_id => $revision ) {
153
-			if ( ! wp_is_post_autosave( $revision ) )
154
-				unset( $revisions[ $revision_id ] );
160
+			if ( ! wp_is_post_autosave( $revision ) ) {
161
+							unset( $revisions[ $revision_id ] );
162
+			}
155 163
 		}
156 164
 		$revisions = array( $post->ID => $post ) + $revisions;
157 165
 	}
Please login to merge, or discard this patch.
Spacing   +99 added lines, -99 removed lines patch added patch discarded remove patch
@@ -19,43 +19,43 @@  discard block
 block discarded – undo
19 19
  * @return array|bool Associative array of a post's revisioned fields and their diffs.
20 20
  *                    Or, false on failure.
21 21
  */
22
-function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) {
23
-	if ( ! $post = get_post( $post ) )
22
+function wp_get_revision_ui_diff($post, $compare_from, $compare_to) {
23
+	if ( ! $post = get_post($post))
24 24
 		return false;
25 25
 
26
-	if ( $compare_from ) {
27
-		if ( ! $compare_from = get_post( $compare_from ) )
26
+	if ($compare_from) {
27
+		if ( ! $compare_from = get_post($compare_from))
28 28
 			return false;
29 29
 	} else {
30 30
 		// If we're dealing with the first revision...
31 31
 		$compare_from = false;
32 32
 	}
33 33
 
34
-	if ( ! $compare_to = get_post( $compare_to ) )
34
+	if ( ! $compare_to = get_post($compare_to))
35 35
 		return false;
36 36
 
37 37
 	// If comparing revisions, make sure we're dealing with the right post parent.
38 38
 	// The parent post may be a 'revision' when revisions are disabled and we're looking at autosaves.
39
-	if ( $compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID )
39
+	if ($compare_from && $compare_from->post_parent !== $post->ID && $compare_from->ID !== $post->ID)
40 40
 		return false;
41
-	if ( $compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID )
41
+	if ($compare_to->post_parent !== $post->ID && $compare_to->ID !== $post->ID)
42 42
 		return false;
43 43
 
44
-	if ( $compare_from && strtotime( $compare_from->post_date_gmt ) > strtotime( $compare_to->post_date_gmt ) ) {
44
+	if ($compare_from && strtotime($compare_from->post_date_gmt) > strtotime($compare_to->post_date_gmt)) {
45 45
 		$temp = $compare_from;
46 46
 		$compare_from = $compare_to;
47 47
 		$compare_to = $temp;
48 48
 	}
49 49
 
50 50
 	// Add default title if title field is empty
51
-	if ( $compare_from && empty( $compare_from->post_title ) )
52
-		$compare_from->post_title = __( '(no title)' );
53
-	if ( empty( $compare_to->post_title ) )
54
-		$compare_to->post_title = __( '(no title)' );
51
+	if ($compare_from && empty($compare_from->post_title))
52
+		$compare_from->post_title = __('(no title)');
53
+	if (empty($compare_to->post_title))
54
+		$compare_to->post_title = __('(no title)');
55 55
 
56 56
 	$return = array();
57 57
 
58
-	foreach ( _wp_post_revision_fields( $post ) as $field => $name ) {
58
+	foreach (_wp_post_revision_fields($post) as $field => $name) {
59 59
 		/**
60 60
 		 * Contextually filter a post revision field.
61 61
 		 *
@@ -70,10 +70,10 @@  discard block
 block discarded – undo
70 70
 		 * @param string  null                  The context of whether the current revision is the old
71 71
 		 *                                      or the new one. Values are 'to' or 'from'.
72 72
 		 */
73
-		$content_from = $compare_from ? apply_filters( "_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from' ) : '';
73
+		$content_from = $compare_from ? apply_filters("_wp_post_revision_field_{$field}", $compare_from->$field, $field, $compare_from, 'from') : '';
74 74
 
75 75
 		/** This filter is documented in wp-admin/includes/revision.php */
76
-		$content_to = apply_filters( "_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to' );
76
+		$content_to = apply_filters("_wp_post_revision_field_{$field}", $compare_to->$field, $field, $compare_to, 'to');
77 77
 
78 78
 		$args = array(
79 79
 			'show_split_view' => true
@@ -96,20 +96,20 @@  discard block
 block discarded – undo
96 96
 		 * @param WP_Post $compare_from The revision post to compare from.
97 97
 		 * @param WP_Post $compare_to   The revision post to compare to.
98 98
 		 */
99
-		$args = apply_filters( 'revision_text_diff_options', $args, $field, $compare_from, $compare_to );
99
+		$args = apply_filters('revision_text_diff_options', $args, $field, $compare_from, $compare_to);
100 100
 
101
-		$diff = wp_text_diff( $content_from, $content_to, $args );
101
+		$diff = wp_text_diff($content_from, $content_to, $args);
102 102
 
103
-		if ( ! $diff && 'post_title' === $field ) {
103
+		if ( ! $diff && 'post_title' === $field) {
104 104
 			// It's a better user experience to still show the Title, even if it didn't change.
105 105
 			// No, you didn't see this.
106 106
 			$diff = '<table class="diff"><colgroup><col class="content diffsplit left"><col class="content diffsplit middle"><col class="content diffsplit right"></colgroup><tbody><tr>';
107
-			$diff .= '<td>' . esc_html( $compare_from->post_title ) . '</td><td></td><td>' . esc_html( $compare_to->post_title ) . '</td>';
107
+			$diff .= '<td>'.esc_html($compare_from->post_title).'</td><td></td><td>'.esc_html($compare_to->post_title).'</td>';
108 108
 			$diff .= '</tr></tbody>';
109 109
 			$diff .= '</table>';
110 110
 		}
111 111
 
112
-		if ( $diff ) {
112
+		if ($diff) {
113 113
 			$return[] = array(
114 114
 				'id' => $field,
115 115
 				'name' => $name,
@@ -127,7 +127,7 @@  discard block
 block discarded – undo
127 127
 	 * @param WP_Post $compare_from The revision post to compare from.
128 128
 	 * @param WP_Post $compare_to   The revision post to compare to.
129 129
 	 */
130
-	return apply_filters( 'wp_get_revision_ui_diff', $return, $compare_from, $compare_to );
130
+	return apply_filters('wp_get_revision_ui_diff', $return, $compare_from, $compare_to);
131 131
 
132 132
 }
133 133
 
@@ -142,71 +142,71 @@  discard block
 block discarded – undo
142 142
  *
143 143
  * @return array An associative array of revision data and related settings.
144 144
  */
145
-function wp_prepare_revisions_for_js( $post, $selected_revision_id, $from = null ) {
146
-	$post = get_post( $post );
145
+function wp_prepare_revisions_for_js($post, $selected_revision_id, $from = null) {
146
+	$post = get_post($post);
147 147
 	$authors = array();
148 148
 	$now_gmt = time();
149 149
 
150
-	$revisions = wp_get_post_revisions( $post->ID, array( 'order' => 'ASC', 'check_enabled' => false ) );
150
+	$revisions = wp_get_post_revisions($post->ID, array('order' => 'ASC', 'check_enabled' => false));
151 151
 	// If revisions are disabled, we only want autosaves and the current post.
152
-	if ( ! wp_revisions_enabled( $post ) ) {
153
-		foreach ( $revisions as $revision_id => $revision ) {
154
-			if ( ! wp_is_post_autosave( $revision ) )
155
-				unset( $revisions[ $revision_id ] );
152
+	if ( ! wp_revisions_enabled($post)) {
153
+		foreach ($revisions as $revision_id => $revision) {
154
+			if ( ! wp_is_post_autosave($revision))
155
+				unset($revisions[$revision_id]);
156 156
 		}
157
-		$revisions = array( $post->ID => $post ) + $revisions;
157
+		$revisions = array($post->ID => $post) + $revisions;
158 158
 	}
159 159
 
160
-	$show_avatars = get_option( 'show_avatars' );
160
+	$show_avatars = get_option('show_avatars');
161 161
 
162
-	cache_users( wp_list_pluck( $revisions, 'post_author' ) );
162
+	cache_users(wp_list_pluck($revisions, 'post_author'));
163 163
 
164
-	$can_restore = current_user_can( 'edit_post', $post->ID );
164
+	$can_restore = current_user_can('edit_post', $post->ID);
165 165
 	$current_id = false;
166 166
 
167
-	foreach ( $revisions as $revision ) {
168
-		$modified = strtotime( $revision->post_modified );
169
-		$modified_gmt = strtotime( $revision->post_modified_gmt );
170
-		if ( $can_restore ) {
171
-			$restore_link = str_replace( '&amp;', '&', wp_nonce_url(
167
+	foreach ($revisions as $revision) {
168
+		$modified = strtotime($revision->post_modified);
169
+		$modified_gmt = strtotime($revision->post_modified_gmt);
170
+		if ($can_restore) {
171
+			$restore_link = str_replace('&amp;', '&', wp_nonce_url(
172 172
 				add_query_arg(
173
-					array( 'revision' => $revision->ID,
174
-						'action' => 'restore' ),
175
-						admin_url( 'revision.php' )
173
+					array('revision' => $revision->ID,
174
+						'action' => 'restore'),
175
+						admin_url('revision.php')
176 176
 				),
177 177
 				"restore-post_{$revision->ID}"
178
-			) );
178
+			));
179 179
 		}
180 180
 
181
-		if ( ! isset( $authors[ $revision->post_author ] ) ) {
182
-			$authors[ $revision->post_author ] = array(
181
+		if ( ! isset($authors[$revision->post_author])) {
182
+			$authors[$revision->post_author] = array(
183 183
 				'id' => (int) $revision->post_author,
184
-				'avatar' => $show_avatars ? get_avatar( $revision->post_author, 32 ) : '',
185
-				'name' => get_the_author_meta( 'display_name', $revision->post_author ),
184
+				'avatar' => $show_avatars ? get_avatar($revision->post_author, 32) : '',
185
+				'name' => get_the_author_meta('display_name', $revision->post_author),
186 186
 			);
187 187
 		}
188 188
 
189
-		$autosave = (bool) wp_is_post_autosave( $revision );
189
+		$autosave = (bool) wp_is_post_autosave($revision);
190 190
 		$current = ! $autosave && $revision->post_modified_gmt === $post->post_modified_gmt;
191
-		if ( $current && ! empty( $current_id ) ) {
191
+		if ($current && ! empty($current_id)) {
192 192
 			// If multiple revisions have the same post_modified_gmt, highest ID is current.
193
-			if ( $current_id < $revision->ID ) {
194
-				$revisions[ $current_id ]['current'] = false;
193
+			if ($current_id < $revision->ID) {
194
+				$revisions[$current_id]['current'] = false;
195 195
 				$current_id = $revision->ID;
196 196
 			} else {
197 197
 				$current = false;
198 198
 			}
199
-		} elseif ( $current ) {
199
+		} elseif ($current) {
200 200
 			$current_id = $revision->ID;
201 201
 		}
202 202
 
203 203
 		$revisions_data = array(
204 204
 			'id'         => $revision->ID,
205
-			'title'      => get_the_title( $post->ID ),
206
-			'author'     => $authors[ $revision->post_author ],
207
-			'date'       => date_i18n( __( 'M j, Y @ H:i' ), $modified ),
208
-			'dateShort'  => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), $modified ),
209
-			'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( $modified_gmt, $now_gmt ) ),
205
+			'title'      => get_the_title($post->ID),
206
+			'author'     => $authors[$revision->post_author],
207
+			'date'       => date_i18n(__('M j, Y @ H:i'), $modified),
208
+			'dateShort'  => date_i18n(_x('j M @ H:i', 'revision date short format'), $modified),
209
+			'timeAgo'    => sprintf(__('%s ago'), human_time_diff($modified_gmt, $now_gmt)),
210 210
 			'autosave'   => $autosave,
211 211
 			'current'    => $current,
212 212
 			'restoreUrl' => $can_restore ? $restore_link : false,
@@ -234,21 +234,21 @@  discard block
 block discarded – undo
234 234
 		 * @param WP_Post $revision       The revision's WP_Post object.
235 235
 		 * @param WP_Post $post           The revision's parent WP_Post object.
236 236
 		 */
237
-		$revisions[ $revision->ID ] = apply_filters( 'wp_prepare_revision_for_js', $revisions_data, $revision, $post );
237
+		$revisions[$revision->ID] = apply_filters('wp_prepare_revision_for_js', $revisions_data, $revision, $post);
238 238
 	}
239 239
 
240 240
 	/**
241 241
 	 * If we only have one revision, the initial revision is missing; This happens
242 242
 	 * when we have an autsosave and the user has clicked 'View the Autosave'
243 243
 	 */
244
-	if ( 1 === sizeof( $revisions ) ) {
245
-		$revisions[ $post->ID ] = array(
244
+	if (1 === sizeof($revisions)) {
245
+		$revisions[$post->ID] = array(
246 246
 			'id'         => $post->ID,
247
-			'title'      => get_the_title( $post->ID ),
248
-			'author'     => $authors[ $post->post_author ],
249
-			'date'       => date_i18n( __( 'M j, Y @ H:i' ), strtotime( $post->post_modified ) ),
250
-			'dateShort'  => date_i18n( _x( 'j M @ H:i', 'revision date short format' ), strtotime( $post->post_modified ) ),
251
-			'timeAgo'    => sprintf( __( '%s ago' ), human_time_diff( strtotime( $post->post_modified_gmt ), $now_gmt ) ),
247
+			'title'      => get_the_title($post->ID),
248
+			'author'     => $authors[$post->post_author],
249
+			'date'       => date_i18n(__('M j, Y @ H:i'), strtotime($post->post_modified)),
250
+			'dateShort'  => date_i18n(_x('j M @ H:i', 'revision date short format'), strtotime($post->post_modified)),
251
+			'timeAgo'    => sprintf(__('%s ago'), human_time_diff(strtotime($post->post_modified_gmt), $now_gmt)),
252 252
 			'autosave'   => false,
253 253
 			'current'    => true,
254 254
 			'restoreUrl' => false,
@@ -261,48 +261,48 @@  discard block
 block discarded – undo
261 261
 	 * were changed), we may not have a "current" revision. Mark the latest
262 262
 	 * revision as "current".
263 263
 	 */
264
-	if ( empty( $current_id ) ) {
265
-		if ( $revisions[ $revision->ID ]['autosave'] ) {
266
-			$revision = end( $revisions );
267
-			while ( $revision['autosave'] ) {
268
-				$revision = prev( $revisions );
264
+	if (empty($current_id)) {
265
+		if ($revisions[$revision->ID]['autosave']) {
266
+			$revision = end($revisions);
267
+			while ($revision['autosave']) {
268
+				$revision = prev($revisions);
269 269
 			}
270 270
 			$current_id = $revision['id'];
271 271
 		} else {
272 272
 			$current_id = $revision->ID;
273 273
 		}
274
-		$revisions[ $current_id ]['current'] = true;
274
+		$revisions[$current_id]['current'] = true;
275 275
 	}
276 276
 
277 277
 	// Now, grab the initial diff.
278
-	$compare_two_mode = is_numeric( $from );
279
-	if ( ! $compare_two_mode ) {
280
-		$found = array_search( $selected_revision_id, array_keys( $revisions ) );
281
-		if ( $found ) {
282
-			$from = array_keys( array_slice( $revisions, $found - 1, 1, true ) );
283
-			$from = reset( $from );
278
+	$compare_two_mode = is_numeric($from);
279
+	if ( ! $compare_two_mode) {
280
+		$found = array_search($selected_revision_id, array_keys($revisions));
281
+		if ($found) {
282
+			$from = array_keys(array_slice($revisions, $found - 1, 1, true));
283
+			$from = reset($from);
284 284
 		} else {
285 285
 			$from = 0;
286 286
 		}
287 287
 	}
288 288
 
289
-	$from = absint( $from );
289
+	$from = absint($from);
290 290
 
291
-	$diffs = array( array(
292
-		'id' => $from . ':' . $selected_revision_id,
293
-		'fields' => wp_get_revision_ui_diff( $post->ID, $from, $selected_revision_id ),
291
+	$diffs = array(array(
292
+		'id' => $from.':'.$selected_revision_id,
293
+		'fields' => wp_get_revision_ui_diff($post->ID, $from, $selected_revision_id),
294 294
 	));
295 295
 
296 296
 	return array(
297 297
 		'postId'           => $post->ID,
298
-		'nonce'            => wp_create_nonce( 'revisions-ajax-nonce' ),
299
-		'revisionData'     => array_values( $revisions ),
298
+		'nonce'            => wp_create_nonce('revisions-ajax-nonce'),
299
+		'revisionData'     => array_values($revisions),
300 300
 		'to'               => $selected_revision_id,
301 301
 		'from'             => $from,
302 302
 		'diffData'         => $diffs,
303
-		'baseUrl'          => parse_url( admin_url( 'revision.php' ), PHP_URL_PATH ),
304
-		'compareTwoMode'   => absint( $compare_two_mode ), // Apparently booleans are not allowed
305
-		'revisionIds'      => array_keys( $revisions ),
303
+		'baseUrl'          => parse_url(admin_url('revision.php'), PHP_URL_PATH),
304
+		'compareTwoMode'   => absint($compare_two_mode), // Apparently booleans are not allowed
305
+		'revisionIds'      => array_keys($revisions),
306 306
 	);
307 307
 }
308 308
 
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 
323 323
 	<script id="tmpl-revisions-buttons" type="text/html">
324 324
 		<div class="revisions-previous">
325
-			<input class="button" type="button" value="<?php echo esc_attr_x( 'Previous', 'Button label for a previous revision' ); ?>" />
325
+			<input class="button" type="button" value="<?php echo esc_attr_x('Previous', 'Button label for a previous revision'); ?>" />
326 326
 		</div>
327 327
 
328 328
 		<div class="revisions-next">
329
-			<input class="button" type="button" value="<?php echo esc_attr_x( 'Next', 'Button label for a next revision' ); ?>" />
329
+			<input class="button" type="button" value="<?php echo esc_attr_x('Next', 'Button label for a next revision'); ?>" />
330 330
 		</div>
331 331
 	</script>
332 332
 
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 				}
341 341
 				#>
342 342
 				/>
343
-				<?php esc_html_e( 'Compare any two revisions' ); ?>
343
+				<?php esc_html_e('Compare any two revisions'); ?>
344 344
 			</label>
345 345
 		</div>
346 346
 	</script>
@@ -349,28 +349,28 @@  discard block
 block discarded – undo
349 349
 		<# if ( ! _.isUndefined( data.attributes ) ) { #>
350 350
 			<div class="diff-title">
351 351
 				<# if ( 'from' === data.type ) { #>
352
-					<strong><?php _ex( 'From:', 'Followed by post revision info' ); ?></strong>
352
+					<strong><?php _ex('From:', 'Followed by post revision info'); ?></strong>
353 353
 				<# } else if ( 'to' === data.type ) { #>
354
-					<strong><?php _ex( 'To:', 'Followed by post revision info' ); ?></strong>
354
+					<strong><?php _ex('To:', 'Followed by post revision info'); ?></strong>
355 355
 				<# } #>
356 356
 				<div class="author-card<# if ( data.attributes.autosave ) { #> autosave<# } #>">
357 357
 					{{{ data.attributes.author.avatar }}}
358 358
 					<div class="author-info">
359 359
 					<# if ( data.attributes.autosave ) { #>
360
-						<span class="byline"><?php printf( __( 'Autosave by %s' ),
361
-							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
360
+						<span class="byline"><?php printf(__('Autosave by %s'),
361
+							'<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span>
362 362
 					<# } else if ( data.attributes.current ) { #>
363
-						<span class="byline"><?php printf( __( 'Current Revision by %s' ),
364
-							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
363
+						<span class="byline"><?php printf(__('Current Revision by %s'),
364
+							'<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span>
365 365
 					<# } else { #>
366
-						<span class="byline"><?php printf( __( 'Revision by %s' ),
367
-							'<span class="author-name">{{ data.attributes.author.name }}</span>' ); ?></span>
366
+						<span class="byline"><?php printf(__('Revision by %s'),
367
+							'<span class="author-name">{{ data.attributes.author.name }}</span>'); ?></span>
368 368
 					<# } #>
369 369
 						<span class="time-ago">{{ data.attributes.timeAgo }}</span>
370 370
 						<span class="date">({{ data.attributes.dateShort }})</span>
371 371
 					</div>
372 372
 				<# if ( 'to' === data.type && data.attributes.restoreUrl ) { #>
373
-					<input  <?php if ( wp_check_post_lock( $post->ID ) ) { ?>
373
+					<input  <?php if (wp_check_post_lock($post->ID)) { ?>
374 374
 						disabled="disabled"
375 375
 					<?php } else { ?>
376 376
 						<# if ( data.attributes.current ) { #>
@@ -378,9 +378,9 @@  discard block
 block discarded – undo
378 378
 						<# } #>
379 379
 					<?php } ?>
380 380
 					<# if ( data.attributes.autosave ) { #>
381
-						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Autosave' ); ?>" />
381
+						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e('Restore This Autosave'); ?>" />
382 382
 					<# } else { #>
383
-						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e( 'Restore This Revision' ); ?>" />
383
+						type="button" class="restore-revision button button-primary" value="<?php esc_attr_e('Restore This Revision'); ?>" />
384 384
 					<# } #>
385 385
 				<# } #>
386 386
 			</div>
@@ -392,7 +392,7 @@  discard block
 block discarded – undo
392 392
 
393 393
 	<script id="tmpl-revisions-diff" type="text/html">
394 394
 		<div class="loading-indicator"><span class="spinner"></span></div>
395
-		<div class="diff-error"><?php _e( 'Sorry, something went wrong. The requested comparison could not be loaded.' ); ?></div>
395
+		<div class="diff-error"><?php _e('Sorry, something went wrong. The requested comparison could not be loaded.'); ?></div>
396 396
 		<div class="diff">
397 397
 		<# _.each( data.fields, function( field ) { #>
398 398
 			<h3>{{ field.name }}</h3>
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-users-list-table.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -54,7 +54,7 @@
 block discarded – undo
54 54
 	/**
55 55
 	 * Check the current user's permissions.
56 56
 	 *
57
- 	 * @since 3.1.0
57
+	 * @since 3.1.0
58 58
 	 * @access public
59 59
 	 *
60 60
 	 * @return bool
Please login to merge, or discard this patch.
Spacing   +109 added lines, -109 removed lines patch added patch discarded remove patch
@@ -45,17 +45,17 @@  discard block
 block discarded – undo
45 45
 	 *
46 46
 	 * @param array $args An associative array of arguments.
47 47
 	 */
48
-	public function __construct( $args = array() ) {
49
-		parent::__construct( array(
48
+	public function __construct($args = array()) {
49
+		parent::__construct(array(
50 50
 			'singular' => 'user',
51 51
 			'plural'   => 'users',
52
-			'screen'   => isset( $args['screen'] ) ? $args['screen'] : null,
53
-		) );
52
+			'screen'   => isset($args['screen']) ? $args['screen'] : null,
53
+		));
54 54
 
55 55
 		$this->is_site_users = 'site-users-network' === $this->screen->id;
56 56
 
57
-		if ( $this->is_site_users )
58
-			$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
57
+		if ($this->is_site_users)
58
+			$this->site_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0;
59 59
 	}
60 60
 
61 61
 	/**
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	 * @return bool
68 68
 	 */
69 69
 	public function ajax_user_can() {
70
-		if ( $this->is_site_users )
71
-			return current_user_can( 'manage_sites' );
70
+		if ($this->is_site_users)
71
+			return current_user_can('manage_sites');
72 72
 		else
73
-			return current_user_can( 'list_users' );
73
+			return current_user_can('list_users');
74 74
 	}
75 75
 
76 76
 	/**
@@ -85,19 +85,19 @@  discard block
 block discarded – undo
85 85
 	public function prepare_items() {
86 86
 		global $role, $usersearch;
87 87
 
88
-		$usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : '';
88
+		$usersearch = isset($_REQUEST['s']) ? wp_unslash(trim($_REQUEST['s'])) : '';
89 89
 
90
-		$role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : '';
90
+		$role = isset($_REQUEST['role']) ? $_REQUEST['role'] : '';
91 91
 
92
-		$per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page';
93
-		$users_per_page = $this->get_items_per_page( $per_page );
92
+		$per_page = ($this->is_site_users) ? 'site_users_network_per_page' : 'users_per_page';
93
+		$users_per_page = $this->get_items_per_page($per_page);
94 94
 
95 95
 		$paged = $this->get_pagenum();
96 96
 
97
-		if ( 'none' === $role ) {
97
+		if ('none' === $role) {
98 98
 			$args = array(
99 99
 				'number' => $users_per_page,
100
-				'offset' => ( $paged-1 ) * $users_per_page,
100
+				'offset' => ($paged - 1) * $users_per_page,
101 101
 				'include' => wp_get_users_with_no_role(),
102 102
 				'search' => $usersearch,
103 103
 				'fields' => 'all_with_meta'
@@ -105,23 +105,23 @@  discard block
 block discarded – undo
105 105
 		} else {
106 106
 			$args = array(
107 107
 				'number' => $users_per_page,
108
-				'offset' => ( $paged-1 ) * $users_per_page,
108
+				'offset' => ($paged - 1) * $users_per_page,
109 109
 				'role' => $role,
110 110
 				'search' => $usersearch,
111 111
 				'fields' => 'all_with_meta'
112 112
 			);
113 113
 		}
114 114
 
115
-		if ( '' !== $args['search'] )
116
-			$args['search'] = '*' . $args['search'] . '*';
115
+		if ('' !== $args['search'])
116
+			$args['search'] = '*'.$args['search'].'*';
117 117
 
118
-		if ( $this->is_site_users )
118
+		if ($this->is_site_users)
119 119
 			$args['blog_id'] = $this->site_id;
120 120
 
121
-		if ( isset( $_REQUEST['orderby'] ) )
121
+		if (isset($_REQUEST['orderby']))
122 122
 			$args['orderby'] = $_REQUEST['orderby'];
123 123
 
124
-		if ( isset( $_REQUEST['order'] ) )
124
+		if (isset($_REQUEST['order']))
125 125
 			$args['order'] = $_REQUEST['order'];
126 126
 
127 127
 		/**
@@ -132,17 +132,17 @@  discard block
 block discarded – undo
132 132
 		 * @param array $args Arguments passed to WP_User_Query to retrieve items for the current
133 133
 		 *                    users list table.
134 134
 		 */
135
-		$args = apply_filters( 'users_list_table_query_args', $args );
135
+		$args = apply_filters('users_list_table_query_args', $args);
136 136
 
137 137
 		// Query the user IDs for this page
138
-		$wp_user_search = new WP_User_Query( $args );
138
+		$wp_user_search = new WP_User_Query($args);
139 139
 
140 140
 		$this->items = $wp_user_search->get_results();
141 141
 
142
-		$this->set_pagination_args( array(
142
+		$this->set_pagination_args(array(
143 143
 			'total_items' => $wp_user_search->get_total(),
144 144
 			'per_page' => $users_per_page,
145
-		) );
145
+		));
146 146
 	}
147 147
 
148 148
 	/**
@@ -152,7 +152,7 @@  discard block
 block discarded – undo
152 152
 	 * @access public
153 153
 	 */
154 154
 	public function no_items() {
155
-		_e( 'No users found.' );
155
+		_e('No users found.');
156 156
 	}
157 157
 
158 158
 	/**
@@ -174,9 +174,9 @@  discard block
 block discarded – undo
174 174
 
175 175
 		$wp_roles = wp_roles();
176 176
 
177
-		if ( $this->is_site_users ) {
178
-			$url = 'site-users.php?id=' . $this->site_id;
179
-			switch_to_blog( $this->site_id );
177
+		if ($this->is_site_users) {
178
+			$url = 'site-users.php?id='.$this->site_id;
179
+			switch_to_blog($this->site_id);
180 180
 			$users_of_blog = count_users();
181 181
 			restore_current_blog();
182 182
 		} else {
@@ -185,40 +185,40 @@  discard block
 block discarded – undo
185 185
 		}
186 186
 
187 187
 		$total_users = $users_of_blog['total_users'];
188
-		$avail_roles =& $users_of_blog['avail_roles'];
188
+		$avail_roles = & $users_of_blog['avail_roles'];
189 189
 		unset($users_of_blog);
190 190
 
191 191
 		$class = empty($role) ? ' class="current"' : '';
192 192
 		$role_links = array();
193
-		$role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
194
-		foreach ( $wp_roles->get_names() as $this_role => $name ) {
195
-			if ( !isset($avail_roles[$this_role]) )
193
+		$role_links['all'] = "<a href='$url'$class>".sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)).'</a>';
194
+		foreach ($wp_roles->get_names() as $this_role => $name) {
195
+			if ( ! isset($avail_roles[$this_role]))
196 196
 				continue;
197 197
 
198 198
 			$class = '';
199 199
 
200
-			if ( $this_role === $role ) {
200
+			if ($this_role === $role) {
201 201
 				$class = ' class="current"';
202 202
 			}
203 203
 
204
-			$name = translate_user_role( $name );
204
+			$name = translate_user_role($name);
205 205
 			/* translators: User role name with count */
206
-			$name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) );
207
-			$role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$class>$name</a>";
206
+			$name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n($avail_roles[$this_role]));
207
+			$role_links[$this_role] = "<a href='".esc_url(add_query_arg('role', $this_role, $url))."'$class>$name</a>";
208 208
 		}
209 209
 
210
-		if ( ! empty( $avail_roles['none' ] ) ) {
210
+		if ( ! empty($avail_roles['none'])) {
211 211
 
212 212
 			$class = '';
213 213
 
214
-			if ( 'none' === $role ) {
214
+			if ('none' === $role) {
215 215
 				$class = ' class="current"';
216 216
 			}
217 217
 
218
-			$name = __( 'No role' );
218
+			$name = __('No role');
219 219
 			/* translators: User role name with count */
220
-			$name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles['none' ] ) );
221
-			$role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$class>$name</a>";
220
+			$name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n($avail_roles['none']));
221
+			$role_links['none'] = "<a href='".esc_url(add_query_arg('role', 'none', $url))."'$class>$name</a>";
222 222
 
223 223
 		}
224 224
 
@@ -236,12 +236,12 @@  discard block
 block discarded – undo
236 236
 	protected function get_bulk_actions() {
237 237
 		$actions = array();
238 238
 
239
-		if ( is_multisite() ) {
240
-			if ( current_user_can( 'remove_users' ) )
241
-				$actions['remove'] = __( 'Remove' );
239
+		if (is_multisite()) {
240
+			if (current_user_can('remove_users'))
241
+				$actions['remove'] = __('Remove');
242 242
 		} else {
243
-			if ( current_user_can( 'delete_users' ) )
244
-				$actions['delete'] = __( 'Delete' );
243
+			if (current_user_can('delete_users'))
244
+				$actions['delete'] = __('Delete');
245 245
 		}
246 246
 
247 247
 		return $actions;
@@ -256,19 +256,19 @@  discard block
 block discarded – undo
256 256
 	 * @param string $which Whether this is being invoked above ("top")
257 257
 	 *                      or below the table ("bottom").
258 258
 	 */
259
-	protected function extra_tablenav( $which ) {
259
+	protected function extra_tablenav($which) {
260 260
 		$id = 'bottom' === $which ? 'new_role2' : 'new_role';
261 261
 		$button_id = 'bottom' === $which ? 'changeit2' : 'changeit';
262 262
 	?>
263 263
 	<div class="alignleft actions">
264
-		<?php if ( current_user_can( 'promote_users' ) && $this->has_items() ) : ?>
265
-		<label class="screen-reader-text" for="<?php echo $id ?>"><?php _e( 'Change role to&hellip;' ) ?></label>
264
+		<?php if (current_user_can('promote_users') && $this->has_items()) : ?>
265
+		<label class="screen-reader-text" for="<?php echo $id ?>"><?php _e('Change role to&hellip;') ?></label>
266 266
 		<select name="<?php echo $id ?>" id="<?php echo $id ?>">
267
-			<option value=""><?php _e( 'Change role to&hellip;' ) ?></option>
267
+			<option value=""><?php _e('Change role to&hellip;') ?></option>
268 268
 			<?php wp_dropdown_roles(); ?>
269 269
 		</select>
270 270
 	<?php
271
-			submit_button( __( 'Change' ), '', $button_id, false );
271
+			submit_button(__('Change'), '', $button_id, false);
272 272
 		endif;
273 273
 
274 274
 		/**
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 		 *
281 281
 		 * @param string $which The location of the extra table nav markup: 'top' or 'bottom'.
282 282
 		 */
283
-		do_action( 'restrict_manage_users', $which );
283
+		do_action('restrict_manage_users', $which);
284 284
 		echo '</div>';
285 285
 	}
286 286
 
@@ -296,8 +296,8 @@  discard block
 block discarded – undo
296 296
 	 * @return string The bulk action required.
297 297
 	 */
298 298
 	public function current_action() {
299
-		if ( ( isset( $_REQUEST['changeit'] ) || isset( $_REQUEST['changeit2'] ) ) &&
300
-			( ! empty( $_REQUEST['new_role'] ) || ! empty( $_REQUEST['new_role2'] ) ) ) {
299
+		if ((isset($_REQUEST['changeit']) || isset($_REQUEST['changeit2'])) &&
300
+			( ! empty($_REQUEST['new_role']) || ! empty($_REQUEST['new_role2']))) {
301 301
 			return 'promote';
302 302
 		}
303 303
 
@@ -316,15 +316,15 @@  discard block
 block discarded – undo
316 316
 	public function get_columns() {
317 317
 		$c = array(
318 318
 			'cb'       => '<input type="checkbox" />',
319
-			'username' => __( 'Username' ),
320
-			'name'     => __( 'Name' ),
321
-			'email'    => __( 'Email' ),
322
-			'role'     => __( 'Role' ),
323
-			'posts'    => __( 'Posts' )
319
+			'username' => __('Username'),
320
+			'name'     => __('Name'),
321
+			'email'    => __('Email'),
322
+			'role'     => __('Role'),
323
+			'posts'    => __('Posts')
324 324
 		);
325 325
 
326
-		if ( $this->is_site_users )
327
-			unset( $c['posts'] );
326
+		if ($this->is_site_users)
327
+			unset($c['posts']);
328 328
 
329 329
 		return $c;
330 330
 	}
@@ -354,14 +354,14 @@  discard block
 block discarded – undo
354 354
 	 */
355 355
 	public function display_rows() {
356 356
 		// Query the post counts for this page
357
-		if ( ! $this->is_site_users )
358
-			$post_counts = count_many_users_posts( array_keys( $this->items ) );
357
+		if ( ! $this->is_site_users)
358
+			$post_counts = count_many_users_posts(array_keys($this->items));
359 359
 
360
-		foreach ( $this->items as $userid => $user_object ) {
361
-			if ( is_multisite() && empty( $user_object->allcaps ) )
360
+		foreach ($this->items as $userid => $user_object) {
361
+			if (is_multisite() && empty($user_object->allcaps))
362 362
 				continue;
363 363
 
364
-			echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
364
+			echo "\n\t".$this->single_row($user_object, '', '', isset($post_counts) ? $post_counts[$userid] : 0);
365 365
 		}
366 366
 	}
367 367
 
@@ -380,39 +380,39 @@  discard block
 block discarded – undo
380 380
 	 *                             to zero, as in, a new user has made zero posts.
381 381
 	 * @return string Output for a single row.
382 382
 	 */
383
-	public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) {
384
-		if ( ! ( $user_object instanceof WP_User ) ) {
385
-			$user_object = get_userdata( (int) $user_object );
383
+	public function single_row($user_object, $style = '', $role = '', $numposts = 0) {
384
+		if ( ! ($user_object instanceof WP_User)) {
385
+			$user_object = get_userdata((int) $user_object);
386 386
 		}
387 387
 		$user_object->filter = 'display';
388 388
 		$email = $user_object->user_email;
389 389
 
390
-		if ( $this->is_site_users )
390
+		if ($this->is_site_users)
391 391
 			$url = "site-users.php?id={$this->site_id}&amp;";
392 392
 		else
393 393
 			$url = 'users.php?';
394 394
 
395
-		$user_roles = $this->get_role_list( $user_object );
395
+		$user_roles = $this->get_role_list($user_object);
396 396
 
397 397
 		// Set up the hover actions for this user
398 398
 		$actions = array();
399 399
 		$checkbox = '';
400 400
 		// Check if the user for this row is editable
401
-		if ( current_user_can( 'list_users' ) ) {
401
+		if (current_user_can('list_users')) {
402 402
 			// Set up the user editing link
403
-			$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) );
403
+			$edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_object->ID)));
404 404
 
405
-			if ( current_user_can( 'edit_user',  $user_object->ID ) ) {
405
+			if (current_user_can('edit_user', $user_object->ID)) {
406 406
 				$edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />";
407
-				$actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>';
407
+				$actions['edit'] = '<a href="'.$edit_link.'">'.__('Edit').'</a>';
408 408
 			} else {
409 409
 				$edit = "<strong>$user_object->user_login</strong><br />";
410 410
 			}
411 411
 
412
-			if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
413
-				$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
414
-			if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
415
-				$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
412
+			if ( ! is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID))
413
+				$actions['delete'] = "<a class='submitdelete' href='".wp_nonce_url("users.php?action=delete&amp;user=$user_object->ID", 'bulk-users')."'>".__('Delete')."</a>";
414
+			if (is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID))
415
+				$actions['remove'] = "<a class='submitdelete' href='".wp_nonce_url($url."action=remove&amp;user=$user_object->ID", 'bulk-users')."'>".__('Remove')."</a>";
416 416
 
417 417
 			/**
418 418
 			 * Filters the action links displayed under each user in the Users list table.
@@ -424,49 +424,49 @@  discard block
 block discarded – undo
424 424
 			 *                             'Edit', 'Remove' for Multisite.
425 425
 			 * @param WP_User $user_object WP_User object for the currently-listed user.
426 426
 			 */
427
-			$actions = apply_filters( 'user_row_actions', $actions, $user_object );
427
+			$actions = apply_filters('user_row_actions', $actions, $user_object);
428 428
 
429 429
 			// Role classes.
430
-			$role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) );
430
+			$role_classes = esc_attr(implode(' ', array_keys($user_roles)));
431 431
 
432 432
 			// Set up the checkbox ( because the user is editable, otherwise it's empty )
433
-			$checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>'
433
+			$checkbox = '<label class="screen-reader-text" for="user_'.$user_object->ID.'">'.sprintf(__('Select %s'), $user_object->user_login).'</label>'
434 434
 						. "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role_classes}' value='{$user_object->ID}' />";
435 435
 
436 436
 		} else {
437
-			$edit = '<strong>' . $user_object->user_login . '</strong>';
437
+			$edit = '<strong>'.$user_object->user_login.'</strong>';
438 438
 		}
439
-		$avatar = get_avatar( $user_object->ID, 32 );
439
+		$avatar = get_avatar($user_object->ID, 32);
440 440
 
441 441
 		// Comma-separated list of user roles.
442
-		$roles_list = implode( ', ', $user_roles );
442
+		$roles_list = implode(', ', $user_roles);
443 443
 
444 444
 		$r = "<tr id='user-$user_object->ID'>";
445 445
 
446
-		list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info();
446
+		list($columns, $hidden, $sortable, $primary) = $this->get_column_info();
447 447
 
448
-		foreach ( $columns as $column_name => $column_display_name ) {
448
+		foreach ($columns as $column_name => $column_display_name) {
449 449
 			$classes = "$column_name column-$column_name";
450
-			if ( $primary === $column_name ) {
450
+			if ($primary === $column_name) {
451 451
 				$classes .= ' has-row-actions column-primary';
452 452
 			}
453
-			if ( 'posts' === $column_name ) {
453
+			if ('posts' === $column_name) {
454 454
 				$classes .= ' num'; // Special case for that column
455 455
 			}
456 456
 
457
-			if ( in_array( $column_name, $hidden ) ) {
457
+			if (in_array($column_name, $hidden)) {
458 458
 				$classes .= ' hidden';
459 459
 			}
460 460
 
461
-			$data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"';
461
+			$data = 'data-colname="'.wp_strip_all_tags($column_display_name).'"';
462 462
 
463 463
 			$attributes = "class='$classes' $data";
464 464
 
465
-			if ( 'cb' === $column_name ) {
465
+			if ('cb' === $column_name) {
466 466
 				$r .= "<th scope='row' class='check-column'>$checkbox</th>";
467 467
 			} else {
468 468
 				$r .= "<td $attributes>";
469
-				switch ( $column_name ) {
469
+				switch ($column_name) {
470 470
 					case 'username':
471 471
 						$r .= "$avatar $edit";
472 472
 						break;
@@ -474,16 +474,16 @@  discard block
 block discarded – undo
474 474
 						$r .= "$user_object->first_name $user_object->last_name";
475 475
 						break;
476 476
 					case 'email':
477
-						$r .= "<a href='" . esc_url( "mailto:$email" ) . "'>$email</a>";
477
+						$r .= "<a href='".esc_url("mailto:$email")."'>$email</a>";
478 478
 						break;
479 479
 					case 'role':
480
-						$r .= esc_html( $roles_list );
480
+						$r .= esc_html($roles_list);
481 481
 						break;
482 482
 					case 'posts':
483
-						if ( $numposts > 0 ) {
483
+						if ($numposts > 0) {
484 484
 							$r .= "<a href='edit.php?author=$user_object->ID' class='edit'>";
485
-							$r .= '<span aria-hidden="true">' . $numposts . '</span>';
486
-							$r .= '<span class="screen-reader-text">' . sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) . '</span>';
485
+							$r .= '<span aria-hidden="true">'.$numposts.'</span>';
486
+							$r .= '<span class="screen-reader-text">'.sprintf(_n('%s post by this author', '%s posts by this author', $numposts), number_format_i18n($numposts)).'</span>';
487 487
 							$r .= '</a>';
488 488
 						} else {
489 489
 							$r .= 0;
@@ -499,11 +499,11 @@  discard block
 block discarded – undo
499 499
 						 * @param string $column_name Column name.
500 500
 						 * @param int    $user_id     ID of the currently-listed user.
501 501
 						 */
502
-						$r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID );
502
+						$r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID);
503 503
 				}
504 504
 
505
-				if ( $primary === $column_name ) {
506
-					$r .= $this->row_actions( $actions );
505
+				if ($primary === $column_name) {
506
+					$r .= $this->row_actions($actions);
507 507
 				}
508 508
 				$r .= "</td>";
509 509
 			}
@@ -534,19 +534,19 @@  discard block
 block discarded – undo
534 534
 	 * @param WP_User $user_object The WP_User object.
535 535
 	 * @return array An array of user roles.
536 536
 	 */
537
-	protected function get_role_list( $user_object ) {
537
+	protected function get_role_list($user_object) {
538 538
 		$wp_roles = wp_roles();
539 539
 
540 540
 		$role_list = array();
541 541
 
542
-		foreach ( $user_object->roles as $role ) {
543
-			if ( isset( $wp_roles->role_names[ $role ] ) ) {
544
-				$role_list[ $role ] = translate_user_role( $wp_roles->role_names[ $role ] );
542
+		foreach ($user_object->roles as $role) {
543
+			if (isset($wp_roles->role_names[$role])) {
544
+				$role_list[$role] = translate_user_role($wp_roles->role_names[$role]);
545 545
 			}
546 546
 		}
547 547
 
548
-		if ( empty( $role_list ) ) {
549
-			$role_list['none'] = _x( 'None', 'no user roles' );
548
+		if (empty($role_list)) {
549
+			$role_list['none'] = _x('None', 'no user roles');
550 550
 		}
551 551
 
552 552
 		/**
@@ -557,7 +557,7 @@  discard block
 block discarded – undo
557 557
 		 * @param array   $role_list   An array of user roles.
558 558
 		 * @param WP_User $user_object A WP_User object.
559 559
 		 */
560
-		return apply_filters( 'get_role_list', $role_list, $user_object );
560
+		return apply_filters('get_role_list', $role_list, $user_object);
561 561
 	}
562 562
 
563 563
 }
Please login to merge, or discard this patch.
Braces   +49 added lines, -34 removed lines patch added patch discarded remove patch
@@ -54,8 +54,9 @@  discard block
 block discarded – undo
54 54
 
55 55
 		$this->is_site_users = 'site-users-network' === $this->screen->id;
56 56
 
57
-		if ( $this->is_site_users )
58
-			$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
57
+		if ( $this->is_site_users ) {
58
+					$this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0;
59
+		}
59 60
 	}
60 61
 
61 62
 	/**
@@ -67,10 +68,11 @@  discard block
 block discarded – undo
67 68
 	 * @return bool
68 69
 	 */
69 70
 	public function ajax_user_can() {
70
-		if ( $this->is_site_users )
71
-			return current_user_can( 'manage_sites' );
72
-		else
73
-			return current_user_can( 'list_users' );
71
+		if ( $this->is_site_users ) {
72
+					return current_user_can( 'manage_sites' );
73
+		} else {
74
+					return current_user_can( 'list_users' );
75
+		}
74 76
 	}
75 77
 
76 78
 	/**
@@ -112,17 +114,21 @@  discard block
 block discarded – undo
112 114
 			);
113 115
 		}
114 116
 
115
-		if ( '' !== $args['search'] )
116
-			$args['search'] = '*' . $args['search'] . '*';
117
+		if ( '' !== $args['search'] ) {
118
+					$args['search'] = '*' . $args['search'] . '*';
119
+		}
117 120
 
118
-		if ( $this->is_site_users )
119
-			$args['blog_id'] = $this->site_id;
121
+		if ( $this->is_site_users ) {
122
+					$args['blog_id'] = $this->site_id;
123
+		}
120 124
 
121
-		if ( isset( $_REQUEST['orderby'] ) )
122
-			$args['orderby'] = $_REQUEST['orderby'];
125
+		if ( isset( $_REQUEST['orderby'] ) ) {
126
+					$args['orderby'] = $_REQUEST['orderby'];
127
+		}
123 128
 
124
-		if ( isset( $_REQUEST['order'] ) )
125
-			$args['order'] = $_REQUEST['order'];
129
+		if ( isset( $_REQUEST['order'] ) ) {
130
+					$args['order'] = $_REQUEST['order'];
131
+		}
126 132
 
127 133
 		/**
128 134
 		 * Filters the query arguments used to retrieve users for the current users list table.
@@ -192,8 +198,9 @@  discard block
 block discarded – undo
192 198
 		$role_links = array();
193 199
 		$role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>';
194 200
 		foreach ( $wp_roles->get_names() as $this_role => $name ) {
195
-			if ( !isset($avail_roles[$this_role]) )
196
-				continue;
201
+			if ( !isset($avail_roles[$this_role]) ) {
202
+							continue;
203
+			}
197 204
 
198 205
 			$class = '';
199 206
 
@@ -237,11 +244,13 @@  discard block
 block discarded – undo
237 244
 		$actions = array();
238 245
 
239 246
 		if ( is_multisite() ) {
240
-			if ( current_user_can( 'remove_users' ) )
241
-				$actions['remove'] = __( 'Remove' );
247
+			if ( current_user_can( 'remove_users' ) ) {
248
+							$actions['remove'] = __( 'Remove' );
249
+			}
242 250
 		} else {
243
-			if ( current_user_can( 'delete_users' ) )
244
-				$actions['delete'] = __( 'Delete' );
251
+			if ( current_user_can( 'delete_users' ) ) {
252
+							$actions['delete'] = __( 'Delete' );
253
+			}
245 254
 		}
246 255
 
247 256
 		return $actions;
@@ -323,8 +332,9 @@  discard block
 block discarded – undo
323 332
 			'posts'    => __( 'Posts' )
324 333
 		);
325 334
 
326
-		if ( $this->is_site_users )
327
-			unset( $c['posts'] );
335
+		if ( $this->is_site_users ) {
336
+					unset( $c['posts'] );
337
+		}
328 338
 
329 339
 		return $c;
330 340
 	}
@@ -354,12 +364,14 @@  discard block
 block discarded – undo
354 364
 	 */
355 365
 	public function display_rows() {
356 366
 		// Query the post counts for this page
357
-		if ( ! $this->is_site_users )
358
-			$post_counts = count_many_users_posts( array_keys( $this->items ) );
367
+		if ( ! $this->is_site_users ) {
368
+					$post_counts = count_many_users_posts( array_keys( $this->items ) );
369
+		}
359 370
 
360 371
 		foreach ( $this->items as $userid => $user_object ) {
361
-			if ( is_multisite() && empty( $user_object->allcaps ) )
362
-				continue;
372
+			if ( is_multisite() && empty( $user_object->allcaps ) ) {
373
+							continue;
374
+			}
363 375
 
364 376
 			echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 );
365 377
 		}
@@ -387,10 +399,11 @@  discard block
 block discarded – undo
387 399
 		$user_object->filter = 'display';
388 400
 		$email = $user_object->user_email;
389 401
 
390
-		if ( $this->is_site_users )
391
-			$url = "site-users.php?id={$this->site_id}&amp;";
392
-		else
393
-			$url = 'users.php?';
402
+		if ( $this->is_site_users ) {
403
+					$url = "site-users.php?id={$this->site_id}&amp;";
404
+		} else {
405
+					$url = 'users.php?';
406
+		}
394 407
 
395 408
 		$user_roles = $this->get_role_list( $user_object );
396 409
 
@@ -409,10 +422,12 @@  discard block
 block discarded – undo
409 422
 				$edit = "<strong>$user_object->user_login</strong><br />";
410 423
 			}
411 424
 
412
-			if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) )
413
-				$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
414
-			if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) )
415
-				$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
425
+			if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) {
426
+							$actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>";
427
+			}
428
+			if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) {
429
+							$actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&amp;user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>";
430
+			}
416 431
 
417 432
 			/**
418 433
 			 * Filters the action links displayed under each user in the Users list table.
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-filesystem-direct.php 2 patches
Spacing   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -55,25 +55,25 @@  discard block
 block discarded – undo
55 55
 	 *                         Default false.
56 56
 	 * @return bool False upon failure, true otherwise.
57 57
 	 */
58
-	public function put_contents( $file, $contents, $mode = false ) {
59
-		$fp = @fopen( $file, 'wb' );
60
-		if ( ! $fp )
58
+	public function put_contents($file, $contents, $mode = false) {
59
+		$fp = @fopen($file, 'wb');
60
+		if ( ! $fp)
61 61
 			return false;
62 62
 
63 63
 		mbstring_binary_safe_encoding();
64 64
 
65
-		$data_length = strlen( $contents );
65
+		$data_length = strlen($contents);
66 66
 
67
-		$bytes_written = fwrite( $fp, $contents );
67
+		$bytes_written = fwrite($fp, $contents);
68 68
 
69 69
 		reset_mbstring_encoding();
70 70
 
71
-		fclose( $fp );
71
+		fclose($fp);
72 72
 
73
-		if ( $data_length !== $bytes_written )
73
+		if ($data_length !== $bytes_written)
74 74
 			return false;
75 75
 
76
-		$this->chmod( $file, $mode );
76
+		$this->chmod($file, $mode);
77 77
 
78 78
 		return true;
79 79
 	}
@@ -106,17 +106,17 @@  discard block
 block discarded – undo
106 106
 	 * @return bool Returns true on success or false on failure.
107 107
 	 */
108 108
 	public function chgrp($file, $group, $recursive = false) {
109
-		if ( ! $this->exists($file) )
109
+		if ( ! $this->exists($file))
110 110
 			return false;
111
-		if ( ! $recursive )
111
+		if ( ! $recursive)
112 112
 			return @chgrp($file, $group);
113
-		if ( ! $this->is_dir($file) )
113
+		if ( ! $this->is_dir($file))
114 114
 			return @chgrp($file, $group);
115 115
 		// Is a directory, and we want recursive
116 116
 		$file = trailingslashit($file);
117 117
 		$filelist = $this->dirlist($file);
118 118
 		foreach ($filelist as $filename)
119
-			$this->chgrp($file . $filename, $group, $recursive);
119
+			$this->chgrp($file.$filename, $group, $recursive);
120 120
 
121 121
 		return true;
122 122
 	}
@@ -131,22 +131,22 @@  discard block
 block discarded – undo
131 131
 	 * @return bool Returns true on success or false on failure.
132 132
 	 */
133 133
 	public function chmod($file, $mode = false, $recursive = false) {
134
-		if ( ! $mode ) {
135
-			if ( $this->is_file($file) )
134
+		if ( ! $mode) {
135
+			if ($this->is_file($file))
136 136
 				$mode = FS_CHMOD_FILE;
137
-			elseif ( $this->is_dir($file) )
137
+			elseif ($this->is_dir($file))
138 138
 				$mode = FS_CHMOD_DIR;
139 139
 			else
140 140
 				return false;
141 141
 		}
142 142
 
143
-		if ( ! $recursive || ! $this->is_dir($file) )
143
+		if ( ! $recursive || ! $this->is_dir($file))
144 144
 			return @chmod($file, $mode);
145 145
 		// Is a directory, and we want recursive
146 146
 		$file = trailingslashit($file);
147 147
 		$filelist = $this->dirlist($file);
148
-		foreach ( (array)$filelist as $filename => $filemeta)
149
-			$this->chmod($file . $filename, $mode, $recursive);
148
+		foreach ((array) $filelist as $filename => $filemeta)
149
+			$this->chmod($file.$filename, $mode, $recursive);
150 150
 
151 151
 		return true;
152 152
 	}
@@ -161,16 +161,16 @@  discard block
 block discarded – undo
161 161
 	 * @return bool Returns true on success or false on failure.
162 162
 	 */
163 163
 	public function chown($file, $owner, $recursive = false) {
164
-		if ( ! $this->exists($file) )
164
+		if ( ! $this->exists($file))
165 165
 			return false;
166
-		if ( ! $recursive )
166
+		if ( ! $recursive)
167 167
 			return @chown($file, $owner);
168
-		if ( ! $this->is_dir($file) )
168
+		if ( ! $this->is_dir($file))
169 169
 			return @chown($file, $owner);
170 170
 		// Is a directory, and we want recursive
171 171
 		$filelist = $this->dirlist($file);
172 172
 		foreach ($filelist as $filename) {
173
-			$this->chown($file . '/' . $filename, $owner, $recursive);
173
+			$this->chown($file.'/'.$filename, $owner, $recursive);
174 174
 		}
175 175
 		return true;
176 176
 	}
@@ -183,9 +183,9 @@  discard block
 block discarded – undo
183 183
 	 */
184 184
 	public function owner($file) {
185 185
 		$owneruid = @fileowner($file);
186
-		if ( ! $owneruid )
186
+		if ( ! $owneruid)
187 187
 			return false;
188
-		if ( ! function_exists('posix_getpwuid') )
188
+		if ( ! function_exists('posix_getpwuid'))
189 189
 			return $owneruid;
190 190
 		$ownerarray = posix_getpwuid($owneruid);
191 191
 		return $ownerarray['name'];
@@ -200,7 +200,7 @@  discard block
 block discarded – undo
200 200
 	 * @return string Mode of the file (last 3 digits).
201 201
 	 */
202 202
 	public function getchmod($file) {
203
-		return substr( decoct( @fileperms( $file ) ), -3 );
203
+		return substr(decoct(@fileperms($file)), -3);
204 204
 	}
205 205
 
206 206
 	/**
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 	 */
210 210
 	public function group($file) {
211 211
 		$gid = @filegroup($file);
212
-		if ( ! $gid )
212
+		if ( ! $gid)
213 213
 			return false;
214
-		if ( ! function_exists('posix_getgrgid') )
214
+		if ( ! function_exists('posix_getgrgid'))
215 215
 			return $gid;
216 216
 		$grouparray = posix_getgrgid($gid);
217 217
 		return $grouparray['name'];
@@ -225,11 +225,11 @@  discard block
 block discarded – undo
225 225
 	 * @return bool
226 226
 	 */
227 227
 	public function copy($source, $destination, $overwrite = false, $mode = false) {
228
-		if ( ! $overwrite && $this->exists($destination) )
228
+		if ( ! $overwrite && $this->exists($destination))
229 229
 			return false;
230 230
 
231 231
 		$rtval = copy($source, $destination);
232
-		if ( $mode )
232
+		if ($mode)
233 233
 			$this->chmod($destination, $mode);
234 234
 		return $rtval;
235 235
 	}
@@ -241,14 +241,14 @@  discard block
 block discarded – undo
241 241
 	 * @return bool
242 242
 	 */
243 243
 	public function move($source, $destination, $overwrite = false) {
244
-		if ( ! $overwrite && $this->exists($destination) )
244
+		if ( ! $overwrite && $this->exists($destination))
245 245
 			return false;
246 246
 
247 247
 		// Try using rename first. if that fails (for example, source is read only) try copy.
248
-		if ( @rename($source, $destination) )
248
+		if (@rename($source, $destination))
249 249
 			return true;
250 250
 
251
-		if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) {
251
+		if ($this->copy($source, $destination, $overwrite) && $this->exists($destination)) {
252 252
 			$this->delete($source);
253 253
 			return true;
254 254
 		} else {
@@ -263,13 +263,13 @@  discard block
 block discarded – undo
263 263
 	 * @return bool
264 264
 	 */
265 265
 	public function delete($file, $recursive = false, $type = false) {
266
-		if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
266
+		if (empty($file)) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
267 267
 			return false;
268
-		$file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
268
+		$file = str_replace('\\', '/', $file); // for win32, occasional problems deleting files otherwise
269 269
 
270
-		if ( 'f' == $type || $this->is_file($file) )
270
+		if ('f' == $type || $this->is_file($file))
271 271
 			return @unlink($file);
272
-		if ( ! $recursive && $this->is_dir($file) )
272
+		if ( ! $recursive && $this->is_dir($file))
273 273
 			return @rmdir($file);
274 274
 
275 275
 		// At this point it's a folder, and we're in recursive mode
@@ -277,14 +277,14 @@  discard block
 block discarded – undo
277 277
 		$filelist = $this->dirlist($file, true);
278 278
 
279 279
 		$retval = true;
280
-		if ( is_array( $filelist ) ) {
281
-			foreach ( $filelist as $filename => $fileinfo ) {
282
-				if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) )
280
+		if (is_array($filelist)) {
281
+			foreach ($filelist as $filename => $fileinfo) {
282
+				if ( ! $this->delete($file.$filename, $recursive, $fileinfo['type']))
283 283
 					$retval = false;
284 284
 			}
285 285
 		}
286 286
 
287
-		if ( file_exists($file) && ! @rmdir($file) )
287
+		if (file_exists($file) && ! @rmdir($file))
288 288
 			$retval = false;
289 289
 
290 290
 		return $retval;
@@ -375,18 +375,18 @@  discard block
 block discarded – undo
375 375
 	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
376 376
 		// Safe mode fails with a trailing slash under certain PHP versions.
377 377
 		$path = untrailingslashit($path);
378
-		if ( empty($path) )
378
+		if (empty($path))
379 379
 			return false;
380 380
 
381
-		if ( ! $chmod )
381
+		if ( ! $chmod)
382 382
 			$chmod = FS_CHMOD_DIR;
383 383
 
384
-		if ( ! @mkdir($path) )
384
+		if ( ! @mkdir($path))
385 385
 			return false;
386 386
 		$this->chmod($path, $chmod);
387
-		if ( $chown )
387
+		if ($chown)
388 388
 			$this->chown($path, $chown);
389
-		if ( $chgrp )
389
+		if ($chgrp)
390 390
 			$this->chgrp($path, $chgrp);
391 391
 		return true;
392 392
 	}
@@ -407,54 +407,54 @@  discard block
 block discarded – undo
407 407
 	 * @return bool|array
408 408
 	 */
409 409
 	public function dirlist($path, $include_hidden = true, $recursive = false) {
410
-		if ( $this->is_file($path) ) {
410
+		if ($this->is_file($path)) {
411 411
 			$limit_file = basename($path);
412 412
 			$path = dirname($path);
413 413
 		} else {
414 414
 			$limit_file = false;
415 415
 		}
416 416
 
417
-		if ( ! $this->is_dir($path) )
417
+		if ( ! $this->is_dir($path))
418 418
 			return false;
419 419
 
420 420
 		$dir = @dir($path);
421
-		if ( ! $dir )
421
+		if ( ! $dir)
422 422
 			return false;
423 423
 
424 424
 		$ret = array();
425 425
 
426
-		while (false !== ($entry = $dir->read()) ) {
426
+		while (false !== ($entry = $dir->read())) {
427 427
 			$struc = array();
428 428
 			$struc['name'] = $entry;
429 429
 
430
-			if ( '.' == $struc['name'] || '..' == $struc['name'] )
430
+			if ('.' == $struc['name'] || '..' == $struc['name'])
431 431
 				continue;
432 432
 
433
-			if ( ! $include_hidden && '.' == $struc['name'][0] )
433
+			if ( ! $include_hidden && '.' == $struc['name'][0])
434 434
 				continue;
435 435
 
436
-			if ( $limit_file && $struc['name'] != $limit_file)
436
+			if ($limit_file && $struc['name'] != $limit_file)
437 437
 				continue;
438 438
 
439 439
 			$struc['perms'] 	= $this->gethchmod($path.'/'.$entry);
440 440
 			$struc['permsn']	= $this->getnumchmodfromh($struc['perms']);
441
-			$struc['number'] 	= false;
441
+			$struc['number'] = false;
442 442
 			$struc['owner']    	= $this->owner($path.'/'.$entry);
443 443
 			$struc['group']    	= $this->group($path.'/'.$entry);
444 444
 			$struc['size']    	= $this->size($path.'/'.$entry);
445
-			$struc['lastmodunix']= $this->mtime($path.'/'.$entry);
446
-			$struc['lastmod']   = date('M j',$struc['lastmodunix']);
447
-			$struc['time']    	= date('h:i:s',$struc['lastmodunix']);
448
-			$struc['type']		= $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
449
-
450
-			if ( 'd' == $struc['type'] ) {
451
-				if ( $recursive )
452
-					$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
445
+			$struc['lastmodunix'] = $this->mtime($path.'/'.$entry);
446
+			$struc['lastmod']   = date('M j', $struc['lastmodunix']);
447
+			$struc['time']    	= date('h:i:s', $struc['lastmodunix']);
448
+			$struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
449
+
450
+			if ('d' == $struc['type']) {
451
+				if ($recursive)
452
+					$struc['files'] = $this->dirlist($path.'/'.$struc['name'], $include_hidden, $recursive);
453 453
 				else
454 454
 					$struc['files'] = array();
455 455
 			}
456 456
 
457
-			$ret[ $struc['name'] ] = $struc;
457
+			$ret[$struc['name']] = $struc;
458 458
 		}
459 459
 		$dir->close();
460 460
 		unset($dir);
Please login to merge, or discard this patch.
Braces   +120 added lines, -81 removed lines patch added patch discarded remove patch
@@ -57,8 +57,9 @@  discard block
 block discarded – undo
57 57
 	 */
58 58
 	public function put_contents( $file, $contents, $mode = false ) {
59 59
 		$fp = @fopen( $file, 'wb' );
60
-		if ( ! $fp )
61
-			return false;
60
+		if ( ! $fp ) {
61
+					return false;
62
+		}
62 63
 
63 64
 		mbstring_binary_safe_encoding();
64 65
 
@@ -70,8 +71,9 @@  discard block
 block discarded – undo
70 71
 
71 72
 		fclose( $fp );
72 73
 
73
-		if ( $data_length !== $bytes_written )
74
-			return false;
74
+		if ( $data_length !== $bytes_written ) {
75
+					return false;
76
+		}
75 77
 
76 78
 		$this->chmod( $file, $mode );
77 79
 
@@ -106,17 +108,21 @@  discard block
 block discarded – undo
106 108
 	 * @return bool Returns true on success or false on failure.
107 109
 	 */
108 110
 	public function chgrp($file, $group, $recursive = false) {
109
-		if ( ! $this->exists($file) )
110
-			return false;
111
-		if ( ! $recursive )
112
-			return @chgrp($file, $group);
113
-		if ( ! $this->is_dir($file) )
114
-			return @chgrp($file, $group);
111
+		if ( ! $this->exists($file) ) {
112
+					return false;
113
+		}
114
+		if ( ! $recursive ) {
115
+					return @chgrp($file, $group);
116
+		}
117
+		if ( ! $this->is_dir($file) ) {
118
+					return @chgrp($file, $group);
119
+		}
115 120
 		// Is a directory, and we want recursive
116 121
 		$file = trailingslashit($file);
117 122
 		$filelist = $this->dirlist($file);
118
-		foreach ($filelist as $filename)
119
-			$this->chgrp($file . $filename, $group, $recursive);
123
+		foreach ($filelist as $filename) {
124
+					$this->chgrp($file . $filename, $group, $recursive);
125
+		}
120 126
 
121 127
 		return true;
122 128
 	}
@@ -132,21 +138,24 @@  discard block
 block discarded – undo
132 138
 	 */
133 139
 	public function chmod($file, $mode = false, $recursive = false) {
134 140
 		if ( ! $mode ) {
135
-			if ( $this->is_file($file) )
136
-				$mode = FS_CHMOD_FILE;
137
-			elseif ( $this->is_dir($file) )
138
-				$mode = FS_CHMOD_DIR;
139
-			else
140
-				return false;
141
+			if ( $this->is_file($file) ) {
142
+							$mode = FS_CHMOD_FILE;
143
+			} elseif ( $this->is_dir($file) ) {
144
+							$mode = FS_CHMOD_DIR;
145
+			} else {
146
+							return false;
147
+			}
141 148
 		}
142 149
 
143
-		if ( ! $recursive || ! $this->is_dir($file) )
144
-			return @chmod($file, $mode);
150
+		if ( ! $recursive || ! $this->is_dir($file) ) {
151
+					return @chmod($file, $mode);
152
+		}
145 153
 		// Is a directory, and we want recursive
146 154
 		$file = trailingslashit($file);
147 155
 		$filelist = $this->dirlist($file);
148
-		foreach ( (array)$filelist as $filename => $filemeta)
149
-			$this->chmod($file . $filename, $mode, $recursive);
156
+		foreach ( (array)$filelist as $filename => $filemeta) {
157
+					$this->chmod($file . $filename, $mode, $recursive);
158
+		}
150 159
 
151 160
 		return true;
152 161
 	}
@@ -161,12 +170,15 @@  discard block
 block discarded – undo
161 170
 	 * @return bool Returns true on success or false on failure.
162 171
 	 */
163 172
 	public function chown($file, $owner, $recursive = false) {
164
-		if ( ! $this->exists($file) )
165
-			return false;
166
-		if ( ! $recursive )
167
-			return @chown($file, $owner);
168
-		if ( ! $this->is_dir($file) )
169
-			return @chown($file, $owner);
173
+		if ( ! $this->exists($file) ) {
174
+					return false;
175
+		}
176
+		if ( ! $recursive ) {
177
+					return @chown($file, $owner);
178
+		}
179
+		if ( ! $this->is_dir($file) ) {
180
+					return @chown($file, $owner);
181
+		}
170 182
 		// Is a directory, and we want recursive
171 183
 		$filelist = $this->dirlist($file);
172 184
 		foreach ($filelist as $filename) {
@@ -183,10 +195,12 @@  discard block
 block discarded – undo
183 195
 	 */
184 196
 	public function owner($file) {
185 197
 		$owneruid = @fileowner($file);
186
-		if ( ! $owneruid )
187
-			return false;
188
-		if ( ! function_exists('posix_getpwuid') )
189
-			return $owneruid;
198
+		if ( ! $owneruid ) {
199
+					return false;
200
+		}
201
+		if ( ! function_exists('posix_getpwuid') ) {
202
+					return $owneruid;
203
+		}
190 204
 		$ownerarray = posix_getpwuid($owneruid);
191 205
 		return $ownerarray['name'];
192 206
 	}
@@ -209,10 +223,12 @@  discard block
 block discarded – undo
209 223
 	 */
210 224
 	public function group($file) {
211 225
 		$gid = @filegroup($file);
212
-		if ( ! $gid )
213
-			return false;
214
-		if ( ! function_exists('posix_getgrgid') )
215
-			return $gid;
226
+		if ( ! $gid ) {
227
+					return false;
228
+		}
229
+		if ( ! function_exists('posix_getgrgid') ) {
230
+					return $gid;
231
+		}
216 232
 		$grouparray = posix_getgrgid($gid);
217 233
 		return $grouparray['name'];
218 234
 	}
@@ -225,12 +241,14 @@  discard block
 block discarded – undo
225 241
 	 * @return bool
226 242
 	 */
227 243
 	public function copy($source, $destination, $overwrite = false, $mode = false) {
228
-		if ( ! $overwrite && $this->exists($destination) )
229
-			return false;
244
+		if ( ! $overwrite && $this->exists($destination) ) {
245
+					return false;
246
+		}
230 247
 
231 248
 		$rtval = copy($source, $destination);
232
-		if ( $mode )
233
-			$this->chmod($destination, $mode);
249
+		if ( $mode ) {
250
+					$this->chmod($destination, $mode);
251
+		}
234 252
 		return $rtval;
235 253
 	}
236 254
 
@@ -241,12 +259,14 @@  discard block
 block discarded – undo
241 259
 	 * @return bool
242 260
 	 */
243 261
 	public function move($source, $destination, $overwrite = false) {
244
-		if ( ! $overwrite && $this->exists($destination) )
245
-			return false;
262
+		if ( ! $overwrite && $this->exists($destination) ) {
263
+					return false;
264
+		}
246 265
 
247 266
 		// Try using rename first. if that fails (for example, source is read only) try copy.
248
-		if ( @rename($source, $destination) )
249
-			return true;
267
+		if ( @rename($source, $destination) ) {
268
+					return true;
269
+		}
250 270
 
251 271
 		if ( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ) {
252 272
 			$this->delete($source);
@@ -263,14 +283,18 @@  discard block
 block discarded – undo
263 283
 	 * @return bool
264 284
 	 */
265 285
 	public function delete($file, $recursive = false, $type = false) {
266
-		if ( empty( $file ) ) // Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
286
+		if ( empty( $file ) ) {
287
+			// Some filesystems report this as /, which can cause non-expected recursive deletion of all files in the filesystem.
267 288
 			return false;
289
+		}
268 290
 		$file = str_replace( '\\', '/', $file ); // for win32, occasional problems deleting files otherwise
269 291
 
270
-		if ( 'f' == $type || $this->is_file($file) )
271
-			return @unlink($file);
272
-		if ( ! $recursive && $this->is_dir($file) )
273
-			return @rmdir($file);
292
+		if ( 'f' == $type || $this->is_file($file) ) {
293
+					return @unlink($file);
294
+		}
295
+		if ( ! $recursive && $this->is_dir($file) ) {
296
+					return @rmdir($file);
297
+		}
274 298
 
275 299
 		// At this point it's a folder, and we're in recursive mode
276 300
 		$file = trailingslashit($file);
@@ -279,13 +303,15 @@  discard block
 block discarded – undo
279 303
 		$retval = true;
280 304
 		if ( is_array( $filelist ) ) {
281 305
 			foreach ( $filelist as $filename => $fileinfo ) {
282
-				if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) )
283
-					$retval = false;
306
+				if ( ! $this->delete($file . $filename, $recursive, $fileinfo['type']) ) {
307
+									$retval = false;
308
+				}
284 309
 			}
285 310
 		}
286 311
 
287
-		if ( file_exists($file) && ! @rmdir($file) )
288
-			$retval = false;
312
+		if ( file_exists($file) && ! @rmdir($file) ) {
313
+					$retval = false;
314
+		}
289 315
 
290 316
 		return $retval;
291 317
 	}
@@ -358,10 +384,12 @@  discard block
 block discarded – undo
358 384
 	 * @return bool
359 385
 	 */
360 386
 	public function touch($file, $time = 0, $atime = 0) {
361
-		if ($time == 0)
362
-			$time = time();
363
-		if ($atime == 0)
364
-			$atime = time();
387
+		if ($time == 0) {
388
+					$time = time();
389
+		}
390
+		if ($atime == 0) {
391
+					$atime = time();
392
+		}
365 393
 		return @touch($file, $time, $atime);
366 394
 	}
367 395
 
@@ -375,19 +403,24 @@  discard block
 block discarded – undo
375 403
 	public function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
376 404
 		// Safe mode fails with a trailing slash under certain PHP versions.
377 405
 		$path = untrailingslashit($path);
378
-		if ( empty($path) )
379
-			return false;
406
+		if ( empty($path) ) {
407
+					return false;
408
+		}
380 409
 
381
-		if ( ! $chmod )
382
-			$chmod = FS_CHMOD_DIR;
410
+		if ( ! $chmod ) {
411
+					$chmod = FS_CHMOD_DIR;
412
+		}
383 413
 
384
-		if ( ! @mkdir($path) )
385
-			return false;
414
+		if ( ! @mkdir($path) ) {
415
+					return false;
416
+		}
386 417
 		$this->chmod($path, $chmod);
387
-		if ( $chown )
388
-			$this->chown($path, $chown);
389
-		if ( $chgrp )
390
-			$this->chgrp($path, $chgrp);
418
+		if ( $chown ) {
419
+					$this->chown($path, $chown);
420
+		}
421
+		if ( $chgrp ) {
422
+					$this->chgrp($path, $chgrp);
423
+		}
391 424
 		return true;
392 425
 	}
393 426
 
@@ -414,12 +447,14 @@  discard block
 block discarded – undo
414 447
 			$limit_file = false;
415 448
 		}
416 449
 
417
-		if ( ! $this->is_dir($path) )
418
-			return false;
450
+		if ( ! $this->is_dir($path) ) {
451
+					return false;
452
+		}
419 453
 
420 454
 		$dir = @dir($path);
421
-		if ( ! $dir )
422
-			return false;
455
+		if ( ! $dir ) {
456
+					return false;
457
+		}
423 458
 
424 459
 		$ret = array();
425 460
 
@@ -427,14 +462,17 @@  discard block
 block discarded – undo
427 462
 			$struc = array();
428 463
 			$struc['name'] = $entry;
429 464
 
430
-			if ( '.' == $struc['name'] || '..' == $struc['name'] )
431
-				continue;
465
+			if ( '.' == $struc['name'] || '..' == $struc['name'] ) {
466
+							continue;
467
+			}
432 468
 
433
-			if ( ! $include_hidden && '.' == $struc['name'][0] )
434
-				continue;
469
+			if ( ! $include_hidden && '.' == $struc['name'][0] ) {
470
+							continue;
471
+			}
435 472
 
436
-			if ( $limit_file && $struc['name'] != $limit_file)
437
-				continue;
473
+			if ( $limit_file && $struc['name'] != $limit_file) {
474
+							continue;
475
+			}
438 476
 
439 477
 			$struc['perms'] 	= $this->gethchmod($path.'/'.$entry);
440 478
 			$struc['permsn']	= $this->getnumchmodfromh($struc['perms']);
@@ -448,10 +486,11 @@  discard block
 block discarded – undo
448 486
 			$struc['type']		= $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
449 487
 
450 488
 			if ( 'd' == $struc['type'] ) {
451
-				if ( $recursive )
452
-					$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
453
-				else
454
-					$struc['files'] = array();
489
+				if ( $recursive ) {
490
+									$struc['files'] = $this->dirlist($path . '/' . $struc['name'], $include_hidden, $recursive);
491
+				} else {
492
+									$struc['files'] = array();
493
+				}
455 494
 			}
456 495
 
457 496
 			$ret[ $struc['name'] ] = $struc;
Please login to merge, or discard this patch.
src/wp-admin/includes/menu.php 2 patches
Braces   +31 added lines, -22 removed lines patch added patch discarded remove patch
@@ -49,20 +49,22 @@  discard block
 block discarded – undo
49 49
 		$hook_args = substr($menu_page[2], $pos + 1);
50 50
 		wp_parse_str($hook_args, $hook_args);
51 51
 		// Set the hook name to be the post type.
52
-		if ( isset($hook_args['post_type']) )
53
-			$hook_name = $hook_args['post_type'];
54
-		else
55
-			$hook_name = basename($hook_name, '.php');
52
+		if ( isset($hook_args['post_type']) ) {
53
+					$hook_name = $hook_args['post_type'];
54
+		} else {
55
+					$hook_name = basename($hook_name, '.php');
56
+		}
56 57
 		unset($hook_args);
57 58
 	} else {
58 59
 		$hook_name = basename($menu_page[2], '.php');
59 60
 	}
60 61
 	$hook_name = sanitize_title($hook_name);
61 62
 
62
-	if ( isset($compat[$hook_name]) )
63
-		$hook_name = $compat[$hook_name];
64
-	elseif ( !$hook_name )
65
-		continue;
63
+	if ( isset($compat[$hook_name]) ) {
64
+			$hook_name = $compat[$hook_name];
65
+	} elseif ( !$hook_name ) {
66
+			continue;
67
+	}
66 68
 
67 69
 	$admin_page_hooks[$menu_page[2]] = $hook_name;
68 70
 }
@@ -80,9 +82,10 @@  discard block
 block discarded – undo
80 82
 	}
81 83
 	unset($index, $data);
82 84
 
83
-	if ( empty($submenu[$parent]) )
84
-		unset($submenu[$parent]);
85
-}
85
+	if ( empty($submenu[$parent]) ) {
86
+			unset($submenu[$parent]);
87
+	}
88
+	}
86 89
 unset($sub, $parent);
87 90
 
88 91
 /*
@@ -91,8 +94,9 @@  discard block
 block discarded – undo
91 94
  * will have the next submenu in line be assigned as the new menu parent.
92 95
  */
93 96
 foreach ( $menu as $id => $data ) {
94
-	if ( empty($submenu[$data[2]]) )
95
-		continue;
97
+	if ( empty($submenu[$data[2]]) ) {
98
+			continue;
99
+	}
96 100
 	$subs = $submenu[$data[2]];
97 101
 	$first_sub = reset( $subs );
98 102
 	$old_parent = $data[2];
@@ -111,8 +115,9 @@  discard block
 block discarded – undo
111 115
 		}
112 116
 		unset($submenu[$old_parent], $index);
113 117
 
114
-		if ( isset($_wp_submenu_nopriv[$old_parent]) )
115
-			$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
118
+		if ( isset($_wp_submenu_nopriv[$old_parent]) ) {
119
+					$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
120
+		}
116 121
 	}
117 122
 }
118 123
 unset($id, $data, $subs, $first_sub, $old_parent, $new_parent);
@@ -154,8 +159,9 @@  discard block
 block discarded – undo
154 159
  * that the user does not have. Run re-parent loop again.
155 160
  */
156 161
 foreach ( $menu as $id => $data ) {
157
-	if ( ! current_user_can($data[1]) )
158
-		$_wp_menu_nopriv[$data[2]] = true;
162
+	if ( ! current_user_can($data[1]) ) {
163
+			$_wp_menu_nopriv[$data[2]] = true;
164
+	}
159 165
 
160 166
 	/*
161 167
 	 * If there is only one submenu and it is has same destination as the parent,
@@ -164,8 +170,9 @@  discard block
 block discarded – undo
164 170
 	if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
165 171
 		$subs = $submenu[$data[2]];
166 172
 		$first_sub = reset( $subs );
167
-		if ( $data[2] == $first_sub[2] )
168
-			unset( $submenu[$data[2]] );
173
+		if ( $data[2] == $first_sub[2] ) {
174
+					unset( $submenu[$data[2]] );
175
+		}
169 176
 	}
170 177
 
171 178
 	// If submenu is empty...
@@ -307,8 +314,9 @@  discard block
 block discarded – undo
307 314
 		} elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) {
308 315
 			return 1;
309 316
 		} elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) {
310
-			if ( $menu_order[$a] == $menu_order[$b] )
311
-				return 0;
317
+			if ( $menu_order[$a] == $menu_order[$b] ) {
318
+							return 0;
319
+			}
312 320
 			return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1;
313 321
 		} else {
314 322
 			return ($default_menu_order[$a] <= $default_menu_order[$b]) ? -1 : 1;
@@ -322,8 +330,9 @@  discard block
 block discarded – undo
322 330
 // Remove the last menu item if it is a separator.
323 331
 $last_menu_key = array_keys( $menu );
324 332
 $last_menu_key = array_pop( $last_menu_key );
325
-if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
333
+if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] ) {
326 334
 	unset( $menu[ $last_menu_key ] );
335
+}
327 336
 unset( $last_menu_key );
328 337
 
329 338
 if ( !user_can_access_admin_page() ) {
Please login to merge, or discard this patch.
Spacing   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -6,7 +6,7 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( is_network_admin() ) {
9
+if (is_network_admin()) {
10 10
 
11 11
 	/**
12 12
 	 * Fires before the administration menu loads in the Network Admin.
@@ -16,8 +16,8 @@  discard block
 block discarded – undo
16 16
 	 * @private
17 17
 	 * @since 3.1.0
18 18
 	 */
19
-	do_action( '_network_admin_menu' );
20
-} elseif ( is_user_admin() ) {
19
+	do_action('_network_admin_menu');
20
+} elseif (is_user_admin()) {
21 21
 
22 22
 	/**
23 23
 	 * Fires before the administration menu loads in the User Admin.
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 	 * @private
28 28
 	 * @since 3.1.0
29 29
 	 */
30
-	do_action( '_user_admin_menu' );
30
+	do_action('_user_admin_menu');
31 31
 } else {
32 32
 
33 33
 	/**
@@ -38,18 +38,18 @@  discard block
 block discarded – undo
38 38
 	 * @private
39 39
 	 * @since 2.2.0
40 40
 	 */
41
-	do_action( '_admin_menu' );
41
+	do_action('_admin_menu');
42 42
 }
43 43
 
44 44
 // Create list of page plugin hook names.
45 45
 foreach ($menu as $menu_page) {
46
-	if ( false !== $pos = strpos($menu_page[2], '?') ) {
46
+	if (false !== $pos = strpos($menu_page[2], '?')) {
47 47
 		// Handle post_type=post|page|foo pages.
48 48
 		$hook_name = substr($menu_page[2], 0, $pos);
49 49
 		$hook_args = substr($menu_page[2], $pos + 1);
50 50
 		wp_parse_str($hook_args, $hook_args);
51 51
 		// Set the hook name to be the post type.
52
-		if ( isset($hook_args['post_type']) )
52
+		if (isset($hook_args['post_type']))
53 53
 			$hook_name = $hook_args['post_type'];
54 54
 		else
55 55
 			$hook_name = basename($hook_name, '.php');
@@ -59,9 +59,9 @@  discard block
 block discarded – undo
59 59
 	}
60 60
 	$hook_name = sanitize_title($hook_name);
61 61
 
62
-	if ( isset($compat[$hook_name]) )
62
+	if (isset($compat[$hook_name]))
63 63
 		$hook_name = $compat[$hook_name];
64
-	elseif ( !$hook_name )
64
+	elseif ( ! $hook_name)
65 65
 		continue;
66 66
 
67 67
 	$admin_page_hooks[$menu_page[2]] = $hook_name;
@@ -73,14 +73,14 @@  discard block
 block discarded – undo
73 73
 // Loop over submenus and remove pages for which the user does not have privs.
74 74
 foreach ($submenu as $parent => $sub) {
75 75
 	foreach ($sub as $index => $data) {
76
-		if ( ! current_user_can($data[1]) ) {
76
+		if ( ! current_user_can($data[1])) {
77 77
 			unset($submenu[$parent][$index]);
78 78
 			$_wp_submenu_nopriv[$parent][$data[2]] = true;
79 79
 		}
80 80
 	}
81 81
 	unset($index, $data);
82 82
 
83
-	if ( empty($submenu[$parent]) )
83
+	if (empty($submenu[$parent]))
84 84
 		unset($submenu[$parent]);
85 85
 }
86 86
 unset($sub, $parent);
@@ -90,18 +90,18 @@  discard block
 block discarded – undo
90 90
  * Menus for which the original parent is not accessible due to lack of privileges
91 91
  * will have the next submenu in line be assigned as the new menu parent.
92 92
  */
93
-foreach ( $menu as $id => $data ) {
94
-	if ( empty($submenu[$data[2]]) )
93
+foreach ($menu as $id => $data) {
94
+	if (empty($submenu[$data[2]]))
95 95
 		continue;
96 96
 	$subs = $submenu[$data[2]];
97
-	$first_sub = reset( $subs );
97
+	$first_sub = reset($subs);
98 98
 	$old_parent = $data[2];
99 99
 	$new_parent = $first_sub[2];
100 100
 	/*
101 101
 	 * If the first submenu is not the same as the assigned parent,
102 102
 	 * make the first submenu the new parent.
103 103
 	 */
104
-	if ( $new_parent != $old_parent ) {
104
+	if ($new_parent != $old_parent) {
105 105
 		$_wp_real_parent_file[$old_parent] = $new_parent;
106 106
 		$menu[$id][2] = $new_parent;
107 107
 
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 		}
112 112
 		unset($submenu[$old_parent], $index);
113 113
 
114
-		if ( isset($_wp_submenu_nopriv[$old_parent]) )
114
+		if (isset($_wp_submenu_nopriv[$old_parent]))
115 115
 			$_wp_submenu_nopriv[$new_parent] = $_wp_submenu_nopriv[$old_parent];
116 116
 	}
117 117
 }
118 118
 unset($id, $data, $subs, $first_sub, $old_parent, $new_parent);
119 119
 
120
-if ( is_network_admin() ) {
120
+if (is_network_admin()) {
121 121
 
122 122
 	/**
123 123
 	 * Fires before the administration menu loads in the Network Admin.
@@ -126,8 +126,8 @@  discard block
 block discarded – undo
126 126
 	 *
127 127
 	 * @param string $context Empty context.
128 128
 	 */
129
-	do_action( 'network_admin_menu', '' );
130
-} elseif ( is_user_admin() ) {
129
+	do_action('network_admin_menu', '');
130
+} elseif (is_user_admin()) {
131 131
 
132 132
 	/**
133 133
 	 * Fires before the administration menu loads in the User Admin.
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 	 *
137 137
 	 * @param string $context Empty context.
138 138
 	 */
139
-	do_action( 'user_admin_menu', '' );
139
+	do_action('user_admin_menu', '');
140 140
 } else {
141 141
 
142 142
 	/**
@@ -146,32 +146,32 @@  discard block
 block discarded – undo
146 146
 	 *
147 147
 	 * @param string $context Empty context.
148 148
 	 */
149
-	do_action( 'admin_menu', '' );
149
+	do_action('admin_menu', '');
150 150
 }
151 151
 
152 152
 /*
153 153
  * Remove menus that have no accessible submenus and require privileges
154 154
  * that the user does not have. Run re-parent loop again.
155 155
  */
156
-foreach ( $menu as $id => $data ) {
157
-	if ( ! current_user_can($data[1]) )
156
+foreach ($menu as $id => $data) {
157
+	if ( ! current_user_can($data[1]))
158 158
 		$_wp_menu_nopriv[$data[2]] = true;
159 159
 
160 160
 	/*
161 161
 	 * If there is only one submenu and it is has same destination as the parent,
162 162
 	 * remove the submenu.
163 163
 	 */
164
-	if ( ! empty( $submenu[$data[2]] ) && 1 == count ( $submenu[$data[2]] ) ) {
164
+	if ( ! empty($submenu[$data[2]]) && 1 == count($submenu[$data[2]])) {
165 165
 		$subs = $submenu[$data[2]];
166
-		$first_sub = reset( $subs );
167
-		if ( $data[2] == $first_sub[2] )
168
-			unset( $submenu[$data[2]] );
166
+		$first_sub = reset($subs);
167
+		if ($data[2] == $first_sub[2])
168
+			unset($submenu[$data[2]]);
169 169
 	}
170 170
 
171 171
 	// If submenu is empty...
172
-	if ( empty($submenu[$data[2]]) ) {
172
+	if (empty($submenu[$data[2]])) {
173 173
 		// And user doesn't have privs, remove menu.
174
-		if ( isset( $_wp_menu_nopriv[$data[2]] ) ) {
174
+		if (isset($_wp_menu_nopriv[$data[2]])) {
175 175
 			unset($menu[$id]);
176 176
 		}
177 177
 	}
@@ -185,7 +185,7 @@  discard block
 block discarded – undo
185 185
  * @return string
186 186
  */
187 187
 function add_cssclass($add, $class) {
188
-	$class = empty($class) ? $add : $class .= ' ' . $add;
188
+	$class = empty($class) ? $add : $class .= ' '.$add;
189 189
 	return $class;
190 190
 }
191 191
 
@@ -198,29 +198,29 @@  discard block
 block discarded – undo
198 198
 	$first = $lastorder = false;
199 199
 	$i = 0;
200 200
 	$mc = count($menu);
201
-	foreach ( $menu as $order => $top ) {
201
+	foreach ($menu as $order => $top) {
202 202
 		$i++;
203 203
 
204
-		if ( 0 == $order ) { // dashboard is always shown/single
204
+		if (0 == $order) { // dashboard is always shown/single
205 205
 			$menu[0][4] = add_cssclass('menu-top-first', $top[4]);
206 206
 			$lastorder = 0;
207 207
 			continue;
208 208
 		}
209 209
 
210
-		if ( 0 === strpos($top[2], 'separator') && false !== $lastorder ) { // if separator
210
+		if (0 === strpos($top[2], 'separator') && false !== $lastorder) { // if separator
211 211
 			$first = true;
212 212
 			$c = $menu[$lastorder][4];
213 213
 			$menu[$lastorder][4] = add_cssclass('menu-top-last', $c);
214 214
 			continue;
215 215
 		}
216 216
 
217
-		if ( $first ) {
217
+		if ($first) {
218 218
 			$c = $menu[$order][4];
219 219
 			$menu[$order][4] = add_cssclass('menu-top-first', $c);
220 220
 			$first = false;
221 221
 		}
222 222
 
223
-		if ( $mc == $i ) { // last item
223
+		if ($mc == $i) { // last item
224 224
 			$c = $menu[$order][4];
225 225
 			$menu[$order][4] = add_cssclass('menu-top-last', $c);
226 226
 		}
@@ -235,7 +235,7 @@  discard block
 block discarded – undo
235 235
 	 *
236 236
 	 * @param array $menu Associative array of administration menu items.
237 237
 	 */
238
-	return apply_filters( 'add_menu_classes', $menu );
238
+	return apply_filters('add_menu_classes', $menu);
239 239
 }
240 240
 
241 241
 uksort($menu, "strnatcasecmp"); // make it all pretty
@@ -249,9 +249,9 @@  discard block
 block discarded – undo
249 249
  *
250 250
  * @param bool $custom Whether custom ordering is enabled. Default false.
251 251
  */
252
-if ( apply_filters( 'custom_menu_order', false ) ) {
252
+if (apply_filters('custom_menu_order', false)) {
253 253
 	$menu_order = array();
254
-	foreach ( $menu as $menu_item ) {
254
+	foreach ($menu as $menu_item) {
255 255
 		$menu_order[] = $menu_item[2];
256 256
 	}
257 257
 	unset($menu_item);
@@ -269,7 +269,7 @@  discard block
 block discarded – undo
269 269
 	 *
270 270
 	 * @param array $menu_order An ordered array of menu items.
271 271
 	 */
272
-	$menu_order = apply_filters( 'menu_order', $menu_order );
272
+	$menu_order = apply_filters('menu_order', $menu_order);
273 273
 	$menu_order = array_flip($menu_order);
274 274
 	$default_menu_order = array_flip($default_menu_order);
275 275
 
@@ -286,12 +286,12 @@  discard block
 block discarded – undo
286 286
 		global $menu_order, $default_menu_order;
287 287
 		$a = $a[2];
288 288
 		$b = $b[2];
289
-		if ( isset($menu_order[$a]) && !isset($menu_order[$b]) ) {
289
+		if (isset($menu_order[$a]) && ! isset($menu_order[$b])) {
290 290
 			return -1;
291
-		} elseif ( !isset($menu_order[$a]) && isset($menu_order[$b]) ) {
291
+		} elseif ( ! isset($menu_order[$a]) && isset($menu_order[$b])) {
292 292
 			return 1;
293
-		} elseif ( isset($menu_order[$a]) && isset($menu_order[$b]) ) {
294
-			if ( $menu_order[$a] == $menu_order[$b] )
293
+		} elseif (isset($menu_order[$a]) && isset($menu_order[$b])) {
294
+			if ($menu_order[$a] == $menu_order[$b])
295 295
 				return 0;
296 296
 			return ($menu_order[$a] < $menu_order[$b]) ? -1 : 1;
297 297
 		} else {
@@ -305,41 +305,41 @@  discard block
 block discarded – undo
305 305
 
306 306
 // Prevent adjacent separators
307 307
 $prev_menu_was_separator = false;
308
-foreach ( $menu as $id => $data ) {
309
-	if ( false === stristr( $data[4], 'wp-menu-separator' ) ) {
308
+foreach ($menu as $id => $data) {
309
+	if (false === stristr($data[4], 'wp-menu-separator')) {
310 310
 
311 311
 		// This item is not a separator, so falsey the toggler and do nothing
312 312
 		$prev_menu_was_separator = false;
313 313
 	} else {
314 314
 
315 315
 		// The previous item was a separator, so unset this one
316
-		if ( true === $prev_menu_was_separator ) {
317
-			unset( $menu[ $id ] );
316
+		if (true === $prev_menu_was_separator) {
317
+			unset($menu[$id]);
318 318
 		}
319 319
 
320 320
 		// This item is a separator, so truthy the toggler and move on
321 321
 		$prev_menu_was_separator = true;
322 322
 	}
323 323
 }
324
-unset( $id, $data, $prev_menu_was_separator );
324
+unset($id, $data, $prev_menu_was_separator);
325 325
 
326 326
 // Remove the last menu item if it is a separator.
327
-$last_menu_key = array_keys( $menu );
328
-$last_menu_key = array_pop( $last_menu_key );
329
-if ( !empty( $menu ) && 'wp-menu-separator' == $menu[ $last_menu_key ][ 4 ] )
330
-	unset( $menu[ $last_menu_key ] );
331
-unset( $last_menu_key );
327
+$last_menu_key = array_keys($menu);
328
+$last_menu_key = array_pop($last_menu_key);
329
+if ( ! empty($menu) && 'wp-menu-separator' == $menu[$last_menu_key][4])
330
+	unset($menu[$last_menu_key]);
331
+unset($last_menu_key);
332 332
 
333
-if ( !user_can_access_admin_page() ) {
333
+if ( ! user_can_access_admin_page()) {
334 334
 
335 335
 	/**
336 336
 	 * Fires when access to an admin page is denied.
337 337
 	 *
338 338
 	 * @since 2.5.0
339 339
 	 */
340
-	do_action( 'admin_page_access_denied' );
340
+	do_action('admin_page_access_denied');
341 341
 
342
-	wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 );
342
+	wp_die(__('Sorry, you are not allowed to access this page.'), 403);
343 343
 }
344 344
 
345 345
 $menu = add_menu_classes($menu);
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-themes-list-table.php 2 patches
Braces   +30 added lines, -20 removed lines patch added patch discarded remove patch
@@ -44,16 +44,19 @@  discard block
 block discarded – undo
44 44
 	public function prepare_items() {
45 45
 		$themes = wp_get_themes( array( 'allowed' => true ) );
46 46
 
47
-		if ( ! empty( $_REQUEST['s'] ) )
48
-			$this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );
47
+		if ( ! empty( $_REQUEST['s'] ) ) {
48
+					$this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );
49
+		}
49 50
 
50
-		if ( ! empty( $_REQUEST['features'] ) )
51
-			$this->features = $_REQUEST['features'];
51
+		if ( ! empty( $_REQUEST['features'] ) ) {
52
+					$this->features = $_REQUEST['features'];
53
+		}
52 54
 
53 55
 		if ( $this->search_terms || $this->features ) {
54 56
 			foreach ( $themes as $key => $theme ) {
55
-				if ( ! $this->search_theme( $theme ) )
56
-					unset( $themes[ $key ] );
57
+				if ( ! $this->search_theme( $theme ) ) {
58
+									unset( $themes[ $key ] );
59
+				}
57 60
 			}
58 61
 		}
59 62
 
@@ -109,8 +112,9 @@  discard block
 block discarded – undo
109 112
 	 * @param string $which
110 113
 	 */
111 114
 	public function tablenav( $which = 'top' ) {
112
-		if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
113
-			return;
115
+		if ( $this->get_pagination_arg( 'total_pages' ) <= 1 ) {
116
+					return;
117
+		}
114 118
 		?>
115 119
 		<div class="tablenav themes <?php echo $which; ?>">
116 120
 			<?php $this->pagination( $which ); ?>
@@ -183,10 +187,11 @@  discard block
 block discarded – undo
183 187
 					. __( 'Live Preview' ) . '</a>';
184 188
 			}
185 189
 
186
-			if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
187
-				$actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet )
190
+			if ( ! is_multisite() && current_user_can( 'delete_themes' ) ) {
191
+							$actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet )
188 192
 					. '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete." ), $title ) )
189 193
 					. "' );" . '">' . __( 'Delete' ) . '</a>';
194
+			}
190 195
 
191 196
 			/** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */
192 197
 			$actions       = apply_filters( 'theme_action_links', $actions, $theme );
@@ -245,14 +250,16 @@  discard block
 block discarded – undo
245 250
 	public function search_theme( $theme ) {
246 251
 		// Search the features
247 252
 		foreach ( $this->features as $word ) {
248
-			if ( ! in_array( $word, $theme->get('Tags') ) )
249
-				return false;
253
+			if ( ! in_array( $word, $theme->get('Tags') ) ) {
254
+							return false;
255
+			}
250 256
 		}
251 257
 
252 258
 		// Match all phrases
253 259
 		foreach ( $this->search_terms as $word ) {
254
-			if ( in_array( $word, $theme->get('Tags') ) )
255
-				continue;
260
+			if ( in_array( $word, $theme->get('Tags') ) ) {
261
+							continue;
262
+			}
256 263
 
257 264
 			foreach ( array( 'Name', 'Description', 'Author', 'AuthorURI' ) as $header ) {
258 265
 				// Don't mark up; Do translate.
@@ -261,11 +268,13 @@  discard block
 block discarded – undo
261 268
 				}
262 269
 			}
263 270
 
264
-			if ( false !== stripos( $theme->get_stylesheet(), $word ) )
265
-				continue;
271
+			if ( false !== stripos( $theme->get_stylesheet(), $word ) ) {
272
+							continue;
273
+			}
266 274
 
267
-			if ( false !== stripos( $theme->get_template(), $word ) )
268
-				continue;
275
+			if ( false !== stripos( $theme->get_template(), $word ) ) {
276
+							continue;
277
+			}
269 278
 
270 279
 			return false;
271 280
 		}
@@ -291,8 +300,9 @@  discard block
 block discarded – undo
291 300
 			'total_pages' => ! empty( $this->_pagination_args['total_pages'] ) ? $this->_pagination_args['total_pages'] : 1,
292 301
 		);
293 302
 
294
-		if ( is_array( $extra_args ) )
295
-			$args = array_merge( $args, $extra_args );
303
+		if ( is_array( $extra_args ) ) {
304
+					$args = array_merge( $args, $extra_args );
305
+		}
296 306
 
297 307
 		printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", wp_json_encode( $args ) );
298 308
 		parent::_js_vars();
Please login to merge, or discard this patch.
Spacing   +79 added lines, -79 removed lines patch added patch discarded remove patch
@@ -30,11 +30,11 @@  discard block
 block discarded – undo
30 30
 	 *
31 31
 	 * @param array $args An associative array of arguments.
32 32
 	 */
33
-	public function __construct( $args = array() ) {
34
-		parent::__construct( array(
33
+	public function __construct($args = array()) {
34
+		parent::__construct(array(
35 35
 			'ajax' => true,
36
-			'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
37
-		) );
36
+			'screen' => isset($args['screen']) ? $args['screen'] : null,
37
+		));
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,86 +43,86 @@  discard block
 block discarded – undo
43 43
 	 */
44 44
 	public function ajax_user_can() {
45 45
 		// Do not check edit_theme_options here. Ajax calls for available themes require switch_themes.
46
-		return current_user_can( 'switch_themes' );
46
+		return current_user_can('switch_themes');
47 47
 	}
48 48
 
49 49
 	/**
50 50
 	 * @access public
51 51
 	 */
52 52
 	public function prepare_items() {
53
-		$themes = wp_get_themes( array( 'allowed' => true ) );
53
+		$themes = wp_get_themes(array('allowed' => true));
54 54
 
55
-		if ( ! empty( $_REQUEST['s'] ) )
56
-			$this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) );
55
+		if ( ! empty($_REQUEST['s']))
56
+			$this->search_terms = array_unique(array_filter(array_map('trim', explode(',', strtolower(wp_unslash($_REQUEST['s']))))));
57 57
 
58
-		if ( ! empty( $_REQUEST['features'] ) )
58
+		if ( ! empty($_REQUEST['features']))
59 59
 			$this->features = $_REQUEST['features'];
60 60
 
61
-		if ( $this->search_terms || $this->features ) {
62
-			foreach ( $themes as $key => $theme ) {
63
-				if ( ! $this->search_theme( $theme ) )
64
-					unset( $themes[ $key ] );
61
+		if ($this->search_terms || $this->features) {
62
+			foreach ($themes as $key => $theme) {
63
+				if ( ! $this->search_theme($theme))
64
+					unset($themes[$key]);
65 65
 			}
66 66
 		}
67 67
 
68
-		unset( $themes[ get_option( 'stylesheet' ) ] );
69
-		WP_Theme::sort_by_name( $themes );
68
+		unset($themes[get_option('stylesheet')]);
69
+		WP_Theme::sort_by_name($themes);
70 70
 
71 71
 		$per_page = 36;
72 72
 		$page = $this->get_pagenum();
73 73
 
74
-		$start = ( $page - 1 ) * $per_page;
74
+		$start = ($page - 1) * $per_page;
75 75
 
76
-		$this->items = array_slice( $themes, $start, $per_page, true );
76
+		$this->items = array_slice($themes, $start, $per_page, true);
77 77
 
78
-		$this->set_pagination_args( array(
79
-			'total_items' => count( $themes ),
78
+		$this->set_pagination_args(array(
79
+			'total_items' => count($themes),
80 80
 			'per_page' => $per_page,
81 81
 			'infinite_scroll' => true,
82
-		) );
82
+		));
83 83
 	}
84 84
 
85 85
 	/**
86 86
 	 * @access public
87 87
 	 */
88 88
 	public function no_items() {
89
-		if ( $this->search_terms || $this->features ) {
90
-			_e( 'No items found.' );
89
+		if ($this->search_terms || $this->features) {
90
+			_e('No items found.');
91 91
 			return;
92 92
 		}
93 93
 
94 94
 		$blog_id = get_current_blog_id();
95
-		if ( is_multisite() ) {
96
-			if ( current_user_can( 'install_themes' ) && current_user_can( 'manage_network_themes' ) ) {
97
-				printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> or <a href="%2$s">install</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ), network_admin_url( 'theme-install.php' ) );
95
+		if (is_multisite()) {
96
+			if (current_user_can('install_themes') && current_user_can('manage_network_themes')) {
97
+				printf(__('You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> or <a href="%2$s">install</a> more themes.'), network_admin_url('site-themes.php?id='.$blog_id), network_admin_url('theme-install.php'));
98 98
 
99 99
 				return;
100
-			} elseif ( current_user_can( 'manage_network_themes' ) ) {
101
-				printf( __( 'You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> more themes.' ), network_admin_url( 'site-themes.php?id=' . $blog_id ) );
100
+			} elseif (current_user_can('manage_network_themes')) {
101
+				printf(__('You only have one theme enabled for this site right now. Visit the Network Admin to <a href="%1$s">enable</a> more themes.'), network_admin_url('site-themes.php?id='.$blog_id));
102 102
 
103 103
 				return;
104 104
 			}
105 105
 			// Else, fallthrough. install_themes doesn't help if you can't enable it.
106 106
 		} else {
107
-			if ( current_user_can( 'install_themes' ) ) {
108
-				printf( __( 'You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress Theme Directory at any time: just click on the <a href="%s">Install Themes</a> tab above.' ), admin_url( 'theme-install.php' ) );
107
+			if (current_user_can('install_themes')) {
108
+				printf(__('You only have one theme installed right now. Live a little! You can choose from over 1,000 free themes in the WordPress Theme Directory at any time: just click on the <a href="%s">Install Themes</a> tab above.'), admin_url('theme-install.php'));
109 109
 
110 110
 				return;
111 111
 			}
112 112
 		}
113 113
 		// Fallthrough.
114
-		printf( __( 'Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.' ), get_site_option( 'site_name' ) );
114
+		printf(__('Only the current theme is available to you. Contact the %s administrator for information about accessing additional themes.'), get_site_option('site_name'));
115 115
 	}
116 116
 
117 117
 	/**
118 118
 	 * @param string $which
119 119
 	 */
120
-	public function tablenav( $which = 'top' ) {
121
-		if ( $this->get_pagination_arg( 'total_pages' ) <= 1 )
120
+	public function tablenav($which = 'top') {
121
+		if ($this->get_pagination_arg('total_pages') <= 1)
122 122
 			return;
123 123
 		?>
124 124
 		<div class="tablenav themes <?php echo $which; ?>">
125
-			<?php $this->pagination( $which ); ?>
125
+			<?php $this->pagination($which); ?>
126 126
 			<span class="spinner"></span>
127 127
 			<br class="clear" />
128 128
 		</div>
@@ -133,15 +133,15 @@  discard block
 block discarded – undo
133 133
 	 * @access public
134 134
 	 */
135 135
 	public function display() {
136
-		wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' );
136
+		wp_nonce_field("fetch-list-".get_class($this), '_ajax_fetch_list_nonce');
137 137
 ?>
138
-		<?php $this->tablenav( 'top' ); ?>
138
+		<?php $this->tablenav('top'); ?>
139 139
 
140 140
 		<div id="availablethemes">
141 141
 			<?php $this->display_rows_or_placeholder(); ?>
142 142
 		</div>
143 143
 
144
-		<?php $this->tablenav( 'bottom' ); ?>
144
+		<?php $this->tablenav('bottom'); ?>
145 145
 <?php
146 146
 	}
147 147
 
@@ -157,7 +157,7 @@  discard block
 block discarded – undo
157 157
 	 * @access public
158 158
 	 */
159 159
 	public function display_rows_or_placeholder() {
160
-		if ( $this->has_items() ) {
160
+		if ($this->has_items()) {
161 161
 			$this->display_rows();
162 162
 		} else {
163 163
 			echo '<div class="no-items">';
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 	public function display_rows() {
173 173
 		$themes = $this->items;
174 174
 
175
-		foreach ( $themes as $theme ):
175
+		foreach ($themes as $theme):
176 176
 			?><div class="available-theme"><?php
177 177
 
178 178
 			$template   = $theme->get_template();
@@ -181,64 +181,64 @@  discard block
 block discarded – undo
181 181
 			$version    = $theme->display('Version');
182 182
 			$author     = $theme->display('Author');
183 183
 
184
-			$activate_link = wp_nonce_url( "themes.php?action=activate&amp;template=" . urlencode( $template ) . "&amp;stylesheet=" . urlencode( $stylesheet ), 'switch-theme_' . $stylesheet );
184
+			$activate_link = wp_nonce_url("themes.php?action=activate&amp;template=".urlencode($template)."&amp;stylesheet=".urlencode($stylesheet), 'switch-theme_'.$stylesheet);
185 185
 
186 186
 			$actions = array();
187
-			$actions['activate'] = '<a href="' . $activate_link . '" class="activatelink" title="'
188
-				. esc_attr( sprintf( __( 'Activate &#8220;%s&#8221;' ), $title ) ) . '">' . __( 'Activate' ) . '</a>';
187
+			$actions['activate'] = '<a href="'.$activate_link.'" class="activatelink" title="'
188
+				. esc_attr(sprintf(__('Activate &#8220;%s&#8221;'), $title)).'">'.__('Activate').'</a>';
189 189
 
190
-			if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {
191
-				$actions['preview'] .= '<a href="' . wp_customize_url( $stylesheet ) . '" class="load-customize hide-if-no-customize">'
192
-					. __( 'Live Preview' ) . '</a>';
190
+			if (current_user_can('edit_theme_options') && current_user_can('customize')) {
191
+				$actions['preview'] .= '<a href="'.wp_customize_url($stylesheet).'" class="load-customize hide-if-no-customize">'
192
+					. __('Live Preview').'</a>';
193 193
 			}
194 194
 
195
-			if ( ! is_multisite() && current_user_can( 'delete_themes' ) )
196
-				$actions['delete'] = '<a class="submitdelete deletion" href="' . wp_nonce_url( 'themes.php?action=delete&amp;stylesheet=' . urlencode( $stylesheet ), 'delete-theme_' . $stylesheet )
197
-					. '" onclick="' . "return confirm( '" . esc_js( sprintf( __( "You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete." ), $title ) )
198
-					. "' );" . '">' . __( 'Delete' ) . '</a>';
195
+			if ( ! is_multisite() && current_user_can('delete_themes'))
196
+				$actions['delete'] = '<a class="submitdelete deletion" href="'.wp_nonce_url('themes.php?action=delete&amp;stylesheet='.urlencode($stylesheet), 'delete-theme_'.$stylesheet)
197
+					. '" onclick="'."return confirm( '".esc_js(sprintf(__("You are about to delete this theme '%s'\n  'Cancel' to stop, 'OK' to delete."), $title))
198
+					. "' );".'">'.__('Delete').'</a>';
199 199
 
200 200
 			/** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */
201
-			$actions       = apply_filters( 'theme_action_links', $actions, $theme );
201
+			$actions       = apply_filters('theme_action_links', $actions, $theme);
202 202
 
203 203
 			/** This filter is documented in wp-admin/includes/class-wp-ms-themes-list-table.php */
204
-			$actions       = apply_filters( "theme_action_links_$stylesheet", $actions, $theme );
205
-			$delete_action = isset( $actions['delete'] ) ? '<div class="delete-theme">' . $actions['delete'] . '</div>' : '';
206
-			unset( $actions['delete'] );
204
+			$actions       = apply_filters("theme_action_links_$stylesheet", $actions, $theme);
205
+			$delete_action = isset($actions['delete']) ? '<div class="delete-theme">'.$actions['delete'].'</div>' : '';
206
+			unset($actions['delete']);
207 207
 
208 208
 			?>
209 209
 
210 210
 			<span class="screenshot hide-if-customize">
211
-				<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
212
-					<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
211
+				<?php if ($screenshot = $theme->get_screenshot()) : ?>
212
+					<img src="<?php echo esc_url($screenshot); ?>" alt="" />
213 213
 				<?php endif; ?>
214 214
 			</span>
215
-			<a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize">
216
-				<?php if ( $screenshot = $theme->get_screenshot() ) : ?>
217
-					<img src="<?php echo esc_url( $screenshot ); ?>" alt="" />
215
+			<a href="<?php echo wp_customize_url($stylesheet); ?>" class="screenshot load-customize hide-if-no-customize">
216
+				<?php if ($screenshot = $theme->get_screenshot()) : ?>
217
+					<img src="<?php echo esc_url($screenshot); ?>" alt="" />
218 218
 				<?php endif; ?>
219 219
 			</a>
220 220
 
221 221
 			<h3><?php echo $title; ?></h3>
222
-			<div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div>
222
+			<div class="theme-author"><?php printf(__('By %s'), $author); ?></div>
223 223
 			<div class="action-links">
224 224
 				<ul>
225
-					<?php foreach ( $actions as $action ): ?>
225
+					<?php foreach ($actions as $action): ?>
226 226
 						<li><?php echo $action; ?></li>
227 227
 					<?php endforeach; ?>
228 228
 					<li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e('Details') ?></a></li>
229 229
 				</ul>
230 230
 				<?php echo $delete_action; ?>
231 231
 
232
-				<?php theme_update_available( $theme ); ?>
232
+				<?php theme_update_available($theme); ?>
233 233
 			</div>
234 234
 
235 235
 			<div class="themedetaildiv hide-if-js">
236 236
 				<p><strong><?php _e('Version:'); ?></strong> <?php echo $version; ?></p>
237 237
 				<p><?php echo $theme->display('Description'); ?></p>
238
-				<?php if ( $theme->parent() ) {
239
-					printf( ' <p class="howto">' . __( 'This <a href="%1$s">child theme</a> requires its parent theme, %2$s.' ) . '</p>',
240
-						__( 'https://codex.wordpress.org/Child_Themes' ),
241
-						$theme->parent()->display( 'Name' ) );
238
+				<?php if ($theme->parent()) {
239
+					printf(' <p class="howto">'.__('This <a href="%1$s">child theme</a> requires its parent theme, %2$s.').'</p>',
240
+						__('https://codex.wordpress.org/Child_Themes'),
241
+						$theme->parent()->display('Name'));
242 242
 				} ?>
243 243
 			</div>
244 244
 
@@ -251,29 +251,29 @@  discard block
 block discarded – undo
251 251
 	 * @param WP_Theme $theme
252 252
 	 * @return bool
253 253
 	 */
254
-	public function search_theme( $theme ) {
254
+	public function search_theme($theme) {
255 255
 		// Search the features
256
-		foreach ( $this->features as $word ) {
257
-			if ( ! in_array( $word, $theme->get('Tags') ) )
256
+		foreach ($this->features as $word) {
257
+			if ( ! in_array($word, $theme->get('Tags')))
258 258
 				return false;
259 259
 		}
260 260
 
261 261
 		// Match all phrases
262
-		foreach ( $this->search_terms as $word ) {
263
-			if ( in_array( $word, $theme->get('Tags') ) )
262
+		foreach ($this->search_terms as $word) {
263
+			if (in_array($word, $theme->get('Tags')))
264 264
 				continue;
265 265
 
266
-			foreach ( array( 'Name', 'Description', 'Author', 'AuthorURI' ) as $header ) {
266
+			foreach (array('Name', 'Description', 'Author', 'AuthorURI') as $header) {
267 267
 				// Don't mark up; Do translate.
268
-				if ( false !== stripos( strip_tags( $theme->display( $header, false, true ) ), $word ) ) {
268
+				if (false !== stripos(strip_tags($theme->display($header, false, true)), $word)) {
269 269
 					continue 2;
270 270
 				}
271 271
 			}
272 272
 
273
-			if ( false !== stripos( $theme->get_stylesheet(), $word ) )
273
+			if (false !== stripos($theme->get_stylesheet(), $word))
274 274
 				continue;
275 275
 
276
-			if ( false !== stripos( $theme->get_template(), $word ) )
276
+			if (false !== stripos($theme->get_template(), $word))
277 277
 				continue;
278 278
 
279 279
 			return false;
@@ -290,20 +290,20 @@  discard block
 block discarded – undo
290 290
 	 *
291 291
 	 * @param array $extra_args
292 292
 	 */
293
-	public function _js_vars( $extra_args = array() ) {
294
-		$search_string = isset( $_REQUEST['s'] ) ? esc_attr( wp_unslash( $_REQUEST['s'] ) ) : '';
293
+	public function _js_vars($extra_args = array()) {
294
+		$search_string = isset($_REQUEST['s']) ? esc_attr(wp_unslash($_REQUEST['s'])) : '';
295 295
 
296 296
 		$args = array(
297 297
 			'search' => $search_string,
298 298
 			'features' => $this->features,
299 299
 			'paged' => $this->get_pagenum(),
300
-			'total_pages' => ! empty( $this->_pagination_args['total_pages'] ) ? $this->_pagination_args['total_pages'] : 1,
300
+			'total_pages' => ! empty($this->_pagination_args['total_pages']) ? $this->_pagination_args['total_pages'] : 1,
301 301
 		);
302 302
 
303
-		if ( is_array( $extra_args ) )
304
-			$args = array_merge( $args, $extra_args );
303
+		if (is_array($extra_args))
304
+			$args = array_merge($args, $extra_args);
305 305
 
306
-		printf( "<script type='text/javascript'>var theme_list_args = %s;</script>\n", wp_json_encode( $args ) );
306
+		printf("<script type='text/javascript'>var theme_list_args = %s;</script>\n", wp_json_encode($args));
307 307
 		parent::_js_vars();
308 308
 	}
309 309
 }
Please login to merge, or discard this patch.
src/wp-admin/includes/class-wp-press-this.php 3 patches
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -1039,7 +1039,7 @@
 block discarded – undo
1039 1039
 	 * @since 4.2.0
1040 1040
 	 * @access public
1041 1041
 	 *
1042
- 	 * @param array $data The site's data.
1042
+	 * @param array $data The site's data.
1043 1043
 	 * @return string Discovered canonical URL, or empty
1044 1044
 	 */
1045 1045
 	public function get_canonical_link( $data ) {
Please login to merge, or discard this patch.
Spacing   +405 added lines, -405 removed lines patch added patch discarded remove patch
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 			 *
49 49
 			 * @param bool $redirect Whether to redirect in parent window or not. Default false.
50 50
 			 */
51
-			'redirInParent' => apply_filters( 'press_this_redirect_in_parent', false ),
51
+			'redirInParent' => apply_filters('press_this_redirect_in_parent', false),
52 52
 		);
53 53
 	}
54 54
 
@@ -62,37 +62,37 @@  discard block
 block discarded – undo
62 62
 	 * @param string $content Optional. Current expected markup for Press This. Expects slashed. Default empty.
63 63
 	 * @return string New markup with old image URLs replaced with the local attachment ones if swapped.
64 64
 	 */
65
-	public function side_load_images( $post_id, $content = '' ) {
66
-		$content = wp_unslash( $content );
65
+	public function side_load_images($post_id, $content = '') {
66
+		$content = wp_unslash($content);
67 67
 
68
-		if ( preg_match_all( '/<img [^>]+>/', $content, $matches ) && current_user_can( 'upload_files' ) ) {
69
-			foreach ( (array) $matches[0] as $image ) {
68
+		if (preg_match_all('/<img [^>]+>/', $content, $matches) && current_user_can('upload_files')) {
69
+			foreach ((array) $matches[0] as $image) {
70 70
 				// This is inserted from our JS so HTML attributes should always be in double quotes.
71
-				if ( ! preg_match( '/src="([^"]+)"/', $image, $url_matches ) ) {
71
+				if ( ! preg_match('/src="([^"]+)"/', $image, $url_matches)) {
72 72
 					continue;
73 73
 				}
74 74
 
75 75
 				$image_src = $url_matches[1];
76 76
 
77 77
 				// Don't try to sideload a file without a file extension, leads to WP upload error.
78
-				if ( ! preg_match( '/[^\?]+\.(?:jpe?g|jpe|gif|png)(?:\?|$)/i', $image_src ) ) {
78
+				if ( ! preg_match('/[^\?]+\.(?:jpe?g|jpe|gif|png)(?:\?|$)/i', $image_src)) {
79 79
 					continue;
80 80
 				}
81 81
 
82 82
 				// Sideload image, which gives us a new image src.
83
-				$new_src = media_sideload_image( $image_src, $post_id, null, 'src' );
83
+				$new_src = media_sideload_image($image_src, $post_id, null, 'src');
84 84
 
85
-				if ( ! is_wp_error( $new_src ) ) {
85
+				if ( ! is_wp_error($new_src)) {
86 86
 					// Replace the POSTED content <img> with correct uploaded ones.
87 87
 					// Need to do it in two steps so we don't replace links to the original image if any.
88
-					$new_image = str_replace( $image_src, $new_src, $image );
89
-					$content = str_replace( $image, $new_image, $content );
88
+					$new_image = str_replace($image_src, $new_src, $image);
89
+					$content = str_replace($image, $new_image, $content);
90 90
 				}
91 91
 			}
92 92
 		}
93 93
 
94 94
 		// Expected slashed
95
-		return wp_slash( $content );
95
+		return wp_slash($content);
96 96
 	}
97 97
 
98 98
 	/**
@@ -102,38 +102,38 @@  discard block
 block discarded – undo
102 102
 	 * @access public
103 103
 	 */
104 104
 	public function save_post() {
105
-		if ( empty( $_POST['post_ID'] ) || ! $post_id = (int) $_POST['post_ID'] ) {
106
-			wp_send_json_error( array( 'errorMessage' => __( 'Missing post ID.' ) ) );
105
+		if (empty($_POST['post_ID']) || ! $post_id = (int) $_POST['post_ID']) {
106
+			wp_send_json_error(array('errorMessage' => __('Missing post ID.')));
107 107
 		}
108 108
 
109
-		if ( empty( $_POST['_wpnonce'] ) || ! wp_verify_nonce( $_POST['_wpnonce'], 'update-post_' . $post_id ) ||
110
-			! current_user_can( 'edit_post', $post_id ) ) {
109
+		if (empty($_POST['_wpnonce']) || ! wp_verify_nonce($_POST['_wpnonce'], 'update-post_'.$post_id) ||
110
+			! current_user_can('edit_post', $post_id)) {
111 111
 
112
-			wp_send_json_error( array( 'errorMessage' => __( 'Invalid post.' ) ) );
112
+			wp_send_json_error(array('errorMessage' => __('Invalid post.')));
113 113
 		}
114 114
 
115 115
 		$post_data = array(
116 116
 			'ID'            => $post_id,
117
-			'post_title'    => ( ! empty( $_POST['post_title'] ) ) ? sanitize_text_field( trim( $_POST['post_title'] ) ) : '',
118
-			'post_content'  => ( ! empty( $_POST['post_content'] ) ) ? trim( $_POST['post_content'] ) : '',
117
+			'post_title'    => ( ! empty($_POST['post_title'])) ? sanitize_text_field(trim($_POST['post_title'])) : '',
118
+			'post_content'  => ( ! empty($_POST['post_content'])) ? trim($_POST['post_content']) : '',
119 119
 			'post_type'     => 'post',
120 120
 			'post_status'   => 'draft',
121
-			'post_format'   => ( ! empty( $_POST['post_format'] ) ) ? sanitize_text_field( $_POST['post_format'] ) : '',
121
+			'post_format'   => ( ! empty($_POST['post_format'])) ? sanitize_text_field($_POST['post_format']) : '',
122 122
 		);
123 123
 
124 124
 		// Only accept categories if the user actually can assign
125
-		$category_tax = get_taxonomy( 'category' );
126
-		if ( current_user_can( $category_tax->cap->assign_terms ) ) {
127
-			$post_data['post_category'] = ( ! empty( $_POST['post_category'] ) ) ? $_POST['post_category'] : array();
125
+		$category_tax = get_taxonomy('category');
126
+		if (current_user_can($category_tax->cap->assign_terms)) {
127
+			$post_data['post_category'] = ( ! empty($_POST['post_category'])) ? $_POST['post_category'] : array();
128 128
 		}
129 129
 
130 130
 		// Only accept taxonomies if the user can actually assign
131
-		if ( ! empty( $_POST['tax_input'] ) ) {
131
+		if ( ! empty($_POST['tax_input'])) {
132 132
 			$tax_input = $_POST['tax_input'];
133
-			foreach ( $tax_input as $tax => $_ti ) {
134
-				$tax_object = get_taxonomy( $tax );
135
-				if ( ! $tax_object || ! current_user_can( $tax_object->cap->assign_terms ) ) {
136
-					unset( $tax_input[ $tax ] );
133
+			foreach ($tax_input as $tax => $_ti) {
134
+				$tax_object = get_taxonomy($tax);
135
+				if ( ! $tax_object || ! current_user_can($tax_object->cap->assign_terms)) {
136
+					unset($tax_input[$tax]);
137 137
 				}
138 138
 			}
139 139
 
@@ -141,15 +141,15 @@  discard block
 block discarded – undo
141 141
 		}
142 142
 
143 143
 		// Toggle status to pending if user cannot actually publish
144
-		if ( ! empty( $_POST['post_status'] ) && 'publish' === $_POST['post_status'] ) {
145
-			if ( current_user_can( 'publish_posts' ) ) {
144
+		if ( ! empty($_POST['post_status']) && 'publish' === $_POST['post_status']) {
145
+			if (current_user_can('publish_posts')) {
146 146
 				$post_data['post_status'] = 'publish';
147 147
 			} else {
148 148
 				$post_data['post_status'] = 'pending';
149 149
 			}
150 150
 		}
151 151
 
152
-		$post_data['post_content'] = $this->side_load_images( $post_id, $post_data['post_content'] );
152
+		$post_data['post_content'] = $this->side_load_images($post_id, $post_data['post_content']);
153 153
 
154 154
 		/**
155 155
 		 * Filters the post data of a Press This post before saving/updating.
@@ -160,28 +160,28 @@  discard block
 block discarded – undo
160 160
 		 *
161 161
 		 * @param array $post_data The post data.
162 162
 		 */
163
-		$post_data = apply_filters( 'press_this_save_post', $post_data );
163
+		$post_data = apply_filters('press_this_save_post', $post_data);
164 164
 
165
-		$updated = wp_update_post( $post_data, true );
165
+		$updated = wp_update_post($post_data, true);
166 166
 
167
-		if ( is_wp_error( $updated ) ) {
168
-			wp_send_json_error( array( 'errorMessage' => $updated->get_error_message() ) );
167
+		if (is_wp_error($updated)) {
168
+			wp_send_json_error(array('errorMessage' => $updated->get_error_message()));
169 169
 		} else {
170
-			if ( isset( $post_data['post_format'] ) ) {
171
-				if ( current_theme_supports( 'post-formats', $post_data['post_format'] ) ) {
172
-					set_post_format( $post_id, $post_data['post_format'] );
173
-				} elseif ( $post_data['post_format'] ) {
174
-					set_post_format( $post_id, false );
170
+			if (isset($post_data['post_format'])) {
171
+				if (current_theme_supports('post-formats', $post_data['post_format'])) {
172
+					set_post_format($post_id, $post_data['post_format']);
173
+				} elseif ($post_data['post_format']) {
174
+					set_post_format($post_id, false);
175 175
 				}
176 176
 			}
177 177
 
178 178
 			$forceRedirect = false;
179 179
 
180
-			if ( 'publish' === get_post_status( $post_id ) ) {
181
-				$redirect = get_post_permalink( $post_id );
182
-			} elseif ( isset( $_POST['pt-force-redirect'] ) && $_POST['pt-force-redirect'] === 'true' ) {
180
+			if ('publish' === get_post_status($post_id)) {
181
+				$redirect = get_post_permalink($post_id);
182
+			} elseif (isset($_POST['pt-force-redirect']) && $_POST['pt-force-redirect'] === 'true') {
183 183
 				$forceRedirect = true;
184
-				$redirect = get_edit_post_link( $post_id, 'js' );
184
+				$redirect = get_edit_post_link($post_id, 'js');
185 185
 			} else {
186 186
 				$redirect = false;
187 187
 			}
@@ -196,12 +196,12 @@  discard block
 block discarded – undo
196 196
 			 * @param int    $post_id Post ID.
197 197
 			 * @param string $status  Post status.
198 198
 			 */
199
-			$redirect = apply_filters( 'press_this_save_redirect', $redirect, $post_id, $post_data['post_status'] );
199
+			$redirect = apply_filters('press_this_save_redirect', $redirect, $post_id, $post_data['post_status']);
200 200
 
201
-			if ( $redirect ) {
202
-				wp_send_json_success( array( 'redirect' => $redirect, 'force' => $forceRedirect ) );
201
+			if ($redirect) {
202
+				wp_send_json_success(array('redirect' => $redirect, 'force' => $forceRedirect));
203 203
 			} else {
204
-				wp_send_json_success( array( 'postSaved' => true ) );
204
+				wp_send_json_success(array('postSaved' => true));
205 205
 			}
206 206
 		}
207 207
 	}
@@ -213,57 +213,57 @@  discard block
 block discarded – undo
213 213
 	 * @access public
214 214
 	 */
215 215
 	public function add_category() {
216
-		if ( false === wp_verify_nonce( $_POST['new_cat_nonce'], 'add-category' ) ) {
216
+		if (false === wp_verify_nonce($_POST['new_cat_nonce'], 'add-category')) {
217 217
 			wp_send_json_error();
218 218
 		}
219 219
 
220
-		$taxonomy = get_taxonomy( 'category' );
220
+		$taxonomy = get_taxonomy('category');
221 221
 
222
-		if ( ! current_user_can( $taxonomy->cap->edit_terms ) || empty( $_POST['name'] ) ) {
222
+		if ( ! current_user_can($taxonomy->cap->edit_terms) || empty($_POST['name'])) {
223 223
 			wp_send_json_error();
224 224
 		}
225 225
 
226
-		$parent = isset( $_POST['parent'] ) && (int) $_POST['parent'] > 0 ? (int) $_POST['parent'] : 0;
227
-		$names = explode( ',', $_POST['name'] );
226
+		$parent = isset($_POST['parent']) && (int) $_POST['parent'] > 0 ? (int) $_POST['parent'] : 0;
227
+		$names = explode(',', $_POST['name']);
228 228
 		$added = $data = array();
229 229
 
230
-		foreach ( $names as $cat_name ) {
231
-			$cat_name = trim( $cat_name );
232
-			$cat_nicename = sanitize_title( $cat_name );
230
+		foreach ($names as $cat_name) {
231
+			$cat_name = trim($cat_name);
232
+			$cat_nicename = sanitize_title($cat_name);
233 233
 
234
-			if ( empty( $cat_nicename ) ) {
234
+			if (empty($cat_nicename)) {
235 235
 				continue;
236 236
 			}
237 237
 
238 238
 			// @todo Find a more performant way to check existence, maybe get_term() with a separate parent check.
239
-			if ( term_exists( $cat_name, $taxonomy->name, $parent ) ) {
240
-				if ( count( $names ) === 1 ) {
241
-					wp_send_json_error( array( 'errorMessage' => __( 'This category already exists.' ) ) );
239
+			if (term_exists($cat_name, $taxonomy->name, $parent)) {
240
+				if (count($names) === 1) {
241
+					wp_send_json_error(array('errorMessage' => __('This category already exists.')));
242 242
 				} else {
243 243
 					continue;
244 244
 				}
245 245
 			}
246 246
 
247
-			$cat_id = wp_insert_term( $cat_name, $taxonomy->name, array( 'parent' => $parent ) );
247
+			$cat_id = wp_insert_term($cat_name, $taxonomy->name, array('parent' => $parent));
248 248
 
249
-			if ( is_wp_error( $cat_id ) ) {
249
+			if (is_wp_error($cat_id)) {
250 250
 				continue;
251
-			} elseif ( is_array( $cat_id ) ) {
251
+			} elseif (is_array($cat_id)) {
252 252
 				$cat_id = $cat_id['term_id'];
253 253
 			}
254 254
 
255 255
 			$added[] = $cat_id;
256 256
 		}
257 257
 
258
-		if ( empty( $added ) ) {
259
-			wp_send_json_error( array( 'errorMessage' => __( 'This category cannot be added. Please change the name and try again.' ) ) );
258
+		if (empty($added)) {
259
+			wp_send_json_error(array('errorMessage' => __('This category cannot be added. Please change the name and try again.')));
260 260
 		}
261 261
 
262
-		foreach ( $added as $new_cat_id ) {
263
-			$new_cat = get_category( $new_cat_id );
262
+		foreach ($added as $new_cat_id) {
263
+			$new_cat = get_category($new_cat_id);
264 264
 
265
-			if ( is_wp_error( $new_cat ) ) {
266
-				wp_send_json_error( array( 'errorMessage' => __( 'Error while adding the category. Please try again later.' ) ) );
265
+			if (is_wp_error($new_cat)) {
266
+				wp_send_json_error(array('errorMessage' => __('Error while adding the category. Please try again later.')));
267 267
 			}
268 268
 
269 269
 			$data[] = array(
@@ -272,7 +272,7 @@  discard block
 block discarded – undo
272 272
 				'parent' => $new_cat->parent,
273 273
 			);
274 274
 		}
275
-		wp_send_json_success( $data );
275
+		wp_send_json_success($data);
276 276
 	}
277 277
 
278 278
 	/**
@@ -284,18 +284,18 @@  discard block
 block discarded – undo
284 284
 	 * @param string $url URL to scan.
285 285
 	 * @return string Source's HTML sanitized markup
286 286
 	 */
287
-	public function fetch_source_html( $url ) {
288
-		if ( empty( $url ) ) {
289
-			return new WP_Error( 'invalid-url', __( 'A valid URL was not provided.' ) );
287
+	public function fetch_source_html($url) {
288
+		if (empty($url)) {
289
+			return new WP_Error('invalid-url', __('A valid URL was not provided.'));
290 290
 		}
291 291
 
292
-		$remote_url = wp_safe_remote_get( $url, array(
292
+		$remote_url = wp_safe_remote_get($url, array(
293 293
 			'timeout' => 30,
294 294
 			// Use an explicit user-agent for Press This
295
-			'user-agent' => 'Press This (WordPress/' . get_bloginfo( 'version' ) . '); ' . get_bloginfo( 'url' )
296
-		) );
295
+			'user-agent' => 'Press This (WordPress/'.get_bloginfo('version').'); '.get_bloginfo('url')
296
+		));
297 297
 
298
-		if ( is_wp_error( $remote_url ) ) {
298
+		if (is_wp_error($remote_url)) {
299 299
 			return $remote_url;
300 300
 		}
301 301
 
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 			)
321 321
 		);
322 322
 
323
-		$source_content = wp_remote_retrieve_body( $remote_url );
324
-		$source_content = wp_kses( $source_content, $allowed_elements );
323
+		$source_content = wp_remote_retrieve_body($remote_url);
324
+		$source_content = wp_kses($source_content, $allowed_elements);
325 325
 
326 326
 		return $source_content;
327 327
 	}
@@ -335,10 +335,10 @@  discard block
 block discarded – undo
335 335
 	 * @param array $value Array to limit.
336 336
 	 * @return array Original array if fewer than 50 values, limited array, empty array otherwise.
337 337
 	 */
338
-	private function _limit_array( $value ) {
339
-		if ( is_array( $value ) ) {
340
-			if ( count( $value ) > 50 ) {
341
-				return array_slice( $value, 0, 50 );
338
+	private function _limit_array($value) {
339
+		if (is_array($value)) {
340
+			if (count($value) > 50) {
341
+				return array_slice($value, 0, 50);
342 342
 			}
343 343
 
344 344
 			return $value;
@@ -358,20 +358,20 @@  discard block
 block discarded – undo
358 358
 	 *                         if fewer than 5,000 characters, a truncated version, otherwise an
359 359
 	 *                         empty string.
360 360
 	 */
361
-	private function _limit_string( $value ) {
361
+	private function _limit_string($value) {
362 362
 		$return = '';
363 363
 
364
-		if ( is_numeric( $value ) || is_bool( $value ) ) {
364
+		if (is_numeric($value) || is_bool($value)) {
365 365
 			$return = $value;
366
-		} else if ( is_string( $value ) ) {
367
-			if ( mb_strlen( $value ) > 5000 ) {
368
-				$return = mb_substr( $value, 0, 5000 );
366
+		} else if (is_string($value)) {
367
+			if (mb_strlen($value) > 5000) {
368
+				$return = mb_substr($value, 0, 5000);
369 369
 			} else {
370 370
 				$return = $value;
371 371
 			}
372 372
 
373
-			$return = html_entity_decode( $return, ENT_QUOTES, 'UTF-8' );
374
-			$return = sanitize_text_field( trim( $return ) );
373
+			$return = html_entity_decode($return, ENT_QUOTES, 'UTF-8');
374
+			$return = sanitize_text_field(trim($return));
375 375
 		}
376 376
 
377 377
 		return $return;
@@ -386,32 +386,32 @@  discard block
 block discarded – undo
386 386
 	 * @param string $url URL to check for length and validity.
387 387
 	 * @return string Escaped URL if of valid length (< 2048) and makeup. Empty string otherwise.
388 388
 	 */
389
-	private function _limit_url( $url ) {
390
-		if ( ! is_string( $url ) ) {
389
+	private function _limit_url($url) {
390
+		if ( ! is_string($url)) {
391 391
 			return '';
392 392
 		}
393 393
 
394 394
 		// HTTP 1.1 allows 8000 chars but the "de-facto" standard supported in all current browsers is 2048.
395
-		if ( strlen( $url ) > 2048 ) {
395
+		if (strlen($url) > 2048) {
396 396
 			return ''; // Return empty rather than a truncated/invalid URL
397 397
 		}
398 398
 
399 399
 		// Does not look like a URL.
400
-		if ( ! preg_match( '/^([!#$&-;=?-\[\]_a-z~]|%[0-9a-fA-F]{2})+$/', $url ) ) {
400
+		if ( ! preg_match('/^([!#$&-;=?-\[\]_a-z~]|%[0-9a-fA-F]{2})+$/', $url)) {
401 401
 			return '';
402 402
 		}
403 403
 
404 404
 		// If the URL is root-relative, prepend the protocol and domain name
405
-		if ( $url && $this->domain && preg_match( '%^/[^/]+%', $url ) ) {
406
-			$url = $this->domain . $url;
405
+		if ($url && $this->domain && preg_match('%^/[^/]+%', $url)) {
406
+			$url = $this->domain.$url;
407 407
 		}
408 408
 
409 409
 		// Not absolute or protocol-relative URL.
410
-		if ( ! preg_match( '%^(?:https?:)?//[^/]+%', $url ) ) {
410
+		if ( ! preg_match('%^(?:https?:)?//[^/]+%', $url)) {
411 411
 			return '';
412 412
 		}
413 413
 
414
-		return esc_url_raw( $url, array( 'http', 'https' ) );
414
+		return esc_url_raw($url, array('http', 'https'));
415 415
 	}
416 416
 
417 417
 	/**
@@ -426,34 +426,34 @@  discard block
 block discarded – undo
426 426
 	 * @param string $src Image source URL.
427 427
 	 * @return string If not matched an excluded URL type, the original URL, empty string otherwise.
428 428
 	 */
429
-	private function _limit_img( $src ) {
430
-		$src = $this->_limit_url( $src );
429
+	private function _limit_img($src) {
430
+		$src = $this->_limit_url($src);
431 431
 
432
-		if ( preg_match( '!/ad[sx]?/!i', $src ) ) {
432
+		if (preg_match('!/ad[sx]?/!i', $src)) {
433 433
 			// Ads
434 434
 			return '';
435
-		} else if ( preg_match( '!(/share-?this[^.]+?\.[a-z0-9]{3,4})(\?.*)?$!i', $src ) ) {
435
+		} else if (preg_match('!(/share-?this[^.]+?\.[a-z0-9]{3,4})(\?.*)?$!i', $src)) {
436 436
 			// Share-this type button
437 437
 			return '';
438
-		} else if ( preg_match( '!/(spinner|loading|spacer|blank|rss)\.(gif|jpg|png)!i', $src ) ) {
438
+		} else if (preg_match('!/(spinner|loading|spacer|blank|rss)\.(gif|jpg|png)!i', $src)) {
439 439
 			// Loaders, spinners, spacers
440 440
 			return '';
441
-		} else if ( preg_match( '!/([^./]+[-_])?(spinner|loading|spacer|blank)s?([-_][^./]+)?\.[a-z0-9]{3,4}!i', $src ) ) {
441
+		} else if (preg_match('!/([^./]+[-_])?(spinner|loading|spacer|blank)s?([-_][^./]+)?\.[a-z0-9]{3,4}!i', $src)) {
442 442
 			// Fancy loaders, spinners, spacers
443 443
 			return '';
444
-		} else if ( preg_match( '!([^./]+[-_])?thumb[^.]*\.(gif|jpg|png)$!i', $src ) ) {
444
+		} else if (preg_match('!([^./]+[-_])?thumb[^.]*\.(gif|jpg|png)$!i', $src)) {
445 445
 			// Thumbnails, too small, usually irrelevant to context
446 446
 			return '';
447
-		} else if ( false !== stripos( $src, '/wp-includes/' ) ) {
447
+		} else if (false !== stripos($src, '/wp-includes/')) {
448 448
 			// Classic WordPress interface images
449 449
 			return '';
450
-		} else if ( preg_match( '![^\d]\d{1,2}x\d+\.(gif|jpg|png)$!i', $src ) ) {
450
+		} else if (preg_match('![^\d]\d{1,2}x\d+\.(gif|jpg|png)$!i', $src)) {
451 451
 			// Most often tiny buttons/thumbs (< 100px wide)
452 452
 			return '';
453
-		} else if ( preg_match( '!/pixel\.(mathtag|quantserve)\.com!i', $src ) ) {
453
+		} else if (preg_match('!/pixel\.(mathtag|quantserve)\.com!i', $src)) {
454 454
 			// See mathtag.com and https://www.quantcast.com/how-we-do-it/iab-standard-measurement/how-we-collect-data/
455 455
 			return '';
456
-		} else if ( preg_match( '!/[gb]\.gif(\?.+)?$!i', $src ) ) {
456
+		} else if (preg_match('!/[gb]\.gif(\?.+)?$!i', $src)) {
457 457
 			// WordPress.com stats gif
458 458
 			return '';
459 459
 		}
@@ -473,31 +473,31 @@  discard block
 block discarded – undo
473 473
 	 * @param string $src Embed source URL.
474 474
 	 * @return string If not from a supported provider, an empty string. Otherwise, a reformatted embed URL.
475 475
 	 */
476
-	private function _limit_embed( $src ) {
477
-		$src = $this->_limit_url( $src );
476
+	private function _limit_embed($src) {
477
+		$src = $this->_limit_url($src);
478 478
 
479
-		if ( empty( $src ) )
479
+		if (empty($src))
480 480
 			return '';
481 481
 
482
-		if ( preg_match( '!//(m|www)\.youtube\.com/(embed|v)/([^?]+)\?.+$!i', $src, $src_matches ) ) {
482
+		if (preg_match('!//(m|www)\.youtube\.com/(embed|v)/([^?]+)\?.+$!i', $src, $src_matches)) {
483 483
 			// Embedded Youtube videos (www or mobile)
484
-			$src = 'https://www.youtube.com/watch?v=' . $src_matches[3];
485
-		} else if ( preg_match( '!//player\.vimeo\.com/video/([\d]+)([?/].*)?$!i', $src, $src_matches ) ) {
484
+			$src = 'https://www.youtube.com/watch?v='.$src_matches[3];
485
+		} else if (preg_match('!//player\.vimeo\.com/video/([\d]+)([?/].*)?$!i', $src, $src_matches)) {
486 486
 			// Embedded Vimeo iframe videos
487
-			$src = 'https://vimeo.com/' . (int) $src_matches[1];
488
-		} else if ( preg_match( '!//vimeo\.com/moogaloop\.swf\?clip_id=([\d]+)$!i', $src, $src_matches ) ) {
487
+			$src = 'https://vimeo.com/'.(int) $src_matches[1];
488
+		} else if (preg_match('!//vimeo\.com/moogaloop\.swf\?clip_id=([\d]+)$!i', $src, $src_matches)) {
489 489
 			// Embedded Vimeo Flash videos
490
-			$src = 'https://vimeo.com/' . (int) $src_matches[1];
491
-		} else if ( preg_match( '!//vine\.co/v/([^/]+)/embed!i', $src, $src_matches ) ) {
490
+			$src = 'https://vimeo.com/'.(int) $src_matches[1];
491
+		} else if (preg_match('!//vine\.co/v/([^/]+)/embed!i', $src, $src_matches)) {
492 492
 			// Embedded Vine videos
493
-			$src = 'https://vine.co/v/' . $src_matches[1];
494
-		} else if ( preg_match( '!//(www\.)?dailymotion\.com/embed/video/([^/?]+)([/?].+)?!i', $src, $src_matches ) ) {
493
+			$src = 'https://vine.co/v/'.$src_matches[1];
494
+		} else if (preg_match('!//(www\.)?dailymotion\.com/embed/video/([^/?]+)([/?].+)?!i', $src, $src_matches)) {
495 495
 			// Embedded Daily Motion videos
496
-			$src = 'https://www.dailymotion.com/video/' . $src_matches[2];
496
+			$src = 'https://www.dailymotion.com/video/'.$src_matches[2];
497 497
 		} else {
498 498
 			$oembed = _wp_oembed_get_object();
499 499
 
500
-			if ( ! $oembed->get_provider( $src, array( 'discover' => false ) ) ) {
500
+			if ( ! $oembed->get_provider($src, array('discover' => false))) {
501 501
 				$src = '';
502 502
 			}
503 503
 		}
@@ -516,21 +516,21 @@  discard block
 block discarded – undo
516 516
 	 * @param array  $data       Associative array of source data.
517 517
 	 * @return array Processed data array.
518 518
 	 */
519
-	private function _process_meta_entry( $meta_name, $meta_value, $data ) {
520
-		if ( preg_match( '/:?(title|description|keywords|site_name)$/', $meta_name ) ) {
521
-			$data['_meta'][ $meta_name ] = $meta_value;
519
+	private function _process_meta_entry($meta_name, $meta_value, $data) {
520
+		if (preg_match('/:?(title|description|keywords|site_name)$/', $meta_name)) {
521
+			$data['_meta'][$meta_name] = $meta_value;
522 522
 		} else {
523
-			switch ( $meta_name ) {
523
+			switch ($meta_name) {
524 524
 				case 'og:url':
525 525
 				case 'og:video':
526 526
 				case 'og:video:secure_url':
527
-					$meta_value = $this->_limit_embed( $meta_value );
527
+					$meta_value = $this->_limit_embed($meta_value);
528 528
 
529
-					if ( ! isset( $data['_embeds'] ) ) {
529
+					if ( ! isset($data['_embeds'])) {
530 530
 						$data['_embeds'] = array();
531 531
 					}
532 532
 
533
-					if ( ! empty( $meta_value ) && ! in_array( $meta_value, $data['_embeds'] ) ) {
533
+					if ( ! empty($meta_value) && ! in_array($meta_value, $data['_embeds'])) {
534 534
 						$data['_embeds'][] = $meta_value;
535 535
 					}
536 536
 
@@ -541,13 +541,13 @@  discard block
 block discarded – undo
541 541
 				case 'twitter:image0':
542 542
 				case 'twitter:image:src':
543 543
 				case 'twitter:image':
544
-					$meta_value = $this->_limit_img( $meta_value );
544
+					$meta_value = $this->_limit_img($meta_value);
545 545
 
546
-					if ( ! isset( $data['_images'] ) ) {
546
+					if ( ! isset($data['_images'])) {
547 547
 						$data['_images'] = array();
548 548
 					}
549 549
 
550
-					if ( ! empty( $meta_value ) && ! in_array( $meta_value, $data['_images'] ) ) {
550
+					if ( ! empty($meta_value) && ! in_array($meta_value, $data['_images'])) {
551 551
 						$data['_images'][] = $meta_value;
552 552
 					}
553 553
 
@@ -568,58 +568,58 @@  discard block
 block discarded – undo
568 568
 	 * @param array  $data Optional. Existing data array if you have one. Default empty array.
569 569
 	 * @return array New data array.
570 570
 	 */
571
-	public function source_data_fetch_fallback( $url, $data = array() ) {
572
-		if ( empty( $url ) ) {
571
+	public function source_data_fetch_fallback($url, $data = array()) {
572
+		if (empty($url)) {
573 573
 			return array();
574 574
 		}
575 575
 
576 576
 		// Download source page to tmp file.
577
-		$source_content = $this->fetch_source_html( $url );
578
-		if ( is_wp_error( $source_content ) ) {
579
-			return array( 'errors' => $source_content->get_error_messages() );
577
+		$source_content = $this->fetch_source_html($url);
578
+		if (is_wp_error($source_content)) {
579
+			return array('errors' => $source_content->get_error_messages());
580 580
 		}
581 581
 
582 582
 		// Fetch and gather <meta> data first, so discovered media is offered 1st to user.
583
-		if ( empty( $data['_meta'] ) ) {
583
+		if (empty($data['_meta'])) {
584 584
 			$data['_meta'] = array();
585 585
 		}
586 586
 
587
-		if ( preg_match_all( '/<meta [^>]+>/', $source_content, $matches ) ) {
588
-			$items = $this->_limit_array( $matches[0] );
587
+		if (preg_match_all('/<meta [^>]+>/', $source_content, $matches)) {
588
+			$items = $this->_limit_array($matches[0]);
589 589
 
590
-			foreach ( $items as $value ) {
591
-				if ( preg_match( '/(property|name)="([^"]+)"[^>]+content="([^"]+)"/', $value, $new_matches ) ) {
592
-					$meta_name  = $this->_limit_string( $new_matches[2] );
593
-					$meta_value = $this->_limit_string( $new_matches[3] );
590
+			foreach ($items as $value) {
591
+				if (preg_match('/(property|name)="([^"]+)"[^>]+content="([^"]+)"/', $value, $new_matches)) {
592
+					$meta_name  = $this->_limit_string($new_matches[2]);
593
+					$meta_value = $this->_limit_string($new_matches[3]);
594 594
 
595 595
 					// Sanity check. $key is usually things like 'title', 'description', 'keywords', etc.
596
-					if ( strlen( $meta_name ) > 100 ) {
596
+					if (strlen($meta_name) > 100) {
597 597
 						continue;
598 598
 					}
599 599
 
600
-					$data = $this->_process_meta_entry( $meta_name, $meta_value, $data );
600
+					$data = $this->_process_meta_entry($meta_name, $meta_value, $data);
601 601
 				}
602 602
 			}
603 603
 		}
604 604
 
605 605
 		// Fetch and gather <img> data.
606
-		if ( empty( $data['_images'] ) ) {
606
+		if (empty($data['_images'])) {
607 607
 			$data['_images'] = array();
608 608
 		}
609 609
 
610
-		if ( preg_match_all( '/<img [^>]+>/', $source_content, $matches ) ) {
611
-			$items = $this->_limit_array( $matches[0] );
610
+		if (preg_match_all('/<img [^>]+>/', $source_content, $matches)) {
611
+			$items = $this->_limit_array($matches[0]);
612 612
 
613
-			foreach ( $items as $value ) {
614
-				if ( ( preg_match( '/width=(\'|")(\d+)\\1/i', $value, $new_matches ) && $new_matches[2] < 256 ) ||
615
-					( preg_match( '/height=(\'|")(\d+)\\1/i', $value, $new_matches ) && $new_matches[2] < 128 ) ) {
613
+			foreach ($items as $value) {
614
+				if ((preg_match('/width=(\'|")(\d+)\\1/i', $value, $new_matches) && $new_matches[2] < 256) ||
615
+					(preg_match('/height=(\'|")(\d+)\\1/i', $value, $new_matches) && $new_matches[2] < 128)) {
616 616
 
617 617
 					continue;
618 618
 				}
619 619
 
620
-				if ( preg_match( '/src=(\'|")([^\'"]+)\\1/i', $value, $new_matches ) ) {
621
-					$src = $this->_limit_img( $new_matches[2] );
622
-					if ( ! empty( $src ) && ! in_array( $src, $data['_images'] ) ) {
620
+				if (preg_match('/src=(\'|")([^\'"]+)\\1/i', $value, $new_matches)) {
621
+					$src = $this->_limit_img($new_matches[2]);
622
+					if ( ! empty($src) && ! in_array($src, $data['_images'])) {
623 623
 						$data['_images'][] = $src;
624 624
 					}
625 625
 				}
@@ -627,18 +627,18 @@  discard block
 block discarded – undo
627 627
 		}
628 628
 
629 629
 		// Fetch and gather <iframe> data.
630
-		if ( empty( $data['_embeds'] ) ) {
630
+		if (empty($data['_embeds'])) {
631 631
 			$data['_embeds'] = array();
632 632
 		}
633 633
 
634
-		if ( preg_match_all( '/<iframe [^>]+>/', $source_content, $matches ) ) {
635
-			$items = $this->_limit_array( $matches[0] );
634
+		if (preg_match_all('/<iframe [^>]+>/', $source_content, $matches)) {
635
+			$items = $this->_limit_array($matches[0]);
636 636
 
637
-			foreach ( $items as $value ) {
638
-				if ( preg_match( '/src=(\'|")([^\'"]+)\\1/', $value, $new_matches ) ) {
639
-					$src = $this->_limit_embed( $new_matches[2] );
637
+			foreach ($items as $value) {
638
+				if (preg_match('/src=(\'|")([^\'"]+)\\1/', $value, $new_matches)) {
639
+					$src = $this->_limit_embed($new_matches[2]);
640 640
 
641
-					if ( ! empty( $src ) && ! in_array( $src, $data['_embeds'] ) ) {
641
+					if ( ! empty($src) && ! in_array($src, $data['_embeds'])) {
642 642
 						$data['_embeds'][] = $src;
643 643
 					}
644 644
 				}
@@ -646,20 +646,20 @@  discard block
 block discarded – undo
646 646
 		}
647 647
 
648 648
 		// Fetch and gather <link> data.
649
-		if ( empty( $data['_links'] ) ) {
649
+		if (empty($data['_links'])) {
650 650
 			$data['_links'] = array();
651 651
 		}
652 652
 
653
-		if ( preg_match_all( '/<link [^>]+>/', $source_content, $matches ) ) {
654
-			$items = $this->_limit_array( $matches[0] );
653
+		if (preg_match_all('/<link [^>]+>/', $source_content, $matches)) {
654
+			$items = $this->_limit_array($matches[0]);
655 655
 
656
-			foreach ( $items as $value ) {
657
-				if ( preg_match( '/rel=["\'](canonical|shortlink|icon)["\']/i', $value, $matches_rel ) && preg_match( '/href=[\'"]([^\'" ]+)[\'"]/i', $value, $matches_url ) ) {
656
+			foreach ($items as $value) {
657
+				if (preg_match('/rel=["\'](canonical|shortlink|icon)["\']/i', $value, $matches_rel) && preg_match('/href=[\'"]([^\'" ]+)[\'"]/i', $value, $matches_url)) {
658 658
 					$rel = $matches_rel[1];
659
-					$url = $this->_limit_url( $matches_url[1] );
659
+					$url = $this->_limit_url($matches_url[1]);
660 660
 
661
-					if ( ! empty( $url ) && empty( $data['_links'][ $rel ] ) ) {
662
-						$data['_links'][ $rel ] = $url;
661
+					if ( ! empty($url) && empty($data['_links'][$rel])) {
662
+						$data['_links'][$rel] = $url;
663 663
 					}
664 664
 				}
665 665
 			}
@@ -681,27 +681,27 @@  discard block
 block discarded – undo
681 681
 		$data = array();
682 682
 
683 683
 		// Only instantiate the keys we want. Sanity check and sanitize each one.
684
-		foreach ( array( 'u', 's', 't', 'v' ) as $key ) {
685
-			if ( ! empty( $_POST[ $key ] ) ) {
686
-				$value = wp_unslash( $_POST[ $key ] );
687
-			} else if ( ! empty( $_GET[ $key ] ) ) {
688
-				$value = wp_unslash( $_GET[ $key ] );
684
+		foreach (array('u', 's', 't', 'v') as $key) {
685
+			if ( ! empty($_POST[$key])) {
686
+				$value = wp_unslash($_POST[$key]);
687
+			} else if ( ! empty($_GET[$key])) {
688
+				$value = wp_unslash($_GET[$key]);
689 689
 			} else {
690 690
 				continue;
691 691
 			}
692 692
 
693
-			if ( 'u' === $key ) {
694
-				$value = $this->_limit_url( $value );
693
+			if ('u' === $key) {
694
+				$value = $this->_limit_url($value);
695 695
 
696
-				if ( preg_match( '%^(?:https?:)?//[^/]+%i', $value, $domain_match ) ) {
696
+				if (preg_match('%^(?:https?:)?//[^/]+%i', $value, $domain_match)) {
697 697
 					$this->domain = $domain_match[0];
698 698
 				}
699 699
 			} else {
700
-				$value = $this->_limit_string( $value );
700
+				$value = $this->_limit_string($value);
701 701
 			}
702 702
 
703
-			if ( ! empty( $value ) ) {
704
-				$data[ $key ] = $value;
703
+			if ( ! empty($value)) {
704
+				$data[$key] = $value;
705 705
 			}
706 706
 		}
707 707
 
@@ -712,62 +712,62 @@  discard block
 block discarded – undo
712 712
 		 *
713 713
 		 * @param bool $enable Whether to enable media discovery.
714 714
 		 */
715
-		if ( apply_filters( 'enable_press_this_media_discovery', true ) ) {
715
+		if (apply_filters('enable_press_this_media_discovery', true)) {
716 716
 			/*
717 717
 			 * If no title, _images, _embed, and _meta was passed via $_POST, fetch data from source as fallback,
718 718
 			 * making PT fully backward compatible with the older bookmarklet.
719 719
 			 */
720
-			if ( empty( $_POST ) && ! empty( $data['u'] ) ) {
721
-				if ( isset( $_GET['_wpnonce'] ) && wp_verify_nonce( $_GET['_wpnonce'], 'scan-site' ) ) {
722
-					$data = $this->source_data_fetch_fallback( $data['u'], $data );
720
+			if (empty($_POST) && ! empty($data['u'])) {
721
+				if (isset($_GET['_wpnonce']) && wp_verify_nonce($_GET['_wpnonce'], 'scan-site')) {
722
+					$data = $this->source_data_fetch_fallback($data['u'], $data);
723 723
 				} else {
724 724
 					$data['errors'] = 'missing nonce';
725 725
 				}
726 726
 			} else {
727
-				foreach ( array( '_images', '_embeds' ) as $type ) {
728
-					if ( empty( $_POST[ $type ] ) ) {
727
+				foreach (array('_images', '_embeds') as $type) {
728
+					if (empty($_POST[$type])) {
729 729
 						continue;
730 730
 					}
731 731
 
732
-					$data[ $type ] = array();
733
-					$items = $this->_limit_array( $_POST[ $type ] );
732
+					$data[$type] = array();
733
+					$items = $this->_limit_array($_POST[$type]);
734 734
 
735
-					foreach ( $items as $key => $value ) {
736
-						if ( $type === '_images' ) {
737
-							$value = $this->_limit_img( wp_unslash( $value ) );
735
+					foreach ($items as $key => $value) {
736
+						if ($type === '_images') {
737
+							$value = $this->_limit_img(wp_unslash($value));
738 738
 						} else {
739
-							$value = $this->_limit_embed( wp_unslash( $value ) );
739
+							$value = $this->_limit_embed(wp_unslash($value));
740 740
 						}
741 741
 
742
-						if ( ! empty( $value ) ) {
743
-							$data[ $type ][] = $value;
742
+						if ( ! empty($value)) {
743
+							$data[$type][] = $value;
744 744
 						}
745 745
 					}
746 746
 				}
747 747
 
748
-				foreach ( array( '_meta', '_links' ) as $type ) {
749
-					if ( empty( $_POST[ $type ] ) ) {
748
+				foreach (array('_meta', '_links') as $type) {
749
+					if (empty($_POST[$type])) {
750 750
 						continue;
751 751
 					}
752 752
 
753
-					$data[ $type ] = array();
754
-					$items = $this->_limit_array( $_POST[ $type ] );
753
+					$data[$type] = array();
754
+					$items = $this->_limit_array($_POST[$type]);
755 755
 
756
-					foreach ( $items as $key => $value ) {
756
+					foreach ($items as $key => $value) {
757 757
 						// Sanity check. These are associative arrays, $key is usually things like 'title', 'description', 'keywords', etc.
758
-						if ( empty( $key ) || strlen( $key ) > 100 ) {
758
+						if (empty($key) || strlen($key) > 100) {
759 759
 							continue;
760 760
 						}
761 761
 
762
-						if ( $type === '_meta' ) {
763
-							$value = $this->_limit_string( wp_unslash( $value ) );
762
+						if ($type === '_meta') {
763
+							$value = $this->_limit_string(wp_unslash($value));
764 764
 
765
-							if ( ! empty( $value ) ) {
766
-								$data = $this->_process_meta_entry( $key, $value, $data );
765
+							if ( ! empty($value)) {
766
+								$data = $this->_process_meta_entry($key, $value, $data);
767 767
 							}
768 768
 						} else {
769
-							if ( in_array( $key, array( 'canonical', 'shortlink', 'icon' ), true ) ) {
770
-								$data[ $type ][ $key ] = $this->_limit_url( wp_unslash( $value ) );
769
+							if (in_array($key, array('canonical', 'shortlink', 'icon'), true)) {
770
+								$data[$type][$key] = $this->_limit_url(wp_unslash($value));
771 771
 							}
772 772
 						}
773 773
 					}
@@ -775,11 +775,11 @@  discard block
 block discarded – undo
775 775
 			}
776 776
 
777 777
 			// Support passing a single image src as `i`
778
-			if ( ! empty( $_REQUEST['i'] ) && ( $img_src = $this->_limit_img( wp_unslash( $_REQUEST['i'] ) ) ) ) {
779
-				if ( empty( $data['_images'] ) ) {
780
-					$data['_images'] = array( $img_src );
781
-				} elseif ( ! in_array( $img_src, $data['_images'], true ) ) {
782
-					array_unshift( $data['_images'], $img_src );
778
+			if ( ! empty($_REQUEST['i']) && ($img_src = $this->_limit_img(wp_unslash($_REQUEST['i'])))) {
779
+				if (empty($data['_images'])) {
780
+					$data['_images'] = array($img_src);
781
+				} elseif ( ! in_array($img_src, $data['_images'], true)) {
782
+					array_unshift($data['_images'], $img_src);
783 783
 				}
784 784
 			}
785 785
 		}
@@ -791,7 +791,7 @@  discard block
 block discarded – undo
791 791
 		 *
792 792
 		 * @param array $data Press This Data array.
793 793
 		 */
794
-		return apply_filters( 'press_this_data', $data );
794
+		return apply_filters('press_this_data', $data);
795 795
 	}
796 796
 
797 797
 	/**
@@ -803,17 +803,17 @@  discard block
 block discarded – undo
803 803
 	 * @param string $styles URL to editor stylesheet.
804 804
 	 * @return string Possibly modified stylesheets list.
805 805
 	 */
806
-	public function add_editor_style( $styles ) {
807
-		if ( ! empty( $styles ) ) {
806
+	public function add_editor_style($styles) {
807
+		if ( ! empty($styles)) {
808 808
 			$styles .= ',';
809 809
 		}
810 810
 
811
-		$press_this = admin_url( 'css/press-this-editor.css' );
812
-		if ( is_rtl() ) {
813
-			$press_this = str_replace( '.css', '-rtl.css', $press_this );
811
+		$press_this = admin_url('css/press-this-editor.css');
812
+		if (is_rtl()) {
813
+			$press_this = str_replace('.css', '-rtl.css', $press_this);
814 814
 		}
815 815
 
816
-		return $styles . $press_this;
816
+		return $styles.$press_this;
817 817
 	}
818 818
 
819 819
 	/**
@@ -824,35 +824,35 @@  discard block
 block discarded – undo
824 824
 	 *
825 825
 	 * @param WP_Post $post Post object.
826 826
 	 */
827
-	public function post_formats_html( $post ) {
828
-		if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) {
829
-			$post_formats = get_theme_support( 'post-formats' );
827
+	public function post_formats_html($post) {
828
+		if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
829
+			$post_formats = get_theme_support('post-formats');
830 830
 
831
-			if ( is_array( $post_formats[0] ) ) {
832
-				$post_format = get_post_format( $post->ID );
831
+			if (is_array($post_formats[0])) {
832
+				$post_format = get_post_format($post->ID);
833 833
 
834
-				if ( ! $post_format ) {
834
+				if ( ! $post_format) {
835 835
 					$post_format = '0';
836 836
 				}
837 837
 
838 838
 				// Add in the current one if it isn't there yet, in case the current theme doesn't support it.
839
-				if ( $post_format && ! in_array( $post_format, $post_formats[0] ) ) {
839
+				if ($post_format && ! in_array($post_format, $post_formats[0])) {
840 840
 					$post_formats[0][] = $post_format;
841 841
 				}
842 842
 
843 843
 				?>
844 844
 				<div id="post-formats-select">
845
-				<fieldset><legend class="screen-reader-text"><?php _e( 'Post Formats' ); ?></legend>
846
-					<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked( $post_format, '0' ); ?> />
847
-					<label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string( 'standard' ); ?></label>
845
+				<fieldset><legend class="screen-reader-text"><?php _e('Post Formats'); ?></legend>
846
+					<input type="radio" name="post_format" class="post-format" id="post-format-0" value="0" <?php checked($post_format, '0'); ?> />
847
+					<label for="post-format-0" class="post-format-icon post-format-standard"><?php echo get_post_format_string('standard'); ?></label>
848 848
 					<?php
849 849
 
850
-					foreach ( $post_formats[0] as $format ) {
851
-						$attr_format = esc_attr( $format );
850
+					foreach ($post_formats[0] as $format) {
851
+						$attr_format = esc_attr($format);
852 852
 						?>
853 853
 						<br />
854
-						<input type="radio" name="post_format" class="post-format" id="post-format-<?php echo $attr_format; ?>" value="<?php echo $attr_format; ?>" <?php checked( $post_format, $format ); ?> />
855
-						<label for="post-format-<?php echo $attr_format ?>" class="post-format-icon post-format-<?php echo $attr_format; ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></label>
854
+						<input type="radio" name="post_format" class="post-format" id="post-format-<?php echo $attr_format; ?>" value="<?php echo $attr_format; ?>" <?php checked($post_format, $format); ?> />
855
+						<label for="post-format-<?php echo $attr_format ?>" class="post-format-icon post-format-<?php echo $attr_format; ?>"><?php echo esc_html(get_post_format_string($format)); ?></label>
856 856
 						<?php
857 857
 					 }
858 858
 
@@ -872,51 +872,51 @@  discard block
 block discarded – undo
872 872
 	 *
873 873
 	 * @param WP_Post $post Post object.
874 874
 	 */
875
-	public function categories_html( $post ) {
876
-		$taxonomy = get_taxonomy( 'category' );
875
+	public function categories_html($post) {
876
+		$taxonomy = get_taxonomy('category');
877 877
 
878 878
 		// Bail if user cannot assign terms
879
-		if ( ! current_user_can( $taxonomy->cap->assign_terms ) ) {
879
+		if ( ! current_user_can($taxonomy->cap->assign_terms)) {
880 880
 			return;
881 881
 		}
882 882
 
883 883
 		// Only show "add" if user can edit terms
884
-		if ( current_user_can( $taxonomy->cap->edit_terms ) ) {
884
+		if (current_user_can($taxonomy->cap->edit_terms)) {
885 885
 			?>
886 886
 			<button type="button" class="add-cat-toggle button-link" aria-expanded="false">
887
-				<span class="dashicons dashicons-plus"></span><span class="screen-reader-text"><?php _e( 'Toggle add category' ); ?></span>
887
+				<span class="dashicons dashicons-plus"></span><span class="screen-reader-text"><?php _e('Toggle add category'); ?></span>
888 888
 			</button>
889 889
 			<div class="add-category is-hidden">
890 890
 				<label class="screen-reader-text" for="new-category"><?php echo $taxonomy->labels->add_new_item; ?></label>
891
-				<input type="text" id="new-category" class="add-category-name" placeholder="<?php echo esc_attr( $taxonomy->labels->new_item_name ); ?>" value="" aria-required="true">
891
+				<input type="text" id="new-category" class="add-category-name" placeholder="<?php echo esc_attr($taxonomy->labels->new_item_name); ?>" value="" aria-required="true">
892 892
 				<label class="screen-reader-text" for="new-category-parent"><?php echo $taxonomy->labels->parent_item_colon; ?></label>
893 893
 				<div class="postform-wrapper">
894 894
 					<?php
895
-					wp_dropdown_categories( array(
895
+					wp_dropdown_categories(array(
896 896
 						'taxonomy'         => 'category',
897 897
 						'hide_empty'       => 0,
898 898
 						'name'             => 'new-category-parent',
899 899
 						'orderby'          => 'name',
900 900
 						'hierarchical'     => 1,
901
-						'show_option_none' => '&mdash; ' . $taxonomy->labels->parent_item . ' &mdash;'
902
-					) );
901
+						'show_option_none' => '&mdash; '.$taxonomy->labels->parent_item.' &mdash;'
902
+					));
903 903
 					?>
904 904
 				</div>
905
-				<button type="button" class="add-cat-submit"><?php _e( 'Add' ); ?></button>
905
+				<button type="button" class="add-cat-submit"><?php _e('Add'); ?></button>
906 906
 			</div>
907 907
 			<?php
908 908
 
909 909
 		}
910 910
 		?>
911 911
 		<div class="categories-search-wrapper">
912
-			<input id="categories-search" type="search" class="categories-search" placeholder="<?php esc_attr_e( 'Search categories by name' ) ?>">
912
+			<input id="categories-search" type="search" class="categories-search" placeholder="<?php esc_attr_e('Search categories by name') ?>">
913 913
 			<label for="categories-search">
914
-				<span class="dashicons dashicons-search"></span><span class="screen-reader-text"><?php _e( 'Search categories' ); ?></span>
914
+				<span class="dashicons dashicons-search"></span><span class="screen-reader-text"><?php _e('Search categories'); ?></span>
915 915
 			</label>
916 916
 		</div>
917
-		<div aria-label="<?php esc_attr_e( 'Categories' ); ?>">
917
+		<div aria-label="<?php esc_attr_e('Categories'); ?>">
918 918
 			<ul class="categories-select">
919
-				<?php wp_terms_checklist( $post->ID, array( 'taxonomy' => 'category', 'list_only' => true ) ); ?>
919
+				<?php wp_terms_checklist($post->ID, array('taxonomy' => 'category', 'list_only' => true)); ?>
920 920
 			</ul>
921 921
 		</div>
922 922
 		<?php
@@ -930,12 +930,12 @@  discard block
 block discarded – undo
930 930
 	 *
931 931
 	 * @param WP_Post $post Post object.
932 932
 	 */
933
-	public function tags_html( $post ) {
934
-		$taxonomy              = get_taxonomy( 'post_tag' );
935
-		$user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms );
936
-		$esc_tags              = get_terms_to_edit( $post->ID, 'post_tag' );
933
+	public function tags_html($post) {
934
+		$taxonomy              = get_taxonomy('post_tag');
935
+		$user_can_assign_terms = current_user_can($taxonomy->cap->assign_terms);
936
+		$esc_tags              = get_terms_to_edit($post->ID, 'post_tag');
937 937
 
938
-		if ( ! $esc_tags || is_wp_error( $esc_tags ) ) {
938
+		if ( ! $esc_tags || is_wp_error($esc_tags)) {
939 939
 			$esc_tags = '';
940 940
 		}
941 941
 
@@ -945,13 +945,13 @@  discard block
 block discarded – undo
945 945
 			<input type="hidden" name="tax_input[post_tag]" class="the-tags" value="<?php echo $esc_tags; // escaped in get_terms_to_edit() ?>">
946 946
 		 	<?php
947 947
 
948
-			if ( $user_can_assign_terms ) {
948
+			if ($user_can_assign_terms) {
949 949
 				?>
950 950
 				<div class="ajaxtag hide-if-no-js">
951
-					<label class="screen-reader-text" for="new-tag-post_tag"><?php _e( 'Tags' ); ?></label>
951
+					<label class="screen-reader-text" for="new-tag-post_tag"><?php _e('Tags'); ?></label>
952 952
 					<p>
953 953
 						<input type="text" id="new-tag-post_tag" name="newtag[post_tag]" class="newtag form-input-tip" size="16" autocomplete="off" value="" aria-describedby="new-tag-desc" />
954
-						<button type="button" class="tagadd"><?php _e( 'Add' ); ?></button>
954
+						<button type="button" class="tagadd"><?php _e('Add'); ?></button>
955 955
 					</p>
956 956
 				</div>
957 957
 				<p class="howto" id="new-tag-desc">
@@ -966,7 +966,7 @@  discard block
 block discarded – undo
966 966
 		</div>
967 967
 		<?php
968 968
 
969
-		if ( $user_can_assign_terms ) {
969
+		if ($user_can_assign_terms) {
970 970
 			?>
971 971
 			<button type="button" class="button-link tagcloud-link" id="link-post_tag" aria-expanded="false"><?php echo $taxonomy->labels->choose_from_most_used; ?></button>
972 972
 			<?php
@@ -982,19 +982,19 @@  discard block
 block discarded – undo
982 982
 	 * @param array $data The site's data.
983 983
 	 * @return array Embeds selected to be available.
984 984
 	 */
985
-	public function get_embeds( $data ) {
985
+	public function get_embeds($data) {
986 986
 		$selected_embeds = array();
987 987
 
988 988
 		// Make sure to add the Pressed page if it's a valid oembed itself
989
-		if ( ! empty ( $data['u'] ) && $this->_limit_embed( $data['u'] ) ) {
989
+		if ( ! empty ($data['u']) && $this->_limit_embed($data['u'])) {
990 990
 			$data['_embeds'][] = $data['u'];
991 991
 		}
992 992
 
993
-		if ( ! empty( $data['_embeds'] ) ) {
994
-			foreach ( $data['_embeds'] as $src ) {
995
-				$prot_relative_src = preg_replace( '/^https?:/', '', $src );
993
+		if ( ! empty($data['_embeds'])) {
994
+			foreach ($data['_embeds'] as $src) {
995
+				$prot_relative_src = preg_replace('/^https?:/', '', $src);
996 996
 
997
-				if ( in_array( $prot_relative_src, $this->embeds ) ) {
997
+				if (in_array($prot_relative_src, $this->embeds)) {
998 998
 					continue;
999 999
 				}
1000 1000
 
@@ -1015,19 +1015,19 @@  discard block
 block discarded – undo
1015 1015
 	 * @param array $data The site's data.
1016 1016
 	 * @return array
1017 1017
 	 */
1018
-	public function get_images( $data ) {
1018
+	public function get_images($data) {
1019 1019
 		$selected_images = array();
1020 1020
 
1021
-		if ( ! empty( $data['_images'] ) ) {
1022
-			foreach ( $data['_images'] as $src ) {
1023
-				if ( false !== strpos( $src, 'gravatar.com' ) ) {
1024
-					$src = preg_replace( '%http://[\d]+\.gravatar\.com/%', 'https://secure.gravatar.com/', $src );
1021
+		if ( ! empty($data['_images'])) {
1022
+			foreach ($data['_images'] as $src) {
1023
+				if (false !== strpos($src, 'gravatar.com')) {
1024
+					$src = preg_replace('%http://[\d]+\.gravatar\.com/%', 'https://secure.gravatar.com/', $src);
1025 1025
 				}
1026 1026
 
1027
-				$prot_relative_src = preg_replace( '/^https?:/', '', $src );
1027
+				$prot_relative_src = preg_replace('/^https?:/', '', $src);
1028 1028
 
1029
-				if ( in_array( $prot_relative_src, $this->images ) ||
1030
-					( false !== strpos( $src, 'avatar' ) && count( $this->images ) > 15 ) ) {
1029
+				if (in_array($prot_relative_src, $this->images) ||
1030
+					(false !== strpos($src, 'avatar') && count($this->images) > 15)) {
1031 1031
 					// Skip: already selected or some type of avatar and we've already gathered more than 15 images.
1032 1032
 					continue;
1033 1033
 				}
@@ -1049,22 +1049,22 @@  discard block
 block discarded – undo
1049 1049
  	 * @param array $data The site's data.
1050 1050
 	 * @return string Discovered canonical URL, or empty
1051 1051
 	 */
1052
-	public function get_canonical_link( $data ) {
1052
+	public function get_canonical_link($data) {
1053 1053
 		$link = '';
1054 1054
 
1055
-		if ( ! empty( $data['_links']['canonical'] ) ) {
1055
+		if ( ! empty($data['_links']['canonical'])) {
1056 1056
 			$link = $data['_links']['canonical'];
1057
-		} elseif ( ! empty( $data['u'] ) ) {
1057
+		} elseif ( ! empty($data['u'])) {
1058 1058
 			$link = $data['u'];
1059
-		} elseif ( ! empty( $data['_meta'] ) ) {
1060
-			if ( ! empty( $data['_meta']['twitter:url'] ) ) {
1059
+		} elseif ( ! empty($data['_meta'])) {
1060
+			if ( ! empty($data['_meta']['twitter:url'])) {
1061 1061
 				$link = $data['_meta']['twitter:url'];
1062
-			} else if ( ! empty( $data['_meta']['og:url'] ) ) {
1062
+			} else if ( ! empty($data['_meta']['og:url'])) {
1063 1063
 				$link = $data['_meta']['og:url'];
1064 1064
 			}
1065 1065
 		}
1066 1066
 
1067
-		if ( empty( $link ) && ! empty( $data['_links']['shortlink'] ) ) {
1067
+		if (empty($link) && ! empty($data['_links']['shortlink'])) {
1068 1068
 			$link = $data['_links']['shortlink'];
1069 1069
 		}
1070 1070
 
@@ -1080,13 +1080,13 @@  discard block
 block discarded – undo
1080 1080
 	 * @param array $data The site's data.
1081 1081
 	 * @return string Discovered site name, or empty
1082 1082
 	 */
1083
-	public function get_source_site_name( $data ) {
1083
+	public function get_source_site_name($data) {
1084 1084
 		$name = '';
1085 1085
 
1086
-		if ( ! empty( $data['_meta'] ) ) {
1087
-			if ( ! empty( $data['_meta']['og:site_name'] ) ) {
1086
+		if ( ! empty($data['_meta'])) {
1087
+			if ( ! empty($data['_meta']['og:site_name'])) {
1088 1088
 				$name = $data['_meta']['og:site_name'];
1089
-			} else if ( ! empty( $data['_meta']['application-name'] ) ) {
1089
+			} else if ( ! empty($data['_meta']['application-name'])) {
1090 1090
 				$name = $data['_meta']['application-name'];
1091 1091
 			}
1092 1092
 		}
@@ -1103,17 +1103,17 @@  discard block
 block discarded – undo
1103 1103
 	 * @param array $data The site's data.
1104 1104
 	 * @return string Discovered page title, or empty
1105 1105
 	 */
1106
-	public function get_suggested_title( $data ) {
1106
+	public function get_suggested_title($data) {
1107 1107
 		$title = '';
1108 1108
 
1109
-		if ( ! empty( $data['t'] ) ) {
1109
+		if ( ! empty($data['t'])) {
1110 1110
 			$title = $data['t'];
1111
-		} elseif ( ! empty( $data['_meta'] ) ) {
1112
-			if ( ! empty( $data['_meta']['twitter:title'] ) ) {
1111
+		} elseif ( ! empty($data['_meta'])) {
1112
+			if ( ! empty($data['_meta']['twitter:title'])) {
1113 1113
 				$title = $data['_meta']['twitter:title'];
1114
-			} else if ( ! empty( $data['_meta']['og:title'] ) ) {
1114
+			} else if ( ! empty($data['_meta']['og:title'])) {
1115 1115
 				$title = $data['_meta']['og:title'];
1116
-			} else if ( ! empty( $data['_meta']['title'] ) ) {
1116
+			} else if ( ! empty($data['_meta']['title'])) {
1117 1117
 				$title = $data['_meta']['title'];
1118 1118
 			}
1119 1119
 		}
@@ -1132,38 +1132,38 @@  discard block
 block discarded – undo
1132 1132
 	 * @param array $data The site's data.
1133 1133
 	 * @return string Discovered content, or empty
1134 1134
 	 */
1135
-	public function get_suggested_content( $data ) {
1135
+	public function get_suggested_content($data) {
1136 1136
 		$content = $text = '';
1137 1137
 
1138
-		if ( ! empty( $data['s'] ) ) {
1138
+		if ( ! empty($data['s'])) {
1139 1139
 			$text = $data['s'];
1140
-		} else if ( ! empty( $data['_meta'] ) ) {
1141
-			if ( ! empty( $data['_meta']['twitter:description'] ) ) {
1140
+		} else if ( ! empty($data['_meta'])) {
1141
+			if ( ! empty($data['_meta']['twitter:description'])) {
1142 1142
 				$text = $data['_meta']['twitter:description'];
1143
-			} else if ( ! empty( $data['_meta']['og:description'] ) ) {
1143
+			} else if ( ! empty($data['_meta']['og:description'])) {
1144 1144
 				$text = $data['_meta']['og:description'];
1145
-			} else if ( ! empty( $data['_meta']['description'] ) ) {
1145
+			} else if ( ! empty($data['_meta']['description'])) {
1146 1146
 				$text = $data['_meta']['description'];
1147 1147
 			}
1148 1148
 
1149 1149
 			// If there is an ellipsis at the end, the description is very likely auto-generated. Better to ignore it.
1150
-			if ( $text && substr( $text, -3 ) === '...' ) {
1150
+			if ($text && substr($text, -3) === '...') {
1151 1151
 				$text = '';
1152 1152
 			}
1153 1153
 		}
1154 1154
 
1155
-		$default_html = array( 'quote' => '', 'link' => '', 'embed' => '' );
1155
+		$default_html = array('quote' => '', 'link' => '', 'embed' => '');
1156 1156
 
1157
-		if ( ! empty( $data['u'] ) && $this->_limit_embed( $data['u'] ) ) {
1158
-			$default_html['embed'] = '<p>[embed]' . $data['u'] . '[/embed]</p>';
1157
+		if ( ! empty($data['u']) && $this->_limit_embed($data['u'])) {
1158
+			$default_html['embed'] = '<p>[embed]'.$data['u'].'[/embed]</p>';
1159 1159
 
1160
-			if ( ! empty( $data['s'] ) ) {
1160
+			if ( ! empty($data['s'])) {
1161 1161
 				// If the user has selected some text, do quote it.
1162 1162
 				$default_html['quote'] = '<blockquote>%1$s</blockquote>';
1163 1163
 			}
1164 1164
 		} else {
1165 1165
 			$default_html['quote'] = '<blockquote>%1$s</blockquote>';
1166
-			$default_html['link'] = '<p>' . _x( 'Source:', 'Used in Press This to indicate where the content comes from.' ) .
1166
+			$default_html['link'] = '<p>'._x('Source:', 'Used in Press This to indicate where the content comes from.').
1167 1167
 				' <em><a href="%1$s">%2$s</a></em></p>';
1168 1168
 		}
1169 1169
 
@@ -1180,28 +1180,28 @@  discard block
 block discarded – undo
1180 1180
 		 *                                - 'embed' which contains an [embed] shortcode when the source page offers embeddable content.
1181 1181
 		 * @param array $data         Associative array containing the data from the source page.
1182 1182
 		 */
1183
-		$default_html = apply_filters( 'press_this_suggested_html', $default_html, $data );
1183
+		$default_html = apply_filters('press_this_suggested_html', $default_html, $data);
1184 1184
 
1185
-		if ( ! empty( $default_html['embed'] ) ) {
1185
+		if ( ! empty($default_html['embed'])) {
1186 1186
 			$content .= $default_html['embed'];
1187 1187
 		}
1188 1188
 
1189 1189
 		// Wrap suggested content in the specified HTML.
1190
-		if ( ! empty( $default_html['quote'] ) && $text ) {
1191
-			$content .= sprintf( $default_html['quote'], $text );
1190
+		if ( ! empty($default_html['quote']) && $text) {
1191
+			$content .= sprintf($default_html['quote'], $text);
1192 1192
 		}
1193 1193
 
1194 1194
 		// Add source attribution if there is one available.
1195
-		if ( ! empty( $default_html['link'] ) ) {
1196
-			$title = $this->get_suggested_title( $data );
1197
-			$url = $this->get_canonical_link( $data );
1195
+		if ( ! empty($default_html['link'])) {
1196
+			$title = $this->get_suggested_title($data);
1197
+			$url = $this->get_canonical_link($data);
1198 1198
 
1199
-			if ( ! $title ) {
1200
-				$title = $this->get_source_site_name( $data );
1199
+			if ( ! $title) {
1200
+				$title = $this->get_source_site_name($data);
1201 1201
 			}
1202 1202
 
1203
-			if ( $url && $title ) {
1204
-				$content .= sprintf( $default_html['link'], $url, $title );
1203
+			if ($url && $title) {
1204
+				$content .= sprintf($default_html['link'], $url, $title);
1205 1205
 			}
1206 1206
 		}
1207 1207
 
@@ -1220,46 +1220,46 @@  discard block
 block discarded – undo
1220 1220
 	public function html() {
1221 1221
 		global $wp_locale;
1222 1222
 
1223
-		$wp_version = get_bloginfo( 'version' );
1223
+		$wp_version = get_bloginfo('version');
1224 1224
 
1225 1225
 		// Get data, new (POST) and old (GET).
1226 1226
 		$data = $this->merge_or_fetch_data();
1227 1227
 
1228
-		$post_title = $this->get_suggested_title( $data );
1228
+		$post_title = $this->get_suggested_title($data);
1229 1229
 
1230
-		$post_content = $this->get_suggested_content( $data );
1230
+		$post_content = $this->get_suggested_content($data);
1231 1231
 
1232 1232
 		// Get site settings array/data.
1233 1233
 		$site_settings = $this->site_settings();
1234 1234
 
1235 1235
 		// Pass the images and embeds
1236
-		$images = $this->get_images( $data );
1237
-		$embeds = $this->get_embeds( $data );
1236
+		$images = $this->get_images($data);
1237
+		$embeds = $this->get_embeds($data);
1238 1238
 
1239 1239
 		$site_data = array(
1240
-			'v' => ! empty( $data['v'] ) ? $data['v'] : '',
1241
-			'u' => ! empty( $data['u'] ) ? $data['u'] : '',
1242
-			'hasData' => ! empty( $data ) && ! isset( $data['errors'] ),
1240
+			'v' => ! empty($data['v']) ? $data['v'] : '',
1241
+			'u' => ! empty($data['u']) ? $data['u'] : '',
1242
+			'hasData' => ! empty($data) && ! isset($data['errors']),
1243 1243
 		);
1244 1244
 
1245
-		if ( ! empty( $images ) ) {
1245
+		if ( ! empty($images)) {
1246 1246
 			$site_data['_images'] = $images;
1247 1247
 		}
1248 1248
 
1249
-		if ( ! empty( $embeds ) ) {
1249
+		if ( ! empty($embeds)) {
1250 1250
 			$site_data['_embeds'] = $embeds;
1251 1251
 		}
1252 1252
 
1253 1253
 		// Add press-this-editor.css and remove theme's editor-style.css, if any.
1254 1254
 		remove_editor_styles();
1255 1255
 
1256
-		add_filter( 'mce_css', array( $this, 'add_editor_style' ) );
1256
+		add_filter('mce_css', array($this, 'add_editor_style'));
1257 1257
 
1258
-		if ( ! empty( $GLOBALS['is_IE'] ) ) {
1259
-			@header( 'X-UA-Compatible: IE=edge' );
1258
+		if ( ! empty($GLOBALS['is_IE'])) {
1259
+			@header('X-UA-Compatible: IE=edge');
1260 1260
 		}
1261 1261
 
1262
-		@header( 'Content-Type: ' . get_option( 'html_type' ) . '; charset=' . get_option( 'blog_charset' ) );
1262
+		@header('Content-Type: '.get_option('html_type').'; charset='.get_option('blog_charset'));
1263 1263
 
1264 1264
 ?>
1265 1265
 <!DOCTYPE html>
@@ -1267,22 +1267,22 @@  discard block
 block discarded – undo
1267 1267
 <!--[if IE 8]>         <html class="lt-ie9" <?php language_attributes(); ?>> <![endif]-->
1268 1268
 <!--[if gt IE 8]><!--> <html <?php language_attributes(); ?>> <!--<![endif]-->
1269 1269
 <head>
1270
-	<meta http-equiv="Content-Type" content="<?php echo esc_attr( get_bloginfo( 'html_type' ) ); ?>; charset=<?php echo esc_attr( get_option( 'blog_charset' ) ); ?>" />
1270
+	<meta http-equiv="Content-Type" content="<?php echo esc_attr(get_bloginfo('html_type')); ?>; charset=<?php echo esc_attr(get_option('blog_charset')); ?>" />
1271 1271
 	<meta name="viewport" content="width=device-width">
1272
-	<title><?php esc_html_e( 'Press This!' ) ?></title>
1272
+	<title><?php esc_html_e('Press This!') ?></title>
1273 1273
 
1274 1274
 	<script>
1275
-		window.wpPressThisData   = <?php echo wp_json_encode( $site_data ); ?>;
1276
-		window.wpPressThisConfig = <?php echo wp_json_encode( $site_settings ); ?>;
1275
+		window.wpPressThisData   = <?php echo wp_json_encode($site_data); ?>;
1276
+		window.wpPressThisConfig = <?php echo wp_json_encode($site_settings); ?>;
1277 1277
 	</script>
1278 1278
 
1279 1279
 	<script type="text/javascript">
1280
-		var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>',
1280
+		var ajaxurl = '<?php echo esc_js(admin_url('admin-ajax.php', 'relative')); ?>',
1281 1281
 			pagenow = 'press-this',
1282 1282
 			typenow = 'post',
1283 1283
 			adminpage = 'press-this-php',
1284
-			thousandsSeparator = '<?php echo addslashes( $wp_locale->number_format['thousands_sep'] ); ?>',
1285
-			decimalPoint = '<?php echo addslashes( $wp_locale->number_format['decimal_point'] ); ?>',
1284
+			thousandsSeparator = '<?php echo addslashes($wp_locale->number_format['thousands_sep']); ?>',
1285
+			decimalPoint = '<?php echo addslashes($wp_locale->number_format['decimal_point']); ?>',
1286 1286
 			isRtl = <?php echo (int) is_rtl(); ?>;
1287 1287
 	</script>
1288 1288
 
@@ -1291,89 +1291,89 @@  discard block
 block discarded – undo
1291 1291
 		 * $post->ID is needed for the embed shortcode so we can show oEmbed previews in the editor.
1292 1292
 		 * Maybe find a way without it.
1293 1293
 		 */
1294
-		$post = get_default_post_to_edit( 'post', true );
1294
+		$post = get_default_post_to_edit('post', true);
1295 1295
 		$post_ID = (int) $post->ID;
1296 1296
 
1297
-		wp_enqueue_media( array( 'post' => $post_ID ) );
1298
-		wp_enqueue_style( 'press-this' );
1299
-		wp_enqueue_script( 'press-this' );
1300
-		wp_enqueue_script( 'json2' );
1301
-		wp_enqueue_script( 'editor' );
1297
+		wp_enqueue_media(array('post' => $post_ID));
1298
+		wp_enqueue_style('press-this');
1299
+		wp_enqueue_script('press-this');
1300
+		wp_enqueue_script('json2');
1301
+		wp_enqueue_script('editor');
1302 1302
 
1303
-		$categories_tax   = get_taxonomy( 'category' );
1304
-		$show_categories  = current_user_can( $categories_tax->cap->assign_terms ) || current_user_can( $categories_tax->cap->edit_terms );
1303
+		$categories_tax   = get_taxonomy('category');
1304
+		$show_categories  = current_user_can($categories_tax->cap->assign_terms) || current_user_can($categories_tax->cap->edit_terms);
1305 1305
 
1306
-		$tag_tax          = get_taxonomy( 'post_tag' );
1307
-		$show_tags        = current_user_can( $tag_tax->cap->assign_terms );
1306
+		$tag_tax          = get_taxonomy('post_tag');
1307
+		$show_tags        = current_user_can($tag_tax->cap->assign_terms);
1308 1308
 
1309 1309
 		$supports_formats = false;
1310 1310
 		$post_format      = 0;
1311 1311
 
1312
-		if ( current_theme_supports( 'post-formats' ) && post_type_supports( $post->post_type, 'post-formats' ) ) {
1312
+		if (current_theme_supports('post-formats') && post_type_supports($post->post_type, 'post-formats')) {
1313 1313
 			$supports_formats = true;
1314 1314
 
1315
-			if ( ! ( $post_format = get_post_format( $post_ID ) ) ) {
1315
+			if ( ! ($post_format = get_post_format($post_ID))) {
1316 1316
 				$post_format = 0;
1317 1317
 			}
1318 1318
 		}
1319 1319
 
1320 1320
 		/** This action is documented in wp-admin/admin-header.php */
1321
-		do_action( 'admin_enqueue_scripts', 'press-this.php' );
1321
+		do_action('admin_enqueue_scripts', 'press-this.php');
1322 1322
 
1323 1323
 		/** This action is documented in wp-admin/admin-header.php */
1324
-		do_action( 'admin_print_styles-press-this.php' );
1324
+		do_action('admin_print_styles-press-this.php');
1325 1325
 
1326 1326
 		/** This action is documented in wp-admin/admin-header.php */
1327
-		do_action( 'admin_print_styles' );
1327
+		do_action('admin_print_styles');
1328 1328
 
1329 1329
 		/** This action is documented in wp-admin/admin-header.php */
1330
-		do_action( 'admin_print_scripts-press-this.php' );
1330
+		do_action('admin_print_scripts-press-this.php');
1331 1331
 
1332 1332
 		/** This action is documented in wp-admin/admin-header.php */
1333
-		do_action( 'admin_print_scripts' );
1333
+		do_action('admin_print_scripts');
1334 1334
 
1335 1335
 		/** This action is documented in wp-admin/admin-header.php */
1336
-		do_action( 'admin_head-press-this.php' );
1336
+		do_action('admin_head-press-this.php');
1337 1337
 
1338 1338
 		/** This action is documented in wp-admin/admin-header.php */
1339
-		do_action( 'admin_head' );
1339
+		do_action('admin_head');
1340 1340
 	?>
1341 1341
 </head>
1342 1342
 <?php
1343 1343
 
1344 1344
 	$admin_body_class  = 'press-this';
1345
-	$admin_body_class .= ( is_rtl() ) ? ' rtl' : '';
1346
-	$admin_body_class .= ' branch-' . str_replace( array( '.', ',' ), '-', floatval( $wp_version ) );
1347
-	$admin_body_class .= ' version-' . str_replace( '.', '-', preg_replace( '/^([.0-9]+).*/', '$1', $wp_version ) );
1348
-	$admin_body_class .= ' admin-color-' . sanitize_html_class( get_user_option( 'admin_color' ), 'fresh' );
1349
-	$admin_body_class .= ' locale-' . sanitize_html_class( strtolower( str_replace( '_', '-', get_user_locale() ) ) );
1345
+	$admin_body_class .= (is_rtl()) ? ' rtl' : '';
1346
+	$admin_body_class .= ' branch-'.str_replace(array('.', ','), '-', floatval($wp_version));
1347
+	$admin_body_class .= ' version-'.str_replace('.', '-', preg_replace('/^([.0-9]+).*/', '$1', $wp_version));
1348
+	$admin_body_class .= ' admin-color-'.sanitize_html_class(get_user_option('admin_color'), 'fresh');
1349
+	$admin_body_class .= ' locale-'.sanitize_html_class(strtolower(str_replace('_', '-', get_user_locale())));
1350 1350
 
1351 1351
 	/** This filter is documented in wp-admin/admin-header.php */
1352
-	$admin_body_classes = apply_filters( 'admin_body_class', '' );
1352
+	$admin_body_classes = apply_filters('admin_body_class', '');
1353 1353
 
1354 1354
 ?>
1355
-<body class="wp-admin wp-core-ui <?php echo $admin_body_classes . ' ' . $admin_body_class; ?>">
1355
+<body class="wp-admin wp-core-ui <?php echo $admin_body_classes.' '.$admin_body_class; ?>">
1356 1356
 	<div id="adminbar" class="adminbar">
1357 1357
 		<h1 id="current-site" class="current-site">
1358
-			<a class="current-site-link" href="<?php echo esc_url( home_url( '/' ) ); ?>" target="_blank" rel="home">
1358
+			<a class="current-site-link" href="<?php echo esc_url(home_url('/')); ?>" target="_blank" rel="home">
1359 1359
 				<span class="dashicons dashicons-wordpress"></span>
1360
-				<span class="current-site-name"><?php bloginfo( 'name' ); ?></span>
1360
+				<span class="current-site-name"><?php bloginfo('name'); ?></span>
1361 1361
 			</a>
1362 1362
 		</h1>
1363 1363
 		<button type="button" class="options button-link closed">
1364 1364
 			<span class="dashicons dashicons-tag on-closed"></span>
1365
-			<span class="screen-reader-text on-closed"><?php _e( 'Show post options' ); ?></span>
1366
-			<span aria-hidden="true" class="on-open"><?php _e( 'Done' ); ?></span>
1367
-			<span class="screen-reader-text on-open"><?php _e( 'Hide post options' ); ?></span>
1365
+			<span class="screen-reader-text on-closed"><?php _e('Show post options'); ?></span>
1366
+			<span aria-hidden="true" class="on-open"><?php _e('Done'); ?></span>
1367
+			<span class="screen-reader-text on-open"><?php _e('Hide post options'); ?></span>
1368 1368
 		</button>
1369 1369
 	</div>
1370 1370
 
1371 1371
 	<div id="scanbar" class="scan">
1372 1372
 		<form method="GET">
1373
-			<label for="url-scan" class="screen-reader-text"><?php _e( 'Scan site for content' ); ?></label>
1374
-			<input type="url" name="u" id="url-scan" class="scan-url" value="<?php echo esc_attr( $site_data['u'] ) ?>" placeholder="<?php esc_attr_e( 'Enter a URL to scan' ) ?>" />
1375
-			<input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e( 'Scan' ) ?>" />
1376
-			<?php wp_nonce_field( 'scan-site' ); ?>
1373
+			<label for="url-scan" class="screen-reader-text"><?php _e('Scan site for content'); ?></label>
1374
+			<input type="url" name="u" id="url-scan" class="scan-url" value="<?php echo esc_attr($site_data['u']) ?>" placeholder="<?php esc_attr_e('Enter a URL to scan') ?>" />
1375
+			<input type="submit" name="url-scan-submit" id="url-scan-submit" class="scan-submit" value="<?php esc_attr_e('Scan') ?>" />
1376
+			<?php wp_nonce_field('scan-site'); ?>
1377 1377
 		</form>
1378 1378
 	</div>
1379 1379
 
@@ -1386,8 +1386,8 @@  discard block
 block discarded – undo
1386 1386
 		<input type="hidden" name="pt-force-redirect" id="pt-force-redirect" value="" />
1387 1387
 		<?php
1388 1388
 
1389
-		wp_nonce_field( 'update-post_' . $post_ID, '_wpnonce', false );
1390
-		wp_nonce_field( 'add-category', '_ajax_nonce-add-category', false );
1389
+		wp_nonce_field('update-post_'.$post_ID, '_wpnonce', false);
1390
+		wp_nonce_field('add-category', '_ajax_nonce-add-category', false);
1391 1391
 
1392 1392
 		?>
1393 1393
 
@@ -1396,10 +1396,10 @@  discard block
 block discarded – undo
1396 1396
 			<div class="alerts" role="alert" aria-live="assertive" aria-relevant="all" aria-atomic="true">
1397 1397
 				<?php
1398 1398
 
1399
-				if ( isset( $data['v'] ) && $this->version > $data['v'] ) {
1399
+				if (isset($data['v']) && $this->version > $data['v']) {
1400 1400
 					?>
1401 1401
 					<p class="alert is-notice">
1402
-						<?php printf( __( 'You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!' ), admin_url( 'tools.php' ) ); ?>
1402
+						<?php printf(__('You should upgrade <a href="%s" target="_blank">your bookmarklet</a> to the latest version!'), admin_url('tools.php')); ?>
1403 1403
 					</p>
1404 1404
 					<?php
1405 1405
 				}
@@ -1408,18 +1408,18 @@  discard block
 block discarded – undo
1408 1408
 			</div>
1409 1409
 
1410 1410
 			<div id="app-container" class="editor">
1411
-				<span id="title-container-label" class="post-title-placeholder" aria-hidden="true"><?php _e( 'Post title' ); ?></span>
1412
-				<h2 id="title-container" class="post-title" contenteditable="true" spellcheck="true" aria-label="<?php esc_attr_e( 'Post title' ); ?>" tabindex="0"><?php echo esc_html( $post_title ); ?></h2>
1411
+				<span id="title-container-label" class="post-title-placeholder" aria-hidden="true"><?php _e('Post title'); ?></span>
1412
+				<h2 id="title-container" class="post-title" contenteditable="true" spellcheck="true" aria-label="<?php esc_attr_e('Post title'); ?>" tabindex="0"><?php echo esc_html($post_title); ?></h2>
1413 1413
 
1414 1414
 				<div class="media-list-container">
1415 1415
 					<div class="media-list-inner-container">
1416
-						<h2 class="screen-reader-text"><?php _e( 'Suggested media' ); ?></h2>
1416
+						<h2 class="screen-reader-text"><?php _e('Suggested media'); ?></h2>
1417 1417
 						<ul class="media-list"></ul>
1418 1418
 					</div>
1419 1419
 				</div>
1420 1420
 
1421 1421
 				<?php
1422
-				wp_editor( $post_content, 'pressthis', array(
1422
+				wp_editor($post_content, 'pressthis', array(
1423 1423
 					'drag_drop_upload' => true,
1424 1424
 					'editor_height'    => 600,
1425 1425
 					'media_buttons'    => false,
@@ -1439,7 +1439,7 @@  discard block
 block discarded – undo
1439 1439
 					'quicktags' => array(
1440 1440
 						'buttons' => 'strong,em,link,block,del,ins,img,ul,ol,li,code,more',
1441 1441
 					),
1442
-				) );
1442
+				));
1443 1443
 
1444 1444
 				?>
1445 1445
 			</div>
@@ -1449,62 +1449,62 @@  discard block
 block discarded – undo
1449 1449
 		<div class="options-panel is-off-screen is-hidden" tabindex="-1">
1450 1450
 			<div class="post-options">
1451 1451
 
1452
-				<?php if ( $supports_formats ) : ?>
1452
+				<?php if ($supports_formats) : ?>
1453 1453
 					<button type="button" class="post-option">
1454 1454
 						<span class="dashicons dashicons-admin-post"></span>
1455
-						<span class="post-option-title"><?php _ex( 'Format', 'post format' ); ?></span>
1456
-						<span class="post-option-contents" id="post-option-post-format"><?php echo esc_html( get_post_format_string( $post_format ) ); ?></span>
1455
+						<span class="post-option-title"><?php _ex('Format', 'post format'); ?></span>
1456
+						<span class="post-option-contents" id="post-option-post-format"><?php echo esc_html(get_post_format_string($post_format)); ?></span>
1457 1457
 						<span class="dashicons post-option-forward"></span>
1458 1458
 					</button>
1459 1459
 				<?php endif; ?>
1460 1460
 
1461
-				<?php if ( $show_categories ) : ?>
1461
+				<?php if ($show_categories) : ?>
1462 1462
 					<button type="button" class="post-option">
1463 1463
 						<span class="dashicons dashicons-category"></span>
1464
-						<span class="post-option-title"><?php _e( 'Categories' ); ?></span>
1464
+						<span class="post-option-title"><?php _e('Categories'); ?></span>
1465 1465
 						<span class="dashicons post-option-forward"></span>
1466 1466
 					</button>
1467 1467
 				<?php endif; ?>
1468 1468
 
1469
-				<?php if ( $show_tags ) : ?>
1469
+				<?php if ($show_tags) : ?>
1470 1470
 					<button type="button" class="post-option">
1471 1471
 						<span class="dashicons dashicons-tag"></span>
1472
-						<span class="post-option-title"><?php _e( 'Tags' ); ?></span>
1472
+						<span class="post-option-title"><?php _e('Tags'); ?></span>
1473 1473
 						<span class="dashicons post-option-forward"></span>
1474 1474
 					</button>
1475 1475
 				<?php endif; ?>
1476 1476
 			</div>
1477 1477
 
1478
-			<?php if ( $supports_formats ) : ?>
1478
+			<?php if ($supports_formats) : ?>
1479 1479
 				<div class="setting-modal is-off-screen is-hidden">
1480 1480
 					<button type="button" class="modal-close">
1481 1481
 						<span class="dashicons post-option-back"></span>
1482
-						<span class="setting-title" aria-hidden="true"><?php _ex( 'Format', 'post format' ); ?></span>
1483
-						<span class="screen-reader-text"><?php _e( 'Back to post options' ) ?></span>
1482
+						<span class="setting-title" aria-hidden="true"><?php _ex('Format', 'post format'); ?></span>
1483
+						<span class="screen-reader-text"><?php _e('Back to post options') ?></span>
1484 1484
 					</button>
1485
-					<?php $this->post_formats_html( $post ); ?>
1485
+					<?php $this->post_formats_html($post); ?>
1486 1486
 				</div>
1487 1487
 			<?php endif; ?>
1488 1488
 
1489
-			<?php if ( $show_categories ) : ?>
1489
+			<?php if ($show_categories) : ?>
1490 1490
 				<div class="setting-modal is-off-screen is-hidden">
1491 1491
 					<button type="button" class="modal-close">
1492 1492
 						<span class="dashicons post-option-back"></span>
1493
-						<span class="setting-title" aria-hidden="true"><?php _e( 'Categories' ); ?></span>
1494
-						<span class="screen-reader-text"><?php _e( 'Back to post options' ) ?></span>
1493
+						<span class="setting-title" aria-hidden="true"><?php _e('Categories'); ?></span>
1494
+						<span class="screen-reader-text"><?php _e('Back to post options') ?></span>
1495 1495
 					</button>
1496
-					<?php $this->categories_html( $post ); ?>
1496
+					<?php $this->categories_html($post); ?>
1497 1497
 				</div>
1498 1498
 			<?php endif; ?>
1499 1499
 
1500
-			<?php if ( $show_tags ) : ?>
1500
+			<?php if ($show_tags) : ?>
1501 1501
 				<div class="setting-modal tags is-off-screen is-hidden">
1502 1502
 					<button type="button" class="modal-close">
1503 1503
 						<span class="dashicons post-option-back"></span>
1504
-						<span class="setting-title" aria-hidden="true"><?php _e( 'Tags' ); ?></span>
1505
-						<span class="screen-reader-text"><?php _e( 'Back to post options' ) ?></span>
1504
+						<span class="setting-title" aria-hidden="true"><?php _e('Tags'); ?></span>
1505
+						<span class="screen-reader-text"><?php _e('Back to post options') ?></span>
1506 1506
 					</button>
1507
-					<?php $this->tags_html( $post ); ?>
1507
+					<?php $this->tags_html($post); ?>
1508 1508
 				</div>
1509 1509
 			<?php endif; ?>
1510 1510
 		</div><!-- .options-panel -->
@@ -1514,7 +1514,7 @@  discard block
 block discarded – undo
1514 1514
 		<div class="pressthis-media-buttons">
1515 1515
 			<button type="button" class="insert-media" data-editor="pressthis">
1516 1516
 				<span class="dashicons dashicons-admin-media"></span>
1517
-				<span class="screen-reader-text"><?php _e( 'Add Media' ); ?></span>
1517
+				<span class="screen-reader-text"><?php _e('Add Media'); ?></span>
1518 1518
 			</button>
1519 1519
 		</div>
1520 1520
 		<div class="post-actions">
@@ -1522,17 +1522,17 @@  discard block
 block discarded – undo
1522 1522
 			<div class="split-button">
1523 1523
 				<div class="split-button-head">
1524 1524
 					<button type="button" class="publish-button split-button-primary" aria-live="polite">
1525
-						<span class="publish"><?php echo ( current_user_can( 'publish_posts' ) ) ? __( 'Publish' ) : __( 'Submit for Review' ); ?></span>
1526
-						<span class="saving-draft"><?php _e( 'Saving&hellip;' ); ?></span>
1525
+						<span class="publish"><?php echo (current_user_can('publish_posts')) ? __('Publish') : __('Submit for Review'); ?></span>
1526
+						<span class="saving-draft"><?php _e('Saving&hellip;'); ?></span>
1527 1527
 					</button><button type="button" class="split-button-toggle" aria-haspopup="true" aria-expanded="false">
1528 1528
 						<i class="dashicons dashicons-arrow-down-alt2"></i>
1529 1529
 						<span class="screen-reader-text"><?php _e('More actions'); ?></span>
1530 1530
 					</button>
1531 1531
 				</div>
1532 1532
 				<ul class="split-button-body">
1533
-					<li><button type="button" class="button-link draft-button split-button-option"><?php _e( 'Save Draft' ); ?></button></li>
1534
-					<li><button type="button" class="button-link standard-editor-button split-button-option"><?php _e( 'Standard Editor' ); ?></button></li>
1535
-					<li><button type="button" class="button-link preview-button split-button-option"><?php _e( 'Preview' ); ?></button></li>
1533
+					<li><button type="button" class="button-link draft-button split-button-option"><?php _e('Save Draft'); ?></button></li>
1534
+					<li><button type="button" class="button-link standard-editor-button split-button-option"><?php _e('Standard Editor'); ?></button></li>
1535
+					<li><button type="button" class="button-link preview-button split-button-option"><?php _e('Preview'); ?></button></li>
1536 1536
 				</ul>
1537 1537
 			</div>
1538 1538
 		</div>
@@ -1541,16 +1541,16 @@  discard block
 block discarded – undo
1541 1541
 
1542 1542
 	<?php
1543 1543
 	/** This action is documented in wp-admin/admin-footer.php */
1544
-	do_action( 'admin_footer' );
1544
+	do_action('admin_footer');
1545 1545
 
1546 1546
 	/** This action is documented in wp-admin/admin-footer.php */
1547
-	do_action( 'admin_print_footer_scripts-press-this.php' );
1547
+	do_action('admin_print_footer_scripts-press-this.php');
1548 1548
 
1549 1549
 	/** This action is documented in wp-admin/admin-footer.php */
1550
-	do_action( 'admin_print_footer_scripts' );
1550
+	do_action('admin_print_footer_scripts');
1551 1551
 
1552 1552
 	/** This action is documented in wp-admin/admin-footer.php */
1553
-	do_action( 'admin_footer-press-this.php' );
1553
+	do_action('admin_footer-press-this.php');
1554 1554
 	?>
1555 1555
 </body>
1556 1556
 </html>
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -476,8 +476,9 @@
 block discarded – undo
476 476
 	private function _limit_embed( $src ) {
477 477
 		$src = $this->_limit_url( $src );
478 478
 
479
-		if ( empty( $src ) )
480
-			return '';
479
+		if ( empty( $src ) ) {
480
+					return '';
481
+		}
481 482
 
482 483
 		if ( preg_match( '!//(m|www)\.youtube\.com/(embed|v)/([^?]+)\?.+$!i', $src, $src_matches ) ) {
483 484
 			// Embedded Youtube videos (www or mobile)
Please login to merge, or discard this patch.