Completed
Push — master ( cde0c6...d99bf9 )
by Stephen
15:46
created
src/wp-admin/admin-functions.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
  * @subpackage Administration
10 10
  */
11 11
 
12
-_deprecated_file( basename(__FILE__), '2.5.0', 'wp-admin/includes/admin.php' );
12
+_deprecated_file(basename(__FILE__), '2.5.0', 'wp-admin/includes/admin.php');
13 13
 
14 14
 /** WordPress Administration API: Includes all Administration functions. */
15
-require_once(ABSPATH . 'wp-admin/includes/admin.php');
15
+require_once(ABSPATH.'wp-admin/includes/admin.php');
Please login to merge, or discard this patch.
src/wp-admin/upload.php 2 patches
Braces   +32 added lines, -21 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
12
-if ( !current_user_can('upload_files') )
12
+if ( !current_user_can('upload_files') ) {
13 13
 	wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
14
+}
14 15
 
15 16
 $mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
16 17
 $modes = array( 'grid', 'list' );
@@ -114,8 +115,9 @@  discard block
 block discarded – undo
114 115
 
115 116
 	$location = 'upload.php';
116 117
 	if ( $referer = wp_get_referer() ) {
117
-		if ( false !== strpos( $referer, 'upload.php' ) )
118
-			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
118
+		if ( false !== strpos( $referer, 'upload.php' ) ) {
119
+					$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
120
+		}
119 121
 	}
120 122
 
121 123
 	switch ( $doaction ) {
@@ -128,38 +130,47 @@  discard block
 block discarded – undo
128 130
 			break;
129 131
 
130 132
 		case 'trash':
131
-			if ( !isset( $post_ids ) )
132
-				break;
133
+			if ( !isset( $post_ids ) ) {
134
+							break;
135
+			}
133 136
 			foreach ( (array) $post_ids as $post_id ) {
134
-				if ( !current_user_can( 'delete_post', $post_id ) )
135
-					wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
137
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
138
+									wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
139
+				}
136 140
 
137
-				if ( !wp_trash_post( $post_id ) )
138
-					wp_die( __( 'Error in moving to Trash.' ) );
141
+				if ( !wp_trash_post( $post_id ) ) {
142
+									wp_die( __( 'Error in moving to Trash.' ) );
143
+				}
139 144
 			}
140 145
 			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
141 146
 			break;
142 147
 		case 'untrash':
143
-			if ( !isset( $post_ids ) )
144
-				break;
148
+			if ( !isset( $post_ids ) ) {
149
+							break;
150
+			}
145 151
 			foreach ( (array) $post_ids as $post_id ) {
146
-				if ( !current_user_can( 'delete_post', $post_id ) )
147
-					wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
152
+				if ( !current_user_can( 'delete_post', $post_id ) ) {
153
+									wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
154
+				}
148 155
 
149
-				if ( !wp_untrash_post( $post_id ) )
150
-					wp_die( __( 'Error in restoring from Trash.' ) );
156
+				if ( !wp_untrash_post( $post_id ) ) {
157
+									wp_die( __( 'Error in restoring from Trash.' ) );
158
+				}
151 159
 			}
152 160
 			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
153 161
 			break;
154 162
 		case 'delete':
155
-			if ( !isset( $post_ids ) )
156
-				break;
163
+			if ( !isset( $post_ids ) ) {
164
+							break;
165
+			}
157 166
 			foreach ( (array) $post_ids as $post_id_del ) {
158
-				if ( !current_user_can( 'delete_post', $post_id_del ) )
159
-					wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
167
+				if ( !current_user_can( 'delete_post', $post_id_del ) ) {
168
+									wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
169
+				}
160 170
 
161
-				if ( !wp_delete_attachment( $post_id_del ) )
162
-					wp_die( __( 'Error in deleting.' ) );
171
+				if ( !wp_delete_attachment( $post_id_del ) ) {
172
+									wp_die( __( 'Error in deleting.' ) );
173
+				}
163 174
 			}
164 175
 			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
165 176
 			break;
Please login to merge, or discard this patch.
Spacing   +144 added lines, -144 removed lines patch added patch discarded remove patch
@@ -7,77 +7,77 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( !current_user_can('upload_files') )
13
-	wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
12
+if ( ! current_user_can('upload_files'))
13
+	wp_die(__('Sorry, you are not allowed to upload files.'));
14 14
 
15
-$mode = get_user_option( 'media_library_mode', get_current_user_id() ) ? get_user_option( 'media_library_mode', get_current_user_id() ) : 'grid';
16
-$modes = array( 'grid', 'list' );
15
+$mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
16
+$modes = array('grid', 'list');
17 17
 
