Passed
Push — main ( 16d49b...d78e29 )
by TARIQ
111:03
created
brighty/wp-admin/theme-editor.php 1 patch
Braces   +8 added lines, -3 removed lines patch added patch discarded remove patch
@@ -277,10 +277,13 @@  discard block
 block discarded – undo
277 277
 <?php
278 278
 if ( $error ) :
279 279
 	echo '<div class="error"><p>' . __( 'File does not exist! Please double check the name and try again.' ) . '</p></div>';
280
-else :
280
+else {
281
+    :
281 282
 	?>
282 283
 	<form name="template" id="template" action="theme-editor.php" method="post">
283
-		<?php wp_nonce_field( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce' ); ?>
284
+		<?php wp_nonce_field( 'edit-theme_' . $stylesheet . '_' . $relative_file, 'nonce' );
285
+}
286
+?>
284 287
 		<div>
285 288
 			<label for="newcontent" id="theme-plugin-editor-label"><?php _e( 'Selected file content:' ); ?></label>
286 289
 			<textarea cols="70" rows="30" name="newcontent" id="newcontent" aria-describedby="editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4"><?php echo $content; ?></textarea>
@@ -315,7 +318,8 @@  discard block
 block discarded – undo
315 318
 					<?php submit_button( __( 'Update File' ), 'primary', 'submit', false ); ?>
316 319
 					<span class="spinner"></span>
317 320
 				</p>
318
-			<?php else : ?>
321
+			<?php else {
322
+    : ?>
319 323
 				<p>
320 324
 					<?php
321 325
 					printf(
@@ -323,6 +327,7 @@  discard block
 block discarded – undo
323 327
 						__( 'You need to make this file writable before you can save your changes. See <a href="%s">Changing File Permissions</a> for more information.' ),
324 328
 						__( 'https://wordpress.org/support/article/changing-file-permissions/' )
325 329
 					);
330
+}
326 331
 					?>
327 332
 				</p>
328 333
 			<?php endif; ?>
Please login to merge, or discard this patch.
brighty/wp-admin/post.php 1 patch
Switch Indentation   +263 added lines, -263 removed lines patch added patch discarded remove patch
@@ -70,108 +70,108 @@  discard block
 block discarded – undo
70 70
 }
71 71
 
72 72
 switch ( $action ) {
73
-	case 'post-quickdraft-save':
74
-		// Check nonce and capabilities.
75
-		$nonce     = $_REQUEST['_wpnonce'];
76
-		$error_msg = false;
77
-
78
-		// For output of the Quick Draft dashboard widget.
79
-		require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
-
81
-		if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
-			$error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
-		}
84
-
85
-		if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
-			exit;
87
-		}
88
-
89
-		if ( $error_msg ) {
90
-			return wp_dashboard_quick_press( $error_msg );
91
-		}
92
-
93
-		$post = get_post( $_REQUEST['post_ID'] );
94
-		check_admin_referer( 'add-' . $post->post_type );
95
-
96
-		$_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
-		$_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
-
99
-		// Wrap Quick Draft content in the Paragraph block.
100
-		if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
-			$_POST['content'] = sprintf(
102
-				'<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
-				str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
-			);
105
-		}
106
-
107
-		edit_post();
108
-		wp_dashboard_quick_press();
109
-		exit;
110
-
111
-	case 'postajaxpost':
112
-	case 'post':
113
-		check_admin_referer( 'add-' . $post_type );
114
-		$post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
-		redirect_post( $post_id );
116
-		exit;
117
-
118
-	case 'edit':
119
-		$editing = true;
120
-
121
-		if ( empty( $post_id ) ) {
122
-			wp_redirect( admin_url( 'post.php' ) );
123
-			exit;
124
-		}
125
-
126
-		if ( ! $post ) {
127
-			wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
-		}
129
-
130
-		if ( ! $post_type_object ) {
131
-			wp_die( __( 'Invalid post type.' ) );
132
-		}
133
-
134
-		if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
-			wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
-		}
137
-
138
-		if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
-			wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
-		}
141
-
142
-		if ( 'trash' === $post->post_status ) {
143
-			wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
-		}
145
-
146
-		if ( ! empty( $_GET['get-post-lock'] ) ) {
147
-			check_admin_referer( 'lock-post_' . $post_id );
148
-			wp_set_post_lock( $post_id );
149
-			wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
-			exit;
151
-		}
152
-
153
-		$post_type = $post->post_type;
154
-		if ( 'post' === $post_type ) {
155
-			$parent_file   = 'edit.php';
156
-			$submenu_file  = 'edit.php';
157
-			$post_new_file = 'post-new.php';
158
-		} elseif ( 'attachment' === $post_type ) {
159
-			$parent_file   = 'upload.php';
160
-			$submenu_file  = 'upload.php';
161
-			$post_new_file = 'media-new.php';
162
-		} else {
163
-			if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
-				$parent_file = $post_type_object->show_in_menu;
165
-			} else {
166
-				$parent_file = "edit.php?post_type=$post_type";
167
-			}
168
-			$submenu_file  = "edit.php?post_type=$post_type";
169
-			$post_new_file = "post-new.php?post_type=$post_type";
170
-		}
171
-
172
-		$title = $post_type_object->labels->edit_item;
173
-
174
-		/**
73
+	    case 'post-quickdraft-save':
74
+		    // Check nonce and capabilities.
75
+		    $nonce     = $_REQUEST['_wpnonce'];
76
+		    $error_msg = false;
77
+
78
+		    // For output of the Quick Draft dashboard widget.
79
+		    require_once ABSPATH . 'wp-admin/includes/dashboard.php';
80
+
81
+		    if ( ! wp_verify_nonce( $nonce, 'add-post' ) ) {
82
+			    $error_msg = __( 'Unable to submit this form, please refresh and try again.' );
83
+		    }
84
+
85
+		    if ( ! current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) {
86
+			    exit;
87
+		    }
88
+
89
+		    if ( $error_msg ) {
90
+			    return wp_dashboard_quick_press( $error_msg );
91
+		    }
92
+
93
+		    $post = get_post( $_REQUEST['post_ID'] );
94
+		    check_admin_referer( 'add-' . $post->post_type );
95
+
96
+		    $_POST['comment_status'] = get_default_comment_status( $post->post_type );
97
+		    $_POST['ping_status']    = get_default_comment_status( $post->post_type, 'pingback' );
98
+
99
+		    // Wrap Quick Draft content in the Paragraph block.
100
+		    if ( false === strpos( $_POST['content'], '<!-- wp:paragraph -->' ) ) {
101
+			    $_POST['content'] = sprintf(
102
+				    '<!-- wp:paragraph -->%s<!-- /wp:paragraph -->',
103
+				    str_replace( array( "\r\n", "\r", "\n" ), '<br />', $_POST['content'] )
104
+			    );
105
+		    }
106
+
107
+		    edit_post();
108
+		    wp_dashboard_quick_press();
109
+		    exit;
110
+
111
+	    case 'postajaxpost':
112
+	    case 'post':
113
+		    check_admin_referer( 'add-' . $post_type );
114
+		    $post_id = 'postajaxpost' === $action ? edit_post() : write_post();
115
+		    redirect_post( $post_id );
116
+		    exit;
117
+
118
+	    case 'edit':
119
+		    $editing = true;
120
+
121
+		    if ( empty( $post_id ) ) {
122
+			    wp_redirect( admin_url( 'post.php' ) );
123
+			    exit;
124
+		    }
125
+
126
+		    if ( ! $post ) {
127
+			    wp_die( __( 'You attempted to edit an item that does not exist. Perhaps it was deleted?' ) );
128
+		    }
129
+
130
+		    if ( ! $post_type_object ) {
131
+			    wp_die( __( 'Invalid post type.' ) );
132
+		    }
133
+
134
+		    if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
135
+			    wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
136
+		    }
137
+
138
+		    if ( ! current_user_can( 'edit_post', $post_id ) ) {
139
+			    wp_die( __( 'Sorry, you are not allowed to edit this item.' ) );
140
+		    }
141
+
142
+		    if ( 'trash' === $post->post_status ) {
143
+			    wp_die( __( 'You cannot edit this item because it is in the Trash. Please restore it and try again.' ) );
144
+		    }
145
+
146
+		    if ( ! empty( $_GET['get-post-lock'] ) ) {
147
+			    check_admin_referer( 'lock-post_' . $post_id );
148
+			    wp_set_post_lock( $post_id );
149
+			    wp_redirect( get_edit_post_link( $post_id, 'url' ) );
150
+			    exit;
151
+		    }
152
+
153
+		    $post_type = $post->post_type;
154
+		    if ( 'post' === $post_type ) {
155
+			    $parent_file   = 'edit.php';
156
+			    $submenu_file  = 'edit.php';
157
+			    $post_new_file = 'post-new.php';
158
+		    } elseif ( 'attachment' === $post_type ) {
159
+			    $parent_file   = 'upload.php';
160
+			    $submenu_file  = 'upload.php';
161
+			    $post_new_file = 'media-new.php';
162
+		    } else {
163
+			    if ( isset( $post_type_object ) && $post_type_object->show_in_menu && true !== $post_type_object->show_in_menu ) {
164
+				    $parent_file = $post_type_object->show_in_menu;
165
+			    } else {
166
+				    $parent_file = "edit.php?post_type=$post_type";
167
+			    }
168
+			    $submenu_file  = "edit.php?post_type=$post_type";
169
+			    $post_new_file = "post-new.php?post_type=$post_type";
170
+		    }
171
+
172
+		    $title = $post_type_object->labels->edit_item;
173
+
174
+		    /**
175 175
 		 * Allows replacement of the editor.
176 176
 		 *
177 177
 		 * @since 4.9.0
@@ -179,179 +179,179 @@  discard block
 block discarded – undo
179 179
 		 * @param bool    $replace Whether to replace the editor. Default false.
180 180
 		 * @param WP_Post $post    Post object.
181 181
 		 */