18
-if ( isset( $_GET['mode'] ) && in_array( $_GET['mode'], $modes ) ) {
18
+if (isset($_GET['mode']) && in_array($_GET['mode'], $modes)) {
19 19
 	$mode = $_GET['mode'];
20
-	update_user_option( get_current_user_id(), 'media_library_mode', $mode );
20
+	update_user_option(get_current_user_id(), 'media_library_mode', $mode);
21 21
 }
22 22
 
23
-if ( 'grid' === $mode ) {
23
+if ('grid' === $mode) {
24 24
 	wp_enqueue_media();
25
-	wp_enqueue_script( 'media-grid' );
26
-	wp_enqueue_script( 'media' );
25
+	wp_enqueue_script('media-grid');
26
+	wp_enqueue_script('media');
27 27
 
28
-	remove_action( 'admin_head', 'wp_admin_canonical_url' );
28
+	remove_action('admin_head', 'wp_admin_canonical_url');
29 29
 
30 30
 	$q = $_GET;
31 31
 	// let JS handle this
32
-	unset( $q['s'] );
33
-	$vars = wp_edit_attachments_query_vars( $q );
34
-	$ignore = array( 'mode', 'post_type', 'post_status', 'posts_per_page' );
35
-	foreach ( $vars as $key => $value ) {
36
-		if ( ! $value || in_array( $key, $ignore ) ) {
37
-			unset( $vars[ $key ] );
32
+	unset($q['s']);
33
+	$vars = wp_edit_attachments_query_vars($q);
34
+	$ignore = array('mode', 'post_type', 'post_status', 'posts_per_page');
35
+	foreach ($vars as $key => $value) {
36
+		if ( ! $value || in_array($key, $ignore)) {
37
+			unset($vars[$key]);
38 38
 		}
39 39
 	}
40 40
 
41
-	wp_localize_script( 'media-grid', '_wpMediaGridSettings', array(
42
-		'adminUrl' => parse_url( self_admin_url(), PHP_URL_PATH ),
41
+	wp_localize_script('media-grid', '_wpMediaGridSettings', array(
42
+		'adminUrl' => parse_url(self_admin_url(), PHP_URL_PATH),
43 43
 		'queryVars' => (object) $vars
44
-	) );
44
+	));
45 45
 
46
-	get_current_screen()->add_help_tab( array(
46
+	get_current_screen()->add_help_tab(array(
47 47
 		'id'		=> 'overview',
48
-		'title'		=> __( 'Overview' ),
48
+		'title'		=> __('Overview'),
49 49
 		'content'	=>
50
-			'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.' ) . '</p>' .
51
-			'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>' .
52
-			'<p>' . __( 'To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.' ) . '</p>'
53
-	) );
50
+			'<p>'.__('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first.').'</p>'.
51
+			'<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>'.
52
+			'<p>'.__('To delete media items, click the Bulk Select button at the top of the screen. Select any items you wish to delete, then click the Delete Selected button. Clicking the Cancel Selection button takes you back to viewing your media.').'</p>'
53
+	));
54 54
 
55
-	get_current_screen()->add_help_tab( array(
55
+	get_current_screen()->add_help_tab(array(
56 56
 		'id'		=> 'attachment-details',
57
-		'title'		=> __( 'Attachment Details' ),
57
+		'title'		=> __('Attachment Details'),
58 58
 		'content'	=>
59
-			'<p>' . __( 'Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.' ) . '</p>' .
60
-			'<p>' . __( 'Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.' ) . '</p>' .
61
-			'<p>' . __( 'You can also delete individual items and access the extended edit screen from the details dialog.' ) . '</p>'
62
-	) );
59
+			'<p>'.__('Clicking an item will display an Attachment Details dialog, which allows you to preview media and make quick edits. Any changes you make to the attachment details will be automatically saved.').'</p>'.
60
+			'<p>'.__('Use the arrow buttons at the top of the dialog, or the left and right arrow keys on your keyboard, to navigate between media items quickly.').'</p>'.
61
+			'<p>'.__('You can also delete individual items and access the extended edit screen from the details dialog.').'</p>'
62
+	));
63 63
 
64 64
 	get_current_screen()->set_help_sidebar(
65
-		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
66
-		'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>' ) . '</p>' .
67
-		'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
65
+		'<p><strong>'.__('For more information:').'</strong></p>'.
66
+		'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>').'</p>'.
67
+		'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
68 68
 	);
69 69
 
70 70
 	$title = __('Media Library');
71 71
 	$parent_file = 'upload.php';
72 72
 
73
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
73
+	require_once(ABSPATH.'wp-admin/admin-header.php');
74 74
 	?>
75 75
 	<div class="wrap" id="wp-media-grid" data-search="<?php _admin_search_query() ?>">
76
-		<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
76
+		<h1 class="wp-heading-inline"><?php echo esc_html($title); ?></h1>
77 77
 
78 78
 		<?php
79
-		if ( current_user_can( 'upload_files' ) ) { ?>
80
-			<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
79
+		if (current_user_can('upload_files')) { ?>
80
+			<a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
81 81
 		}
82 82
 		?>
83 83
 
@@ -86,13 +86,13 @@  discard block
 block discarded – undo
86 86
 		<div class="error hide-if-js">
87 87
 			<p><?php printf(
88 88
 				/* translators: %s: list view URL */
89
-				__( 'The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.' ),
89
+				__('The grid view for the Media Library requires JavaScript. <a href="%s">Switch to the list view</a>.'),
90 90
 				'upload.php?mode=list'
91 91
 			); ?></p>
92 92
 		</div>
93 93
 	</div>
94 94
 	<?php
95
-	include( ABSPATH . 'wp-admin/admin-footer.php' );
95
+	include(ABSPATH.'wp-admin/admin-footer.php');
96 96
 	exit;
97 97
 }
98 98
 
@@ -102,78 +102,78 @@  discard block
 block discarded – undo
102 102
 // Handle bulk actions
103 103
 $doaction = $wp_list_table->current_action();
104 104
 
105
-if ( $doaction ) {
105
+if ($doaction) {
106 106
 	check_admin_referer('bulk-media');
107 107
 
108
-	if ( 'delete_all' == $doaction ) {
109
-		$post_ids = $wpdb->get_col( "SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'" );
108
+	if ('delete_all' == $doaction) {
109
+		$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_type='attachment' AND post_status = 'trash'");
110 110
 		$doaction = 'delete';
111
-	} elseif ( isset( $_REQUEST['media'] ) ) {
111
+	} elseif (isset($_REQUEST['media'])) {
112 112
 		$post_ids = $_REQUEST['media'];
113
-	} elseif ( isset( $_REQUEST['ids'] ) ) {
114
-		$post_ids = explode( ',', $_REQUEST['ids'] );
113
+	} elseif (isset($_REQUEST['ids'])) {
114
+		$post_ids = explode(',', $_REQUEST['ids']);
115 115
 	}
116 116
 
117 117
 	$location = 'upload.php';
118
-	if ( $referer = wp_get_referer() ) {
119
-		if ( false !== strpos( $referer, 'upload.php' ) )
120
-			$location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer );
118
+	if ($referer = wp_get_referer()) {
119
+		if (false !== strpos($referer, 'upload.php'))
120
+			$location = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted'), $referer);
121 121
 	}
122 122
 
123
-	switch ( $doaction ) {
123
+	switch ($doaction) {
124 124
 		case 'detach':
125
-			wp_media_attach_action( $_REQUEST['parent_post_id'], 'detach' );
125
+			wp_media_attach_action($_REQUEST['parent_post_id'], 'detach');
126 126
 			break;
127 127
 
128 128
 		case 'attach':
129
-			wp_media_attach_action( $_REQUEST['found_post_id'] );
129
+			wp_media_attach_action($_REQUEST['found_post_id']);
130 130
 			break;
131 131
 
132 132
 		case 'trash':
133
-			if ( !isset( $post_ids ) )
133
+			if ( ! isset($post_ids))
134 134
 				break;
135
-			foreach ( (array) $post_ids as $post_id ) {
136
-				if ( !current_user_can( 'delete_post', $post_id ) )
137
-					wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
135
+			foreach ((array) $post_ids as $post_id) {
136
+				if ( ! current_user_can('delete_post', $post_id))
137
+					wp_die(__('Sorry, you are not allowed to move this item to the Trash.'));
138 138
 
139
-				if ( !wp_trash_post( $post_id ) )
140
-					wp_die( __( 'Error in moving to Trash.' ) );
139
+				if ( ! wp_trash_post($post_id))
140
+					wp_die(__('Error in moving to Trash.'));
141 141
 			}
142
-			$location = add_query_arg( array( 'trashed' => count( $post_ids ), 'ids' => join( ',', $post_ids ) ), $location );
142
+			$location = add_query_arg(array('trashed' => count($post_ids), 'ids' => join(',', $post_ids)), $location);
143 143
 			break;
144 144
 		case 'untrash':
145
-			if ( !isset( $post_ids ) )
145
+			if ( ! isset($post_ids))
146 146
 				break;
147
-			foreach ( (array) $post_ids as $post_id ) {
148
-				if ( !current_user_can( 'delete_post', $post_id ) )
149
-					wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
147
+			foreach ((array) $post_ids as $post_id) {
148
+				if ( ! current_user_can('delete_post', $post_id))
149
+					wp_die(__('Sorry, you are not allowed to restore this item from the Trash.'));
150 150
 
151
-				if ( !wp_untrash_post( $post_id ) )
152
-					wp_die( __( 'Error in restoring from Trash.' ) );
151
+				if ( ! wp_untrash_post($post_id))
152
+					wp_die(__('Error in restoring from Trash.'));
153 153
 			}
154
-			$location = add_query_arg( 'untrashed', count( $post_ids ), $location );
154
+			$location = add_query_arg('untrashed', count($post_ids), $location);
155 155
 			break;
156 156
 		case 'delete':
157
-			if ( !isset( $post_ids ) )
157
+			if ( ! isset($post_ids))
158 158
 				break;
159
-			foreach ( (array) $post_ids as $post_id_del ) {
160
-				if ( !current_user_can( 'delete_post', $post_id_del ) )
161
-					wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
159
+			foreach ((array) $post_ids as $post_id_del) {
160
+				if ( ! current_user_can('delete_post', $post_id_del))
161
+					wp_die(__('Sorry, you are not allowed to delete this item.'));
162 162
 
163
-				if ( !wp_delete_attachment( $post_id_del ) )
164
-					wp_die( __( 'Error in deleting.' ) );
163
+				if ( ! wp_delete_attachment($post_id_del))
164
+					wp_die(__('Error in deleting.'));
165 165
 			}
166
-			$location = add_query_arg( 'deleted', count( $post_ids ), $location );
166
+			$location = add_query_arg('deleted', count($post_ids), $location);
167 167
 			break;
168 168
 		default:
169 169
 			/** This action is documented in wp-admin/edit-comments.php */
170
-			$location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $doaction, $post_ids );
170
+			$location = apply_filters('handle_bulk_actions-'.get_current_screen()->id, $location, $doaction, $post_ids);
171 171
 	}
172 172
 
173
-	wp_redirect( $location );
173
+	wp_redirect($location);
174 174
 	exit;
175
-} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) {
176
-	 wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
175
+} elseif ( ! empty($_GET['_wp_http_referer'])) {
176
+	 wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])));
177 177
 	 exit;
178 178
 }
179 179
 
@@ -182,57 +182,57 @@  discard block
 block discarded – undo
182 182
 $title = __('Media Library');
183 183
 $parent_file = 'upload.php';
184 184
 
185
-wp_enqueue_script( 'media' );
185
+wp_enqueue_script('media');
186 186
 
187
-add_screen_option( 'per_page' );
187
+add_screen_option('per_page');
188 188
 
189
-get_current_screen()->add_help_tab( array(
189
+get_current_screen()->add_help_tab(array(
190 190
 'id'		=> 'overview',
191 191
 'title'		=> __('Overview'),
192 192
 'content'	=>
193
-	'<p>' . __( 'All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.' ) . '</p>' .
194
-	'<p>' . __( 'You can narrow the list by file type/status or by date using the dropdown menus above the media table.' ) . '</p>' .
195
-	'<p>' . __( 'You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.' ) . '</p>'
196
-) );
197
-get_current_screen()->add_help_tab( array(
193
+	'<p>'.__('All the files you&#8217;ve uploaded are listed in the Media Library, with the most recent uploads listed first. You can use the Screen Options tab to customize the display of this screen.').'</p>'.
194
+	'<p>'.__('You can narrow the list by file type/status or by date using the dropdown menus above the media table.').'</p>'.
195
+	'<p>'.__('You can view your media in a simple visual grid or a list with columns. Switch between these views using the icons to the left above the media.').'</p>'
196
+));
197
+get_current_screen()->add_help_tab(array(
198 198
 'id'		=> 'actions-links',
199 199
 'title'		=> __('Available Actions'),
200 200
 'content'	=>
201
-	'<p>' . __( 'Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.' ) . '</p>'
202
-) );
203
-get_current_screen()->add_help_tab( array(
201
+	'<p>'.__('Hovering over a row reveals action links: Edit, Delete Permanently, and View. Clicking Edit or on the media file&#8217;s name displays a simple screen to edit that individual file&#8217;s metadata. Clicking Delete Permanently will delete the file from the media library (as well as from any posts to which it is currently attached). View will take you to the display page for that file.').'</p>'
202
+));
203
+get_current_screen()->add_help_tab(array(
204 204
 'id'		=> 'attaching-files',
205 205
 'title'		=> __('Attaching Files'),
206 206
 'content'	=>
207
-	'<p>' . __( 'If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.' ) . '</p>'
208
-) );
207
+	'<p>'.__('If a media file has not been attached to any content, you will see that in the Uploaded To column, and can click on Attach to launch a small popup that will allow you to search for existing content and attach the file.').'</p>'
208
+));
209 209
 
210 210
 get_current_screen()->set_help_sidebar(
211
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
212
-	'<p>' . __( '<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>' ) . '</p>' .
213
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
211
+	'<p><strong>'.__('For more information:').'</strong></p>'.
212
+	'<p>'.__('<a href="https://codex.wordpress.org/Media_Library_Screen">Documentation on Media Library</a>').'</p>'.
213
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
214 214
 );
215 215
 
216
-get_current_screen()->set_screen_reader_content( array(
217
-	'heading_views'      => __( 'Filter media items list' ),
218
-	'heading_pagination' => __( 'Media items list navigation' ),
219
-	'heading_list'       => __( 'Media items list' ),
220
-) );
216
+get_current_screen()->set_screen_reader_content(array(
217
+	'heading_views'      => __('Filter media items list'),
218
+	'heading_pagination' => __('Media items list navigation'),
219
+	'heading_list'       => __('Media items list'),
220
+));
221 221
 
222
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
222
+require_once(ABSPATH.'wp-admin/admin-header.php');
223 223
 ?>
224 224
 
225 225
 <div class="wrap">
226
-<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1>
226
+<h1 class="wp-heading-inline"><?php echo esc_html($title); ?></h1>
227 227
 
228 228
 <?php
229
-if ( current_user_can( 'upload_files' ) ) { ?>
230
-	<a href="<?php echo admin_url( 'media-new.php' ); ?>" class="page-title-action"><?php echo esc_html_x( 'Add New', 'file' ); ?></a><?php
229
+if (current_user_can('upload_files')) { ?>
230
+	<a href="<?php echo admin_url('media-new.php'); ?>" class="page-title-action"><?php echo esc_html_x('Add New', 'file'); ?></a><?php
231 231
 }
232 232
 
233
-if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
233
+if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) {
234 234
 	/* translators: %s: search keywords */
235
-	printf( '<span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
235
+	printf('<span class="subtitle">'.__('Search results for &#8220;%s&#8221;').'</span>', get_search_query());
236 236
 }
237 237
 ?>
238 238
 
@@ -240,79 +240,79 @@  discard block
 block discarded – undo
240 240
 
241 241
 <?php
242 242
 $message = '';
243
-if ( ! empty( $_GET['posted'] ) ) {
244
-	$message = __( 'Media file updated.' );
243
+if ( ! empty($_GET['posted'])) {
244
+	$message = __('Media file updated.');
245 245
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('posted'), $_SERVER['REQUEST_URI']);
246 246
 }
247 247
 
248
-if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) {
249
-	if ( 1 == $attached ) {
250
-		$message = __( 'Media file attached.' );
248
+if ( ! empty($_GET['attached']) && $attached = absint($_GET['attached'])) {
249
+	if (1 == $attached) {
250
+		$message = __('Media file attached.');
251 251
 	} else {
252 252
 		/* translators: %s: number of media files */
253
-		$message = _n( '%s media file attached.', '%s media files attached.', $attached );
253
+		$message = _n('%s media file attached.', '%s media files attached.', $attached);
254 254
 	}
255
-	$message = sprintf( $message, number_format_i18n( $attached ) );
256
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
255
+	$message = sprintf($message, number_format_i18n($attached));
256
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
257 257
 }
258 258
 
259
-if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) {
260
-	if ( 1 == $detached ) {
261
-		$message = __( 'Media file detached.' );
259
+if ( ! empty($_GET['detach']) && $detached = absint($_GET['detach'])) {
260
+	if (1 == $detached) {
261
+		$message = __('Media file detached.');
262 262
 	} else {
263 263
 		/* translators: %s: number of media files */
264
-		$message = _n( '%s media file detached.', '%s media files detached.', $detached );
264
+		$message = _n('%s media file detached.', '%s media files detached.', $detached);
265 265
 	}
266
-	$message = sprintf( $message, number_format_i18n( $detached ) );
267
-	$_SERVER['REQUEST_URI'] = remove_query_arg( array( 'detach', 'attached' ), $_SERVER['REQUEST_URI'] );
266
+	$message = sprintf($message, number_format_i18n($detached));
267
+	$_SERVER['REQUEST_URI'] = remove_query_arg(array('detach', 'attached'), $_SERVER['REQUEST_URI']);
268 268
 }
269 269
 
270
-if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) {
271
-	if ( 1 == $deleted ) {
272
-		$message = __( 'Media file permanently deleted.' );
270
+if ( ! empty($_GET['deleted']) && $deleted = absint($_GET['deleted'])) {
271
+	if (1 == $deleted) {
272
+		$message = __('Media file permanently deleted.');
273 273
 	} else {
274 274
 		/* translators: %s: number of media files */
275
-		$message = _n( '%s media file permanently deleted.', '%s media files permanently deleted.', $deleted );
275
+		$message = _n('%s media file permanently deleted.', '%s media files permanently deleted.', $deleted);
276 276
 	}
277
-	$message = sprintf( $message, number_format_i18n( $deleted ) );
277
+	$message = sprintf($message, number_format_i18n($deleted));
278 278
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('deleted'), $_SERVER['REQUEST_URI']);
279 279
 }
280 280
 
281
-if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) {
282
-	if ( 1 == $trashed ) {
283
-		$message = __( 'Media file moved to the trash.' );
281
+if ( ! empty($_GET['trashed']) && $trashed = absint($_GET['trashed'])) {
282
+	if (1 == $trashed) {
283
+		$message = __('Media file moved to the trash.');
284 284
 	} else {
285 285
 		/* translators: %s: number of media files */
286
-		$message = _n( '%s media file moved to the trash.', '%s media files moved to the trash.', $trashed );
286
+		$message = _n('%s media file moved to the trash.', '%s media files moved to the trash.', $trashed);
287 287
 	}
288
-	$message = sprintf( $message, number_format_i18n( $trashed ) );
289
-	$message .= ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __('Undo') . '</a>';
288
+	$message = sprintf($message, number_format_i18n($trashed));
289
+	$message .= ' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>';
290 290
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('trashed'), $_SERVER['REQUEST_URI']);
291 291
 }
292 292
 
293
-if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) {
294
-	if ( 1 == $untrashed ) {
295
-		$message = __( 'Media file restored from the trash.' );
293
+if ( ! empty($_GET['untrashed']) && $untrashed = absint($_GET['untrashed'])) {
294
+	if (1 == $untrashed) {
295
+		$message = __('Media file restored from the trash.');
296 296
 	} else {
297 297
 		/* translators: %s: number of media files */
298
-		$message = _n( '%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed );
298
+		$message = _n('%s media file restored from the trash.', '%s media files restored from the trash.', $untrashed);
299 299
 	}
300
-	$message = sprintf( $message, number_format_i18n( $untrashed ) );
300
+	$message = sprintf($message, number_format_i18n($untrashed));
301 301
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('untrashed'), $_SERVER['REQUEST_URI']);
302 302
 }
303 303
 
304
-$messages[1] = __( 'Media file updated.' );
305
-$messages[2] = __( 'Media file permanently deleted.' );
306
-$messages[3] = __( 'Error saving media file.' );
307
-$messages[4] = __( 'Media file moved to the trash.' ) . ' <a href="' . esc_url( wp_nonce_url( 'upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media" ) ) . '">' . __( 'Undo' ) . '</a>';
308
-$messages[5] = __( 'Media file restored from the trash.' );
304
+$messages[1] = __('Media file updated.');
305
+$messages[2] = __('Media file permanently deleted.');
306
+$messages[3] = __('Error saving media file.');
307
+$messages[4] = __('Media file moved to the trash.').' <a href="'.esc_url(wp_nonce_url('upload.php?doaction=undo&action=untrash&ids='.(isset($_GET['ids']) ? $_GET['ids'] : ''), "bulk-media")).'">'.__('Undo').'</a>';
308
+$messages[5] = __('Media file restored from the trash.');
309 309
 
310
-if ( ! empty( $_GET['message'] ) && isset( $messages[ $_GET['message'] ] ) ) {
311
-	$message = $messages[ $_GET['message'] ];
310
+if ( ! empty($_GET['message']) && isset($messages[$_GET['message']])) {
311
+	$message = $messages[$_GET['message']];
312 312
 	$_SERVER['REQUEST_URI'] = remove_query_arg(array('message'), $_SERVER['REQUEST_URI']);
313 313
 }
314 314
 
315
-if ( !empty($message) ) { ?>
315
+if ( ! empty($message)) { ?>
316 316
 <div id="message" class="updated notice is-dismissible"><p><?php echo $message; ?></p></div>
317 317
 <?php } ?>
318 318
 
@@ -328,4 +328,4 @@  discard block
 block discarded – undo
328 328
 </div>
329 329
 
330 330
 <?php
331
-include( ABSPATH . 'wp-admin/admin-footer.php' );
331
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/async-upload.php 2 patches
Spacing   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -6,70 +6,70 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 
9
-if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
10
-	define( 'DOING_AJAX', true );
9
+if (isset($_REQUEST['action']) && 'upload-attachment' === $_REQUEST['action']) {
10
+	define('DOING_AJAX', true);
11 11
 }
12 12
 
13
-if ( ! defined( 'WP_ADMIN' ) ) {
14
-	define( 'WP_ADMIN', true );
13
+if ( ! defined('WP_ADMIN')) {
14
+	define('WP_ADMIN', true);
15 15
 }
16 16
 
17
-if ( defined('ABSPATH') )
18
-	require_once(ABSPATH . 'wp-load.php');
17
+if (defined('ABSPATH'))
18
+	require_once(ABSPATH.'wp-load.php');
19 19
 else
20
-	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
20
+	require_once(dirname(dirname(__FILE__)).'/wp-load.php');
21 21
 
22
-if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
22
+if ( ! (isset($_REQUEST['action']) && 'upload-attachment' == $_REQUEST['action'])) {
23 23
 	// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
24
-	if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
24
+	if (is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && ! empty($_REQUEST['auth_cookie']))
25 25
 		$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
26
-	elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
26
+	elseif (empty($_COOKIE[AUTH_COOKIE]) && ! empty($_REQUEST['auth_cookie']))
27 27
 		$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
28
-	if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
28
+	if (empty($_COOKIE[LOGGED_IN_COOKIE]) && ! empty($_REQUEST['logged_in_cookie']))
29 29
 		$_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
30 30
 	unset($current_user);
31 31
 }
32 32
 
33
-require_once( ABSPATH . 'wp-admin/admin.php' );
33
+require_once(ABSPATH.'wp-admin/admin.php');
34 34
 
35
-header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) );
35
+header('Content-Type: text/html; charset='.get_option('blog_charset'));
36 36
 
37
-if ( isset( $_REQUEST['action'] ) && 'upload-attachment' === $_REQUEST['action'] ) {
38
-	include( ABSPATH . 'wp-admin/includes/ajax-actions.php' );
37
+if (isset($_REQUEST['action']) && 'upload-attachment' === $_REQUEST['action']) {
38
+	include(ABSPATH.'wp-admin/includes/ajax-actions.php');
39 39
 
40 40
 	send_nosniff_header();
41 41
 	nocache_headers();
42 42
 
43 43
 	wp_ajax_upload_attachment();
44
-	die( '0' );
44
+	die('0');
45 45
 }
46 46
 
47
-if ( ! current_user_can( 'upload_files' ) ) {
48
-	wp_die( __( 'Sorry, you are not allowed to upload files.' ) );
47
+if ( ! current_user_can('upload_files')) {
48
+	wp_die(__('Sorry, you are not allowed to upload files.'));
49 49
 }
50 50
 
51 51
 // just fetch the detail form for that attachment
52
-if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
53
-	$post = get_post( $id );
54
-	if ( 'attachment' != $post->post_type )
55
-		wp_die( __( 'Unknown post type.' ) );
56
-	if ( ! current_user_can( 'edit_post', $id ) )
57
-		wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
58
-
59
-	switch ( $_REQUEST['fetch'] ) {
52
+if (isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch']) {
53
+	$post = get_post($id);
54
+	if ('attachment' != $post->post_type)
55
+		wp_die(__('Unknown post type.'));
56
+	if ( ! current_user_can('edit_post', $id))
57
+		wp_die(__('Sorry, you are not allowed to edit this item.'));
58
+
59
+	switch ($_REQUEST['fetch']) {
60 60
 		case 3 :
61
-			if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )
62
-				echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
63
-			echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
61
+			if ($thumb_url = wp_get_attachment_image_src($id, 'thumbnail', true))
62
+				echo '<img class="pinkynail" src="'.esc_url($thumb_url[0]).'" alt="" />';
63
+			echo '<a class="edit-attachment" href="'.esc_url(get_edit_post_link($id)).'" target="_blank">'._x('Edit', 'media item').'</a>';
64 64
 
65 65
 			// Title shouldn't ever be empty, but use filename just in case.
66
-			$file = get_attached_file( $post->ID );
67
-			$title = $post->post_title ? $post->post_title : wp_basename( $file );
68
-			echo '<div class="filename new"><span class="title">' . esc_html( wp_html_excerpt( $title, 60, '&hellip;' ) ) . '</span></div>';
66
+			$file = get_attached_file($post->ID);
67
+			$title = $post->post_title ? $post->post_title : wp_basename($file);
68
+			echo '<div class="filename new"><span class="title">'.esc_html(wp_html_excerpt($title, 60, '&hellip;')).'</span></div>';
69 69
 			break;
70 70
 		case 2 :
71 71
 			add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
72
-			echo get_media_item($id, array( 'send' => false, 'delete' => true ));
72
+			echo get_media_item($id, array('send' => false, 'delete' => true));
73 73
 			break;
74 74
 		default:
75 75
 			add_filter('attachment_fields_to_edit', 'media_post_single_attachment_fields_to_edit', 10, 2);
@@ -82,22 +82,22 @@  discard block
 block discarded – undo
82 82
 check_admin_referer('media-form');
83 83
 
84 84
 $post_id = 0;
85
-if ( isset( $_REQUEST['post_id'] ) ) {
86
-	$post_id = absint( $_REQUEST['post_id'] );
87
-	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) )
85
+if (isset($_REQUEST['post_id'])) {
86
+	$post_id = absint($_REQUEST['post_id']);
87
+	if ( ! get_post($post_id) || ! current_user_can('edit_post', $post_id))
88 88
 		$post_id = 0;
89 89
 }
90 90
 
91
-$id = media_handle_upload( 'async-upload', $post_id );
92
-if ( is_wp_error($id) ) {
91
+$id = media_handle_upload('async-upload', $post_id);
92
+if (is_wp_error($id)) {
93 93
 	echo '<div class="error-div error">
94
-	<a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __('Dismiss') . '</a>
95
-	<strong>' . sprintf(__('&#8220;%s&#8221; has failed to upload.'), esc_html($_FILES['async-upload']['name']) ) . '</strong><br />' .
96
-	esc_html($id->get_error_message()) . '</div>';
94
+	<a class="dismiss" href="#" onclick="jQuery(this).parents(\'div.media-item\').slideUp(200, function(){jQuery(this).remove();});">' . __('Dismiss').'</a>
95
+	<strong>' . sprintf(__('&#8220;%s&#8221; has failed to upload.'), esc_html($_FILES['async-upload']['name'])).'</strong><br />'.
96
+	esc_html($id->get_error_message()).'</div>';
97 97
 	exit;
98 98
 }
99 99
 
100
-if ( $_REQUEST['short'] ) {
100
+if ($_REQUEST['short']) {
101 101
 	// Short form response - attachment ID only.
102 102
 	echo $id;
103 103
 } else {
@@ -114,5 +114,5 @@  discard block
 block discarded – undo
114 114
 	 *
115 115
 	 * @param int $id Uploaded attachment ID.
116 116
 	 */
117
-	echo apply_filters( "async_upload_{$type}", $id );
117
+	echo apply_filters("async_upload_{$type}", $id);
118 118
 }
Please login to merge, or discard this patch.
Braces   +24 added lines, -17 removed lines patch added patch discarded remove patch
@@ -14,19 +14,22 @@  discard block
 block discarded – undo
14 14
 	define( 'WP_ADMIN', true );
15 15
 }
16 16
 
17
-if ( defined('ABSPATH') )
17
+if ( defined('ABSPATH') ) {
18 18
 	require_once(ABSPATH . 'wp-load.php');
19
-else
19
+} else {
20 20
 	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
21
+}
21 22
 
22 23
 if ( ! ( isset( $_REQUEST['action'] ) && 'upload-attachment' == $_REQUEST['action'] ) ) {
23 24
 	// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
24
-	if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
25
-		$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
26
-	elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
27
-		$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
28
-	if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) )
29
-		$_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
25
+	if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) {
26
+			$_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
27
+	} elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) ) {
28
+			$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
29
+	}
30
+	if ( empty($_COOKIE[LOGGED_IN_COOKIE]) && !empty($_REQUEST['logged_in_cookie']) ) {
31
+			$_COOKIE[LOGGED_IN_COOKIE] = $_REQUEST['logged_in_cookie'];
32
+	}
30 33
 	unset($current_user);
31 34
 }
32 35
 
@@ -51,15 +54,18 @@  discard block
 block discarded – undo
51 54
 // just fetch the detail form for that attachment
52 55
 if ( isset($_REQUEST['attachment_id']) && ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
53 56
 	$post = get_post( $id );
54
-	if ( 'attachment' != $post->post_type )
55
-		wp_die( __( 'Unknown post type.' ) );
56
-	if ( ! current_user_can( 'edit_post', $id ) )
57
-		wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
57
+	if ( 'attachment' != $post->post_type ) {
58
+			wp_die( __( 'Unknown post type.' ) );
59
+	}
60
+	if ( ! current_user_can( 'edit_post', $id ) ) {
61
+			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
62
+	}
58 63
 
59 64
 	switch ( $_REQUEST['fetch'] ) {
60 65
 		case 3 :
61
-			if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) )
62
-				echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
66
+			if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) ) {
67
+							echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />';
68
+			}
63 69
 			echo '<a class="edit-attachment" href="' . esc_url( get_edit_post_link( $id ) ) . '" target="_blank">' . _x( 'Edit', 'media item' ) . '</a>';
64 70
 
65 71
 			// Title shouldn't ever be empty, but use filename just in case.
@@ -84,9 +90,10 @@  discard block
 block discarded – undo
84 90
 $post_id = 0;
85 91
 if ( isset( $_REQUEST['post_id'] ) ) {
86 92
 	$post_id = absint( $_REQUEST['post_id'] );
87
-	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) )
88
-		$post_id = 0;
89
-}
93
+	if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) {
94
+			$post_id = 0;
95
+	}
96
+	}
90 97
 
91 98
 $id = media_handle_upload( 'async-upload', $post_id );
92 99
 if ( is_wp_error($id) ) {
Please login to merge, or discard this patch.
src/wp-admin/comment.php 2 patches
Braces   +41 added lines, -31 removed lines patch added patch discarded remove patch
@@ -18,20 +18,23 @@  discard block
 block discarded – undo
18 18
 global $action;
19 19
 wp_reset_vars( array('action') );
20 20
 
21
-if ( isset( $_POST['deletecomment'] ) )
21
+if ( isset( $_POST['deletecomment'] ) ) {
22 22
 	$action = 'deletecomment';
23
+}
23 24
 
24
-if ( 'cdc' == $action )
25
+if ( 'cdc' == $action ) {
25 26
 	$action = 'delete';
26
-elseif ( 'mac' == $action )
27
+} elseif ( 'mac' == $action ) {
27 28
 	$action = 'approve';
29
+}
28 30
 
29 31
 if ( isset( $_GET['dt'] ) ) {
30
-	if ( 'spam' == $_GET['dt'] )
31
-		$action = 'spam';
32
-	elseif ( 'trash' == $_GET['dt'] )
33
-		$action = 'trash';
34
-}
32
+	if ( 'spam' == $_GET['dt'] ) {
33
+			$action = 'spam';
34
+	} elseif ( 'trash' == $_GET['dt'] ) {
35
+			$action = 'trash';
36
+	}
37
+	}
35 38
 
36 39
 switch( $action ) {
37 40
 
@@ -57,14 +60,17 @@  discard block
 block discarded – undo
57 60
 
58 61
 	$comment_id = absint( $_GET['c'] );
59 62
 
60
-	if ( !$comment = get_comment( $comment_id ) )
61
-		comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') );
63
+	if ( !$comment = get_comment( $comment_id ) ) {
64
+			comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') );
65
+	}
62 66
 
63
-	if ( !current_user_can( 'edit_comment', $comment_id ) )
64
-		comment_footer_die( __('Sorry, you are not allowed to edit this comment.') );
67
+	if ( !current_user_can( 'edit_comment', $comment_id ) ) {
68
+			comment_footer_die( __('Sorry, you are not allowed to edit this comment.') );
69
+	}
65 70
 
66
-	if ( 'trash' == $comment->comment_approved )
67
-		comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
71
+	if ( 'trash' == $comment->comment_approved ) {
72
+			comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
73
+	}
68 74
 
69 75
 	$comment = get_comment_to_edit( $comment_id );
70 76
 
@@ -244,26 +250,30 @@  discard block
 block discarded – undo
244 250
 case 'unapprovecomment' :
245 251
 	$comment_id = absint( $_REQUEST['c'] );
246 252
 
247
-	if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
248
-		check_admin_referer( 'approve-comment_' . $comment_id );
249
-	else
250
-		check_admin_referer( 'delete-comment_' . $comment_id );
253
+	if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) {
254
+			check_admin_referer( 'approve-comment_' . $comment_id );
255
+	} else {
256
+			check_admin_referer( 'delete-comment_' . $comment_id );
257
+	}
251 258
 
252 259
 	$noredir = isset($_REQUEST['noredir']);
253 260
 
254
-	if ( !$comment = get_comment($comment_id) )
255
-		comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') );
256
-	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
257
-		comment_footer_die( __('Sorry, you are not allowed to edit comments on this post.') );
258
-
259
-	if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') )
260
-		$redir = wp_get_referer();
261
-	elseif ( '' != wp_get_original_referer() && ! $noredir )
262
-		$redir = wp_get_original_referer();
263
-	elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
264
-		$redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
265
-	else
266
-		$redir = admin_url('edit-comments.php');
261
+	if ( !$comment = get_comment($comment_id) ) {
262
+			comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') );
263
+	}
264
+	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) {
265
+			comment_footer_die( __('Sorry, you are not allowed to edit comments on this post.') );
266
+	}
267
+
268
+	if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') ) {
269
+			$redir = wp_get_referer();
270
+	} elseif ( '' != wp_get_original_referer() && ! $noredir ) {
271
+			$redir = wp_get_original_referer();
272
+	} elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) ) {
273
+			$redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
274
+	} else {
275
+			$redir = admin_url('edit-comments.php');
276
+	}
267 277
 
268 278
 	$redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir );
269 279
 
Please login to merge, or discard this patch.
Spacing   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** Load WordPress Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12 12
 $parent_file = 'edit-comments.php';
13 13
 $submenu_file = 'edit-comments.php';
@@ -16,59 +16,59 @@  discard block
 block discarded – undo
16 16
  * @global string $action
17 17
  */
18 18
 global $action;
19
-wp_reset_vars( array('action') );
19
+wp_reset_vars(array('action'));
20 20
 
21
-if ( isset( $_POST['deletecomment'] ) )
21
+if (isset($_POST['deletecomment']))
22 22
 	$action = 'deletecomment';
23 23
 
24
-if ( 'cdc' == $action )
24
+if ('cdc' == $action)
25 25
 	$action = 'delete';
26
-elseif ( 'mac' == $action )
26
+elseif ('mac' == $action)
27 27
 	$action = 'approve';
28 28
 
29
-if ( isset( $_GET['dt'] ) ) {
30
-	if ( 'spam' == $_GET['dt'] )
29
+if (isset($_GET['dt'])) {
30
+	if ('spam' == $_GET['dt'])
31 31
 		$action = 'spam';
32
-	elseif ( 'trash' == $_GET['dt'] )
32
+	elseif ('trash' == $_GET['dt'])
33 33
 		$action = 'trash';
34 34
 }
35 35
 
36
-switch( $action ) {
36
+switch ($action) {
37 37
 
38 38
 case 'editcomment' :
39 39
 	$title = __('Edit Comment');
40 40
 
41
-	get_current_screen()->add_help_tab( array(
41
+	get_current_screen()->add_help_tab(array(
42 42
 		'id'      => 'overview',
43 43
 		'title'   => __('Overview'),
44 44
 		'content' =>
45
-			'<p>' . __( 'You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.' ) . '</p>' .
46
-			'<p>' . __( 'You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.' ) . '</p>'
47
-	) );
45
+			'<p>'.__('You can edit the information left in a comment if needed. This is often useful when you notice that a commenter has made a typographical error.').'</p>'.
46
+			'<p>'.__('You can also moderate the comment from this screen using the Status box, where you can also change the timestamp of the comment.').'</p>'
47
+	));
48 48
 
49 49
 	get_current_screen()->set_help_sidebar(
50
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
51
-	'<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>' ) . '</p>' .
52
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
50
+	'<p><strong>'.__('For more information:').'</strong></p>'.
51
+	'<p>'.__('<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>').'</p>'.
52
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
53 53
 	);
54 54
 
55 55
 	wp_enqueue_script('comment');
56
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
56
+	require_once(ABSPATH.'wp-admin/admin-header.php');
57 57
 
58
-	$comment_id = absint( $_GET['c'] );
58
+	$comment_id = absint($_GET['c']);
59 59
 
60
-	if ( !$comment = get_comment( $comment_id ) )
61
-		comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'javascript:history.go(-1)') );
60
+	if ( ! $comment = get_comment($comment_id))
61
+		comment_footer_die(__('Invalid comment ID.').sprintf(' <a href="%s">'.__('Go back').'</a>.', 'javascript:history.go(-1)'));
62 62
 
63
-	if ( !current_user_can( 'edit_comment', $comment_id ) )
64
-		comment_footer_die( __('Sorry, you are not allowed to edit this comment.') );
63
+	if ( ! current_user_can('edit_comment', $comment_id))
64
+		comment_footer_die(__('Sorry, you are not allowed to edit this comment.'));
65 65
 
66
-	if ( 'trash' == $comment->comment_approved )
67
-		comment_footer_die( __('This comment is in the Trash. Please move it out of the Trash if you want to edit it.') );
66
+	if ('trash' == $comment->comment_approved)
67
+		comment_footer_die(__('This comment is in the Trash. Please move it out of the Trash if you want to edit it.'));
68 68
 
69
-	$comment = get_comment_to_edit( $comment_id );
69
+	$comment = get_comment_to_edit($comment_id);
70 70
 
71
-	include( ABSPATH . 'wp-admin/edit-form-comment.php' );
71
+	include(ABSPATH.'wp-admin/edit-form-comment.php');
72 72
 
73 73
 	break;
74 74
 
@@ -79,40 +79,40 @@  discard block
 block discarded – undo
79 79
 
80 80
 	$title = __('Moderate Comment');
81 81
 
82
-	$comment_id = absint( $_GET['c'] );
82
+	$comment_id = absint($_GET['c']);
83 83
 