182
-		if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
-			break;
184
-		}
185
-
186
-		if ( use_block_editor_for_post( $post ) ) {
187
-			require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
-			break;
189
-		}
190
-
191
-		if ( ! wp_check_post_lock( $post->ID ) ) {
192
-			$active_post_lock = wp_set_post_lock( $post->ID );
193
-
194
-			if ( 'attachment' !== $post_type ) {
195
-				wp_enqueue_script( 'autosave' );
196
-			}
197
-		}
198
-
199
-		$post = get_post( $post_id, OBJECT, 'edit' );
200
-
201
-		if ( post_type_supports( $post_type, 'comments' ) ) {
202
-			wp_enqueue_script( 'admin-comments' );
203
-			enqueue_comment_hotkeys_js();
204
-		}
205
-
206
-		require ABSPATH . 'wp-admin/edit-form-advanced.php';
182
+		    if ( true === apply_filters( 'replace_editor', false, $post ) ) {
183
+			    break;
184
+		    }
207 185
 
208
-		break;
186
+		    if ( use_block_editor_for_post( $post ) ) {
187
+			    require ABSPATH . 'wp-admin/edit-form-blocks.php';
188
+			    break;
189
+		    }
209 190
 
210
-	case 'editattachment':
211
-		check_admin_referer( 'update-post_' . $post_id );
191
+		    if ( ! wp_check_post_lock( $post->ID ) ) {
192
+			    $active_post_lock = wp_set_post_lock( $post->ID );
212 193
 
213
-		// Don't let these be changed.
214
-		unset( $_POST['guid'] );
215
-		$_POST['post_type'] = 'attachment';
194
+			    if ( 'attachment' !== $post_type ) {
195
+				    wp_enqueue_script( 'autosave' );
196
+			    }
197
+		    }
216 198
 
217
-		// Update the thumbnail filename.
218
-		$newmeta          = wp_get_attachment_metadata( $post_id, true );
219
-		$newmeta['thumb'] = wp_basename( $_POST['thumb'] );
199
+		    $post = get_post( $post_id, OBJECT, 'edit' );
220 200
 
221
-		wp_update_attachment_metadata( $post_id, $newmeta );
201
+		    if ( post_type_supports( $post_type, 'comments' ) ) {
202
+			    wp_enqueue_script( 'admin-comments' );
203
+			    enqueue_comment_hotkeys_js();
204
+		    }
205
+
206
+		    require ABSPATH . 'wp-admin/edit-form-advanced.php';
222 207
 
223
-		// Intentional fall-through to trigger the edit_post() call.
224
-	case 'editpost':
225
-		check_admin_referer( 'update-post_' . $post_id );
208
+		    break;
209
+
210
+	    case 'editattachment':
211
+		    check_admin_referer( 'update-post_' . $post_id );
226 212
 
227
-		$post_id = edit_post();
213
+		    // Don't let these be changed.
214
+		    unset( $_POST['guid'] );
215
+		    $_POST['post_type'] = 'attachment';
228 216
 
229
-		// Session cookie flag that the post was saved.
230
-		if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
-			setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
-		}
233
-
234
-		redirect_post( $post_id ); // Send user on their way while we keep working.
217
+		    // Update the thumbnail filename.
218
+		    $newmeta          = wp_get_attachment_metadata( $post_id, true );
219
+		    $newmeta['thumb'] = wp_basename( $_POST['thumb'] );
235 220
 
236
-		exit;
221
+		    wp_update_attachment_metadata( $post_id, $newmeta );
222
+
223
+		    // Intentional fall-through to trigger the edit_post() call.
224
+	    case 'editpost':
225
+		    check_admin_referer( 'update-post_' . $post_id );
226
+
227
+		    $post_id = edit_post();
228
+
229
+		    // Session cookie flag that the post was saved.
230
+		    if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
231
+			    setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS, ADMIN_COOKIE_PATH, COOKIE_DOMAIN, is_ssl() );
232
+		    }
233
+
234
+		    redirect_post( $post_id ); // Send user on their way while we keep working.
235
+
236
+		    exit;
237
+
238
+	    case 'trash':
239
+		    check_admin_referer( 'trash-post_' . $post_id );
237 240
 
238
-	case 'trash':
239
-		check_admin_referer( 'trash-post_' . $post_id );
241
+		    if ( ! $post ) {
242
+			    wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
+		    }
240 244
 
241
-		if ( ! $post ) {
242
-			wp_die( __( 'The item you are trying to move to the Trash no longer exists.' ) );
243
-		}
244
-
245
-		if ( ! $post_type_object ) {
246
-			wp_die( __( 'Invalid post type.' ) );
247
-		}
245
+		    if ( ! $post_type_object ) {
246
+			    wp_die( __( 'Invalid post type.' ) );
247
+		    }
248
+
249
+		    if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
+			    wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
+		    }
248 252
 
249
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
250
-			wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
251
-		}
252
-
253
-		$user_id = wp_check_post_lock( $post_id );
254
-		if ( $user_id ) {
255
-			$user = get_userdata( $user_id );
256
-			/* translators: %s: User's display name. */
257
-			wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
-		}
259
-
260
-		if ( ! wp_trash_post( $post_id ) ) {
261
-			wp_die( __( 'Error in moving the item to Trash.' ) );
262
-		}
263
-
264
-		wp_redirect(
265
-			add_query_arg(
266
-				array(
267
-					'trashed' => 1,
268
-					'ids'     => $post_id,
269
-				),
270
-				$sendback
271
-			)
272
-		);
273
-		exit;
274
-
275
-	case 'untrash':
276
-		check_admin_referer( 'untrash-post_' . $post_id );
277
-
278
-		if ( ! $post ) {
279
-			wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
-		}
281
-
282
-		if ( ! $post_type_object ) {
283
-			wp_die( __( 'Invalid post type.' ) );
284
-		}
253
+		    $user_id = wp_check_post_lock( $post_id );
254
+		    if ( $user_id ) {
255
+			    $user = get_userdata( $user_id );
256
+			    /* translators: %s: User's display name. */
257
+			    wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) );
258
+		    }
259
+
260
+		    if ( ! wp_trash_post( $post_id ) ) {
261
+			    wp_die( __( 'Error in moving the item to Trash.' ) );
262
+		    }
263
+
264
+		    wp_redirect(
265
+			    add_query_arg(
266
+				    array(
267
+					    'trashed' => 1,
268
+					    'ids'     => $post_id,
269
+				    ),
270
+				    $sendback
271
+			    )
272
+		    );
273
+		    exit;
274
+
275
+	    case 'untrash':
276
+		    check_admin_referer( 'untrash-post_' . $post_id );
277
+
278
+		    if ( ! $post ) {
279
+			    wp_die( __( 'The item you are trying to restore from the Trash no longer exists.' ) );
280
+		    }
281
+
282
+		    if ( ! $post_type_object ) {
283
+			    wp_die( __( 'Invalid post type.' ) );
284
+		    }
285 285
 
286
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
-			wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
-		}
289
-
290
-		if ( ! wp_untrash_post( $post_id ) ) {
291
-			wp_die( __( 'Error in restoring the item from Trash.' ) );
292
-		}
293
-
294
-		$sendback = add_query_arg(
295
-			array(
296
-				'untrashed' => 1,
297
-				'ids'       => $post_id,
298
-			),
299
-			$sendback
300
-		);
301
-		wp_redirect( $sendback );
302
-		exit;
303
-
304
-	case 'delete':
305
-		check_admin_referer( 'delete-post_' . $post_id );
306
-
307
-		if ( ! $post ) {
308
-			wp_die( __( 'This item has already been deleted.' ) );
309
-		}
310
-
311
-		if ( ! $post_type_object ) {
312
-			wp_die( __( 'Invalid post type.' ) );
313
-		}
314
-
315
-		if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
-			wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
-		}
318
-
319
-		if ( 'attachment' === $post->post_type ) {
320
-			$force = ( ! MEDIA_TRASH );
321
-			if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
-				wp_die( __( 'Error in deleting the attachment.' ) );
323
-			}
324
-		} else {
325
-			if ( ! wp_delete_post( $post_id, true ) ) {
326
-				wp_die( __( 'Error in deleting the item.' ) );
327
-			}
328
-		}
329
-
330
-		wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
-		exit;
332
-
333
-	case 'preview':
334
-		check_admin_referer( 'update-post_' . $post_id );
335
-
336
-		$url = post_preview();
337
-
338
-		wp_redirect( $url );
339
-		exit;
340
-
341
-	case 'toggle-custom-fields':
342
-		check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
-
344
-		$current_user_id = get_current_user_id();
345
-		if ( $current_user_id ) {
346
-			$enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
-			update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
-		}
286
+		    if ( ! current_user_can( 'delete_post', $post_id ) ) {
287
+			    wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
288
+		    }
349 289
 