84
-	if ( ! $comment = get_comment( $comment_id ) ) {
85
-		wp_redirect( admin_url('edit-comments.php?error=1') );
84
+	if ( ! $comment = get_comment($comment_id)) {
85
+		wp_redirect(admin_url('edit-comments.php?error=1'));
86 86
 		die();
87 87
 	}
88 88
 
89
-	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) ) {
90
-		wp_redirect( admin_url('edit-comments.php?error=2') );
89
+	if ( ! current_user_can('edit_comment', $comment->comment_ID)) {
90
+		wp_redirect(admin_url('edit-comments.php?error=2'));
91 91
 		die();
92 92
 	}
93 93
 
94 94
 	// No need to re-approve/re-trash/re-spam a comment.
95
-	if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) {
96
-		wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
95
+	if ($action == str_replace('1', 'approve', $comment->comment_approved)) {
96
+		wp_redirect(admin_url('edit-comments.php?same='.$comment_id));
97 97
 		die();
98 98
  	}
99 99
 
100
-	require_once( ABSPATH . 'wp-admin/admin-header.php' );
100
+	require_once(ABSPATH.'wp-admin/admin-header.php');
101 101
 
102
-	$formaction    = $action . 'comment';
102
+	$formaction    = $action.'comment';
103 103
 	$nonce_action  = 'approve' == $action ? 'approve-comment_' : 'delete-comment_';
104 104
 	$nonce_action .= $comment_id;
105 105
 
106 106
 ?>
107 107
 <div class="wrap">
108 108
 
109
-<h1><?php echo esc_html( $title ); ?></h1>
109
+<h1><?php echo esc_html($title); ?></h1>
110 110
 
111 111
 <?php
112
-switch ( $action ) {
112
+switch ($action) {
113 113
 	case 'spam' :
114 114
 		$caution_msg = __('You are about to mark the following comment as spam:');
115
-		$button      = _x( 'Mark as Spam', 'comment' );
115
+		$button      = _x('Mark as Spam', 'comment');
116 116
 		break;
117 117
 	case 'trash' :
118 118
 		$caution_msg = __('You are about to move the following comment to the Trash:');
@@ -128,9 +128,9 @@  discard block
 block discarded – undo
128 128
 		break;
129 129
 }
130 130
 
131
-if ( $comment->comment_approved != '0' ) { // if not unapproved
131
+if ($comment->comment_approved != '0') { // if not unapproved
132 132
 	$message = '';
133
-	switch ( $comment->comment_approved ) {
133
+	switch ($comment->comment_approved) {
134 134
 		case '1' :
135 135
 			$message = __('This comment is currently approved.');
136 136
 			break;
@@ -141,68 +141,68 @@  discard block
 block discarded – undo
141 141
 			$message  = __('This comment is currently in the Trash.');
142 142
 			break;
143 143
 	}
144
-	if ( $message ) {
145
-		echo '<div id="message" class="notice notice-info"><p>' . $message . '</p></div>';
144
+	if ($message) {
145
+		echo '<div id="message" class="notice notice-info"><p>'.$message.'</p></div>';
146 146
 	}
147 147
 }
148 148
 ?>
149
-<div id="message" class="notice notice-warning"><p><strong><?php _e( 'Caution:' ); ?></strong> <?php echo $caution_msg; ?></p></div>
149
+<div id="message" class="notice notice-warning"><p><strong><?php _e('Caution:'); ?></strong> <?php echo $caution_msg; ?></p></div>
150 150
 
151 151
 <table class="form-table comment-ays">
152 152
 <tr>
153 153
 <th scope="row"><?php _e('Author'); ?></th>
154
-<td><?php comment_author( $comment ); ?></td>
154
+<td><?php comment_author($comment); ?></td>
155 155
 </tr>
156
-<?php if ( get_comment_author_email( $comment ) ) { ?>
156
+<?php if (get_comment_author_email($comment)) { ?>
157 157
 <tr>
158 158
 <th scope="row"><?php _e('Email'); ?></th>
159
-<td><?php comment_author_email( $comment ); ?></td>
159
+<td><?php comment_author_email($comment); ?></td>
160 160
 </tr>
161 161
 <?php } ?>
162
-<?php if ( get_comment_author_url( $comment ) ) { ?>
162
+<?php if (get_comment_author_url($comment)) { ?>
163 163
 <tr>
164 164
 <th scope="row"><?php _e('URL'); ?></th>
165
-<td><a href="<?php comment_author_url( $comment ); ?>"><?php comment_author_url( $comment ); ?></a></td>
165
+<td><a href="<?php comment_author_url($comment); ?>"><?php comment_author_url($comment); ?></a></td>
166 166
 </tr>
167 167
 <?php } ?>
168 168
 <tr>
169
-	<th scope="row"><?php /* translators: column name or table row header */ _e( 'In Response To' ); ?></th>
169
+	<th scope="row"><?php /* translators: column name or table row header */ _e('In Response To'); ?></th>
170 170
 	<td>
171 171
 	<?php
172 172
 		$post_id = $comment->comment_post_ID;
173
-		if ( current_user_can( 'edit_post', $post_id ) ) {
174
-			$post_link = "<a href='" . esc_url( get_edit_post_link( $post_id ) ) . "'>";
175
-			$post_link .= esc_html( get_the_title( $post_id ) ) . '</a>';
173
+		if (current_user_can('edit_post', $post_id)) {
174
+			$post_link = "<a href='".esc_url(get_edit_post_link($post_id))."'>";
175
+			$post_link .= esc_html(get_the_title($post_id)).'</a>';
176 176
 		} else {
177
-			$post_link = esc_html( get_the_title( $post_id ) );
177
+			$post_link = esc_html(get_the_title($post_id));
178 178
 		}
179 179
 		echo $post_link;
180 180
 
181
-		if ( $comment->comment_parent ) {
182
-			$parent      = get_comment( $comment->comment_parent );
183
-			$parent_link = esc_url( get_comment_link( $parent ) );
184
-			$name        = get_comment_author( $parent );
181
+		if ($comment->comment_parent) {
182
+			$parent      = get_comment($comment->comment_parent);
183
+			$parent_link = esc_url(get_comment_link($parent));
184
+			$name        = get_comment_author($parent);
185 185
 			printf(
186 186
 				/* translators: %s: comment link */
187
-				' | ' . __( 'In reply to %s.' ),
188
-				'<a href="' . $parent_link . '">' . $name . '</a>'
187
+				' | '.__('In reply to %s.'),
188
+				'<a href="'.$parent_link.'">'.$name.'</a>'
189 189
 			);
190 190
 		}
191 191
 	?>
192 192
 	</td>
193 193
 </tr>
194 194
 <tr>
195
-	<th scope="row"><?php _e( 'Submitted on' ); ?></th>
195
+	<th scope="row"><?php _e('Submitted on'); ?></th>
196 196
 	<td>
197 197
 	<?php
198 198
 		/* translators: 1: comment date, 2: comment time */
199
-		$submitted = sprintf( __( '%1$s at %2$s' ),
199
+		$submitted = sprintf(__('%1$s at %2$s'),
200 200
 			/* translators: comment date format. See https://secure.php.net/date */
201
-			get_comment_date( __( 'Y/m/d' ), $comment ),
202
-			get_comment_date( __( 'g:i a' ), $comment )
201
+			get_comment_date(__('Y/m/d'), $comment),
202
+			get_comment_date(__('g:i a'), $comment)
203 203
 		);
204
-		if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) {
205
-			echo '<a href="' . esc_url( get_comment_link( $comment ) ) . '">' . $submitted . '</a>';
204
+		if ('approved' === wp_get_comment_status($comment) && ! empty ($comment->comment_post_ID)) {
205
+			echo '<a href="'.esc_url(get_comment_link($comment)).'">'.$submitted.'</a>';
206 206
 		} else {
207 207
 			echo $submitted;
208 208
 		}
@@ -212,8 +212,8 @@  discard block
 block discarded – undo
212 212
 <tr>
213 213
 <th scope="row"><?php /* translators: field name in comment form */ _ex('Comment', 'noun'); ?></th>
214 214
 <td class="comment-content">
215
-	<?php comment_text( $comment ); ?>
216
-	<p class="edit-comment"><a href="<?php echo admin_url( "comment.php?action=editcomment&amp;c={$comment->comment_ID}" ); ?>"><?php esc_html_e( 'Edit' ); ?></a></p>
215
+	<?php comment_text($comment); ?>
216
+	<p class="edit-comment"><a href="<?php echo admin_url("comment.php?action=editcomment&amp;c={$comment->comment_ID}"); ?>"><?php esc_html_e('Edit'); ?></a></p>
217 217
 </td>
218 218
 </tr>
219 219
 </table>
@@ -221,11 +221,11 @@  discard block
 block discarded – undo
221 221
 <form action="comment.php" method="get" class="comment-ays-submit">
222 222
 
223 223
 <p>
224
-	<?php submit_button( $button, 'primary', 'submit', false ); ?>
225
-	<a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_html_e( 'Cancel' ); ?></a>
224
+	<?php submit_button($button, 'primary', 'submit', false); ?>
225
+	<a href="<?php echo admin_url('edit-comments.php'); ?>" class="button-cancel"><?php esc_html_e('Cancel'); ?></a>
226 226
 </p>
227 227
 
228
-<?php wp_nonce_field( $nonce_action ); ?>
228
+<?php wp_nonce_field($nonce_action); ?>
229 229
 <input type="hidden" name="action" value="<?php echo esc_attr($formaction); ?>" />
230 230
 <input type="hidden" name="c" value="<?php echo esc_attr($comment->comment_ID); ?>" />
231 231
 <input type="hidden" name="noredir" value="1" />
@@ -242,75 +242,75 @@  discard block
 block discarded – undo
242 242
 case 'unspamcomment'    :
243 243
 case 'approvecomment'   :
244 244
 case 'unapprovecomment' :
245
-	$comment_id = absint( $_REQUEST['c'] );
245
+	$comment_id = absint($_REQUEST['c']);
246 246
 
247
-	if ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
248
-		check_admin_referer( 'approve-comment_' . $comment_id );
247
+	if (in_array($action, array('approvecomment', 'unapprovecomment')))
248
+		check_admin_referer('approve-comment_'.$comment_id);
249 249
 	else
250
-		check_admin_referer( 'delete-comment_' . $comment_id );
250
+		check_admin_referer('delete-comment_'.$comment_id);
251 251
 
252 252
 	$noredir = isset($_REQUEST['noredir']);
253 253
 
254
-	if ( !$comment = get_comment($comment_id) )
255
-		comment_footer_die( __( 'Invalid comment ID.' ) . sprintf(' <a href="%s">' . __('Go back') . '</a>.', 'edit-comments.php') );
256
-	if ( !current_user_can( 'edit_comment', $comment->comment_ID ) )
257
-		comment_footer_die( __('Sorry, you are not allowed to edit comments on this post.') );
254
+	if ( ! $comment = get_comment($comment_id))
255
+		comment_footer_die(__('Invalid comment ID.').sprintf(' <a href="%s">'.__('Go back').'</a>.', 'edit-comments.php'));
256
+	if ( ! current_user_can('edit_comment', $comment->comment_ID))
257
+		comment_footer_die(__('Sorry, you are not allowed to edit comments on this post.'));
258 258
 
259
-	if ( '' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php') )
259
+	if ('' != wp_get_referer() && ! $noredir && false === strpos(wp_get_referer(), 'comment.php'))
260 260
 		$redir = wp_get_referer();
261
-	elseif ( '' != wp_get_original_referer() && ! $noredir )
261
+	elseif ('' != wp_get_original_referer() && ! $noredir)
262 262
 		$redir = wp_get_original_referer();
263
-	elseif ( in_array( $action, array( 'approvecomment', 'unapprovecomment' ) ) )
264
-		$redir = admin_url('edit-comments.php?p=' . absint( $comment->comment_post_ID ) );
263
+	elseif (in_array($action, array('approvecomment', 'unapprovecomment')))
264
+		$redir = admin_url('edit-comments.php?p='.absint($comment->comment_post_ID));
265 265
 	else
266 266
 		$redir = admin_url('edit-comments.php');
267 267
 
268
-	$redir = remove_query_arg( array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir );
268
+	$redir = remove_query_arg(array('spammed', 'unspammed', 'trashed', 'untrashed', 'deleted', 'ids', 'approved', 'unapproved'), $redir);
269 269
 
270
-	switch ( $action ) {
270
+	switch ($action) {
271 271
 		case 'deletecomment' :
272
-			wp_delete_comment( $comment );
273
-			$redir = add_query_arg( array('deleted' => '1'), $redir );
272
+			wp_delete_comment($comment);
273
+			$redir = add_query_arg(array('deleted' => '1'), $redir);
274 274
 			break;
275 275
 		case 'trashcomment' :
276
-			wp_trash_comment( $comment );
277
-			$redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir );
276
+			wp_trash_comment($comment);
277
+			$redir = add_query_arg(array('trashed' => '1', 'ids' => $comment_id), $redir);
278 278
 			break;
279 279
 		case 'untrashcomment' :
280
-			wp_untrash_comment( $comment );
281
-			$redir = add_query_arg( array('untrashed' => '1'), $redir );
280
+			wp_untrash_comment($comment);
281
+			$redir = add_query_arg(array('untrashed' => '1'), $redir);
282 282
 			break;
283 283
 		case 'spamcomment' :
284
-			wp_spam_comment( $comment );
285
-			$redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir );
284
+			wp_spam_comment($comment);
285
+			$redir = add_query_arg(array('spammed' => '1', 'ids' => $comment_id), $redir);
286 286
 			break;
287 287
 		case 'unspamcomment' :
288
-			wp_unspam_comment( $comment );
289
-			$redir = add_query_arg( array('unspammed' => '1'), $redir );
288
+			wp_unspam_comment($comment);
289
+			$redir = add_query_arg(array('unspammed' => '1'), $redir);
290 290
 			break;
291 291
 		case 'approvecomment' :
292
-			wp_set_comment_status( $comment, 'approve' );
293
-			$redir = add_query_arg( array( 'approved' => 1 ), $redir );
292
+			wp_set_comment_status($comment, 'approve');
293
+			$redir = add_query_arg(array('approved' => 1), $redir);
294 294
 			break;
295 295
 		case 'unapprovecomment' :
296
-			wp_set_comment_status( $comment, 'hold' );
297
-			$redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
296
+			wp_set_comment_status($comment, 'hold');
297
+			$redir = add_query_arg(array('unapproved' => 1), $redir);
298 298
 			break;
299 299
 	}
300 300
 
301
-	wp_redirect( $redir );
301
+	wp_redirect($redir);
302 302
 	die;
303 303
 
304 304
 case 'editedcomment' :
305 305
 
306
-	$comment_id = absint( $_POST['comment_ID'] );
307
-	$comment_post_id = absint( $_POST['comment_post_ID'] );
306
+	$comment_id = absint($_POST['comment_ID']);
307
+	$comment_post_id = absint($_POST['comment_post_ID']);
308 308
 
309
-	check_admin_referer( 'update-comment_' . $comment_id );
309
+	check_admin_referer('update-comment_'.$comment_id);
310 310
 
311 311
 	edit_comment();
312 312
 
313
-	$location = ( empty( $_POST['referredby'] ) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby'] ) . '#comment-' . $comment_id;
313
+	$location = (empty($_POST['referredby']) ? "edit-comments.php?p=$comment_post_id" : $_POST['referredby']).'#comment-'.$comment_id;
314 314
 
315 315
 	/**
316 316
 	 * Filters the URI the user is redirected to after editing a comment in the admin.
@@ -320,14 +320,14 @@  discard block
 block discarded – undo
320 320
 	 * @param string $location The URI the user will be redirected to.
321 321
 	 * @param int $comment_id The ID of the comment being edited.
322 322
 	 */
323
-	$location = apply_filters( 'comment_edit_redirect', $location, $comment_id );
324
-	wp_redirect( $location );
323
+	$location = apply_filters('comment_edit_redirect', $location, $comment_id);
324
+	wp_redirect($location);
325 325
 
326 326
 	exit();
327 327
 
328 328
 default:
329
-	wp_die( __('Unknown action.') );
329
+	wp_die(__('Unknown action.'));
330 330
 
331 331
 } // end switch
332 332
 
333
-include( ABSPATH . 'wp-admin/admin-footer.php' );
333
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-admin/options-permalink.php 2 patches
Braces   +36 added lines, -23 removed lines patch added patch discarded remove patch
@@ -9,8 +9,9 @@  discard block
 block discarded – undo
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
11 11
 
12
-if ( ! current_user_can( 'manage_options' ) )
12
+if ( ! current_user_can( 'manage_options' ) ) {
13 13
 	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
14
+}
14 15
 
15 16
 $title = __('Permalink Settings');
16 17
 $parent_file = 'options-general.php';
@@ -53,8 +54,9 @@  discard block
 block discarded – undo
53 54
 $permalink_structure = get_option( 'permalink_structure' );
54 55
 
55 56
 $prefix = $blog_prefix = '';
56
-if ( ! got_url_rewrite() )
57
+if ( ! got_url_rewrite() ) {
57 58
 	$prefix = '/index.php';
59
+}
58 60
 
59 61
 /**
60 62
  * In a subdirectory configuration of multisite, the `/blog` prefix is used by
@@ -71,11 +73,12 @@  discard block
 block discarded – undo
71 73
 $update_required     = false;
72 74
 
73 75
 if ( $iis7_permalinks ) {
74
-	if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
75
-		$writable = true;
76
-	else
77
-		$writable = false;
78
-} elseif ( $is_nginx ) {
76
+	if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') ) {
77
+			$writable = true;
78
+	} else {
79
+			$writable = false;
80
+	}
81
+	} elseif ( $is_nginx ) {
79 82
 	$writable = false;
80 83
 } else {
81 84
 	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
@@ -94,17 +97,19 @@  discard block
 block discarded – undo
94 97
 	check_admin_referer('update-permalink');
95 98
 
96 99
 	if ( isset( $_POST['permalink_structure'] ) ) {
97
-		if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] )
98
-			$permalink_structure = $_POST['selection'];
99
-		else
100
-			$permalink_structure = $_POST['permalink_structure'];
100
+		if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] ) {
101
+					$permalink_structure = $_POST['selection'];
102
+		} else {
103
+					$permalink_structure = $_POST['permalink_structure'];
104
+		}
101 105
 
102 106
 		if ( ! empty( $permalink_structure ) ) {
103 107
 			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
104
-			if ( $prefix && $blog_prefix )
105
-				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
106
-			else
107
-				$permalink_structure = $blog_prefix . $permalink_structure;
108
+			if ( $prefix && $blog_prefix ) {
109
+							$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
110
+			} else {
111
+							$permalink_structure = $blog_prefix . $permalink_structure;
112
+			}
108 113
 		}
109 114
 
110 115
 		$permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
@@ -114,15 +119,17 @@  discard block
 block discarded – undo
114 119
 
115 120
 	if ( isset( $_POST['category_base'] ) ) {
116 121
 		$category_base = $_POST['category_base'];
117
-		if ( ! empty( $category_base ) )
118
-			$category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
122
+		if ( ! empty( $category_base ) ) {
123
+					$category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
124
+		}
119 125
 		$wp_rewrite->set_category_base( $category_base );
120 126
 	}
121 127
 
122 128
 	if ( isset( $_POST['tag_base'] ) ) {
123 129
 		$tag_base = $_POST['tag_base'];
124
-		if ( ! empty( $tag_base ) )
125
-			$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
130
+		if ( ! empty( $tag_base ) ) {
131
+					$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
132
+		}
126 133
 		$wp_rewrite->set_tag_base( $tag_base );
127 134
 	}
128 135
 
@@ -241,23 +248,29 @@  discard block
 block discarded – undo
241 248
 	<p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p>
242 249
 </form>
243 250
 <p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p>
244
-		<?php else : ?>
251
+		<?php else {
252
+	: ?>
245 253
 <p><?php _e('If the root directory of your site were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p>
246 254
 <form action="options-permalink.php" method="post">
247 255
 <?php wp_nonce_field('update-permalink') ?>
248
-	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p>
256
+	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) );
257
+}
258
+?></textarea></p>
249 259
 </form>
250 260
 <p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p>
251 261
 		<?php endif; ?>
252 262
 	<?php endif; ?>
253 263
 <?php elseif ( $is_nginx ) : ?>
254 264
 	<p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p>
255
-<?php else:
265
+<?php else {
266
+	:
256 267
 	if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) : ?>
257 268
 <p><?php _e('If your <code>.htaccess</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
258 269
 <form action="options-permalink.php" method="post">
259 270
 <?php wp_nonce_field('update-permalink') ?>
260
-	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p>
271
+	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() );
272
+}
273
+?></textarea></p>
261 274
 </form>
262 275
 	<?php endif; ?>
263 276
 <?php endif; ?>
Please login to merge, or discard this patch.
Spacing   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -7,53 +7,53 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12
-if ( ! current_user_can( 'manage_options' ) )
13
-	wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) );
12
+if ( ! current_user_can('manage_options'))
13
+	wp_die(__('Sorry, you are not allowed to manage options for this site.'));
14 14
 
15 15
 $title = __('Permalink Settings');
16 16
 $parent_file = 'options-general.php';
17 17
 
18
-get_current_screen()->add_help_tab( array(
18
+get_current_screen()->add_help_tab(array(
19 19
 	'id'      => 'overview',
20 20
 	'title'   => __('Overview'),
21
-	'content' => '<p>' . __('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.') . '</p>' .
22
-		'<p>' . __( 'This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.' ) . '</p>' .
23
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
24
-) );
21
+	'content' => '<p>'.__('Permalinks are the permanent URLs to your individual pages and blog posts, as well as your category and tag archives. A permalink is the web address used to link to your content. The URL to each post should be permanent, and never change &#8212; hence the name permalink.').'</p>'.
22
+		'<p>'.__('This screen allows you to choose your permalink structure. You can choose from common settings or create custom URL structures.').'</p>'.
23
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
24
+));
25 25
 
26
-get_current_screen()->add_help_tab( array(
26
+get_current_screen()->add_help_tab(array(
27 27
 	'id'      => 'permalink-settings',
28 28
 	'title'   => __('Permalink Settings'),
29
-	'content' => '<p>' . __( 'Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.' ) . '</p>' .
30
-		'<p>' . __( 'If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.' ) . '</p>' .
31
-		'<p>' . __('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes <code>%category%</code> or <code>%tag%</code>.') . '</p>' .
32
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
33
-) );
29
+	'content' => '<p>'.__('Permalinks can contain useful information, such as the post date, title, or other elements. You can choose from any of the suggested permalink formats, or you can craft your own if you select Custom Structure.').'</p>'.
30
+		'<p>'.__('If you pick an option other than Plain, your general URL path with structure tags (terms surrounded by <code>%</code>) will also appear in the custom structure field and your path can be further modified there.').'</p>'.
31
+		'<p>'.__('When you assign multiple categories or tags to a post, only one can show up in the permalink: the lowest numbered category. This applies if your custom structure includes <code>%category%</code> or <code>%tag%</code>.').'</p>'.
32
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
33
+));
34 34
 
35
-get_current_screen()->add_help_tab( array(
35
+get_current_screen()->add_help_tab(array(
36 36
 	'id'      => 'custom-structures',
37 37
 	'title'   => __('Custom Structures'),
38
-	'content' => '<p>' . __('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.') . '</p>' .
39
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
40
-) );
38
+	'content' => '<p>'.__('The Optional fields let you customize the &#8220;category&#8221; and &#8220;tag&#8221; base names that will appear in archive URLs. For example, the page listing all posts in the &#8220;Uncategorized&#8221; category could be <code>/topics/uncategorized</code> instead of <code>/category/uncategorized</code>.').'</p>'.
39
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
40
+));
41 41
 
42 42
 get_current_screen()->set_help_sidebar(
43
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
44
-	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen">Documentation on Permalinks Settings</a>') . '</p>' .
45
-	'<p>' . __('<a href="https://codex.wordpress.org/Using_Permalinks">Documentation on Using Permalinks</a>') . '</p>' .
46
-	'<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'
43
+	'<p><strong>'.__('For more information:').'</strong></p>'.
44
+	'<p>'.__('<a href="https://codex.wordpress.org/Settings_Permalinks_Screen">Documentation on Permalinks Settings</a>').'</p>'.
45
+	'<p>'.__('<a href="https://codex.wordpress.org/Using_Permalinks">Documentation on Using Permalinks</a>').'</p>'.
46
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
47 47
 );
48 48
 
49 49
 add_filter('admin_head', 'options_permalink_add_js');
50 50
 
51 51
 $home_path = get_home_path();
52 52
 $iis7_permalinks = iis7_supports_permalinks();
53
-$permalink_structure = get_option( 'permalink_structure' );
53
+$permalink_structure = get_option('permalink_structure');
54 54
 
55 55
 $prefix = $blog_prefix = '';
56
-if ( ! got_url_rewrite() )
56
+if ( ! got_url_rewrite())
57 57
 	$prefix = '/index.php';
58 58
 
59 59
 /**
@@ -62,149 +62,149 @@  discard block
 block discarded – undo
62 62
  * network. If the `permalink_structure` option has been changed to remove this
63 63
  * base prefix, WordPress core can no longer account for the possible collision.
64 64
  */
65
-if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
65
+if (is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) {
66 66
 	$blog_prefix = '/blog';
67 67
 }
68 68
 
69
-$category_base       = get_option( 'category_base' );
70
-$tag_base            = get_option( 'tag_base' );
69
+$category_base       = get_option('category_base');
70
+$tag_base            = get_option('tag_base');
71 71
 $update_required     = false;
72 72
 
73
-if ( $iis7_permalinks ) {
74
-	if ( ( ! file_exists($home_path . 'web.config') && win_is_writable($home_path) ) || win_is_writable($home_path . 'web.config') )
73
+if ($iis7_permalinks) {
74
+	if (( ! file_exists($home_path.'web.config') && win_is_writable($home_path)) || win_is_writable($home_path.'web.config'))
75 75
 		$writable = true;
76 76
 	else
77 77
 		$writable = false;
78
-} elseif ( $is_nginx ) {
78
+} elseif ($is_nginx) {
79 79
 	$writable = false;
80 80
 } else {
81
-	if ( ( ! file_exists( $home_path . '.htaccess' ) && is_writable( $home_path ) ) || is_writable( $home_path . '.htaccess' ) ) {
81
+	if (( ! file_exists($home_path.'.htaccess') && is_writable($home_path)) || is_writable($home_path.'.htaccess')) {
82 82
 		$writable = true;
83 83
 	} else {
84 84
 		$writable = false;
85
-		$existing_rules  = array_filter( extract_from_markers( $home_path . '.htaccess', 'WordPress' ) );
86
-		$new_rules       = array_filter( explode( "\n", $wp_rewrite->mod_rewrite_rules() ) );
87
-		$update_required = ( $new_rules !== $existing_rules );
85
+		$existing_rules  = array_filter(extract_from_markers($home_path.'.htaccess', 'WordPress'));
86
+		$new_rules       = array_filter(explode("\n", $wp_rewrite->mod_rewrite_rules()));
87
+		$update_required = ($new_rules !== $existing_rules);
88 88
 	}
89 89
 }
90 90
 
91 91
 $using_index_permalinks = $wp_rewrite->using_index_permalinks();
92 92
 
93
-if ( isset($_POST['permalink_structure']) || isset($_POST['category_base']) ) {
93
+if (isset($_POST['permalink_structure']) || isset($_POST['category_base'])) {
94 94
 	check_admin_referer('update-permalink');
95 95
 
96
-	if ( isset( $_POST['permalink_structure'] ) ) {
97
-		if ( isset( $_POST['selection'] ) && 'custom' != $_POST['selection'] )
96
+	if (isset($_POST['permalink_structure'])) {
97
+		if (isset($_POST['selection']) && 'custom' != $_POST['selection'])
98 98
 			$permalink_structure = $_POST['selection'];
99 99
 		else
100 100
 			$permalink_structure = $_POST['permalink_structure'];
101 101
 
102
-		if ( ! empty( $permalink_structure ) ) {
103
-			$permalink_structure = preg_replace( '#/+#', '/', '/' . str_replace( '#', '', $permalink_structure ) );
104
-			if ( $prefix && $blog_prefix )
105
-				$permalink_structure = $prefix . preg_replace( '#^/?index\.php#', '', $permalink_structure );
102
+		if ( ! empty($permalink_structure)) {
103
+			$permalink_structure = preg_replace('#/+#', '/', '/'.str_replace('#', '', $permalink_structure));
104
+			if ($prefix && $blog_prefix)
105
+				$permalink_structure = $prefix.preg_replace('#^/?index\.php#', '', $permalink_structure);
106 106
 			else
107
-				$permalink_structure = $blog_prefix . $permalink_structure;
107
+				$permalink_structure = $blog_prefix.$permalink_structure;
108 108
 		}
109 109
 
110
-		$permalink_structure = sanitize_option( 'permalink_structure', $permalink_structure );
110
+		$permalink_structure = sanitize_option('permalink_structure', $permalink_structure);
111 111
 
112
-		$wp_rewrite->set_permalink_structure( $permalink_structure );
112
+		$wp_rewrite->set_permalink_structure($permalink_structure);
113 113
 	}
114 114
 
115
-	if ( isset( $_POST['category_base'] ) ) {
115
+	if (isset($_POST['category_base'])) {
116 116
 		$category_base = $_POST['category_base'];
117
-		if ( ! empty( $category_base ) )
118
-			$category_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $category_base ) );
119
-		$wp_rewrite->set_category_base( $category_base );
117
+		if ( ! empty($category_base))
118
+			$category_base = $blog_prefix.preg_replace('#/+#', '/', '/'.str_replace('#', '', $category_base));
119
+		$wp_rewrite->set_category_base($category_base);
120 120
 	}
121 121
 
122
-	if ( isset( $_POST['tag_base'] ) ) {
122
+	if (isset($_POST['tag_base'])) {
123 123
 		$tag_base = $_POST['tag_base'];
124
-		if ( ! empty( $tag_base ) )
125
-			$tag_base = $blog_prefix . preg_replace('#/+#', '/', '/' . str_replace( '#', '', $tag_base ) );
126
-		$wp_rewrite->set_tag_base( $tag_base );
124
+		if ( ! empty($tag_base))
125
+			$tag_base = $blog_prefix.preg_replace('#/+#', '/', '/'.str_replace('#', '', $tag_base));
126
+		$wp_rewrite->set_tag_base($tag_base);
127 127
 	}
128 128
 
129
-	$message = __( 'Permalink structure updated.' );
129
+	$message = __('Permalink structure updated.');
130 130
 
131
-	if ( $iis7_permalinks ) {
132
-		if ( $permalink_structure && ! $using_index_permalinks && ! $writable ) {
133
-			$message = __( 'You should update your web.config now.' );
134
-		} elseif ( $permalink_structure && ! $using_index_permalinks && $writable ) {
135
-			$message = __( 'Permalink structure updated. Remove write access on web.config file now!' );
131
+	if ($iis7_permalinks) {
132
+		if ($permalink_structure && ! $using_index_permalinks && ! $writable) {
133
+			$message = __('You should update your web.config now.');
134
+		} elseif ($permalink_structure && ! $using_index_permalinks && $writable) {
135
+			$message = __('Permalink structure updated. Remove write access on web.config file now!');
136 136
 		}
137
-	} elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) {
138
-		$message = __( 'You should update your .htaccess now.' );
137
+	} elseif ( ! $is_nginx && $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required) {
138
+		$message = __('You should update your .htaccess now.');
139 139
 	}
140 140
 
141
-	if ( ! get_settings_errors() ) {
142
-		add_settings_error( 'general', 'settings_updated', $message, 'updated' );
141
+	if ( ! get_settings_errors()) {
142
+		add_settings_error('general', 'settings_updated', $message, 'updated');
143 143
 	}
144 144
 
145
-	set_transient( 'settings_errors', get_settings_errors(), 30 );
145
+	set_transient('settings_errors', get_settings_errors(), 30);
146 146
 
147
-	wp_redirect( admin_url( 'options-permalink.php?settings-updated=true' ) );
147
+	wp_redirect(admin_url('options-permalink.php?settings-updated=true'));
148 148
 	exit;
149 149
 }
150 150
 
151 151
 flush_rewrite_rules();
152 152
 
153
-require( ABSPATH . 'wp-admin/admin-header.php' );
153
+require(ABSPATH.'wp-admin/admin-header.php');
154 154
 ?>
155 155
 <div class="wrap">
156
-<h1><?php echo esc_html( $title ); ?></h1>
156
+<h1><?php echo esc_html($title); ?></h1>
157 157
 
158 158
 <form name="form" action="options-permalink.php" method="post">
159 159
 <?php wp_nonce_field('update-permalink') ?>
160 160
 
161
-  <p><?php _e( 'WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="https://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.' ); ?></p>
161
+  <p><?php _e('WordPress offers you the ability to create a custom URL structure for your permalinks and archives. Custom URL structures can improve the aesthetics, usability, and forward-compatibility of your links. A <a href="https://codex.wordpress.org/Using_Permalinks">number of tags are available</a>, and here are some examples to get you started.'); ?></p>
162 162
 
163 163
 <?php
164
-if ( is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos( $permalink_structure, '/blog/' ) ) {
165
-	$permalink_structure = preg_replace( '|^/?blog|', '', $permalink_structure );
166
-	$category_base = preg_replace( '|^/?blog|', '', $category_base );
167
-	$tag_base = preg_replace( '|^/?blog|', '', $tag_base );
164
+if (is_multisite() && ! is_subdomain_install() && is_main_site() && 0 === strpos($permalink_structure, '/blog/')) {
165
+	$permalink_structure = preg_replace('|^/?blog|', '', $permalink_structure);
166
+	$category_base = preg_replace('|^/?blog|', '', $category_base);
167
+	$tag_base = preg_replace('|^/?blog|', '', $tag_base);
168 168
 }
169 169
 
170 170
 $structures = array(
171 171
 	0 => '',
172
-	1 => $prefix . '/%year%/%monthnum%/%day%/%postname%/',
173
-	2 => $prefix . '/%year%/%monthnum%/%postname%/',
174
-	3 => $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/%post_id%',
175
-	4 => $prefix . '/%postname%/',
172
+	1 => $prefix.'/%year%/%monthnum%/%day%/%postname%/',
173
+	2 => $prefix.'/%year%/%monthnum%/%postname%/',
174
+	3 => $prefix.'/'._x('archives', 'sample permalink base').'/%post_id%',
175
+	4 => $prefix.'/%postname%/',
176 176
 );
177 177
 ?>
178 178
 <h2 class="title"><?php _e('Common Settings'); ?></h2>
179 179
 <table class="form-table permalink-structure">
180 180
 	<tr>
181
-		<th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e( 'Plain' ); ?></label></th>
181
+		<th><label><input name="selection" type="radio" value="" <?php checked('', $permalink_structure); ?> /> <?php _e('Plain'); ?></label></th>
182 182
 		<td><code><?php echo get_option('home'); ?>/?p=123</code></td>
183 183
 	</tr>
184 184
 	<tr>
185 185
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[1]); ?>" <?php checked($structures[1], $permalink_structure); ?> /> <?php _e('Day and name'); ?></label></th>
186
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . date('d') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
186
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'.date('Y').'/'.date('m').'/'.date('d').'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td>
187 187
 	</tr>
188 188
 	<tr>
189 189
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[2]); ?>" <?php checked($structures[2], $permalink_structure); ?> /> <?php _e('Month and name'); ?></label></th>
190
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . date('Y') . '/' . date('m') . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
190
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'.date('Y').'/'.date('m').'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td>
191 191
 	</tr>
192 192
 	<tr>
193 193
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[3]); ?>" <?php checked($structures[3], $permalink_structure); ?> /> <?php _e('Numeric'); ?></label></th>
194
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'archives', 'sample permalink base' ) . '/123'; ?></code></td>
194
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'._x('archives', 'sample permalink base').'/123'; ?></code></td>
195 195
 	</tr>
196 196
 	<tr>
197 197
 		<th><label><input name="selection" type="radio" value="<?php echo esc_attr($structures[4]); ?>" <?php checked($structures[4], $permalink_structure); ?> /> <?php _e('Post name'); ?></label></th>
198
-		<td><code><?php echo get_option('home') . $blog_prefix . $prefix . '/' . _x( 'sample-post', 'sample permalink structure' ) . '/'; ?></code></td>
198
+		<td><code><?php echo get_option('home').$blog_prefix.$prefix.'/'._x('sample-post', 'sample permalink structure').'/'; ?></code></td>
199 199
 	</tr>
200 200
 	<tr>
201 201
 		<th>
202
-			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( !in_array($permalink_structure, $structures) ); ?> />
202
+			<label><input name="selection" id="custom_selection" type="radio" value="custom" <?php checked( ! in_array($permalink_structure, $structures)); ?> />
203 203
 			<?php _e('Custom Structure'); ?>
204 204
 			</label>
205 205
 		</th>
206 206
 		<td>
207
-			<code><?php echo get_option('home') . $blog_prefix; ?></code>
207
+			<code><?php echo get_option('home').$blog_prefix; ?></code>
208 208
 			<input name="permalink_structure" id="permalink_structure" type="text" value="<?php echo esc_attr($permalink_structure); ?>" class="regular-text code" />
209 209
 		</td>
210 210
 	</tr>
@@ -213,12 +213,12 @@  discard block
 block discarded – undo
213 213
 <h2 class="title"><?php _e('Optional'); ?></h2>
214 214
 <p><?php
215 215
 /* translators: %s is a placeholder that must come at the start of the URL. */
216
-printf( __( 'If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.' ), get_option( 'home' ) . $blog_prefix . $prefix ); ?></p>
216
+printf(__('If you like, you may enter custom structures for your category and tag URLs here. For example, using <code>topics</code> as your category base would make your category links like <code>%s/topics/uncategorized/</code>. If you leave these blank the defaults will be used.'), get_option('home').$blog_prefix.$prefix); ?></p>
217 217
 
218 218
 <table class="form-table">
219 219
 	<tr>
220 220
 		<th><label for="category_base"><?php /* translators: prefix for category permalinks */ _e('Category base'); ?></label></th>
221
-		<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr( $category_base ); ?>" class="regular-text code" /></td>
221
+		<td><?php echo $blog_prefix; ?> <input name="category_base" id="category_base" type="text" value="<?php echo esc_attr($category_base); ?>" class="regular-text code" /></td>
222 222
 	</tr>
223 223
 	<tr>
224 224
 		<th><label for="tag_base"><?php _e('Tag base'); ?></label></th>
@@ -231,33 +231,33 @@  discard block
 block discarded – undo
231 231
 
232 232
 <?php submit_button(); ?>
233 233
   </form>
234
-<?php if ( !is_multisite() ) { ?>
235
-<?php if ( $iis7_permalinks ) :
236
-	if ( isset($_POST['submit']) && $permalink_structure && ! $using_index_permalinks && ! $writable ) :
237
-		if ( file_exists($home_path . 'web.config') ) : ?>
234
+<?php if ( ! is_multisite()) { ?>
235
+<?php if ($iis7_permalinks) :
236
+	if (isset($_POST['submit']) && $permalink_structure && ! $using_index_permalinks && ! $writable) :
237
+		if (file_exists($home_path.'web.config')) : ?>
238 238
 <p><?php _e('If your <code>web.config</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this rule inside of the <code>/&lt;configuration&gt;/&lt;system.webServer&gt;/&lt;rewrite&gt;/&lt;rules&gt;</code> element in <code>web.config</code> file.') ?></p>
239 239
 <form action="options-permalink.php" method="post">
240 240
 <?php wp_nonce_field('update-permalink') ?>
241
-	<p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules() ); ?></textarea></p>
241
+	<p><textarea rows="9" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules()); ?></textarea></p>
242 242
 </form>
243 243
 <p><?php _e('If you temporarily make your <code>web.config</code> file writable for us to generate rewrite rules automatically, do not forget to revert the permissions after rule has been saved.') ?></p>
244 244
 		<?php else : ?>
245 245
 <p><?php _e('If the root directory of your site were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so this is the url rewrite rule you should have in your <code>web.config</code> file. Create a new file, called <code>web.config</code> in the root directory of your site. Click in the field and press <kbd>CTRL + a</kbd> to select all. Then insert this code into the <code>web.config</code> file.') ?></p>
246 246
 <form action="options-permalink.php" method="post">
247 247
 <?php wp_nonce_field('update-permalink') ?>
248
-	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->iis7_url_rewrite_rules(true) ); ?></textarea></p>
248
+	<p><textarea rows="18" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->iis7_url_rewrite_rules(true)); ?></textarea></p>
249 249
 </form>
250 250
 <p><?php _e('If you temporarily make your site&#8217;s root directory writable for us to generate the <code>web.config</code> file automatically, do not forget to revert the permissions after the file has been created.') ?></p>
251 251
 		<?php endif; ?>
252 252
 	<?php endif; ?>
253
-<?php elseif ( $is_nginx ) : ?>
254
-	<p><?php _e( '<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.' ); ?></p>
253
+<?php elseif ($is_nginx) : ?>
254
+	<p><?php _e('<a href="https://codex.wordpress.org/Nginx">Documentation on Nginx configuration</a>.'); ?></p>
255 255
 <?php else:
256
-	if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $update_required ) : ?>
256
+	if ($permalink_structure && ! $using_index_permalinks && ! $writable && $update_required) : ?>
257 257
 <p><?php _e('If your <code>.htaccess</code> file were <a href="https://codex.wordpress.org/Changing_File_Permissions">writable</a>, we could do this automatically, but it isn&#8217;t so these are the mod_rewrite rules you should have in your <code>.htaccess</code> file. Click in the field and press <kbd>CTRL + a</kbd> to select all.') ?></p>
258 258
 <form action="options-permalink.php" method="post">
259 259
 <?php wp_nonce_field('update-permalink') ?>
260
-	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea( $wp_rewrite->mod_rewrite_rules() ); ?></textarea></p>
260
+	<p><textarea rows="6" class="large-text readonly" name="rules" id="rules" readonly="readonly"><?php echo esc_textarea($wp_rewrite->mod_rewrite_rules()); ?></textarea></p>
261 261
 </form>
262 262
 	<?php endif; ?>
263 263
 <?php endif; ?>
@@ -265,4 +265,4 @@  discard block
 block discarded – undo
265 265
 
266 266
 </div>
267 267
 
268
-<?php require( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
268
+<?php require(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
src/wp-admin/admin.php 2 patches
Braces   +59 added lines, -42 removed lines patch added patch discarded remove patch
@@ -15,18 +15,21 @@  discard block
 block discarded – undo
15 15
 	define( 'WP_ADMIN', true );
16 16
 }
17 17
 
18
-if ( ! defined('WP_NETWORK_ADMIN') )
18
+if ( ! defined('WP_NETWORK_ADMIN') ) {
19 19
 	define('WP_NETWORK_ADMIN', false);
20
+}
20 21
 
21
-if ( ! defined('WP_USER_ADMIN') )
22
+if ( ! defined('WP_USER_ADMIN') ) {
22 23
 	define('WP_USER_ADMIN', false);
24
+}
23 25
 
24 26
 if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) {
25 27
 	define('WP_BLOG_ADMIN', true);
26 28
 }
27 29
 
28
-if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') )
30
+if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') ) {
29 31
 	define('WP_LOAD_IMPORTERS', true);
32
+}
30 33
 
31 34
 require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
32 35
 
@@ -84,8 +87,9 @@  discard block
 block discarded – undo
84 87
 auth_redirect();
85 88
 
86 89
 // Schedule trash collection
87
-if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() )
90
+if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() ) {
88 91
 	wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
92
+}
89 93
 
90 94
 set_screen_options();
91 95
 
@@ -120,22 +124,25 @@  discard block
 block discarded – undo
120 124
 	$plugin_page = plugin_basename($plugin_page);
121 125
 }
122 126
 
123
-if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
127
+if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) {
124 128
 	$typenow = $_REQUEST['post_type'];
125
-else
129
+} else {
126 130
 	$typenow = '';
131
+}
127 132
 
128
-if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) )
133
+if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) ) {
129 134
 	$taxnow = $_REQUEST['taxonomy'];
130
-else
135
+} else {
131 136
 	$taxnow = '';
137
+}
132 138
 
133
-if ( WP_NETWORK_ADMIN )
139
+if ( WP_NETWORK_ADMIN ) {
134 140
 	require(ABSPATH . 'wp-admin/network/menu.php');
135
-elseif ( WP_USER_ADMIN )
141
+} elseif ( WP_USER_ADMIN ) {
136 142
 	require(ABSPATH . 'wp-admin/user/menu.php');
137
-else
143
+} else {
138 144
 	require(ABSPATH . 'wp-admin/menu.php');
145
+}
139 146
 
140 147
 if ( current_user_can( 'manage_options' ) ) {
141 148
 	wp_raise_memory_limit( 'admin' );
@@ -154,20 +161,22 @@  discard block
 block discarded – undo
154 161
 do_action( 'admin_init' );
155 162
 
156 163
 if ( isset($plugin_page) ) {
157
-	if ( !empty($typenow) )
158
-		$the_parent = $pagenow . '?post_type=' . $typenow;
159
-	else
160
-		$the_parent = $pagenow;
164
+	if ( !empty($typenow) ) {
165
+			$the_parent = $pagenow . '?post_type=' . $typenow;
166
+	} else {
167
+			$the_parent = $pagenow;
168
+	}
161 169
 	if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) {
162 170
 		$page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
163 171
 
164 172
 		// Back-compat for plugins using add_management_page().
165 173
 		if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
166 174
 			// There could be plugin specific params on the URL, so we need the whole query string
167
-			if ( !empty($_SERVER[ 'QUERY_STRING' ]) )
168
-				$query_string = $_SERVER[ 'QUERY_STRING' ];
169
-			else
170
-				$query_string = 'page=' . $plugin_page;
175
+			if ( !empty($_SERVER[ 'QUERY_STRING' ]) ) {
176
+							$query_string = $_SERVER[ 'QUERY_STRING' ];
177
+			} else {
178
+							$query_string = 'page=' . $plugin_page;
179
+			}
171 180
 			wp_redirect( admin_url('tools.php?' . $query_string) );
172 181
 			exit;
173 182
 		}
@@ -210,8 +219,9 @@  discard block
 block discarded – undo
210 219
 		 * @since 2.1.0
211 220
 		 */
212 221
 		do_action( 'load-' . $page_hook );
213
-		if (! isset($_GET['noheader']))
214
-			require_once(ABSPATH . 'wp-admin/admin-header.php');
222
+		if (! isset($_GET['noheader'])) {
223
+					require_once(ABSPATH . 'wp-admin/admin-header.php');
224
+		}
215 225
 
216 226
 		/**
217 227
 		 * Used to call the registered callback for a plugin screen.
@@ -221,11 +231,13 @@  discard block
 block discarded – undo
221 231
 		 */
222 232
 		do_action( $page_hook );
223 233
 	} else {
224
-		if ( validate_file($plugin_page) )
225
-			wp_die(__('Invalid plugin page'));
234
+		if ( validate_file($plugin_page) ) {
235
+					wp_die(__('Invalid plugin page'));
236
+		}
226 237
 
227
-		if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) )
228
-			wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
238
+		if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) ) {
239
+					wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
240
+		}
229 241
 
230 242
 		/**
231 243
 		 * Fires before a particular screen is loaded.
@@ -241,13 +253,15 @@  discard block
 block discarded – undo
241 253
 		 */
242 254
 		do_action( 'load-' . $plugin_page );
243 255
 
244
-		if ( !isset($_GET['noheader']))
245
-			require_once(ABSPATH . 'wp-admin/admin-header.php');
256
+		if ( !isset($_GET['noheader'])) {
257
+					require_once(ABSPATH . 'wp-admin/admin-header.php');
258
+		}
246 259
 
247
-		if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") )
248
-			include(WPMU_PLUGIN_DIR . "/$plugin_page");
249
-		else
250
-			include(WP_PLUGIN_DIR . "/$plugin_page");
260
+		if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") ) {
261
+					include(WPMU_PLUGIN_DIR . "/$plugin_page");
262
+		} else {
263
+					include(WP_PLUGIN_DIR . "/$plugin_page");
264
+		}
251 265
 	}
252 266
 
253 267
 	include(ABSPATH . 'wp-admin/admin-footer.php');
@@ -284,8 +298,9 @@  discard block
 block discarded – undo
284 298
 	$submenu_file = 'import.php';
285 299
 	$title = __('Import');
286 300
 
287
-	if (! isset($_GET['noheader']))
288
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
301
+	if (! isset($_GET['noheader'])) {
302
+			require_once(ABSPATH . 'wp-admin/admin-header.php');
303
+	}
289 304
 