350
-		wp_safe_redirect( wp_get_referer() );
351
-		exit;
290
+		    if ( ! wp_untrash_post( $post_id ) ) {
291
+			    wp_die( __( 'Error in restoring the item from Trash.' ) );
292
+		    }
352 293
 
353
-	default:
354
-		/**
294
+		    $sendback = add_query_arg(
295
+			    array(
296
+				    'untrashed' => 1,
297
+				    'ids'       => $post_id,
298
+			    ),
299
+			    $sendback
300
+		    );
301
+		    wp_redirect( $sendback );
302
+		    exit;
303
+
304
+	    case 'delete':
305
+		    check_admin_referer( 'delete-post_' . $post_id );
306
+
307
+		    if ( ! $post ) {
308
+			    wp_die( __( 'This item has already been deleted.' ) );
309
+		    }
310
+
311
+		    if ( ! $post_type_object ) {
312
+			    wp_die( __( 'Invalid post type.' ) );
313
+		    }
314
+
315
+		    if ( ! current_user_can( 'delete_post', $post_id ) ) {
316
+			    wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
317
+		    }
318
+
319
+		    if ( 'attachment' === $post->post_type ) {
320
+			    $force = ( ! MEDIA_TRASH );
321
+			    if ( ! wp_delete_attachment( $post_id, $force ) ) {
322
+				    wp_die( __( 'Error in deleting the attachment.' ) );
323
+			    }
324
+		    } else {
325
+			    if ( ! wp_delete_post( $post_id, true ) ) {
326
+				    wp_die( __( 'Error in deleting the item.' ) );
327
+			    }
328
+		    }
329
+
330
+		    wp_redirect( add_query_arg( 'deleted', 1, $sendback ) );
331
+		    exit;
332
+
333
+	    case 'preview':
334
+		    check_admin_referer( 'update-post_' . $post_id );
335
+
336
+		    $url = post_preview();
337
+
338
+		    wp_redirect( $url );
339
+		    exit;
340
+
341
+	    case 'toggle-custom-fields':
342
+		    check_admin_referer( 'toggle-custom-fields', 'toggle-custom-fields-nonce' );
343
+
344
+		    $current_user_id = get_current_user_id();
345
+		    if ( $current_user_id ) {
346
+			    $enable_custom_fields = (bool) get_user_meta( $current_user_id, 'enable_custom_fields', true );
347
+			    update_user_meta( $current_user_id, 'enable_custom_fields', ! $enable_custom_fields );
348
+		    }
349
+
350
+		    wp_safe_redirect( wp_get_referer() );
351
+		    exit;
352
+
353
+	    default:
354
+		    /**
355 355
 		 * Fires for a given custom post action request.
356 356
 		 *
357 357
 		 * The dynamic portion of the hook name, `$action`, refers to the custom post action.
@@ -360,10 +360,10 @@  discard block
 block discarded – undo
360 360
 		 *
361 361
 		 * @param int $post_id Post ID sent with the request.
362 362
 		 */
363
-		do_action( "post_action_{$action}", $post_id );
363
+		    do_action( "post_action_{$action}", $post_id );
364 364
 
365
-		wp_redirect( admin_url( 'edit.php' ) );
366
-		exit;
365
+		    wp_redirect( admin_url( 'edit.php' ) );
366
+		    exit;
367 367
 } // End switch.
368 368
 
369 369
 require_once ABSPATH . 'wp-admin/admin-footer.php';
Please login to merge, or discard this patch.
brighty/wp-admin/options-media.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -139,10 +139,13 @@
 block discarded – undo
139 139
 </tr>
140 140
 <tr>
141 141
 <td colspan="2" class="td-full">
142
-<?php else : ?>
142
+<?php else {
143
+    : ?>
143 144
 <tr>
144 145
 <td class="td-full">
145
-<?php endif; ?>
146
+<?php endif;
147
+}
148
+?>
146 149
 <label for="uploads_use_yearmonth_folders">
147 150
 <input name="uploads_use_yearmonth_folders" type="checkbox" id="uploads_use_yearmonth_folders" value="1"<?php checked( '1', get_option( 'uploads_use_yearmonth_folders' ) ); ?> />
148 151
 	<?php _e( 'Organize my uploads into month- and year-based folders' ); ?>
Please login to merge, or discard this patch.
brighty/wp-admin/options-permalink.php 1 patch
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -390,7 +390,8 @@  discard block
 block discarded – undo
390 390
 				);
391 391
 				?>
392 392
 </p>
393
-		<?php else : ?>
393
+		<?php else {
394
+    : ?>
394 395
 <p id="iis-description-b">
395 396
 			<?php
396 397
 			printf(
@@ -401,6 +402,7 @@  discard block
 block discarded – undo
401 402
 				'<kbd>Ctrl + A</kbd>',
402 403
 				'<kbd>⌘ + A</kbd>'
403 404
 			);
405
+}
404 406
 			?>
405 407
 </p>
406 408
 <form action="options-permalink.php" method="post">
@@ -419,7 +421,8 @@  discard block
 block discarded – undo
419 421
 		<?php endif; ?>
420 422
 	<?php endif; ?>
421 423
 		<?php
422
-else :
424
+else {
425
+    :
423 426
 	if ( $permalink_structure && ! $using_index_permalinks && ! $writable && $htaccess_update_required ) :
424 427
 		?>
425 428
 <p id="htaccess-description">
@@ -432,6 +435,7 @@  discard block
 block discarded – undo
432 435
 			'<kbd>Ctrl + A</kbd>',
433 436
 			'<kbd>⌘ + A</kbd>'
434 437
 		);
438
+}
435 439
 		?>
436 440
 </p>
437 441
 <form action="options-permalink.php" method="post">
Please login to merge, or discard this patch.
brighty/wp-admin/customize.php 1 patch
Braces   +5 added lines, -2 removed lines patch added patch discarded remove patch
@@ -195,8 +195,11 @@
 block discarded – undo
195 195
 					<?php submit_button( $save_text, 'primary save', 'save', false ); ?>
196 196
 					<button id="publish-settings" class="publish-settings button-primary button dashicons dashicons-admin-generic" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled></button>
197 197
 				</div>
198
-			<?php else : ?>
199
-				<?php $save_text = _x( 'Cannot Activate', 'theme' ); ?>
198
+			<?php else {
199
+    : ?>
200
+				<?php $save_text = _x( 'Cannot Activate', 'theme' );
201
+}
202
+?>
200 203
 				<div id="customize-save-button-wrapper" class="customize-save-button-wrapper disabled" >
201 204
 					<button class="button button-primary disabled" aria-label="<?php esc_attr_e( 'Publish Settings' ); ?>" aria-expanded="false" disabled><?php echo $save_text; ?></button>
202 205
 				</div>
Please login to merge, or discard this patch.
brighty/wp-admin/my-sites.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -77,7 +77,8 @@  discard block
 block discarded – undo
77 77
 	echo '<p>';
78 78
 	_e( 'You must be a member of at least one site to use this page.' );
79 79
 	echo '</p>';
80
-else :
80
+else {
81
+    :
81 82
 	?>
82 83
 
83 84
 <hr class="wp-header-end">
@@ -85,6 +86,7 @@  discard block
 block discarded – undo
85 86
 <form id="myblogs" method="post">
86 87
 	<?php
87 88
 	choose_primary_blog();
89
+}
88 90
 	/**
89 91
 	 * Fires before the sites list on the My Sites screen.
90 92
 	 *
Please login to merge, or discard this patch.
brighty/wp-admin/users.php 1 patch
Braces   +30 added lines, -12 removed lines patch added patch discarded remove patch
@@ -326,8 +326,11 @@  discard block
 block discarded – undo
326 326
 
327 327
 		<?php if ( 1 === count( $all_userids ) ) : ?>
328 328
 	<p><?php _e( 'You have specified this user for deletion:' ); ?></p>
329
-		<?php else : ?>
330
-	<p><?php _e( 'You have specified these users for deletion:' ); ?></p>
329
+		<?php else {
330
+    : ?>
331
+	<p><?php _e( 'You have specified these users for deletion:' );
332
+}
333
+?></p>
331 334
 		<?php endif; ?>
332 335
 
333 336
 <ul>
@@ -352,11 +355,17 @@  discard block
 block discarded – undo
352 355
 			if ( ! $users_have_content ) :
353 356
 				?>
354 357
 			<input type="hidden" name="delete_option" value="delete" />
355
-			<?php else : ?>
358
+			<?php else {
359
+    : ?>
356 360
 				<?php if ( 1 == $go_delete ) : ?>
357
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' ); ?></legend></p>
358
-		<?php else : ?>
359
-			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' ); ?></legend></p>
361
+			<fieldset><p><legend><?php _e( 'What should be done with content owned by this user?' );
362
+}
363
+?></legend></p>
364
+		<?php else {
365
+    : ?>
366
+			<fieldset><p><legend><?php _e( 'What should be done with content owned by these users?' );
367
+}
368
+?></legend></p>
360 369
 		<?php endif; ?>
361 370
 		<ul style="list-style:none;">
362 371
 			<li><label><input type="radio" id="delete_option0" name="delete_option" value="delete" />
@@ -389,8 +398,11 @@  discard block
 block discarded – undo
389 398
 			?>
390 399
 	<input type="hidden" name="action" value="dodelete" />
391 400
 			<?php submit_button( __( 'Confirm Deletion' ), 'primary' ); ?>
392
-	<?php else : ?>
393
-	<p><?php _e( 'There are no valid users selected for deletion.' ); ?></p>
401
+	<?php else {
402
+    : ?>
403
+	<p><?php _e( 'There are no valid users selected for deletion.' );
404
+}
405
+?></p>
394 406
 	<?php endif; ?>
395 407
 	</div>
396 408
 	</form>
@@ -463,8 +475,11 @@  discard block
 block discarded – undo
463 475
 
464 476
 		<?php if ( 1 === count( $userids ) ) : ?>
465 477
 	<p><?php _e( 'You have specified this user for removal:' ); ?></p>
466
-		<?php else : ?>
467
-	<p><?php _e( 'You have specified these users for removal:' ); ?></p>
478
+		<?php else {
479
+    : ?>
480
+	<p><?php _e( 'You have specified these users for removal:' );
481
+}
482
+?></p>
468 483
 		<?php endif; ?>
469 484
 
470 485
 <ul>
@@ -487,8 +502,11 @@  discard block
 block discarded – undo
487 502
 		<?php if ( $go_remove ) : ?>
488 503
 		<input type="hidden" name="action" value="doremove" />
489 504
 			<?php submit_button( __( 'Confirm Removal' ), 'primary' ); ?>
490
-	<?php else : ?>
491
-	<p><?php _e( 'There are no valid users selected for removal.' ); ?></p>
505
+	<?php else {
506
+    : ?>
507
+	<p><?php _e( 'There are no valid users selected for removal.' );
508
+}
509
+?></p>
492 510
 	<?php endif; ?>
493 511
 	</div>
494 512
 	</form>
Please login to merge, or discard this patch.
brighty/wp-admin/includes/class-ftp.php 1 patch
Braces   +434 added lines, -168 removed lines patch added patch discarded remove patch
@@ -20,7 +20,9 @@  discard block
 block discarded – undo
20 20
  * @since 2.5.0
21 21
  * @var string
22 22
  */
23
-if(!defined('CRLF')) define('CRLF',"\r\n");
23
+if(!defined('CRLF')) {
24
+    define('CRLF',"\r\n");
25
+}
24 26
 
25 27
 /**
26 28
  * Sets whatever to autodetect ASCII mode.
@@ -30,7 +32,9 @@  discard block
 block discarded – undo
30 32
  * @since 2.5.0
31 33
  * @var int
32 34
  */
33
-if(!defined("FTP_AUTOASCII")) define("FTP_AUTOASCII", -1);
35
+if(!defined("FTP_AUTOASCII")) {
36
+    define("FTP_AUTOASCII", -1);
37
+}
34 38
 
35 39
 /**
36 40
  *
@@ -38,7 +42,9 @@  discard block
 block discarded – undo
38 42
  * @since 2.5.0
39 43
  * @var int
40 44
  */
41
-if(!defined("FTP_BINARY")) define("FTP_BINARY", 1);
45
+if(!defined("FTP_BINARY")) {
46
+    define("FTP_BINARY", 1);
47
+}
42 48
 
43 49
 /**
44 50
  *
@@ -46,7 +52,9 @@  discard block
 block discarded – undo
46 52
  * @since 2.5.0
47 53
  * @var int
48 54
  */
49
-if(!defined("FTP_ASCII")) define("FTP_ASCII", 0);
55
+if(!defined("FTP_ASCII")) {
56
+    define("FTP_ASCII", 0);
57
+}
50 58
 
51 59
 /**
52 60
  * Whether to force FTP.
@@ -56,7 +64,9 @@  discard block
 block discarded – undo
56 64
  * @since 2.5.0
57 65
  * @var bool
58 66
  */
59
-if(!defined('FTP_FORCE')) define('FTP_FORCE', true);
67
+if(!defined('FTP_FORCE')) {
68
+    define('FTP_FORCE', true);
69
+}
60 70
 