290 305
 	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
291 306
 
@@ -333,15 +348,17 @@  discard block
 block discarded – undo
333 348
 	 * In all other cases, 'load-' . $pagenow should be used instead.
334 349
 	 */
335 350
 	if ( $typenow == 'page' ) {
336
-		if ( $pagenow == 'post-new.php' )
337
-			do_action( 'load-page-new.php' );
338
-		elseif ( $pagenow == 'post.php' )
339
-			do_action( 'load-page.php' );
340
-	}  elseif ( $pagenow == 'edit-tags.php' ) {
341
-		if ( $taxnow == 'category' )
342
-			do_action( 'load-categories.php' );
343
-		elseif ( $taxnow == 'link_category' )
344
-			do_action( 'load-edit-link-categories.php' );
351
+		if ( $pagenow == 'post-new.php' ) {
352
+					do_action( 'load-page-new.php' );
353
+		} elseif ( $pagenow == 'post.php' ) {
354
+					do_action( 'load-page.php' );
355
+		}
356
+	} elseif ( $pagenow == 'edit-tags.php' ) {
357
+		if ( $taxnow == 'category' ) {
358
+					do_action( 'load-categories.php' );
359
+		} elseif ( $taxnow == 'link_category' ) {
360
+					do_action( 'load-edit-link-categories.php' );
361
+		}
345 362
 	} elseif( 'term.php' === $pagenow ) {
346 363
 		do_action( 'load-edit-tags.php' );
347 364
 	}
Please login to merge, or discard this patch.
Spacing   +91 added lines, -91 removed lines patch added patch discarded remove patch
@@ -11,40 +11,40 @@  discard block
 block discarded – undo
11 11
  *
12 12
  * @since 2.3.2
13 13
  */