61 71
 /**
62 72
  * @since 2.5.0
@@ -149,8 +159,11 @@  discard block
 block discarded – undo
149 159
 	    $this->OS_local=FTP_OS_Unix;
150 160
 		$this->OS_remote=FTP_OS_Unix;
151 161
 		$this->features=array();
152
-		if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') $this->OS_local=FTP_OS_Windows;
153
-		elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') $this->OS_local=FTP_OS_Mac;
162
+		if(strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
163
+		    $this->OS_local=FTP_OS_Windows;
164
+		} elseif(strtoupper(substr(PHP_OS, 0, 3)) === 'MAC') {
165
+		    $this->OS_local=FTP_OS_Mac;
166
+		}
154 167
 	}
155 168
 
156 169
 	function ftp_base($port_mode=FALSE) {
@@ -167,10 +180,11 @@  discard block
 block discarded – undo
167 180
 			$b = array();
168 181
 			if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
169 182
 			$b['isdir'] = ($lucifer[7]=="<DIR>");
170
-			if ( $b['isdir'] )
171
-				$b['type'] = 'd';
172
-			else
173
-				$b['type'] = 'f';
183
+			if ( $b['isdir'] ) {
184
+							$b['type'] = 'd';
185
+			} else {
186
+							$b['type'] = 'f';
187
+			}
174 188
 			$b['size'] = $lucifer[7];
175 189
 			$b['month'] = $lucifer[1];
176 190
 			$b['day'] = $lucifer[2];
@@ -183,16 +197,19 @@  discard block
 block discarded – undo
183 197
 		} else if (!$is_windows && $lucifer=preg_split("/[ ]/",$line,9,PREG_SPLIT_NO_EMPTY)) {
184 198
 			//echo $line."\n";
185 199
 			$lcount=count($lucifer);
186
-			if ($lcount<8) return '';
200
+			if ($lcount<8) {
201
+			    return '';
202
+			}
187 203
 			$b = array();
188 204
 			$b['isdir'] = $lucifer[0][0] === "d";
189 205
 			$b['islink'] = $lucifer[0][0] === "l";
190
-			if ( $b['isdir'] )
191
-				$b['type'] = 'd';
192
-			elseif ( $b['islink'] )
193
-				$b['type'] = 'l';
194
-			else
195
-				$b['type'] = 'f';
206
+			if ( $b['isdir'] ) {
207
+							$b['type'] = 'd';
208
+			} elseif ( $b['islink'] ) {
209
+							$b['type'] = 'l';
210
+			} else {
211
+							$b['type'] = 'f';
212
+			}
196 213
 			$b['perms'] = $lucifer[0];
197 214
 			$b['number'] = $lucifer[1];
198 215
 			$b['owner'] = $lucifer[2];
@@ -245,20 +262,29 @@  discard block
 block discarded – undo
245 262
 		if($this->_ready) {
246 263
 			if($mode==FTP_BINARY) {
247 264
 				if($this->_curtype!=FTP_BINARY) {
248
-					if(!$this->_exec("TYPE I", "SetType")) return FALSE;
265
+					if(!$this->_exec("TYPE I", "SetType")) {
266
+					    return FALSE;
267
+					}
249 268
 					$this->_curtype=FTP_BINARY;
250 269
 				}
251 270
 			} elseif($this->_curtype!=FTP_ASCII) {
252
-				if(!$this->_exec("TYPE A", "SetType")) return FALSE;
271
+				if(!$this->_exec("TYPE A", "SetType")) {
272
+				    return FALSE;
273
+				}
253 274
 				$this->_curtype=FTP_ASCII;
254 275
 			}
255
-		} else return FALSE;
276
+		} else {
277
+		    return FALSE;
278
+		}
256 279
 		return TRUE;
257 280
 	}
258 281
 
259 282
 	function Passive($pasv=NULL) {
260
-		if(is_null($pasv)) $this->_passive=!$this->_passive;
261
-		else $this->_passive=$pasv;
283
+		if(is_null($pasv)) {
284
+		    $this->_passive=!$this->_passive;
285
+		} else {
286
+		    $this->_passive=$pasv;
287
+		}
262 288
 		if(!$this->_port_available and !$this->_passive) {
263 289
 			$this->SendMSG("Only passive connections available!");
264 290
 			$this->_passive=TRUE;
@@ -276,8 +302,12 @@  discard block
 block discarded – undo
276 302
 		} else {
277 303
 			$ip=@gethostbyname($host);
278 304
 	        $dns=@gethostbyaddr($host);
279
-	        if(!$ip) $ip=$host;
280
-	        if(!$dns) $dns=$host;
305
+	        if(!$ip) {
306
+	            $ip=$host;
307
+	        }
308
+	        if(!$dns) {
309
+	            $dns=$host;
310
+	        }
281 311
 	        // Validate the IPAddress PHP4 returns -1 for invalid, PHP5 false
282 312
 	        // -1 === "255.255.255.255" which is the broadcast address which is also going to be invalid
283 313
 	        $ipaslong = ip2long($ip);
@@ -294,8 +324,12 @@  discard block
 block discarded – undo
294 324
 		if($reconnect){
295 325
 			if($this->_connected) {
296 326
 				$this->SendMSG("Reconnecting");
297
-				if(!$this->quit(FTP_FORCE)) return FALSE;
298
-				if(!$this->connect()) return FALSE;
327
+				if(!$this->quit(FTP_FORCE)) {
328
+				    return FALSE;
329
+				}
330
+				if(!$this->connect()) {
331
+				    return FALSE;
332
+				}
299 333
 			}
300 334
 		}
301 335
 		return TRUE;
@@ -311,16 +345,21 @@  discard block
 block discarded – undo
311 345
 	function SetTimeout($timeout=30) {
312 346
 		$this->_timeout=$timeout;
313 347
 		$this->SendMSG("Timeout ".$this->_timeout);
314
-		if($this->_connected)
315
-			if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
348
+		if($this->_connected) {
349
+					if(!$this->_settimeout($this->_ftp_control_sock)) return FALSE;
350
+		}
316 351
 		return TRUE;
317 352
 	}
318 353
 
319 354
 	function connect($server=NULL) {
320 355
 		if(!empty($server)) {
321
-			if(!$this->SetServer($server)) return false;
356
+			if(!$this->SetServer($server)) {
357
+			    return false;
358
+			}
359
+		}
360
+		if($this->_ready) {
361
+		    return true;
322 362
 		}
323
-		if($this->_ready) return true;
324 363
 	    $this->SendMsg('Local OS : '.$this->OS_FullName[$this->OS_local]);
325 364
 		if(!($this->_ftp_control_sock = $this->_connect($this->_host, $this->_port))) {
326 365
 			$this->SendMSG("Error : Cannot connect to remote host \"".$this->_fullhost." :".$this->_port."\"");
@@ -328,29 +367,46 @@  discard block
 block discarded – undo
328 367
 		}
329 368
 		$this->SendMSG("Connected to remote host \"".$this->_fullhost.":".$this->_port."\". Waiting for greeting.");
330 369
 		do {
331
-			if(!$this->_readmsg()) return FALSE;
332
-			if(!$this->_checkCode()) return FALSE;
370
+			if(!$this->_readmsg()) {
371
+			    return FALSE;
372
+			}
373
+			if(!$this->_checkCode()) {
374
+			    return FALSE;
375
+			}
333 376
 			$this->_lastaction=time();
334 377
 		} while($this->_code<200);
335 378
 		$this->_ready=true;
336 379
 		$syst=$this->systype();
337
-		if(!$syst) $this->SendMSG("Cannot detect remote OS");
338
-		else {
339
-			if(preg_match("/win|dos|novell/i", $syst[0])) $this->OS_remote=FTP_OS_Windows;
340
-			elseif(preg_match("/os/i", $syst[0])) $this->OS_remote=FTP_OS_Mac;
341
-			elseif(preg_match("/(li|u)nix/i", $syst[0])) $this->OS_remote=FTP_OS_Unix;
342
-			else $this->OS_remote=FTP_OS_Mac;
380
+		if(!$syst) {
381
+		    $this->SendMSG("Cannot detect remote OS");
382
+		} else {
383
+			if(preg_match("/win|dos|novell/i", $syst[0])) {
384
+			    $this->OS_remote=FTP_OS_Windows;
385
+			} elseif(preg_match("/os/i", $syst[0])) {
386
+			    $this->OS_remote=FTP_OS_Mac;
387
+			} elseif(preg_match("/(li|u)nix/i", $syst[0])) {
388
+			    $this->OS_remote=FTP_OS_Unix;
389
+			} else {
390
+			    $this->OS_remote=FTP_OS_Mac;
391
+			}
343 392
 			$this->SendMSG("Remote OS: ".$this->OS_FullName[$this->OS_remote]);
344 393
 		}
345
-		if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled");
346
-		else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
394
+		if(!$this->features()) {
395
+		    $this->SendMSG("Cannot get features list. All supported - disabled");
396
+		} else {
397
+		    $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
398
+		}
347 399
 		return TRUE;
348 400
 	}
349 401
 
350 402
 	function quit($force=false) {
351 403
 		if($this->_ready) {
352
-			if(!$this->_exec("QUIT") and !$force) return FALSE;
353
-			if(!$this->_checkCode() and !$force) return FALSE;
404
+			if(!$this->_exec("QUIT") and !$force) {
405
+			    return FALSE;
406
+			}
407
+			if(!$this->_checkCode() and !$force) {
408
+			    return FALSE;
409
+			}
354 410
 			$this->_ready=false;
355 411
 			$this->SendMSG("Session finished");
356 412
 		}
@@ -359,61 +415,108 @@  discard block
 block discarded – undo
359 415
 	}
360 416
 
361 417
 	function login($user=NULL, $pass=NULL) {
362
-		if(!is_null($user)) $this->_login=$user;
363
-		else $this->_login="anonymous";
364
-		if(!is_null($pass)) $this->_password=$pass;
365
-		else $this->_password="[email protected]";
366
-		if(!$this->_exec("USER ".$this->_login, "login")) return FALSE;
367
-		if(!$this->_checkCode()) return FALSE;
418
+		if(!is_null($user)) {
419
+		    $this->_login=$user;
420
+		} else {
421
+		    $this->_login="anonymous";
422
+		}
423
+		if(!is_null($pass)) {
424
+		    $this->_password=$pass;
425
+		} else {
426
+		    $this->_password="[email protected]";
427
+		}
428
+		if(!$this->_exec("USER ".$this->_login, "login")) {
429
+		    return FALSE;
430
+		}
431
+		if(!$this->_checkCode()) {
432
+		    return FALSE;
433
+		}
368 434
 		if($this->_code!=230) {
369
-			if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) return FALSE;
370
-			if(!$this->_checkCode()) return FALSE;
435
+			if(!$this->_exec((($this->_code==331)?"PASS ":"ACCT ").$this->_password, "login")) {
436
+			    return FALSE;
437
+			}
438
+			if(!$this->_checkCode()) {
439
+			    return FALSE;
440
+			}
371 441
 		}
372 442
 		$this->SendMSG("Authentication succeeded");
373 443
 		if(empty($this->_features)) {
374
-			if(!$this->features()) $this->SendMSG("Cannot get features list. All supported - disabled");
375
-			else $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
444
+			if(!$this->features()) {
445
+			    $this->SendMSG("Cannot get features list. All supported - disabled");
446
+			} else {
447
+			    $this->SendMSG("Supported features: ".implode(", ", array_keys($this->_features)));
448
+			}
376 449
 		}
377 450
 		return TRUE;
378 451
 	}
379 452
 
380 453
 	function pwd() {
381
-		if(!$this->_exec("PWD", "pwd")) return FALSE;
382
-		if(!$this->_checkCode()) return FALSE;
454
+		if(!$this->_exec("PWD", "pwd")) {
455
+		    return FALSE;
456
+		}
457
+		if(!$this->_checkCode()) {
458
+		    return FALSE;
459
+		}
383 460
 		return preg_replace("/^[0-9]{3} \"(.+)\".*$/s", "\\1", $this->_message);
384 461
 	}
385 462
 
386 463
 	function cdup() {
387
-		if(!$this->_exec("CDUP", "cdup")) return FALSE;
388
-		if(!$this->_checkCode()) return FALSE;
464
+		if(!$this->_exec("CDUP", "cdup")) {
465
+		    return FALSE;
466
+		}
467
+		if(!$this->_checkCode()) {
468
+		    return FALSE;
469
+		}
389 470
 		return true;
390 471
 	}
391 472
 
392 473
 	function chdir($pathname) {
393
-		if(!$this->_exec("CWD ".$pathname, "chdir")) return FALSE;
394
-		if(!$this->_checkCode()) return FALSE;
474
+		if(!$this->_exec("CWD ".$pathname, "chdir")) {
475
+		    return FALSE;
476
+		}
477
+		if(!$this->_checkCode()) {
478
+		    return FALSE;
479
+		}
395 480
 		return TRUE;
396 481
 	}
397 482
 
398 483
 	function rmdir($pathname) {
399
-		if(!$this->_exec("RMD ".$pathname, "rmdir")) return FALSE;
400
-		if(!$this->_checkCode()) return FALSE;
484
+		if(!$this->_exec("RMD ".$pathname, "rmdir")) {
485
+		    return FALSE;
486
+		}
487
+		if(!$this->_checkCode()) {
488
+		    return FALSE;
489
+		}
401 490
 		return TRUE;
402 491
 	}
403 492
 
404 493
 	function mkdir($pathname) {
405
-		if(!$this->_exec("MKD ".$pathname, "mkdir")) return FALSE;
406
-		if(!$this->_checkCode()) return FALSE;
494
+		if(!$this->_exec("MKD ".$pathname, "mkdir")) {
495
+		    return FALSE;
496
+		}
497
+		if(!$this->_checkCode()) {
498
+		    return FALSE;
499
+		}
407 500
 		return TRUE;
408 501
 	}
409 502
 
410 503
 	function rename($from, $to) {
411
-		if(!$this->_exec("RNFR ".$from, "rename")) return FALSE;
412
-		if(!$this->_checkCode()) return FALSE;
504
+		if(!$this->_exec("RNFR ".$from, "rename")) {
505
+		    return FALSE;
506
+		}
507
+		if(!$this->_checkCode()) {
508
+		    return FALSE;
509
+		}
413 510
 		if($this->_code==350) {
414
-			if(!$this->_exec("RNTO ".$to, "rename")) return FALSE;
415
-			if(!$this->_checkCode()) return FALSE;
416
-		} else return FALSE;
511
+			if(!$this->_exec("RNTO ".$to, "rename")) {
512
+			    return FALSE;
513
+			}
514
+			if(!$this->_checkCode()) {
515
+			    return FALSE;
516
+			}
517
+		} else {
518
+		    return FALSE;
519
+		}
417 520
 		return TRUE;
418 521
 	}
419 522
 
@@ -422,17 +525,29 @@  discard block
 block discarded – undo
422 525
 			$this->PushError("filesize", "not supported by server");
423 526
 			return FALSE;
424 527
 		}
425
-		if(!$this->_exec("SIZE ".$pathname, "filesize")) return FALSE;
426
-		if(!$this->_checkCode()) return FALSE;
528
+		if(!$this->_exec("SIZE ".$pathname, "filesize")) {
529
+		    return FALSE;
530
+		}
531
+		if(!$this->_checkCode()) {
532
+		    return FALSE;
533
+		}
427 534
 		return preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message);
428 535
 	}
429 536
 
430 537
 	function abort() {
431
-		if(!$this->_exec("ABOR", "abort")) return FALSE;
538
+		if(!$this->_exec("ABOR", "abort")) {
539
+		    return FALSE;
540
+		}
432 541
 		if(!$this->_checkCode()) {
433
-			if($this->_code!=426) return FALSE;
434
-			if(!$this->_readmsg("abort")) return FALSE;
435
-			if(!$this->_checkCode()) return FALSE;
542
+			if($this->_code!=426) {
543
+			    return FALSE;
544
+			}
545
+			if(!$this->_readmsg("abort")) {
546
+			    return FALSE;
547
+			}
548
+			if(!$this->_checkCode()) {
549
+			    return FALSE;
550
+			}
436 551
 		}
437 552
 		return true;
438 553
 	}
@@ -442,8 +557,12 @@  discard block
 block discarded – undo
442 557
 			$this->PushError("mdtm", "not supported by server");
443 558
 			return FALSE;
444 559
 		}
445
-		if(!$this->_exec("MDTM ".$pathname, "mdtm")) return FALSE;
446
-		if(!$this->_checkCode()) return FALSE;
560
+		if(!$this->_exec("MDTM ".$pathname, "mdtm")) {
561
+		    return FALSE;
562
+		}
563
+		if(!$this->_checkCode()) {
564
+		    return FALSE;
565
+		}
447 566
 		$mdtm = preg_replace("/^[0-9]{3} ([0-9]+).*$/s", "\\1", $this->_message);
448 567
 		$date = sscanf($mdtm, "%4d%2d%2d%2d%2d%2d");
449 568
 		$timestamp = mktime($date[3], $date[4], $date[5], $date[1], $date[2], $date[0]);
@@ -451,26 +570,40 @@  discard block
 block discarded – undo
451 570
 	}
452 571
 
453 572
 	function systype() {
454
-		if(!$this->_exec("SYST", "systype")) return FALSE;
455
-		if(!$this->_checkCode()) return FALSE;
573
+		if(!$this->_exec("SYST", "systype")) {
574
+		    return FALSE;
575
+		}
576
+		if(!$this->_checkCode()) {
577
+		    return FALSE;
578
+		}
456 579
 		$DATA = explode(" ", $this->_message);
457 580
 		return array($DATA[1], $DATA[3]);
458 581
 	}
459 582
 
460 583
 	function delete($pathname) {
461
-		if(!$this->_exec("DELE ".$pathname, "delete")) return FALSE;
462
-		if(!$this->_checkCode()) return FALSE;
584
+		if(!$this->_exec("DELE ".$pathname, "delete")) {
585
+		    return FALSE;
586
+		}
587
+		if(!$this->_checkCode()) {
588
+		    return FALSE;
589
+		}
463 590
 		return TRUE;
464 591
 	}
465 592
 
466 593
 	function site($command, $fnction="site") {
467
-		if(!$this->_exec("SITE ".$command, $fnction)) return FALSE;
468
-		if(!$this->_checkCode()) return FALSE;
594
+		if(!$this->_exec("SITE ".$command, $fnction)) {
595
+		    return FALSE;
596
+		}
597
+		if(!$this->_checkCode()) {
598
+		    return FALSE;
599
+		}
469 600
 		return TRUE;
470 601
 	}
471 602
 
472 603
 	function chmod($pathname, $mode) {
473
-		if(!$this->site( sprintf('CHMOD %o %s', $mode, $pathname), "chmod")) return FALSE;
604
+		if(!$this->site( sprintf('CHMOD %o %s', $mode, $pathname), "chmod")) {
605
+		    return FALSE;
606
+		}
474 607
 		return TRUE;
475 608
 	}
476 609
 
@@ -483,14 +616,22 @@  discard block
 block discarded – undo
483 616
 			$this->PushError("restore", "cannot restore in ASCII mode");
484 617
 			return FALSE;
485 618
 		}
486
-		if(!$this->_exec("REST ".$from, "resore")) return FALSE;
487
-		if(!$this->_checkCode()) return FALSE;
619
+		if(!$this->_exec("REST ".$from, "resore")) {
620
+		    return FALSE;
621
+		}
622
+		if(!$this->_checkCode()) {
623
+		    return FALSE;
624
+		}
488 625
 		return TRUE;
489 626
 	}
490 627
 
491 628
 	function features() {
492
-		if(!$this->_exec("FEAT", "features")) return FALSE;
493
-		if(!$this->_checkCode()) return FALSE;
629
+		if(!$this->_exec("FEAT", "features")) {
630
+		    return FALSE;
631
+		}
632
+		if(!$this->_checkCode()) {
633
+		    return FALSE;
634
+		}
494 635
 		$f=preg_split("/[".CRLF."]+/", preg_replace("/[0-9]{3}[ -].*[".CRLF."]+/", "", $this->_message), -1, PREG_SPLIT_NO_EMPTY);
495 636
 		$this->_features=array();
496 637
 		foreach($f as $k=>$v) {
@@ -514,25 +655,38 @@  discard block
 block discarded – undo
514 655
 
515 656
 	function file_exists($pathname) {
516 657
 		$exists=true;
517
-		if(!$this->_exec("RNFR ".$pathname, "rename")) $exists=FALSE;
518
-		else {
519
-			if(!$this->_checkCode()) $exists=FALSE;
658
+		if(!$this->_exec("RNFR ".$pathname, "rename")) {
659
+		    $exists=FALSE;
660
+		} else {
661
+			if(!$this->_checkCode()) {
662
+			    $exists=FALSE;
663
+			}
520 664
 			$this->abort();
521 665
 		}
522
-		if($exists) $this->SendMSG("Remote file ".$pathname." exists");
523
-		else $this->SendMSG("Remote file ".$pathname." does not exist");
666
+		if($exists) {
667
+		    $this->SendMSG("Remote file ".$pathname." exists");
668
+		} else {
669
+		    $this->SendMSG("Remote file ".$pathname." does not exist");
670
+		}
524 671
 		return $exists;
525 672
 	}
526 673
 
527 674
 	function fget($fp, $remotefile, $rest=0) {
528
-		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
675
+		if($this->_can_restore and $rest!=0) {
676
+		    fseek($fp, $rest);
677
+		}
529 678
 		$pi=pathinfo($remotefile);
530
-		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
531
-		else $mode=FTP_BINARY;
679
+		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) {
680
+		    $mode=FTP_ASCII;
681
+		} else {
682
+		    $mode=FTP_BINARY;
683
+		}
532 684
 		if(!$this->_data_prepare($mode)) {
533 685
 			return FALSE;
534 686
 		}
535
-		if($this->_can_restore and $rest!=0) $this->restore($rest);
687
+		if($this->_can_restore and $rest!=0) {
688
+		    $this->restore($rest);
689
+		}
536 690
 		if(!$this->_exec("RETR ".$remotefile, "get")) {
537 691
 			$this->_data_close();
538 692
 			return FALSE;
@@ -543,28 +697,43 @@  discard block
 block discarded – undo
543 697
 		}
544 698
 		$out=$this->_data_read($mode, $fp);
545 699
 		$this->_data_close();
546
-		if(!$this->_readmsg()) return FALSE;
547
-		if(!$this->_checkCode()) return FALSE;
700
+		if(!$this->_readmsg()) {
701
+		    return FALSE;
702
+		}
703
+		if(!$this->_checkCode()) {
704
+		    return FALSE;
705
+		}
548 706
 		return $out;
549 707
 	}
550 708
 
551 709
 	function get($remotefile, $localfile=NULL, $rest=0) {
552
-		if(is_null($localfile)) $localfile=$remotefile;
553
-		if (@file_exists($localfile)) $this->SendMSG("Warning : local file will be overwritten");
710
+		if(is_null($localfile)) {
711
+		    $localfile=$remotefile;
712
+		}
713
+		if (@file_exists($localfile)) {
714
+		    $this->SendMSG("Warning : local file will be overwritten");
715
+		}
554 716
 		$fp = @fopen($localfile, "w");
555 717
 		if (!$fp) {
556 718
 			$this->PushError("get","cannot open local file", "Cannot create \"".$localfile."\"");
557 719
 			return FALSE;
558 720
 		}
559
-		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
721
+		if($this->_can_restore and $rest!=0) {
722
+		    fseek($fp, $rest);
723
+		}
560 724
 		$pi=pathinfo($remotefile);
561
-		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
562
-		else $mode=FTP_BINARY;
725
+		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) {
726
+		    $mode=FTP_ASCII;
727
+		} else {
728
+		    $mode=FTP_BINARY;
729
+		}
563 730
 		if(!$this->_data_prepare($mode)) {
564 731
 			fclose($fp);
565 732
 			return FALSE;
566 733
 		}
567
-		if($this->_can_restore and $rest!=0) $this->restore($rest);
734
+		if($this->_can_restore and $rest!=0) {
735
+		    $this->restore($rest);
736
+		}
568 737
 		if(!$this->_exec("RETR ".$remotefile, "get")) {
569 738
 			$this->_data_close();
570 739
 			fclose($fp);
@@ -578,20 +747,31 @@  discard block
 block discarded – undo
578 747
 		$out=$this->_data_read($mode, $fp);
579 748
 		fclose($fp);
580 749
 		$this->_data_close();
581
-		if(!$this->_readmsg()) return FALSE;
582
-		if(!$this->_checkCode()) return FALSE;
750
+		if(!$this->_readmsg()) {
751
+		    return FALSE;
752
+		}
753
+		if(!$this->_checkCode()) {
754
+		    return FALSE;
755
+		}
583 756
 		return $out;
584 757
 	}
585 758
 
586 759
 	function fput($remotefile, $fp, $rest=0) {
587
-		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
760
+		if($this->_can_restore and $rest!=0) {
761
+		    fseek($fp, $rest);
762
+		}
588 763
 		$pi=pathinfo($remotefile);
589
-		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
590
-		else $mode=FTP_BINARY;
764
+		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) {
765
+		    $mode=FTP_ASCII;
766
+		} else {
767
+		    $mode=FTP_BINARY;
768
+		}
591 769
 		if(!$this->_data_prepare($mode)) {
592 770
 			return FALSE;
593 771
 		}
594
-		if($this->_can_restore and $rest!=0) $this->restore($rest);
772
+		if($this->_can_restore and $rest!=0) {
773
+		    $this->restore($rest);
774
+		}
595 775
 		if(!$this->_exec("STOR ".$remotefile, "put")) {
596 776
 			$this->_data_close();
597 777
 			return FALSE;
@@ -602,13 +782,19 @@  discard block
 block discarded – undo
602 782
 		}
603 783
 		$ret=$this->_data_write($mode, $fp);
604 784
 		$this->_data_close();
605
-		if(!$this->_readmsg()) return FALSE;
606
-		if(!$this->_checkCode()) return FALSE;
785
+		if(!$this->_readmsg()) {
786
+		    return FALSE;
787
+		}
788
+		if(!$this->_checkCode()) {
789
+		    return FALSE;
790
+		}
607 791
 		return $ret;
608 792
 	}
609 793
 
610 794
 	function put($localfile, $remotefile=NULL, $rest=0) {
611
-		if(is_null($remotefile)) $remotefile=$localfile;
795
+		if(is_null($remotefile)) {
796
+		    $remotefile=$localfile;
797
+		}
612 798
 		if (!file_exists($localfile)) {
613 799
 			$this->PushError("put","cannot open local file", "No such file or directory \"".$localfile."\"");
614 800
 			return FALSE;
@@ -619,15 +805,22 @@  discard block
 block discarded – undo
619 805
 			$this->PushError("put","cannot open local file", "Cannot read file \"".$localfile."\"");
620 806
 			return FALSE;
621 807
 		}
622
-		if($this->_can_restore and $rest!=0) fseek($fp, $rest);
808
+		if($this->_can_restore and $rest!=0) {
809
+		    fseek($fp, $rest);
810
+		}
623 811
 		$pi=pathinfo($localfile);
624
-		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) $mode=FTP_ASCII;
625
-		else $mode=FTP_BINARY;
812
+		if($this->_type==FTP_ASCII or ($this->_type==FTP_AUTOASCII and in_array(strtoupper($pi["extension"]), $this->AutoAsciiExt))) {
813
+		    $mode=FTP_ASCII;
814
+		} else {
815
+		    $mode=FTP_BINARY;
816
+		}
626 817
 		if(!$this->_data_prepare($mode)) {
627 818
 			fclose($fp);
628 819
 			return FALSE;
629 820
 		}
630
-		if($this->_can_restore and $rest!=0) $this->restore($rest);
821
+		if($this->_can_restore and $rest!=0) {
822
+		    $this->restore($rest);
823
+		}
631 824
 		if(!$this->_exec("STOR ".$remotefile, "put")) {
632 825
 			$this->_data_close();
633 826
 			fclose($fp);
@@ -641,8 +834,12 @@  discard block
 block discarded – undo
641 834
 		$ret=$this->_data_write($mode, $fp);
642 835
 		fclose($fp);
643 836
 		$this->_data_close();
644
-		if(!$this->_readmsg()) return FALSE;
645
-		if(!$this->_checkCode()) return FALSE;
837
+		if(!$this->_readmsg()) {
838
+		    return FALSE;
839
+		}
840
+		if(!$this->_checkCode()) {
841
+		    return FALSE;
842
+		}
646 843
 		return $ret;
647 844
 	}
648 845
 
@@ -652,27 +849,41 @@  discard block
 block discarded – undo
652 849
 			$this->PushError("mput","cannot open local folder", "Cannot stat folder \"".$local."\"");
653 850
 			return FALSE;
654 851
 		}
655
-		if(!is_dir($local)) return $this->put($local, $remote);
656
-		if(empty($remote)) $remote=".";
657
-		elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) return FALSE;
852
+		if(!is_dir($local)) {
853
+		    return $this->put($local, $remote);
854
+		}
855
+		if(empty($remote)) {
856
+		    $remote=".";
857
+		} elseif(!$this->file_exists($remote) and !$this->mkdir($remote)) {
858
+		    return FALSE;
859
+		}
658 860
 		if($handle = opendir($local)) {
659 861
 			$list=array();
660 862
 			while (false !== ($file = readdir($handle))) {
661
-				if ($file != "." && $file != "..") $list[]=$file;
863
+				if ($file != "." && $file != "..") {
864
+				    $list[]=$file;
865
+				}
662 866
 			}
663 867
 			closedir($handle);
664 868
 		} else {
665 869
 			$this->PushError("mput","cannot open local folder", "Cannot read folder \"".$local."\"");
666 870
 			return FALSE;
667 871
 		}
668
-		if(empty($list)) return TRUE;
872
+		if(empty($list)) {
873
+		    return TRUE;
874
+		}
669 875
 		$ret=true;
670 876
 		foreach($list as $el) {
671
-			if(is_dir($local."/".$el)) $t=$this->mput($local."/".$el, $remote."/".$el);
672
-			else $t=$this->put($local."/".$el, $remote."/".$el);
877
+			if(is_dir($local."/".$el)) {
878
+			    $t=$this->mput($local."/".$el, $remote."/".$el);
879
+			} else {
880
+			    $t=$this->put($local."/".$el, $remote."/".$el);
881
+			}
673 882
 			if(!$t) {
674 883
 				$ret=FALSE;
675
-				if(!$continious) break;
884
+				if(!$continious) {
885
+				    break;
886
+				}
676 887
 			}
677 888
 		}
678 889
 		return $ret;
@@ -685,7 +896,9 @@  discard block
 block discarded – undo
685 896
 			$this->PushError("mget","cannot read remote folder list", "Cannot read remote folder \"".$remote."\" contents");
686 897
 			return FALSE;
687 898
 		}
688
-		if(empty($list)) return true;
899
+		if(empty($list)) {
900
+		    return true;
901
+		}
689 902
 		if(!@file_exists($local)) {
690 903
 			if(!@mkdir($local)) {
691 904
 				$this->PushError("mget","cannot create local folder", "Cannot create folder \"".$local."\"");
@@ -694,7 +907,9 @@  discard block
 block discarded – undo
694 907
 		}
695 908
 		foreach($list as $k=>$v) {
696 909
 			$list[$k]=$this->parselisting($v);
697
-			if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
910
+			if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") {
911
+			    unset($list[$k]);
912
+			}
698 913
 		}
699 914
 		$ret=true;
700 915
 		foreach($list as $el) {
@@ -702,18 +917,24 @@  discard block
 block discarded – undo
702 917
 				if(!$this->mget($remote."/".$el["name"], $local."/".$el["name"], $continious)) {
703 918
 					$this->PushError("mget", "cannot copy folder", "Cannot copy remote folder \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
704 919
 					$ret=false;
705
-					if(!$continious) break;
920
+					if(!$continious) {
921
+					    break;
922
+					}
706 923
 				}
707 924
 			} else {
708 925
 				if(!$this->get($remote."/".$el["name"], $local."/".$el["name"])) {
709 926
 					$this->PushError("mget", "cannot copy file", "Cannot copy remote file \"".$remote."/".$el["name"]."\" to local \"".$local."/".$el["name"]."\"");
710 927
 					$ret=false;
711
-					if(!$continious) break;
928
+					if(!$continious) {
929
+					    break;
930
+					}
712 931
 				}
713 932
 			}
714 933
 			@chmod($local."/".$el["name"], $el["perms"]);
715 934
 			$t=strtotime($el["date"]);
716
-			if($t!==-1 and $t!==false) @touch($local."/".$el["name"], $t);
935
+			if($t!==-1 and $t!==false) {
936
+			    @touch($local."/".$el["name"], $t);
937
+			}
717 938
 		}
718 939
 		return $ret;
719 940
 	}
@@ -727,24 +948,31 @@  discard block
 block discarded – undo
727 948
 
728 949
 		foreach($list as $k=>$v) {
729 950
 			$list[$k]=$this->parselisting($v);
730
-			if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") unset($list[$k]);
951
+			if( ! $list[$k] or $list[$k]["name"]=="." or $list[$k]["name"]=="..") {
952
+			    unset($list[$k]);
953
+			}
731 954
 		}
732 955
 		$ret=true;
733 956
 
734 957
 		foreach($list as $el) {
735
-			if ( empty($el) )
736
-				continue;
958
+			if ( empty($el) ) {
959
+							continue;
960
+			}
737 961
 
738 962
 			if($el["type"]=="d") {
739 963
 				if(!$this->mdel($remote."/".$el["name"], $continious)) {
740 964
 					$ret=false;
741
-					if(!$continious) break;
965
+					if(!$continious) {
966
+					    break;
967
+					}
742 968
 				}
743 969
 			} else {
744 970
 				if (!$this->delete($remote."/".$el["name"])) {
745 971
 					$this->PushError("mdel", "cannot delete file", "Cannot delete remote file \"".$remote."/".$el["name"]."\"");
746 972
 					$ret=false;
747
-					if(!$continious) break;
973
+					if(!$continious) {
974
+					    break;
975
+					}
748 976
 				}
749 977
 			}
750 978
 		}
@@ -757,9 +985,15 @@  discard block
 block discarded – undo
757 985
 	}
758 986
 
759 987
 	function mmkdir($dir, $mode = 0777) {
760
-		if(empty($dir)) return FALSE;
761
-		if($this->is_exists($dir) or $dir == "/" ) return TRUE;
762
-		if(!$this->mmkdir(dirname($dir), $mode)) return false;
988
+		if(empty($dir)) {
989
+		    return FALSE;
990
+		}
991
+		if($this->is_exists($dir) or $dir == "/" ) {
992
+		    return TRUE;
993
+		}
994
+		if(!$this->mmkdir(dirname($dir), $mode)) {
995
+		    return false;
996
+		}
763 997
 		$r=$this->mkdir($dir, $mode);
764 998
 		$this->chmod($dir,$mode);
765 999
 		return $r;
@@ -767,28 +1001,39 @@  discard block
 block discarded – undo
767 1001
 
768 1002
 	function glob($pattern, $handle=NULL) {
769 1003
 		$path=$output=null;
770
-		if(PHP_OS=='WIN32') $slash='\\';
771
-		else $slash='/';
1004
+		if(PHP_OS=='WIN32') {
1005
+		    $slash='\\';
1006
+		} else {
1007
+		    $slash='/';
1008
+		}
772 1009
 		$lastpos=strrpos($pattern,$slash);
773 1010
 		if(!($lastpos===false)) {
774 1011
 			$path=substr($pattern,0,-$lastpos-1);
775 1012
 			$pattern=substr($pattern,$lastpos);
776
-		} else $path=getcwd();
1013
+		} else {
1014
+		    $path=getcwd();
1015
+		}
777 1016
 		if(is_array($handle) and !empty($handle)) {
778 1017
 			foreach($handle as $dir) {
779
-				if($this->glob_pattern_match($pattern,$dir))
780
-				$output[]=$dir;
1018
+				if($this->glob_pattern_match($pattern,$dir)) {
1019
+								$output[]=$dir;
1020
+				}
781 1021
 			}
782 1022
 		} else {
783 1023
 			$handle=@opendir($path);
784
-			if($handle===false) return false;
1024
+			if($handle===false) {
1025
+			    return false;
1026
+			}
785 1027
 			while($dir=readdir($handle)) {
786
-				if($this->glob_pattern_match($pattern,$dir))
787
-				$output[]=$dir;
1028
+				if($this->glob_pattern_match($pattern,$dir)) {
1029
+								$output[]=$dir;
1030
+				}
788 1031
 			}
789 1032
 			closedir($handle);
790 1033
 		}
791
-		if(is_array($output)) return $output;
1034
+		if(is_array($output)) {
1035
+		    return $output;
1036
+		}
792 1037
 		return false;
793 1038
 	}
794 1039
 
@@ -797,21 +1042,25 @@  discard block
 block discarded – undo
797 1042
 		$chunks=explode(';',$pattern);
798 1043
 		foreach($chunks as $pattern) {
799 1044
 			$escape=array('$','^','.','{','}','(',')','[',']','|');
800
-			while(strpos($pattern,'**')!==false)
801
-				$pattern=str_replace('**','*',$pattern);
802
-			foreach($escape as $probe)
803
-				$pattern=str_replace($probe,"\\$probe",$pattern);
1045
+			while(strpos($pattern,'**')!==false) {
1046
+							$pattern=str_replace('**','*',$pattern);
1047
+			}
1048
+			foreach($escape as $probe) {
1049
+							$pattern=str_replace($probe,"\\$probe",$pattern);
1050
+			}
804 1051
 			$pattern=str_replace('?*','*',
805 1052
 				str_replace('*?','*',
806 1053
 					str_replace('*',".*",
807 1054
 						str_replace('?','.{1,1}',$pattern))));
808 1055
 			$out[]=$pattern;
809 1056
 		}
810
-		if(count($out)==1) return($this->glob_regexp("^$out[0]$",$subject));
811
-		else {
812
-			foreach($out as $tester)
813
-				// TODO: This should probably be glob_regexp(), but needs tests.
1057
+		if(count($out)==1) {
1058
+		    return($this->glob_regexp("^$out[0]$",$subject));
1059
+		} else {
1060
+			foreach($out as $tester) {
1061
+							// TODO: This should probably be glob_regexp(), but needs tests.
814 1062
 				if($this->my_regexp("^$tester$",$subject)) return true;
1063
+			}
815 1064
 		}
816 1065
 		return false;
817 1066
 	}
@@ -834,11 +1083,13 @@  discard block
 block discarded – undo
834 1083
 		$dirlist = array();
835 1084
 		foreach($list as $k=>$v) {
836 1085
 			$entry=$this->parselisting($v);
837
-			if ( empty($entry) )
838
-				continue;
1086
+			if ( empty($entry) ) {
1087
+							continue;
1088
+			}
839 1089
 
840
-			if($entry["name"]=="." or $entry["name"]=="..")
841
-				continue;
1090
+			if($entry["name"]=="." or $entry["name"]=="..") {
1091
+							continue;
1092
+			}
842 1093
 
843 1094
 			$dirlist[$entry['name']] = $entry;
844 1095
 		}
@@ -853,7 +1104,9 @@  discard block
 block discarded – undo
853 1104
 	}
854 1105
 
855 1106
 	function _list($arg="", $cmd="LIST", $fnction="_list") {
856
-		if(!$this->_data_prepare()) return false;
1107
+		if(!$this->_data_prepare()) {
1108
+		    return false;
1109
+		}
857 1110
 		if(!$this->_exec($cmd.$arg, $fnction)) {
858 1111
 			$this->_data_close();
859 1112
 			return FALSE;
@@ -866,9 +1119,15 @@  discard block
 block discarded – undo
866 1119
 		if($this->_code<200) {
867 1120
 			$out=$this->_data_read();
868 1121
 			$this->_data_close();
869
-			if(!$this->_readmsg()) return FALSE;
870
-			if(!$this->_checkCode()) return FALSE;
871
-			if($out === FALSE ) return FALSE;
1122
+			if(!$this->_readmsg()) {
1123
+			    return FALSE;
1124
+			}
1125
+			if(!$this->_checkCode()) {
1126
+			    return FALSE;
1127
+			}
1128
+			if($out === FALSE ) {
1129
+			    return FALSE;
1130
+			}
872 1131
 			$out=preg_split("/[".CRLF."]+/", $out, -1, PREG_SPLIT_NO_EMPTY);
873 1132
 //			$this->SendMSG(implode($this->_eol_code[$this->OS_local], $out));
874 1133
 		}
@@ -885,15 +1144,22 @@  discard block
 block discarded – undo
885 1144
 		$error['fctname']=$fctname;
886 1145
 		$error['msg']=$msg;
887 1146
 		$error['desc']=$desc;
888
-		if($desc) $tmp=' ('.$desc.')'; else $tmp='';
1147
+		if($desc) {
1148
+		    $tmp=' ('.$desc.')';
1149
+		} else {
1150
+		    $tmp='';
1151
+		}
889 1152
 		$this->SendMSG($fctname.': '.$msg.$tmp);
890 1153
 		return(array_push($this->_error_array,$error));
891 1154
 	}
892 1155
 
893 1156
 // Rcupre une erreur externe
894 1157
 	function PopError(){
895
-		if(count($this->_error_array)) return(array_pop($this->_error_array));
896
-			else return(false);
1158
+		if(count($this->_error_array)) {
1159
+		    return(array_pop($this->_error_array));
1160
+		} else {
1161
+			    return(false);
1162
+			}
897 1163
 	}
898 1164
 }
899 1165
 
Please login to merge, or discard this patch.
brighty/wp-admin/includes/media.php 1 patch
Braces   +3 added lines, -1 removed lines patch added patch discarded remove patch
@@ -3186,7 +3186,8 @@  discard block
 block discarded – undo
3186 3186
 		</div>
3187 3187
 		<?php
3188 3188
 
3189
-	else :
3189
+	else {
3190
+	    :
3190 3191
 
3191 3192
 		/**
3192 3193
 		 * Fires when an attachment type can't be rendered in the edit form.
@@ -3196,6 +3197,7 @@  discard block
 block discarded – undo
3196 3197
 		 * @param WP_Post $post A post object.
3197 3198
 		 */
3198 3199
 		do_action( 'wp_edit_form_attachment_display', $post );
3200
+	}
3199 3201
 
3200 3202
 	endif;
3201 3203
 
Please login to merge, or discard this patch.