14
-if ( ! defined( 'WP_ADMIN' ) ) {
15
-	define( 'WP_ADMIN', true );
14
+if ( ! defined('WP_ADMIN')) {
15
+	define('WP_ADMIN', true);
16 16
 }
17 17
 
18
-if ( ! defined('WP_NETWORK_ADMIN') )
18
+if ( ! defined('WP_NETWORK_ADMIN'))
19 19
 	define('WP_NETWORK_ADMIN', false);
20 20
 
21
-if ( ! defined('WP_USER_ADMIN') )
21
+if ( ! defined('WP_USER_ADMIN'))
22 22
 	define('WP_USER_ADMIN', false);
23 23
 
24
-if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN ) {
24
+if ( ! WP_NETWORK_ADMIN && ! WP_USER_ADMIN) {
25 25
 	define('WP_BLOG_ADMIN', true);
26 26
 }
27 27
 
28
-if ( isset($_GET['import']) && !defined('WP_LOAD_IMPORTERS') )
28
+if (isset($_GET['import']) && ! defined('WP_LOAD_IMPORTERS'))
29 29
 	define('WP_LOAD_IMPORTERS', true);
30 30
 
31
-require_once(dirname(dirname(__FILE__)) . '/wp-load.php');
31
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
32 32
 
33 33
 nocache_headers();
34 34
 
35
-if ( get_option('db_upgraded') ) {
35
+if (get_option('db_upgraded')) {
36 36
 	flush_rewrite_rules();
37
-	update_option( 'db_upgraded',  false );
37
+	update_option('db_upgraded', false);
38 38
 
39 39
 	/**
40 40
 	 * Fires on the next page load after a successful DB upgrade.
41 41
 	 *
42 42
 	 * @since 2.8.0
43 43
 	 */
44
-	do_action( 'after_db_upgrade' );
45
-} elseif ( get_option('db_version') != $wp_db_version && empty($_POST) ) {
46
-	if ( !is_multisite() ) {
47
-		wp_redirect( admin_url( 'upgrade.php?_wp_http_referer=' . urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) ) );
44
+	do_action('after_db_upgrade');
45
+} elseif (get_option('db_version') != $wp_db_version && empty($_POST)) {
46
+	if ( ! is_multisite()) {
47
+		wp_redirect(admin_url('upgrade.php?_wp_http_referer='.urlencode(wp_unslash($_SERVER['REQUEST_URI']))));
48 48
 		exit;
49 49
 
50 50
 	/**
@@ -61,38 +61,38 @@  discard block
 block discarded – undo
61 61
 	 *
62 62
 	 * @param bool $do_mu_upgrade Whether to perform the Multisite upgrade routine. Default true.
63 63
 	 */
64
-	} elseif ( apply_filters( 'do_mu_upgrade', true ) ) {
64
+	} elseif (apply_filters('do_mu_upgrade', true)) {
65 65
 		$c = get_blog_count();
66 66
 
67 67
 		/*
68 68
 		 * If there are 50 or fewer sites, run every time. Otherwise, throttle to reduce load:
69 69
 		 * attempt to do no more than threshold value, with some +/- allowed.
70 70
 		 */
71
-		if ( $c <= 50 || ( $c > 50 && mt_rand( 0, (int)( $c / 50 ) ) == 1 ) ) {
72
-			require_once( ABSPATH . WPINC . '/http.php' );
73
-			$response = wp_remote_get( admin_url( 'upgrade.php?step=1' ), array( 'timeout' => 120, 'httpversion' => '1.1' ) );
71
+		if ($c <= 50 || ($c > 50 && mt_rand(0, (int) ($c / 50)) == 1)) {
72
+			require_once(ABSPATH.WPINC.'/http.php');
73
+			$response = wp_remote_get(admin_url('upgrade.php?step=1'), array('timeout' => 120, 'httpversion' => '1.1'));
74 74
 			/** This action is documented in wp-admin/network/upgrade.php */
75
-			do_action( 'after_mu_upgrade', $response );
75
+			do_action('after_mu_upgrade', $response);
76 76
 			unset($response);
77 77
 		}
78 78
 		unset($c);
79 79
 	}
80 80
 }
81 81
 
82
-require_once(ABSPATH . 'wp-admin/includes/admin.php');
82
+require_once(ABSPATH.'wp-admin/includes/admin.php');
83 83
 
84 84
 auth_redirect();
85 85
 
86 86
 // Schedule trash collection
87
-if ( ! wp_next_scheduled( 'wp_scheduled_delete' ) && ! wp_installing() )
87
+if ( ! wp_next_scheduled('wp_scheduled_delete') && ! wp_installing())
88 88
 	wp_schedule_event(time(), 'daily', 'wp_scheduled_delete');
89 89
 
90 90
 set_screen_options();
91 91
 
92
-$date_format = __( 'F j, Y' );
93
-$time_format = __( 'g:i a' );
92
+$date_format = __('F j, Y');
93
+$time_format = __('g:i a');
94 94
 
95
-wp_enqueue_script( 'common' );
95
+wp_enqueue_script('common');
96 96
 
97 97
 
98 98
 
@@ -115,30 +115,30 @@  discard block
 block discarded – undo
115 115
 
116 116
 $editing = false;
117 117
 
118
-if ( isset($_GET['page']) ) {
119
-	$plugin_page = wp_unslash( $_GET['page'] );
118
+if (isset($_GET['page'])) {
119
+	$plugin_page = wp_unslash($_GET['page']);
120 120
 	$plugin_page = plugin_basename($plugin_page);
121 121
 }
122 122
 
123
-if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) )
123
+if (isset($_REQUEST['post_type']) && post_type_exists($_REQUEST['post_type']))
124 124
 	$typenow = $_REQUEST['post_type'];
125 125
 else
126 126
 	$typenow = '';
127 127
 
128
-if ( isset( $_REQUEST['taxonomy'] ) && taxonomy_exists( $_REQUEST['taxonomy'] ) )
128
+if (isset($_REQUEST['taxonomy']) && taxonomy_exists($_REQUEST['taxonomy']))
129 129
 	$taxnow = $_REQUEST['taxonomy'];
130 130
 else
131 131
 	$taxnow = '';
132 132
 
133
-if ( WP_NETWORK_ADMIN )
134
-	require(ABSPATH . 'wp-admin/network/menu.php');
135
-elseif ( WP_USER_ADMIN )
136
-	require(ABSPATH . 'wp-admin/user/menu.php');
133
+if (WP_NETWORK_ADMIN)
134
+	require(ABSPATH.'wp-admin/network/menu.php');
135
+elseif (WP_USER_ADMIN)
136
+	require(ABSPATH.'wp-admin/user/menu.php');
137 137
 else
138
-	require(ABSPATH . 'wp-admin/menu.php');
138
+	require(ABSPATH.'wp-admin/menu.php');
139 139
 
140
-if ( current_user_can( 'manage_options' ) ) {
141
-	wp_raise_memory_limit( 'admin' );
140
+if (current_user_can('manage_options')) {
141
+	wp_raise_memory_limit('admin');
142 142
 }
143 143
 
144 144
 /**
@@ -151,24 +151,24 @@  discard block
 block discarded – undo
151 151
  *
152 152
  * @since 2.5.0
153 153
  */
154
-do_action( 'admin_init' );
154
+do_action('admin_init');
155 155
 
156
-if ( isset($plugin_page) ) {
157
-	if ( !empty($typenow) )
158
-		$the_parent = $pagenow . '?post_type=' . $typenow;
156
+if (isset($plugin_page)) {
157
+	if ( ! empty($typenow))
158
+		$the_parent = $pagenow.'?post_type='.$typenow;
159 159
 	else
160 160
 		$the_parent = $pagenow;
161
-	if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent) ) {
161
+	if ( ! $page_hook = get_plugin_page_hook($plugin_page, $the_parent)) {
162 162
 		$page_hook = get_plugin_page_hook($plugin_page, $plugin_page);
163 163
 
164 164
 		// Back-compat for plugins using add_management_page().
165
-		if ( empty( $page_hook ) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php') ) {
165
+		if (empty($page_hook) && 'edit.php' == $pagenow && '' != get_plugin_page_hook($plugin_page, 'tools.php')) {
166 166
 			// There could be plugin specific params on the URL, so we need the whole query string
167
-			if ( !empty($_SERVER[ 'QUERY_STRING' ]) )
168
-				$query_string = $_SERVER[ 'QUERY_STRING' ];
167
+			if ( ! empty($_SERVER['QUERY_STRING']))
168
+				$query_string = $_SERVER['QUERY_STRING'];
169 169
 			else
170
-				$query_string = 'page=' . $plugin_page;
171
-			wp_redirect( admin_url('tools.php?' . $query_string) );
170
+				$query_string = 'page='.$plugin_page;
171
+			wp_redirect(admin_url('tools.php?'.$query_string));
172 172
 			exit;
173 173
 		}
174 174
 	}
@@ -176,19 +176,19 @@  discard block
 block discarded – undo
176 176
 }
177 177
 
178 178
 $hook_suffix = '';
179
-if ( isset( $page_hook ) ) {
179
+if (isset($page_hook)) {
180 180
 	$hook_suffix = $page_hook;
181
-} elseif ( isset( $plugin_page ) ) {
181
+} elseif (isset($plugin_page)) {
182 182
 	$hook_suffix = $plugin_page;
183
-} elseif ( isset( $pagenow ) ) {
183
+} elseif (isset($pagenow)) {
184 184
 	$hook_suffix = $pagenow;
185 185
 }
186 186
 
187 187
 set_current_screen();
188 188
 
189 189
 // Handle plugin admin pages.
190
-if ( isset($plugin_page) ) {
191
-	if ( $page_hook ) {
190
+if (isset($plugin_page)) {
191
+	if ($page_hook) {
192 192
 		/**
193 193
 		 * Fires before a particular screen is loaded.
194 194
 		 *
@@ -209,9 +209,9 @@  discard block
 block discarded – undo
209 209
 		 *
210 210
 		 * @since 2.1.0
211 211
 		 */
212
-		do_action( "load-{$page_hook}" );
213
-		if (! isset($_GET['noheader']))
214
-			require_once(ABSPATH . 'wp-admin/admin-header.php');
212
+		do_action("load-{$page_hook}");
213
+		if ( ! isset($_GET['noheader']))
214
+			require_once(ABSPATH.'wp-admin/admin-header.php');
215 215
 
216 216
 		/**
217 217
 		 * Used to call the registered callback for a plugin screen.
@@ -219,12 +219,12 @@  discard block
 block discarded – undo
219 219
 		 * @ignore
220 220
 		 * @since 1.5.0
221 221
 		 */
222
-		do_action( $page_hook );
222
+		do_action($page_hook);
223 223
 	} else {
224
-		if ( validate_file($plugin_page) )
224
+		if (validate_file($plugin_page))
225 225
 			wp_die(__('Invalid plugin page'));
226 226
 
227
-		if ( !( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) && !( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") && is_file(WPMU_PLUGIN_DIR . "/$plugin_page") ) )
227
+		if ( ! (file_exists(WP_PLUGIN_DIR."/$plugin_page") && is_file(WP_PLUGIN_DIR."/$plugin_page")) && ! (file_exists(WPMU_PLUGIN_DIR."/$plugin_page") && is_file(WPMU_PLUGIN_DIR."/$plugin_page")))
228 228
 			wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
229 229
 
230 230
 		/**
@@ -239,35 +239,35 @@  discard block
 block discarded – undo
239 239
 		 *
240 240
 		 * @since 1.5.0
241 241
 		 */
242
-		do_action( "load-{$plugin_page}" );
242
+		do_action("load-{$plugin_page}");
243 243
 
244
-		if ( !isset($_GET['noheader']))
245
-			require_once(ABSPATH . 'wp-admin/admin-header.php');
244
+		if ( ! isset($_GET['noheader']))
245
+			require_once(ABSPATH.'wp-admin/admin-header.php');
246 246
 
247
-		if ( file_exists(WPMU_PLUGIN_DIR . "/$plugin_page") )
248
-			include(WPMU_PLUGIN_DIR . "/$plugin_page");
247
+		if (file_exists(WPMU_PLUGIN_DIR."/$plugin_page"))
248
+			include(WPMU_PLUGIN_DIR."/$plugin_page");
249 249
 		else
250
-			include(WP_PLUGIN_DIR . "/$plugin_page");
250
+			include(WP_PLUGIN_DIR."/$plugin_page");
251 251
 	}
252 252
 
253
-	include(ABSPATH . 'wp-admin/admin-footer.php');
253
+	include(ABSPATH.'wp-admin/admin-footer.php');
254 254
 
255 255
 	exit();
256
-} elseif ( isset( $_GET['import'] ) ) {
256
+} elseif (isset($_GET['import'])) {
257 257
 
258 258
 	$importer = $_GET['import'];
259 259
 
260
-	if ( ! current_user_can( 'import' ) ) {
261
-		wp_die( __( 'Sorry, you are not allowed to import content.' ) );
260
+	if ( ! current_user_can('import')) {
261
+		wp_die(__('Sorry, you are not allowed to import content.'));
262 262
 	}
263 263
 
264
-	if ( validate_file($importer) ) {
265
-		wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
264
+	if (validate_file($importer)) {
265
+		wp_redirect(admin_url('import.php?invalid='.$importer));
266 266
 		exit;
267 267
 	}
268 268
 
269
-	if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2]) ) {
270
-		wp_redirect( admin_url( 'import.php?invalid=' . $importer ) );
269
+	if ( ! isset($wp_importers[$importer]) || ! is_callable($wp_importers[$importer][2])) {
270
+		wp_redirect(admin_url('import.php?invalid='.$importer));
271 271
 		exit;
272 272
 	}
273 273
 
@@ -278,16 +278,16 @@  discard block
 block discarded – undo
278 278
 	 *
279 279
 	 * @since 3.5.0
280 280
 	 */
281
-	do_action( "load-importer-{$importer}" );
281
+	do_action("load-importer-{$importer}");
282 282
 
283 283
 	$parent_file = 'tools.php';
284 284
 	$submenu_file = 'import.php';
285 285
 	$title = __('Import');
286 286
 
287
-	if (! isset($_GET['noheader']))
288
-		require_once(ABSPATH . 'wp-admin/admin-header.php');
287
+	if ( ! isset($_GET['noheader']))
288
+		require_once(ABSPATH.'wp-admin/admin-header.php');
289 289
 
290
-	require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
290
+	require_once(ABSPATH.'wp-admin/includes/upgrade.php');
291 291
 
292 292
 	define('WP_IMPORTING', true);
293 293
 
@@ -301,13 +301,13 @@  discard block
 block discarded – undo
301 301
 	 *
302 302
 	 * @param bool $force Whether to force data to be filtered through kses. Default false.
303 303
 	 */
304
-	if ( apply_filters( 'force_filtered_html_on_import', false ) ) {
305
-		kses_init_filters();  // Always filter imported data with kses on multisite.
304
+	if (apply_filters('force_filtered_html_on_import', false)) {
305
+		kses_init_filters(); // Always filter imported data with kses on multisite.
306 306
 	}
307 307
 
308 308
 	call_user_func($wp_importers[$importer][2]);
309 309
 
310
-	include(ABSPATH . 'wp-admin/admin-footer.php');
310
+	include(ABSPATH.'wp-admin/admin-footer.php');
311 311
 
312 312
 	// Make sure rules are flushed
313 313
 	flush_rewrite_rules(false);
@@ -326,28 +326,28 @@  discard block
 block discarded – undo
326 326
 	 *
327 327
 	 * @since 2.1.0
328 328
 	 */
329
-	do_action( "load-{$pagenow}" );
329
+	do_action("load-{$pagenow}");
330 330
 
331 331
 	/*
332 332
 	 * The following hooks are fired to ensure backward compatibility.
333 333
 	 * In all other cases, 'load-' . $pagenow should be used instead.
334 334
 	 */
335
-	if ( $typenow == 'page' ) {
336
-		if ( $pagenow == 'post-new.php' )
337
-			do_action( 'load-page-new.php' );
338
-		elseif ( $pagenow == 'post.php' )
339
-			do_action( 'load-page.php' );
340
-	}  elseif ( $pagenow == 'edit-tags.php' ) {
341
-		if ( $taxnow == 'category' )
342
-			do_action( 'load-categories.php' );
343
-		elseif ( $taxnow == 'link_category' )
344
-			do_action( 'load-edit-link-categories.php' );
345
-	} elseif( 'term.php' === $pagenow ) {
346
-		do_action( 'load-edit-tags.php' );
335
+	if ($typenow == 'page') {
336
+		if ($pagenow == 'post-new.php')
337
+			do_action('load-page-new.php');
338
+		elseif ($pagenow == 'post.php')
339
+			do_action('load-page.php');
340
+	}  elseif ($pagenow == 'edit-tags.php') {
341
+		if ($taxnow == 'category')
342
+			do_action('load-categories.php');
343
+		elseif ($taxnow == 'link_category')
344
+			do_action('load-edit-link-categories.php');
345
+	} elseif ('term.php' === $pagenow) {
346
+		do_action('load-edit-tags.php');
347 347
 	}
348 348
 }
349 349
 
350
-if ( ! empty( $_REQUEST['action'] ) ) {
350
+if ( ! empty($_REQUEST['action'])) {
351 351
 	/**
352 352
 	 * Fires when an 'action' request variable is sent.
353 353
 	 *
@@ -356,5 +356,5 @@  discard block
 block discarded – undo
356 356
 	 *
357 357
 	 * @since 2.6.0
358 358
 	 */
359
-	do_action( 'admin_action_' . $_REQUEST['action'] );
359
+	do_action('admin_action_'.$_REQUEST['action']);
360 360
 }
Please login to merge, or discard this patch.
src/wp-admin/index.php 2 patches
Braces   +19 added lines, -10 removed lines patch added patch discarded remove patch
@@ -15,18 +15,21 @@  discard block
 block discarded – undo
15 15
 wp_dashboard_setup();
16 16
 
17 17
 wp_enqueue_script( 'dashboard' );
18
-if ( current_user_can( 'edit_theme_options' ) )
18
+if ( current_user_can( 'edit_theme_options' ) ) {
19 19
 	wp_enqueue_script( 'customize-loader' );
20
+}
20 21
 if ( current_user_can( 'install_plugins' ) ) {
21 22
 	wp_enqueue_script( 'plugin-install' );
22 23
 	wp_enqueue_script( 'updates' );
23 24
 }
24
-if ( current_user_can( 'upload_files' ) )
25
+if ( current_user_can( 'upload_files' ) ) {
25 26
 	wp_enqueue_script( 'media-upload' );
27
+}
26 28
 add_thickbox();
27 29
 
28
-if ( wp_is_mobile() )
30
+if ( wp_is_mobile() ) {
29 31
 	wp_enqueue_script( 'jquery-touch-punch' );
32
+}
30 33
 
31 34
 $title = __('Dashboard');
32 35
 $parent_file = 'index.php';
@@ -65,25 +68,29 @@  discard block
 block discarded – undo
65 68
 ) );
66 69
 
67 70
 $help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
68
-if ( current_user_can( 'edit_posts' ) )
71
+if ( current_user_can( 'edit_posts' ) ) {
69 72
 	$help .= '<p>' . __( '<strong>At A Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
73
+}
70 74
 	$help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
71
-if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
75
+if ( is_blog_admin() && current_user_can( 'edit_posts' ) ) {
72 76
 	$help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>';
73
-if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
77
+}
78
+if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) {
74 79
 	$help .= '<p>' . sprintf(
75 80
 		/* translators: %s: WordPress Planet URL */
76 81
 		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.' ),
77 82
 		__( 'https://planet.wordpress.org/' )
78 83
 	) . '</p>';
79
-else
84
+} else {
80 85
 	$help .= '<p>' . sprintf(
81 86
 		/* translators: %s: WordPress Planet URL */
82 87
 		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
83 88
 		__( 'https://planet.wordpress.org/' )
84 89
 	) . '</p>';
85
-if ( current_user_can( 'edit_theme_options' ) )
90
+}
91
+if ( current_user_can( 'edit_theme_options' ) ) {
86 92
 	$help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
93
+}
87 94
 
88 95
 $screen->add_help_tab( array(
89 96
 	'id'      => 'help-content',
@@ -111,8 +118,10 @@  discard block
 block discarded – undo
111 118
 	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
112 119
 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
113 120
 	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
114
-	if ( $hide )
115
-		$classes .= ' hidden'; ?>
121
+	if ( $hide ) {
122
+			$classes .= ' hidden';
123
+	}
124
+	?>
116 125
 
117 126
 	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
118 127
 		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
Please login to merge, or discard this patch.
Spacing   +64 added lines, -64 removed lines patch added patch discarded remove patch
@@ -7,115 +7,115 @@  discard block
 block discarded – undo
7 7
  */
8 8
 
9 9
 /** Load WordPress Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12 12
 /** Load WordPress dashboard API */
13
-require_once(ABSPATH . 'wp-admin/includes/dashboard.php');
13
+require_once(ABSPATH.'wp-admin/includes/dashboard.php');
14 14
 
15 15
 wp_dashboard_setup();
16 16
 
17
-wp_enqueue_script( 'dashboard' );
18
-if ( current_user_can( 'edit_theme_options' ) )
19
-	wp_enqueue_script( 'customize-loader' );
20
-if ( current_user_can( 'install_plugins' ) ) {
21
-	wp_enqueue_script( 'plugin-install' );
22
-	wp_enqueue_script( 'updates' );
17
+wp_enqueue_script('dashboard');
18
+if (current_user_can('edit_theme_options'))
19
+	wp_enqueue_script('customize-loader');
20
+if (current_user_can('install_plugins')) {
21
+	wp_enqueue_script('plugin-install');
22
+	wp_enqueue_script('updates');
23 23
 }
24
-if ( current_user_can( 'upload_files' ) )
25
-	wp_enqueue_script( 'media-upload' );
24
+if (current_user_can('upload_files'))
25
+	wp_enqueue_script('media-upload');
26 26
 add_thickbox();
27 27
 
28
-if ( wp_is_mobile() )
29
-	wp_enqueue_script( 'jquery-touch-punch' );
28
+if (wp_is_mobile())
29
+	wp_enqueue_script('jquery-touch-punch');
30 30
 
31 31
 $title = __('Dashboard');
32 32
 $parent_file = 'index.php';
33 33
 
34
-$help = '<p>' . __( 'Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab above the screen title.' ) . '</p>';
34
+$help = '<p>'.__('Welcome to your WordPress Dashboard! This is the screen you will see when you log in to your site, and gives you access to all the site management features of WordPress. You can get help for any screen by clicking the Help tab above the screen title.').'</p>';
35 35
 
36 36
 $screen = get_current_screen();
37 37
 
38
-$screen->add_help_tab( array(
38
+$screen->add_help_tab(array(
39 39
 	'id'      => 'overview',
40
-	'title'   => __( 'Overview' ),
40
+	'title'   => __('Overview'),
41 41
 	'content' => $help,
42
-) );
42
+));
43 43
 
44 44
 // Help tabs
45 45
 
46
-$help  = '<p>' . __( 'The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.' ) . '</p>';
47
-$help .= '<p>' . __( 'Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.' ) . '</p>';
46
+$help  = '<p>'.__('The left-hand navigation menu provides links to all of the WordPress administration screens, with submenu items displayed on hover. You can minimize this menu to a narrow icon strip by clicking on the Collapse Menu arrow at the bottom.').'</p>';
47
+$help .= '<p>'.__('Links in the Toolbar at the top of the screen connect your dashboard and the front end of your site, and provide access to your profile and helpful WordPress information.').'</p>';
48 48
 
49
-$screen->add_help_tab( array(
49
+$screen->add_help_tab(array(
50 50
 	'id'      => 'help-navigation',
51
-	'title'   => __( 'Navigation' ),
51
+	'title'   => __('Navigation'),
52 52
 	'content' => $help,
53
-) );
53
+));
54 54
 
55
-$help  = '<p>' . __( 'You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.' ) . '</p>';
56
-$help .= '<p>' . __( '<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.' ) . '</p>';
57
-$help .= '<p>' . __( '<strong>Drag and Drop</strong> &mdash; To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.' ) . '</p>';
58
-$help .= '<p>' . __( '<strong>Box Controls</strong> &mdash; Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.' ) . '</p>';
55
+$help  = '<p>'.__('You can use the following controls to arrange your Dashboard screen to suit your workflow. This is true on most other administration screens as well.').'</p>';
56
+$help .= '<p>'.__('<strong>Screen Options</strong> &mdash; Use the Screen Options tab to choose which Dashboard boxes to show.').'</p>';
57
+$help .= '<p>'.__('<strong>Drag and Drop</strong> &mdash; To rearrange the boxes, drag and drop by clicking on the title bar of the selected box and releasing when you see a gray dotted-line rectangle appear in the location you want to place the box.').'</p>';
58
+$help .= '<p>'.__('<strong>Box Controls</strong> &mdash; Click the title bar of the box to expand or collapse it. Some boxes added by plugins may have configurable content, and will show a &#8220;Configure&#8221; link in the title bar if you hover over it.').'</p>';
59 59
 
60
-$screen->add_help_tab( array(
60
+$screen->add_help_tab(array(
61 61
 	'id'      => 'help-layout',
62
-	'title'   => __( 'Layout' ),
62
+	'title'   => __('Layout'),
63 63
 	'content' => $help,
64
-) );
65
-
66
-$help  = '<p>' . __( 'The boxes on your Dashboard screen are:' ) . '</p>';
67
-if ( current_user_can( 'edit_posts' ) )
68
-	$help .= '<p>' . __( '<strong>At A Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.' ) . '</p>';
69
-	$help .= '<p>' . __( '<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.' ) . '</p>';
70
-if ( is_blog_admin() && current_user_can( 'edit_posts' ) )
71
-	$help .= '<p>' . __( "<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started." ) . '</p>';
72
-if ( ! is_multisite() && current_user_can( 'install_plugins' ) )
73
-	$help .= '<p>' . sprintf(
64
+));
65
+
66
+$help = '<p>'.__('The boxes on your Dashboard screen are:').'</p>';
67
+if (current_user_can('edit_posts'))
68
+	$help .= '<p>'.__('<strong>At A Glance</strong> &mdash; Displays a summary of the content on your site and identifies which theme and version of WordPress you are using.').'</p>';
69
+	$help .= '<p>'.__('<strong>Activity</strong> &mdash; Shows the upcoming scheduled posts, recently published posts, and the most recent comments on your posts and allows you to moderate them.').'</p>';
70
+if (is_blog_admin() && current_user_can('edit_posts'))
71
+	$help .= '<p>'.__("<strong>Quick Draft</strong> &mdash; Allows you to create a new post and save it as a draft. Also displays links to the 5 most recent draft posts you've started.").'</p>';
72
+if ( ! is_multisite() && current_user_can('install_plugins'))
73
+	$help .= '<p>'.sprintf(
74 74
 		/* translators: %s: WordPress Planet URL */
75
-		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.' ),
76
-		__( 'https://planet.wordpress.org/' )
77
-	) . '</p>';
75
+		__('<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project, the <a href="%s">WordPress Planet</a>, and popular plugins.'),
76
+		__('https://planet.wordpress.org/')
77
+	).'</p>';
78 78
 else
79
-	$help .= '<p>' . sprintf(
79
+	$help .= '<p>'.sprintf(
80 80
 		/* translators: %s: WordPress Planet URL */
81
-		__( '<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.' ),
82
-		__( 'https://planet.wordpress.org/' )
83
-	) . '</p>';
84
-if ( current_user_can( 'edit_theme_options' ) )
85
-	$help .= '<p>' . __( '<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.' ) . '</p>';
81
+		__('<strong>WordPress News</strong> &mdash; Latest news from the official WordPress project and the <a href="%s">WordPress Planet</a>.'),
82
+		__('https://planet.wordpress.org/')
83
+	).'</p>';
84
+if (current_user_can('edit_theme_options'))
85
+	$help .= '<p>'.__('<strong>Welcome</strong> &mdash; Shows links for some of the most common tasks when setting up a new site.').'</p>';
86 86
 
87
-$screen->add_help_tab( array(
87
+$screen->add_help_tab(array(
88 88
 	'id'      => 'help-content',
89
-	'title'   => __( 'Content' ),
89
+	'title'   => __('Content'),
90 90
 	'content' => $help,
91
-) );
91
+));
92 92
 
93
-unset( $help );
93
+unset($help);
94 94
 
95 95
 $screen->set_help_sidebar(
96
-	'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
97
-	'<p>' . __( '<a href="https://codex.wordpress.org/Dashboard_Screen">Documentation on Dashboard</a>' ) . '</p>' .
98
-	'<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>'
96
+	'<p><strong>'.__('For more information:').'</strong></p>'.
97
+	'<p>'.__('<a href="https://codex.wordpress.org/Dashboard_Screen">Documentation on Dashboard</a>').'</p>'.
98
+	'<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'
99 99
 );
100 100
 
101
-include( ABSPATH . 'wp-admin/admin-header.php' );
101
+include(ABSPATH.'wp-admin/admin-header.php');
102 102
 ?>
103 103
 
104 104
 <div class="wrap">
105
-	<h1><?php echo esc_html( $title ); ?></h1>
105
+	<h1><?php echo esc_html($title); ?></h1>
106 106
 
107
-<?php if ( has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) :
107
+<?php if (has_action('welcome_panel') && current_user_can('edit_theme_options')) :
108 108
 	$classes = 'welcome-panel';
109 109
 
110
-	$option = get_user_meta( get_current_user_id(), 'show_welcome_panel', true );
110
+	$option = get_user_meta(get_current_user_id(), 'show_welcome_panel', true);
111 111
 	// 0 = hide, 1 = toggled to show or single site creator, 2 = multisite site owner
112
-	$hide = 0 == $option || ( 2 == $option && wp_get_current_user()->user_email != get_option( 'admin_email' ) );
113
-	if ( $hide )
112
+	$hide = 0 == $option || (2 == $option && wp_get_current_user()->user_email != get_option('admin_email'));
113
+	if ($hide)
114 114
 		$classes .= ' hidden'; ?>
115 115
 
116
-	<div id="welcome-panel" class="<?php echo esc_attr( $classes ); ?>">
117
-		<?php wp_nonce_field( 'welcome-panel-nonce', 'welcomepanelnonce', false ); ?>
118
-		<a class="welcome-panel-close" href="<?php echo esc_url( admin_url( '?welcome=0' ) ); ?>" aria-label="<?php esc_attr_e( 'Dismiss the welcome panel' ); ?>"><?php _e( 'Dismiss' ); ?></a>
116
+	<div id="welcome-panel" class="<?php echo esc_attr($classes); ?>">
117
+		<?php wp_nonce_field('welcome-panel-nonce', 'welcomepanelnonce', false); ?>
118
+		<a class="welcome-panel-close" href="<?php echo esc_url(admin_url('?welcome=0')); ?>" aria-label="<?php esc_attr_e('Dismiss the welcome panel'); ?>"><?php _e('Dismiss'); ?></a>
119 119
 		<?php
120 120
 		/**
121 121
 		 * Add content to the welcome panel on the admin dashboard.
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
 		 *
127 127
 		 * @since 3.5.0
128 128
 		 */
129
-		do_action( 'welcome_panel' );
129
+		do_action('welcome_panel');
130 130
 		?>
131 131
 	</div>
132 132
 <?php endif; ?>
@@ -138,4 +138,4 @@  discard block
 block discarded – undo
138 138
 </div><!-- wrap -->
139 139
 
140 140
 <?php
141
-require( ABSPATH . 'wp-admin/admin-footer.php' );
141
+require(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
src/wp-includes/ms-settings.php 1 patch
Spacing   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -23,19 +23,19 @@  discard block
 block discarded – undo
23 23
 global $current_site, $current_blog;
24 24
 
25 25
 /** WP_Network class */
26
-require_once( ABSPATH . WPINC . '/class-wp-network.php' );
26
+require_once(ABSPATH.WPINC.'/class-wp-network.php');
27 27
 
28 28
 /** WP_Site class */
29
-require_once( ABSPATH . WPINC . '/class-wp-site.php' );
29
+require_once(ABSPATH.WPINC.'/class-wp-site.php');
30 30
 
31 31
 /** Multisite loader */
32
-require_once( ABSPATH . WPINC . '/ms-load.php' );
32
+require_once(ABSPATH.WPINC.'/ms-load.php');
33 33
 
34 34
 /** Default Multisite constants */
35
-require_once( ABSPATH . WPINC . '/ms-default-constants.php' );
35
+require_once(ABSPATH.WPINC.'/ms-default-constants.php');
36 36
 
37
-if ( defined( 'SUNRISE' ) ) {
38
-	include_once( WP_CONTENT_DIR . '/sunrise.php' );
37
+if (defined('SUNRISE')) {
38
+	include_once(WP_CONTENT_DIR.'/sunrise.php');
39 39
 }
40 40
 
41 41
 /** Check for and define SUBDOMAIN_INSTALL and the deprecated VHOST constant. */
@@ -43,50 +43,50 @@  discard block
 block discarded – undo
43 43
 
44 44
 // This block will process a request if the current network or current site objects
45 45
 // have not been populated in the global scope through something like `sunrise.php`.
46
-if ( !isset( $current_site ) || !isset( $current_blog ) ) {
47
-
48
-	$domain = strtolower( stripslashes( $_SERVER['HTTP_HOST'] ) );
49
-	if ( substr( $domain, -3 ) == ':80' ) {
50
-		$domain = substr( $domain, 0, -3 );
51
-		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -3 );
52
-	} elseif ( substr( $domain, -4 ) == ':443' ) {
53
-		$domain = substr( $domain, 0, -4 );
54
-		$_SERVER['HTTP_HOST'] = substr( $_SERVER['HTTP_HOST'], 0, -4 );
46
+if ( ! isset($current_site) || ! isset($current_blog)) {
47
+
48
+	$domain = strtolower(stripslashes($_SERVER['HTTP_HOST']));
49
+	if (substr($domain, -3) == ':80') {
50
+		$domain = substr($domain, 0, -3);
51
+		$_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'], 0, -3);
52
+	} elseif (substr($domain, -4) == ':443') {
53
+		$domain = substr($domain, 0, -4);
54
+		$_SERVER['HTTP_HOST'] = substr($_SERVER['HTTP_HOST'], 0, -4);
55 55
 	}
56 56
 
57
-	$path = stripslashes( $_SERVER['REQUEST_URI'] );
58
-	if ( is_admin() ) {
59
-		$path = preg_replace( '#(.*)/wp-admin/.*#', '$1/', $path );
57
+	$path = stripslashes($_SERVER['REQUEST_URI']);
58
+	if (is_admin()) {
59
+		$path = preg_replace('#(.*)/wp-admin/.*#', '$1/', $path);
60 60
 	}
61
-	list( $path ) = explode( '?', $path );
61
+	list($path) = explode('?', $path);
62 62
 
63
-	$bootstrap_result = ms_load_current_site_and_network( $domain, $path, is_subdomain_install() );
63
+	$bootstrap_result = ms_load_current_site_and_network($domain, $path, is_subdomain_install());
64 64
 
65
-	if ( true === $bootstrap_result ) {
65
+	if (true === $bootstrap_result) {
66 66
 		// `$current_blog` and `$current_site are now populated.
67
-	} elseif ( false === $bootstrap_result ) {
68
-		ms_not_installed( $domain, $path );
67
+	} elseif (false === $bootstrap_result) {
68
+		ms_not_installed($domain, $path);
69 69
 	} else {
70
-		header( 'Location: ' . $bootstrap_result );
70
+		header('Location: '.$bootstrap_result);
71 71
 		exit;
72 72
 	}
73
-	unset( $bootstrap_result );
73
+	unset($bootstrap_result);
74 74
 
75 75
 	$blog_id = $current_blog->blog_id;
76 76
 	$public  = $current_blog->public;
77 77
 
78
-	if ( empty( $current_blog->site_id ) ) {
78
+	if (empty($current_blog->site_id)) {
79 79
 		// This dates to [MU134] and shouldn't be relevant anymore,
80 80
 		// but it could be possible for arguments passed to insert_blog() etc.
81 81
 		$current_blog->site_id = 1;
82 82
 	}
83 83
 
84 84
 	$site_id = $current_blog->site_id;
85
-	wp_load_core_site_options( $site_id );
85
+	wp_load_core_site_options($site_id);
86 86
 }
87 87
 
88
-$wpdb->set_prefix( $table_prefix, false ); // $table_prefix can be set in sunrise.php
89
-$wpdb->set_blog_id( $current_blog->blog_id, $current_blog->site_id );
88
+$wpdb->set_prefix($table_prefix, false); // $table_prefix can be set in sunrise.php
89
+$wpdb->set_blog_id($current_blog->blog_id, $current_blog->site_id);
90 90
 $table_prefix = $wpdb->get_blog_prefix();
91 91
 $_wp_switched_stack = array();
92 92
 $switched = false;
@@ -94,12 +94,12 @@  discard block
 block discarded – undo
94 94
 // need to init cache again after blog_id is set
95 95
 wp_start_object_cache();
96 96
 
97
-if ( ! $current_site instanceof WP_Network ) {
98
-	$current_site = new WP_Network( $current_site );
97
+if ( ! $current_site instanceof WP_Network) {
98
+	$current_site = new WP_Network($current_site);
99 99
 }
100 100
 
101
-if ( ! $current_blog instanceof WP_Site ) {
102
-	$current_blog = new WP_Site( $current_blog );
101
+if ( ! $current_blog instanceof WP_Site) {
102
+	$current_blog = new WP_Site($current_blog);
103 103
 }
104 104
 
105 105
 // Define upload directory constants
@@ -111,4 +111,4 @@  discard block
 block discarded – undo
111 111
  *
112 112
  * @since 4.6.0
113 113
  */
114
-do_action( 'ms_loaded' );
114
+do_action('ms_loaded');
Please login to merge, or discard this patch.
src/wp-includes/embed-template.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
  * @deprecated 4.5.0 Moved to wp-includes/theme-compat/embed.php
9 9
  */
10 10
 
11
-_deprecated_file( basename( __FILE__ ), '4.5.0', 'wp-includes/theme-compat/embed.php' );
11
+_deprecated_file(basename(__FILE__), '4.5.0', 'wp-includes/theme-compat/embed.php');
12 12
 
13
-include( ABSPATH . WPINC . '/theme-compat/embed.php' );
13
+include(ABSPATH.WPINC.'/theme-compat/embed.php');
Please login to merge, or discard this patch.