Completed
Push — master ( d488ab...6453e7 )
by Stephen
53:31
created
src/wp-admin/revision.php 4 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,19 +1,19 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Revisions administration panel
4
- *
5
- * Requires wp-admin/includes/revision.php.
6
- *
7
- * @package WordPress
8
- * @subpackage Administration
9
- * @since 2.6.0
10
- *
11
- * @param int    revision Optional. The revision ID.
12
- * @param string action   The action to take.
13
- *                        Accepts 'restore', 'view' or 'edit'.
14
- * @param int    from     The revision to compare from.
15
- * @param int    to       Optional, required if revision missing. The revision to compare to.
16
- */
3
+	 * Revisions administration panel
4
+	 *
5
+	 * Requires wp-admin/includes/revision.php.
6
+	 *
7
+	 * @package WordPress
8
+	 * @subpackage Administration
9
+	 * @since 2.6.0
10
+	 *
11
+	 * @param int    revision Optional. The revision ID.
12
+	 * @param string action   The action to take.
13
+	 *                        Accepts 'restore', 'view' or 'edit'.
14
+	 * @param int    from     The revision to compare from.
15
+	 * @param int    to       Optional, required if revision missing. The revision to compare to.
16
+	 */
17 17
 
18 18
 /** WordPress Administration Bootstrap */
19 19
 require_once( dirname( __FILE__ ) . '/admin.php' );
Please login to merge, or discard this patch.
Switch Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -30,56 +30,56 @@
 block discarded – undo
30 30
 $redirect = 'edit.php';
31 31
 
32 32
 switch ( $action ) {
33
-case 'restore' :
34
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
35
-		break;
33
+	case 'restore' :
34
+		if ( ! $revision = wp_get_post_revision( $revision_id ) )
35
+			break;
36 36
 
37
-	if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
38
-		break;
37
+		if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
38
+			break;
39 39
 
40
-	if ( ! $post = get_post( $revision->post_parent ) )
41
-		break;
40
+		if ( ! $post = get_post( $revision->post_parent ) )
41
+			break;
42 42
 
43
-	// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
44
-	if ( ! wp_revisions_enabled( $post ) ) {
45
-		$redirect = 'edit.php?post_type=' . $post->post_type;
46
-		break;
47
-	}
43
+		// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
44
+		if ( ! wp_revisions_enabled( $post ) ) {
45
+			$redirect = 'edit.php?post_type=' . $post->post_type;
46
+			break;
47
+		}
48 48
 
49
-	// Don't allow revision restore when post is locked
50
-	if ( wp_check_post_lock( $post->ID ) )
51
-		break;
49
+		// Don't allow revision restore when post is locked
50
+		if ( wp_check_post_lock( $post->ID ) )
51
+			break;
52 52
 
53
-	check_admin_referer( "restore-post_{$revision->ID}" );
53
+		check_admin_referer( "restore-post_{$revision->ID}" );
54 54
 
55
-	wp_restore_post_revision( $revision->ID );
56
-	$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
57
-	break;
58
-case 'view' :
59
-case 'edit' :
60
-default :
61
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
55
+		wp_restore_post_revision( $revision->ID );
56
+		$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
62 57
 		break;
63
-	if ( ! $post = get_post( $revision->post_parent ) )
58
+	case 'view' :
59
+	case 'edit' :
60
+	default :
61
+		if ( ! $revision = wp_get_post_revision( $revision_id ) )
62
+			break;
63
+		if ( ! $post = get_post( $revision->post_parent ) )
64
+			break;
65
+
66
+		if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
67
+			break;
68
+
69
+		// Revisions disabled and we're not looking at an autosave
70
+		if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
+			$redirect = 'edit.php?post_type=' . $post->post_type;
72
+			break;
73
+		}
74
+
75
+		$post_edit_link = get_edit_post_link();
76
+		$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
+		$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
+		$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to post editor' ) . '</a>';
79
+		$title          = __( 'Revisions' );
80
+
81
+		$redirect = false;
64 82
 		break;
65
-
66
-	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
67
-		break;
68
-
69
-	// Revisions disabled and we're not looking at an autosave
70
-	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
-		$redirect = 'edit.php?post_type=' . $post->post_type;
72
-		break;
73
-	}
74
-
75
-	$post_edit_link = get_edit_post_link();
76
-	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
-	$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
-	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to post editor' ) . '</a>';
79
-	$title          = __( 'Revisions' );
80
-
81
-	$redirect = false;
82
-	break;
83 83
 }
84 84
 
85 85
 // Empty post_type means either malformed object found, or no valid parent was found.
Please login to merge, or discard this patch.
Spacing   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -16,112 +16,112 @@  discard block
 block discarded – undo
16 16
  */
17 17
 
18 18
 /** WordPress Administration Bootstrap */
19
-require_once( dirname( __FILE__ ) . '/admin.php' );
19
+require_once(dirname(__FILE__).'/admin.php');
20 20
 
21
-require ABSPATH . 'wp-admin/includes/revision.php';
21
+require ABSPATH.'wp-admin/includes/revision.php';
22 22
 
23
-wp_reset_vars( array( 'revision', 'action', 'from', 'to' ) );
23
+wp_reset_vars(array('revision', 'action', 'from', 'to'));
24 24
 
25
-$revision_id = absint( $revision );
25
+$revision_id = absint($revision);
26 26
 
27
-$from = is_numeric( $from ) ? absint( $from ) : null;
28
-if ( ! $revision_id )
29
-	$revision_id = absint( $to );
27
+$from = is_numeric($from) ? absint($from) : null;
28
+if ( ! $revision_id)
29
+	$revision_id = absint($to);
30 30
 $redirect = 'edit.php';
31 31
 
32
-switch ( $action ) {
32
+switch ($action) {
33 33
 case 'restore' :
34
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
34
+	if ( ! $revision = wp_get_post_revision($revision_id))
35 35
 		break;
36 36
 
37
-	if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
37
+	if ( ! current_user_can('edit_post', $revision->post_parent))
38 38
 		break;
39 39
 
40
-	if ( ! $post = get_post( $revision->post_parent ) )
40
+	if ( ! $post = get_post($revision->post_parent))
41 41
 		break;
42 42
 
43 43
 	// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
44
-	if ( ! wp_revisions_enabled( $post ) ) {
45
-		$redirect = 'edit.php?post_type=' . $post->post_type;
44
+	if ( ! wp_revisions_enabled($post)) {
45
+		$redirect = 'edit.php?post_type='.$post->post_type;
46 46
 		break;
47 47
 	}
48 48
 
49 49
 	// Don't allow revision restore when post is locked
50
-	if ( wp_check_post_lock( $post->ID ) )
50
+	if (wp_check_post_lock($post->ID))
51 51
 		break;
52 52
 
53
-	check_admin_referer( "restore-post_{$revision->ID}" );
53
+	check_admin_referer("restore-post_{$revision->ID}");
54 54
 
55
-	wp_restore_post_revision( $revision->ID );
56
-	$redirect = add_query_arg( array( 'message' => 5, 'revision' => $revision->ID ), get_edit_post_link( $post->ID, 'url' ) );
55
+	wp_restore_post_revision($revision->ID);
56
+	$redirect = add_query_arg(array('message' => 5, 'revision' => $revision->ID), get_edit_post_link($post->ID, 'url'));
57 57
 	break;
58 58
 case 'view' :
59 59
 case 'edit' :
60 60
 default :
61
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
61
+	if ( ! $revision = wp_get_post_revision($revision_id))
62 62
 		break;
63
-	if ( ! $post = get_post( $revision->post_parent ) )
63
+	if ( ! $post = get_post($revision->post_parent))
64 64
 		break;
65 65
 
66
-	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
66
+	if ( ! current_user_can('read_post', $revision->ID) || ! current_user_can('read_post', $post->ID))
67 67
 		break;
68 68
 
69 69
 	// Revisions disabled and we're not looking at an autosave
70
-	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
71
-		$redirect = 'edit.php?post_type=' . $post->post_type;
70
+	if ( ! wp_revisions_enabled($post) && ! wp_is_post_autosave($revision)) {
71
+		$redirect = 'edit.php?post_type='.$post->post_type;
72 72
 		break;
73 73
 	}
74 74
 
75 75
 	$post_edit_link = get_edit_post_link();
76
-	$post_title     = '<a href="' . $post_edit_link . '">' . _draft_or_post_title() . '</a>';
77
-	$h1             = sprintf( __( 'Compare Revisions of &#8220;%1$s&#8221;' ), $post_title );
78
-	$return_to_post = '<a href="' . $post_edit_link . '">' . __( '&larr; Return to post editor' ) . '</a>';
79
-	$title          = __( 'Revisions' );
76
+	$post_title     = '<a href="'.$post_edit_link.'">'._draft_or_post_title().'</a>';
77
+	$h1             = sprintf(__('Compare Revisions of &#8220;%1$s&#8221;'), $post_title);
78
+	$return_to_post = '<a href="'.$post_edit_link.'">'.__('&larr; Return to post editor').'</a>';
79
+	$title          = __('Revisions');
80 80
 
81 81
 	$redirect = false;
82 82
 	break;
83 83
 }
84 84
 
85 85
 // Empty post_type means either malformed object found, or no valid parent was found.
86
-if ( ! $redirect && empty( $post->post_type ) )
86
+if ( ! $redirect && empty($post->post_type))
87 87
 	$redirect = 'edit.php';
88 88
 
89
-if ( ! empty( $redirect ) ) {
90
-	wp_redirect( $redirect );
89
+if ( ! empty($redirect)) {
90
+	wp_redirect($redirect);
91 91
 	exit;
92 92
 }
93 93
 
94 94
 // This is so that the correct "Edit" menu item is selected.
95
-if ( ! empty( $post->post_type ) && 'post' != $post->post_type )
96
-	$parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type;
95
+if ( ! empty($post->post_type) && 'post' != $post->post_type)
96
+	$parent_file = $submenu_file = 'edit.php?post_type='.$post->post_type;
97 97
 else
98 98
 	$parent_file = $submenu_file = 'edit.php';
99 99
 
100
-wp_enqueue_script( 'revisions' );
101
-wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $post, $revision_id, $from ) );
100
+wp_enqueue_script('revisions');
101
+wp_localize_script('revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js($post, $revision_id, $from));
102 102
 
103 103
 /* Revisions Help Tab */
104 104
 
105
-$revisions_overview  = '<p>' . __( 'This screen is used for managing your content revisions.' ) . '</p>';
106
-$revisions_overview .= '<p>' . __( 'Revisions are saved copies of your post or page, which are periodically created as you update your content. The red text on the left shows the content that was removed. The green text on the right shows the content that was added.' ) . '</p>';
107
-$revisions_overview .= '<p>' . __( 'From this screen you can review, compare, and restore revisions:' ) . '</p>';
108
-$revisions_overview .= '<ul><li>' . __( 'To navigate between revisions, <strong>drag the slider handle left or right</strong> or <strong>use the Previous or Next buttons</strong>.' ) . '</li>';
109
-$revisions_overview .= '<li>' . __( 'Compare two different revisions by <strong>selecting the &#8220;Compare any two revisions&#8221; box</strong> to the side.' ) . '</li>';
110
-$revisions_overview .= '<li>' . __( 'To restore a revision, <strong>click Restore This Revision</strong>.' ) . '</li></ul>';
105
+$revisions_overview  = '<p>'.__('This screen is used for managing your content revisions.').'</p>';
106
+$revisions_overview .= '<p>'.__('Revisions are saved copies of your post or page, which are periodically created as you update your content. The red text on the left shows the content that was removed. The green text on the right shows the content that was added.').'</p>';
107
+$revisions_overview .= '<p>'.__('From this screen you can review, compare, and restore revisions:').'</p>';
108
+$revisions_overview .= '<ul><li>'.__('To navigate between revisions, <strong>drag the slider handle left or right</strong> or <strong>use the Previous or Next buttons</strong>.').'</li>';
109
+$revisions_overview .= '<li>'.__('Compare two different revisions by <strong>selecting the &#8220;Compare any two revisions&#8221; box</strong> to the side.').'</li>';
110
+$revisions_overview .= '<li>'.__('To restore a revision, <strong>click Restore This Revision</strong>.').'</li></ul>';
111 111
 
112
-get_current_screen()->add_help_tab( array(
112
+get_current_screen()->add_help_tab(array(
113 113
 	'id'      => 'revisions-overview',
114
-	'title'   => __( 'Overview' ),
114
+	'title'   => __('Overview'),
115 115
 	'content' => $revisions_overview
116
-) );
116
+));
117 117
 
118
-$revisions_sidebar  = '<p><strong>' . __( 'For more information:' ) . '</strong></p>';
119
-$revisions_sidebar .= '<p>' . __( '<a href="https://codex.wordpress.org/Revision_Management" target="_blank">Revisions Management</a>' ) . '</p>';
120
-$revisions_sidebar .= '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>';
118
+$revisions_sidebar  = '<p><strong>'.__('For more information:').'</strong></p>';
119
+$revisions_sidebar .= '<p>'.__('<a href="https://codex.wordpress.org/Revision_Management" target="_blank">Revisions Management</a>').'</p>';
120
+$revisions_sidebar .= '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>';
121 121
 
122
-get_current_screen()->set_help_sidebar( $revisions_sidebar );
122
+get_current_screen()->set_help_sidebar($revisions_sidebar);
123 123
 
124
-require_once( ABSPATH . 'wp-admin/admin-header.php' );
124
+require_once(ABSPATH.'wp-admin/admin-header.php');
125 125
 
126 126
 ?>
127 127
 
@@ -132,4 +132,4 @@  discard block
 block discarded – undo
132 132
 <?php
133 133
 wp_print_revision_templates();
134 134
 
135
-require_once( ABSPATH . 'wp-admin/admin-footer.php' );
135
+require_once(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +28 added lines, -18 removed lines patch added patch discarded remove patch
@@ -25,20 +25,24 @@  discard block
 block discarded – undo
25 25
 $revision_id = absint( $revision );
26 26
 
27 27
 $from = is_numeric( $from ) ? absint( $from ) : null;
28
-if ( ! $revision_id )
28
+if ( ! $revision_id ) {
29 29
 	$revision_id = absint( $to );
30
+}
30 31
 $redirect = 'edit.php';
31 32
 
32 33
 switch ( $action ) {
33 34
 case 'restore' :
34
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
35
-		break;
35
+	if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
36
+			break;
37
+	}
36 38
 
37
-	if ( ! current_user_can( 'edit_post', $revision->post_parent ) )
38
-		break;
39
+	if ( ! current_user_can( 'edit_post', $revision->post_parent ) ) {
40
+			break;
41
+	}
39 42
 
40
-	if ( ! $post = get_post( $revision->post_parent ) )
41
-		break;
43
+	if ( ! $post = get_post( $revision->post_parent ) ) {
44
+			break;
45
+	}
42 46
 
43 47
 	// Revisions disabled (previously checked autosaves && ! wp_is_post_autosave( $revision ))
44 48
 	if ( ! wp_revisions_enabled( $post ) ) {
@@ -47,8 +51,9 @@  discard block
 block discarded – undo
47 51
 	}
48 52
 
49 53
 	// Don't allow revision restore when post is locked
50
-	if ( wp_check_post_lock( $post->ID ) )
51
-		break;
54
+	if ( wp_check_post_lock( $post->ID ) ) {
55
+			break;
56
+	}
52 57
 
53 58
 	check_admin_referer( "restore-post_{$revision->ID}" );
54 59
 
@@ -58,13 +63,16 @@  discard block
 block discarded – undo
58 63
 case 'view' :
59 64
 case 'edit' :
60 65
 default :
61
-	if ( ! $revision = wp_get_post_revision( $revision_id ) )
62
-		break;
63
-	if ( ! $post = get_post( $revision->post_parent ) )
64
-		break;
66
+	if ( ! $revision = wp_get_post_revision( $revision_id ) ) {
67
+			break;
68
+	}
69
+	if ( ! $post = get_post( $revision->post_parent ) ) {
70
+			break;
71
+	}
65 72
 
66
-	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) )
67
-		break;
73
+	if ( ! current_user_can( 'read_post', $revision->ID ) || ! current_user_can( 'read_post', $post->ID ) ) {
74
+			break;
75
+	}
68 76
 
69 77
 	// Revisions disabled and we're not looking at an autosave
70 78
 	if ( ! wp_revisions_enabled( $post ) && ! wp_is_post_autosave( $revision ) ) {
@@ -83,8 +91,9 @@  discard block
 block discarded – undo
83 91
 }
84 92
 
85 93
 // Empty post_type means either malformed object found, or no valid parent was found.
86
-if ( ! $redirect && empty( $post->post_type ) )
94
+if ( ! $redirect && empty( $post->post_type ) ) {
87 95
 	$redirect = 'edit.php';
96
+}
88 97
 
89 98
 if ( ! empty( $redirect ) ) {
90 99
 	wp_redirect( $redirect );
@@ -92,10 +101,11 @@  discard block
 block discarded – undo
92 101
 }
93 102
 
94 103
 // This is so that the correct "Edit" menu item is selected.
95
-if ( ! empty( $post->post_type ) && 'post' != $post->post_type )
104
+if ( ! empty( $post->post_type ) && 'post' != $post->post_type ) {
96 105
 	$parent_file = $submenu_file = 'edit.php?post_type=' . $post->post_type;
97
-else
106
+} else {
98 107
 	$parent_file = $submenu_file = 'edit.php';
108
+}
99 109
 
100 110
 wp_enqueue_script( 'revisions' );
101 111
 wp_localize_script( 'revisions', '_wpRevisionsSettings', wp_prepare_revisions_for_js( $post, $revision_id, $from ) );
Please login to merge, or discard this patch.
src/wp-admin/admin-post.php 2 patches
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -9,35 +9,35 @@  discard block
 block discarded – undo
9 9
  */
10 10
 
11 11
 /** We are located in WordPress Administration Screens */
12
-if ( ! defined( 'WP_ADMIN' ) ) {
13
-	define( 'WP_ADMIN', true );
12
+if ( ! defined('WP_ADMIN')) {
13
+	define('WP_ADMIN', true);
14 14
 }
15 15
 
16
-if ( defined('ABSPATH') )
17
-	require_once(ABSPATH . 'wp-load.php');
16
+if (defined('ABSPATH'))
17
+	require_once(ABSPATH.'wp-load.php');
18 18
 else
19
-	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
19
+	require_once(dirname(dirname(__FILE__)).'/wp-load.php');
20 20
 
21 21
 /** Allow for cross-domain requests (from the frontend). */
22 22
 send_origin_headers();
23 23
 
24
-require_once(ABSPATH . 'wp-admin/includes/admin.php');
24
+require_once(ABSPATH.'wp-admin/includes/admin.php');
25 25
 
26 26
 nocache_headers();
27 27
 
28 28
 /** This action is documented in wp-admin/admin.php */
29
-do_action( 'admin_init' );
29
+do_action('admin_init');
30 30
 
31
-$action = empty( $_REQUEST['action'] ) ? '' : $_REQUEST['action'];
31
+$action = empty($_REQUEST['action']) ? '' : $_REQUEST['action'];
32 32
 
33
-if ( ! wp_validate_auth_cookie() ) {
34
-	if ( empty( $action ) ) {
33
+if ( ! wp_validate_auth_cookie()) {
34
+	if (empty($action)) {
35 35
 		/**
36 36
 		 * Fires on a non-authenticated admin post request where no action was supplied.
37 37
 		 *
38 38
 		 * @since 2.6.0
39 39
 		 */
40
-		do_action( 'admin_post_nopriv' );
40
+		do_action('admin_post_nopriv');
41 41
 	} else {
42 42
 		/**
43 43
 		 * Fires on a non-authenticated admin post request for the given action.
@@ -47,16 +47,16 @@  discard block
 block discarded – undo
47 47
 		 *
48 48
 		 * @since 2.6.0
49 49
 		 */
50
-		do_action( "admin_post_nopriv_{$action}" );
50
+		do_action("admin_post_nopriv_{$action}");
51 51
 	}
52 52
 } else {
53
-	if ( empty( $action ) ) {
53
+	if (empty($action)) {
54 54
 		/**
55 55
 		 * Fires on an authenticated admin post request where no action was supplied.
56 56
 		 *
57 57
 		 * @since 2.6.0
58 58
 		 */
59
-		do_action( 'admin_post' );
59
+		do_action('admin_post');
60 60
 	} else {
61 61
 		/**
62 62
 		 * Fires on an authenticated admin post request for the given action.
@@ -66,6 +66,6 @@  discard block
 block discarded – undo
66 66
 		 *
67 67
 		 * @since 2.6.0
68 68
 		 */
69
-		do_action( "admin_post_{$action}" );
69
+		do_action("admin_post_{$action}");
70 70
 	}
71 71
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -2 removed lines patch added patch discarded remove patch
@@ -13,10 +13,11 @@
 block discarded – undo
13 13
 	define( 'WP_ADMIN', true );
14 14
 }
15 15
 
16
-if ( defined('ABSPATH') )
16
+if ( defined('ABSPATH') ) {
17 17
 	require_once(ABSPATH . 'wp-load.php');
18
-else
18
+} else {
19 19
 	require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
20
+}
20 21
 
21 22
 /** Allow for cross-domain requests (from the frontend). */
22 23
 send_origin_headers();
Please login to merge, or discard this patch.
src/wp-admin/options-reading.php 3 patches
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Reading settings administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+	 * Reading settings administration panel.
4
+	 *
5
+	 * @package WordPress
6
+	 * @subpackage Administration
7
+	 */
8 8
 
9 9
 /** WordPress Administration Bootstrap */
10 10
 require_once( dirname( __FILE__ ) . '/admin.php' );
Please login to merge, or discard this patch.
Spacing   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -7,12 +7,12 @@  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( __( 'You do not have sufficient permissions to manage options for this site.' ) );
12
+if ( ! current_user_can('manage_options'))
13
+	wp_die(__('You do not have sufficient permissions to manage options for this site.'));
14 14
 
15
-$title = __( 'Reading Settings' );
15
+$title = __('Reading Settings');
16 16
 $parent_file = 'options-general.php';
17 17
 
18 18
 /**
@@ -44,109 +44,109 @@  discard block
 block discarded – undo
44 44
  * @since 3.5.0
45 45
  */
46 46
 function options_reading_blog_charset() {
47
-	echo '<input name="blog_charset" type="text" id="blog_charset" value="' . esc_attr( get_option( 'blog_charset' ) ) . '" class="regular-text" />';
48
-	echo '<p class="description">' . __( 'The <a href="https://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)' ) . '</p>';
47
+	echo '<input name="blog_charset" type="text" id="blog_charset" value="'.esc_attr(get_option('blog_charset')).'" class="regular-text" />';
48
+	echo '<p class="description">'.__('The <a href="https://codex.wordpress.org/Glossary#Character_set">character encoding</a> of your site (UTF-8 is recommended)').'</p>';
49 49
 }
50 50
 
51
-get_current_screen()->add_help_tab( array(
51
+get_current_screen()->add_help_tab(array(
52 52
 	'id'      => 'overview',
53 53
 	'title'   => __('Overview'),
54
-	'content' => '<p>' . __('This screen contains the settings that affect the display of your content.') . '</p>' .
55
-		'<p>' . sprintf(__('You can choose what&#8217;s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page') . '</p>' .
56
-		'<p>' . __('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display and whether to show full text or a summary.') . '</p>' .
57
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
58
-) );
54
+	'content' => '<p>'.__('This screen contains the settings that affect the display of your content.').'</p>'.
55
+		'<p>'.sprintf(__('You can choose what&#8217;s displayed on the front page of your site. It can be posts in reverse chronological order (classic blog), or a fixed/static page. To set a static home page, you first need to create two <a href="%s">Pages</a>. One will become the front page, and the other will be where your posts are displayed.'), 'post-new.php?post_type=page').'</p>'.
56
+		'<p>'.__('You can also control the display of your content in RSS feeds, including the maximum numbers of posts to display and whether to show full text or a summary.').'</p>'.
57
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
58
+));
59 59
 
60
-get_current_screen()->add_help_tab( array(
60
+get_current_screen()->add_help_tab(array(
61 61
 	'id'      => 'site-visibility',
62
-	'title'   => has_action( 'blog_privacy_selector' ) ? __( 'Site Visibility' ) : __( 'Search Engine Visibility' ),
63
-	'content' => '<p>' . __( 'You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.' ) . '</p>' .
64
-		'<p>' . __( 'When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.' ) . '</p>',
65
-) );
62
+	'title'   => has_action('blog_privacy_selector') ? __('Site Visibility') : __('Search Engine Visibility'),
63
+	'content' => '<p>'.__('You can choose whether or not your site will be crawled by robots, ping services, and spiders. If you want those services to ignore your site, click the checkbox next to &#8220;Discourage search engines from indexing this site&#8221; and click the Save Changes button at the bottom of the screen. Note that your privacy is not complete; your site is still visible on the web.').'</p>'.
64
+		'<p>'.__('When this setting is in effect, a reminder is shown in the At a Glance box of the Dashboard that says, &#8220;Search Engines Discouraged,&#8221; to remind you that your site is not being crawled.').'</p>',
65
+));
66 66
 
67 67
 get_current_screen()->set_help_sidebar(
68
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
69
-	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>') . '</p>' .
70
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
68
+	'<p><strong>'.__('For more information:').'</strong></p>'.
69
+	'<p>'.__('<a href="https://codex.wordpress.org/Settings_Reading_Screen" target="_blank">Documentation on Reading Settings</a>').'</p>'.
70
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
71 71
 );
72 72
 
73
-include( ABSPATH . 'wp-admin/admin-header.php' );
73
+include(ABSPATH.'wp-admin/admin-header.php');
74 74
 ?>
75 75
 
76 76
 <div class="wrap">
77
-<h1><?php echo esc_html( $title ); ?></h1>
77
+<h1><?php echo esc_html($title); ?></h1>
78 78
 
79 79
 <form method="post" action="options.php">
80 80
 <?php
81
-settings_fields( 'reading' );
81
+settings_fields('reading');
82 82
 
83
-if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
84
-	add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
83
+if ( ! in_array(get_option('blog_charset'), array('utf8', 'utf-8', 'UTF8', 'UTF-8')))
84
+	add_settings_field('blog_charset', __('Encoding for pages and feeds'), 'options_reading_blog_charset', 'reading', 'default', array('label_for' => 'blog_charset'));
85 85
 ?>
86 86
 
87
-<?php if ( ! get_pages() ) : ?>
87
+<?php if ( ! get_pages()) : ?>
88 88
 <input name="show_on_front" type="hidden" value="posts" />
89 89
 <table class="form-table">
90 90
 <?php
91
-	if ( 'posts' != get_option( 'show_on_front' ) ) :
92
-		update_option( 'show_on_front', 'posts' );
91
+	if ('posts' != get_option('show_on_front')) :
92
+		update_option('show_on_front', 'posts');
93 93
 	endif;
94 94
 
95 95
 else :
96
-	if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
97
-		update_option( 'show_on_front', 'posts' );
96
+	if ('page' == get_option('show_on_front') && ! get_option('page_on_front') && ! get_option('page_for_posts'))
97
+		update_option('show_on_front', 'posts');
98 98
 ?>
99 99
 <table class="form-table">
100 100
 <tr>
101
-<th scope="row"><?php _e( 'Front page displays' ); ?></th>
102
-<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e( 'Front page displays' ); ?></span></legend>
101
+<th scope="row"><?php _e('Front page displays'); ?></th>
102
+<td id="front-static-pages"><fieldset><legend class="screen-reader-text"><span><?php _e('Front page displays'); ?></span></legend>
103 103
 	<p><label>
104
-		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked( 'posts', get_option( 'show_on_front' ) ); ?> />
105
-		<?php _e( 'Your latest posts' ); ?>
104
+		<input name="show_on_front" type="radio" value="posts" class="tog" <?php checked('posts', get_option('show_on_front')); ?> />
105
+		<?php _e('Your latest posts'); ?>
106 106
 	</label>
107 107
 	</p>
108 108
 	<p><label>
109
-		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked( 'page', get_option( 'show_on_front' ) ); ?> />
110
-		<?php printf( __( 'A <a href="%s">static page</a> (select below)' ), 'edit.php?post_type=page' ); ?>
109
+		<input name="show_on_front" type="radio" value="page" class="tog" <?php checked('page', get_option('show_on_front')); ?> />
110
+		<?php printf(__('A <a href="%s">static page</a> (select below)'), 'edit.php?post_type=page'); ?>
111 111
 	</label>
112 112
 	</p>
113 113
 <ul>
114
-	<li><label for="page_on_front"><?php printf( __( 'Front page: %s' ), wp_dropdown_pages( array( 'name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_on_front' ) ) ) ); ?></label></li>
115
-	<li><label for="page_for_posts"><?php printf( __( 'Posts page: %s' ), wp_dropdown_pages( array( 'name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __( '&mdash; Select &mdash;' ), 'option_none_value' => '0', 'selected' => get_option( 'page_for_posts' ) ) ) ); ?></label></li>
114
+	<li><label for="page_on_front"><?php printf(__('Front page: %s'), wp_dropdown_pages(array('name' => 'page_on_front', 'echo' => 0, 'show_option_none' => __('&mdash; Select &mdash;'), 'option_none_value' => '0', 'selected' => get_option('page_on_front')))); ?></label></li>
115
+	<li><label for="page_for_posts"><?php printf(__('Posts page: %s'), wp_dropdown_pages(array('name' => 'page_for_posts', 'echo' => 0, 'show_option_none' => __('&mdash; Select &mdash;'), 'option_none_value' => '0', 'selected' => get_option('page_for_posts')))); ?></label></li>
116 116
 </ul>
117
-<?php if ( 'page' == get_option( 'show_on_front' ) && get_option( 'page_for_posts' ) == get_option( 'page_on_front' ) ) : ?>
118
-<div id="front-page-warning" class="error inline"><p><?php _e( '<strong>Warning:</strong> these pages should not be the same!' ); ?></p></div>
117
+<?php if ('page' == get_option('show_on_front') && get_option('page_for_posts') == get_option('page_on_front')) : ?>
118
+<div id="front-page-warning" class="error inline"><p><?php _e('<strong>Warning:</strong> these pages should not be the same!'); ?></p></div>
119 119
 <?php endif; ?>
120 120
 </fieldset></td>
121 121
 </tr>
122 122
 <?php endif; ?>
123 123
 <tr>
124
-<th scope="row"><label for="posts_per_page"><?php _e( 'Blog pages show at most' ); ?></label></th>
124
+<th scope="row"><label for="posts_per_page"><?php _e('Blog pages show at most'); ?></label></th>
125 125
 <td>
126
-<input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option( 'posts_per_page' ); ?>" class="small-text" /> <?php _e( 'posts' ); ?>
126
+<input name="posts_per_page" type="number" step="1" min="1" id="posts_per_page" value="<?php form_option('posts_per_page'); ?>" class="small-text" /> <?php _e('posts'); ?>
127 127
 </td>
128 128
 </tr>
129 129
 <tr>
130
-<th scope="row"><label for="posts_per_rss"><?php _e( 'Syndication feeds show the most recent' ); ?></label></th>
131
-<td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option( 'posts_per_rss' ); ?>" class="small-text" /> <?php _e( 'items' ); ?></td>
130
+<th scope="row"><label for="posts_per_rss"><?php _e('Syndication feeds show the most recent'); ?></label></th>
131
+<td><input name="posts_per_rss" type="number" step="1" min="1" id="posts_per_rss" value="<?php form_option('posts_per_rss'); ?>" class="small-text" /> <?php _e('items'); ?></td>
132 132
 </tr>
133 133
 <tr>
134
-<th scope="row"><?php _e( 'For each article in a feed, show' ); ?> </th>
135
-<td><fieldset><legend class="screen-reader-text"><span><?php _e( 'For each article in a feed, show' ); ?> </span></legend>
136
-<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked( 0, get_option( 'rss_use_excerpt' ) ); ?>	/> <?php _e( 'Full text' ); ?></label><br />
137
-<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked( 1, get_option( 'rss_use_excerpt' ) ); ?> /> <?php _e( 'Summary' ); ?></label></p>
134
+<th scope="row"><?php _e('For each article in a feed, show'); ?> </th>
135
+<td><fieldset><legend class="screen-reader-text"><span><?php _e('For each article in a feed, show'); ?> </span></legend>
136
+<p><label><input name="rss_use_excerpt" type="radio" value="0" <?php checked(0, get_option('rss_use_excerpt')); ?>	/> <?php _e('Full text'); ?></label><br />
137
+<label><input name="rss_use_excerpt" type="radio" value="1" <?php checked(1, get_option('rss_use_excerpt')); ?> /> <?php _e('Summary'); ?></label></p>
138 138
 </fieldset></td>
139 139
 </tr>
140 140
 
141 141
 <tr class="option-site-visibility">
142
-<th scope="row"><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </th>
143
-<td><fieldset><legend class="screen-reader-text"><span><?php has_action( 'blog_privacy_selector' ) ? _e( 'Site Visibility' ) : _e( 'Search Engine Visibility' ); ?> </span></legend>
144
-<?php if ( has_action( 'blog_privacy_selector' ) ) : ?>
142
+<th scope="row"><?php has_action('blog_privacy_selector') ? _e('Site Visibility') : _e('Search Engine Visibility'); ?> </th>
143
+<td><fieldset><legend class="screen-reader-text"><span><?php has_action('blog_privacy_selector') ? _e('Site Visibility') : _e('Search Engine Visibility'); ?> </span></legend>
144
+<?php if (has_action('blog_privacy_selector')) : ?>
145 145
 	<input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
146
-	<label for="blog-public"><?php _e( 'Allow search engines to index this site' );?></label><br/>
146
+	<label for="blog-public"><?php _e('Allow search engines to index this site'); ?></label><br/>
147 147
 	<input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
148
-	<label for="blog-norobots"><?php _e( 'Discourage search engines from indexing this site' ); ?></label>
149
-	<p class="description"><?php _e( 'Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.' ); ?></p>
148
+	<label for="blog-norobots"><?php _e('Discourage search engines from indexing this site'); ?></label>
149
+	<p class="description"><?php _e('Note: Neither of these options blocks access to your site &mdash; it is up to search engines to honor your request.'); ?></p>
150 150
 	<?php
151 151
 	/**
152 152
 	 * Enable the legacy 'Site Visibility' privacy options.
@@ -161,22 +161,22 @@  discard block
 block discarded – undo
161 161
 	 *
162 162
 	 * @since 2.1.0
163 163
 	 */
164
-	do_action( 'blog_privacy_selector' );
164
+	do_action('blog_privacy_selector');
165 165
 	?>
166 166
 <?php else : ?>
167
-	<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
168
-	<?php _e( 'Discourage search engines from indexing this site' ); ?></label>
169
-	<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
167
+	<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
168
+	<?php _e('Discourage search engines from indexing this site'); ?></label>
169
+	<p class="description"><?php _e('It is up to search engines to honor this request.'); ?></p>
170 170
 <?php endif; ?>
171 171
 </fieldset></td>
172 172
 </tr>
173 173
 
174
-<?php do_settings_fields( 'reading', 'default' ); ?>
174
+<?php do_settings_fields('reading', 'default'); ?>
175 175
 </table>
176 176
 
177
-<?php do_settings_sections( 'reading' ); ?>
177
+<?php do_settings_sections('reading'); ?>
178 178
 
179 179
 <?php submit_button(); ?>
180 180
 </form>
181 181
 </div>
182
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
182
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
Braces   +12 added lines, -5 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( __( 'You do not have sufficient permissions to manage options for this site.' ) );
14
+}
14 15
 
15 16
 $title = __( 'Reading Settings' );
16 17
 $parent_file = 'options-general.php';
@@ -80,8 +81,9 @@  discard block
 block discarded – undo
80 81
 <?php
81 82
 settings_fields( 'reading' );
82 83
 
83
-if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) )
84
+if ( ! in_array( get_option( 'blog_charset' ), array( 'utf8', 'utf-8', 'UTF8', 'UTF-8' ) ) ) {
84 85
 	add_settings_field( 'blog_charset', __( 'Encoding for pages and feeds' ), 'options_reading_blog_charset', 'reading', 'default', array( 'label_for' => 'blog_charset' ) );
86
+}
85 87
 ?>
86 88
 
87 89
 <?php if ( ! get_pages() ) : ?>
@@ -92,9 +94,11 @@  discard block
 block discarded – undo
92 94
 		update_option( 'show_on_front', 'posts' );
93 95
 	endif;
94 96
 
95
-else :
97
+else {
98
+	:
96 99
 	if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_on_front' ) && ! get_option( 'page_for_posts' ) )
97 100
 		update_option( 'show_on_front', 'posts' );
101
+}
98 102
 ?>
99 103
 <table class="form-table">
100 104
 <tr>
@@ -163,8 +167,11 @@  discard block
 block discarded – undo
163 167
 	 */
164 168
 	do_action( 'blog_privacy_selector' );
165 169
 	?>
166
-<?php else : ?>
167
-	<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) ); ?> />
170
+<?php else {
171
+	: ?>
172
+	<label for="blog_public"><input name="blog_public" type="checkbox" id="blog_public" value="0" <?php checked( '0', get_option( 'blog_public' ) );
173
+}
174
+?> />
168 175
 	<?php _e( 'Discourage search engines from indexing this site' ); ?></label>
169 176
 	<p class="description"><?php _e( 'It is up to search engines to honor this request.' ); ?></p>
170 177
 <?php endif; ?>
Please login to merge, or discard this patch.
src/wp-admin/link.php 3 patches
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -1,13 +1,13 @@
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Manage link administration actions.
4
- *
5
- * This page is accessed by the link management pages and handles the forms and
6
- * AJAX processes for link actions.
7
- *
8
- * @package WordPress
9
- * @subpackage Administration
10
- */
3
+	 * Manage link administration actions.
4
+	 *
5
+	 * This page is accessed by the link management pages and handles the forms and
6
+	 * AJAX processes for link actions.
7
+	 *
8
+	 * @package WordPress
9
+	 * @subpackage Administration
10
+	 */
11 11
 
12 12
 /** Load WordPress Administration Bootstrap */
13 13
 require_once( dirname( __FILE__ ) . '/admin.php' );
Please login to merge, or discard this patch.
Spacing   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -10,18 +10,18 @@  discard block
 block discarded – undo
10 10
  */
11 11
 
12 12
 /** Load WordPress Administration Bootstrap */
13
-require_once( dirname( __FILE__ ) . '/admin.php' );
13
+require_once(dirname(__FILE__).'/admin.php');
14 14
 
15
-wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) );
15
+wp_reset_vars(array('action', 'cat_id', 'link_id'));
16 16
 
17
-if ( ! current_user_can('manage_links') )
17
+if ( ! current_user_can('manage_links'))
18 18
 	wp_link_manager_disabled_message();
19 19
 
20
-if ( !empty($_POST['deletebookmarks']) )
20
+if ( ! empty($_POST['deletebookmarks']))
21 21
 	$action = 'deletebookmarks';
22
-if ( !empty($_POST['move']) )
22
+if ( ! empty($_POST['move']))
23 23
 	$action = 'move';
24
-if ( !empty($_POST['linkcheck']) )
24
+if ( ! empty($_POST['linkcheck']))
25 25
 	$linkcheck = $_POST['linkcheck'];
26 26
 
27 27
 $this_file = admin_url('link-manager.php');
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		foreach ($linkcheck as $link_id) {
41 41
 			$link_id = (int) $link_id;
42 42
 
43
-			if ( wp_delete_link($link_id) )
43
+			if (wp_delete_link($link_id))
44 44
 				$deleted++;
45 45
 		}
46 46
 
@@ -68,15 +68,15 @@  discard block
 block discarded – undo
68 68
 		check_admin_referer('add-bookmark');
69 69
 
70 70
 		$redir = wp_get_referer();
71
-		if ( add_link() )
72
-			$redir = add_query_arg( 'added', 'true', $redir );
71
+		if (add_link())
72
+			$redir = add_query_arg('added', 'true', $redir);
73 73
 
74
-		wp_redirect( $redir );
74
+		wp_redirect($redir);
75 75
 		exit;
76 76
 
77 77
 	case 'save' :
78 78
 		$link_id = (int) $_POST['link_id'];
79
-		check_admin_referer('update-bookmark_' . $link_id);
79
+		check_admin_referer('update-bookmark_'.$link_id);
80 80
 
81 81
 		edit_link($link_id);
82 82
 
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 	case 'delete' :
87 87
 		$link_id = (int) $_GET['link_id'];
88
-		check_admin_referer('delete-bookmark_' . $link_id);
88
+		check_admin_referer('delete-bookmark_'.$link_id);
89 89
 
90 90
 		wp_delete_link($link_id);
91 91
 
@@ -96,8 +96,8 @@  discard block
 block discarded – undo
96 96
 		wp_enqueue_script('link');
97 97
 		wp_enqueue_script('xfn');
98 98
 
99
-		if ( wp_is_mobile() )
100
-			wp_enqueue_script( 'jquery-touch-punch' );
99
+		if (wp_is_mobile())
100
+			wp_enqueue_script('jquery-touch-punch');
101 101
 
102 102
 		$parent_file = 'link-manager.php';
103 103
 		$submenu_file = 'link-manager.php';
@@ -105,11 +105,11 @@  discard block
 block discarded – undo
105 105
 
106 106
 		$link_id = (int) $_GET['link_id'];
107 107
 
108
-		if (!$link = get_link_to_edit($link_id))
108
+		if ( ! $link = get_link_to_edit($link_id))
109 109
 			wp_die(__('Link not found.'));
110 110
 
111
-		include( ABSPATH . 'wp-admin/edit-link-form.php' );
112
-		include( ABSPATH . 'wp-admin/admin-footer.php' );
111
+		include(ABSPATH.'wp-admin/edit-link-form.php');
112
+		include(ABSPATH.'wp-admin/admin-footer.php');
113 113
 		break;
114 114
 
115 115
 	default :
Please login to merge, or discard this patch.
Braces   +20 added lines, -12 removed lines patch added patch discarded remove patch
@@ -14,15 +14,19 @@  discard block
 block discarded – undo
14 14
 
15 15
 wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) );
16 16
 
17
-if ( ! current_user_can('manage_links') )
17
+if ( ! current_user_can('manage_links') ) {
18 18
 	wp_link_manager_disabled_message();
19
+}
19 20
 
20
-if ( !empty($_POST['deletebookmarks']) )
21
+if ( !empty($_POST['deletebookmarks']) ) {
21 22
 	$action = 'deletebookmarks';
22
-if ( !empty($_POST['move']) )
23
+}
24
+if ( !empty($_POST['move']) ) {
23 25
 	$action = 'move';
24
-if ( !empty($_POST['linkcheck']) )
26
+}
27
+if ( !empty($_POST['linkcheck']) ) {
25 28
 	$linkcheck = $_POST['linkcheck'];
29
+}
26 30
 
27 31
 $this_file = admin_url('link-manager.php');
28 32
 
@@ -40,8 +44,9 @@  discard block
 block discarded – undo
40 44
 		foreach ($linkcheck as $link_id) {
41 45
 			$link_id = (int) $link_id;
42 46
 
43
-			if ( wp_delete_link($link_id) )
44
-				$deleted++;
47
+			if ( wp_delete_link($link_id) ) {
48
+							$deleted++;
49
+			}
45 50
 		}
46 51
 
47 52
 		wp_redirect("$this_file?deleted=$deleted");
@@ -68,8 +73,9 @@  discard block
 block discarded – undo
68 73
 		check_admin_referer('add-bookmark');
69 74
 
70 75
 		$redir = wp_get_referer();
71
-		if ( add_link() )
72
-			$redir = add_query_arg( 'added', 'true', $redir );
76
+		if ( add_link() ) {
77
+					$redir = add_query_arg( 'added', 'true', $redir );
78
+		}
73 79
 
74 80
 		wp_redirect( $redir );
75 81
 		exit;
@@ -96,8 +102,9 @@  discard block
 block discarded – undo
96 102
 		wp_enqueue_script('link');
97 103
 		wp_enqueue_script('xfn');
98 104
 
99
-		if ( wp_is_mobile() )
100
-			wp_enqueue_script( 'jquery-touch-punch' );
105
+		if ( wp_is_mobile() ) {
106
+					wp_enqueue_script( 'jquery-touch-punch' );
107
+		}
101 108
 
102 109
 		$parent_file = 'link-manager.php';
103 110
 		$submenu_file = 'link-manager.php';
@@ -105,8 +112,9 @@  discard block
 block discarded – undo
105 112
 
106 113
 		$link_id = (int) $_GET['link_id'];
107 114
 
108
-		if (!$link = get_link_to_edit($link_id))
109
-			wp_die(__('Link not found.'));
115
+		if (!$link = get_link_to_edit($link_id)) {
116
+					wp_die(__('Link not found.'));
117
+		}
110 118
 
111 119
 		include( ABSPATH . 'wp-admin/edit-link-form.php' );
112 120
 		include( ABSPATH . 'wp-admin/admin-footer.php' );
Please login to merge, or discard this patch.
src/wp-admin/options-discussion.php 3 patches
Indentation   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -1,10 +1,10 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 /**
3
- * Discussion settings administration panel.
4
- *
5
- * @package WordPress
6
- * @subpackage Administration
7
- */
3
+		 * Discussion settings administration panel.
4
+		 *
5
+		 * @package WordPress
6
+		 * @subpackage Administration
7
+		 */
8 8
 /** WordPress Administration Bootstrap */
9 9
 require_once( dirname( __FILE__ ) . '/admin.php' );
10 10
 
@@ -248,15 +248,15 @@  discard block
 block discarded – undo
248 248
 	'retro' => __('Retro (Generated)')
249 249
 );
250 250
 /**
251
- * Filter the default avatars.
252
- *
253
- * Avatars are stored in key/value pairs, where the key is option value,
254
- * and the name is the displayed avatar name.
255
- *
256
- * @since 2.6.0
257
- *
258
- * @param array $avatar_defaults Array of default avatars.
259
- */
251
+	 * Filter the default avatars.
252
+	 *
253
+	 * Avatars are stored in key/value pairs, where the key is option value,
254
+	 * and the name is the displayed avatar name.
255
+	 *
256
+	 * @since 2.6.0
257
+	 *
258
+	 * @param array $avatar_defaults Array of default avatars.
259
+	 */
260 260
 $avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
261 261
 $default = get_option( 'avatar_default', 'mystery' );
262 262
 $size = 32;
Please login to merge, or discard this patch.
Spacing   +52 added lines, -52 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
  * @subpackage Administration
7 7
  */
8 8
 /** WordPress Administration Bootstrap */
9
-require_once( dirname( __FILE__ ) . '/admin.php' );
9
+require_once(dirname(__FILE__).'/admin.php');
10 10
 
11
-if ( ! current_user_can( 'manage_options' ) )
12
-	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
11
+if ( ! current_user_can('manage_options'))
12
+	wp_die(__('You do not have sufficient permissions to manage options for this site.'));
13 13
 
14 14
 $title = __('Discussion Settings');
15 15
 $parent_file = 'options-general.php';
@@ -32,26 +32,26 @@  discard block
 block discarded – undo
32 32
 	</script>
33 33
 <?php
34 34
 }
35
-add_action( 'admin_print_footer_scripts', 'options_discussion_add_js' );
35
+add_action('admin_print_footer_scripts', 'options_discussion_add_js');
36 36
 
37
-get_current_screen()->add_help_tab( array(
37
+get_current_screen()->add_help_tab(array(
38 38
 	'id'      => 'overview',
39 39
 	'title'   => __('Overview'),
40
-	'content' => '<p>' . __('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won&#8217;t all fit here! :) Use the documentation links to get information on what each discussion setting does.') . '</p>' .
41
-		'<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>',
42
-) );
40
+	'content' => '<p>'.__('This screen provides many options for controlling the management and display of comments and links to your posts/pages. So many, in fact, they won&#8217;t all fit here! :) Use the documentation links to get information on what each discussion setting does.').'</p>'.
41
+		'<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>',
42
+));
43 43
 
44 44
 get_current_screen()->set_help_sidebar(
45
-	'<p><strong>' . __('For more information:') . '</strong></p>' .
46
-	'<p>' . __('<a href="https://codex.wordpress.org/Settings_Discussion_Screen" target="_blank">Documentation on Discussion Settings</a>') . '</p>' .
47
-	'<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
45
+	'<p><strong>'.__('For more information:').'</strong></p>'.
46
+	'<p>'.__('<a href="https://codex.wordpress.org/Settings_Discussion_Screen" target="_blank">Documentation on Discussion Settings</a>').'</p>'.
47
+	'<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>'
48 48
 );
49 49
 
50
-include( ABSPATH . 'wp-admin/admin-header.php' );
50
+include(ABSPATH.'wp-admin/admin-header.php');
51 51
 ?>
52 52
 
53 53
 <div class="wrap">
54
-<h1><?php echo esc_html( $title ); ?></h1>
54
+<h1><?php echo esc_html($title); ?></h1>
55 55
 
56 56
 <form method="post" action="options.php">
57 57
 <?php settings_fields('discussion'); ?>
@@ -72,7 +72,7 @@  discard block
 block discarded – undo
72 72
 <input name="default_comment_status" type="checkbox" id="default_comment_status" value="open" <?php checked('open', get_option('default_comment_status')); ?> />
73 73
 <?php _e('Allow people to post comments on new articles'); ?></label>
74 74
 <br />
75
-<p class="description"><?php echo '(' . __( 'These settings may be overridden for individual articles.' ) . ')'; ?></p>
75
+<p class="description"><?php echo '('.__('These settings may be overridden for individual articles.').')'; ?></p>
76 76
 </fieldset></td>
77 77
 </tr>
78 78
 <tr>
@@ -83,13 +83,13 @@  discard block
 block discarded – undo
83 83
 <label for="comment_registration">
84 84
 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
85 85
 <?php _e('Users must be registered and logged in to comment'); ?>
86
-<?php if ( !get_option( 'users_can_register' ) && is_multisite() ) echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' ); ?>
86
+<?php if ( ! get_option('users_can_register') && is_multisite()) echo ' '.__('(Signup has been disabled. Only members of this site can comment.)'); ?>
87 87
 </label>
88 88
 <br />
89 89
 
90 90
 <label for="close_comments_for_old_posts">
91 91
 <input name="close_comments_for_old_posts" type="checkbox" id="close_comments_for_old_posts" value="1" <?php checked('1', get_option('close_comments_for_old_posts')); ?> />
92
-<?php printf( __('Automatically close comments on articles older than %s days'), '</label><label for="close_comments_days_old"><input name="close_comments_days_old" type="number" min="0" step="1" id="close_comments_days_old" value="' . esc_attr(get_option('close_comments_days_old')) . '" class="small-text" />'); ?>
92
+<?php printf(__('Automatically close comments on articles older than %s days'), '</label><label for="close_comments_days_old"><input name="close_comments_days_old" type="number" min="0" step="1" id="close_comments_days_old" value="'.esc_attr(get_option('close_comments_days_old')).'" class="small-text" />'); ?>
93 93
 </label>
94 94
 <br />
95 95
 <label for="thread_comments">
@@ -102,17 +102,17 @@  discard block
 block discarded – undo
102 102
  *
103 103
  * @param int $max_depth The maximum depth of threaded comments. Default 10.
104 104
  */
105
-$maxdeep = (int) apply_filters( 'thread_comments_depth_max', 10 );
105
+$maxdeep = (int) apply_filters('thread_comments_depth_max', 10);
106 106
 
107 107
 $thread_comments_depth = '</label><label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">';
108
-for ( $i = 2; $i <= $maxdeep; $i++ ) {
109
-	$thread_comments_depth .= "<option value='" . esc_attr($i) . "'";
110
-	if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
108
+for ($i = 2; $i <= $maxdeep; $i++) {
109
+	$thread_comments_depth .= "<option value='".esc_attr($i)."'";
110
+	if (get_option('thread_comments_depth') == $i) $thread_comments_depth .= " selected='selected'";
111 111
 	$thread_comments_depth .= ">$i</option>";
112 112
 }
113 113
 $thread_comments_depth .= '</select>';
114 114
 
115
-printf( __('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth );
115
+printf(__('Enable threaded (nested) comments %s levels deep'), $thread_comments_depth);
116 116
 
117 117
 ?></label>
118 118
 <br />
@@ -121,24 +121,24 @@  discard block
 block discarded – undo
121 121
 <?php
122 122
 
123 123
 $default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
124
-if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
125
-$default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
126
-if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
127
-$default_comments_page .= '>' . __('first') . '</option></select>';
124
+if ('newest' == get_option('default_comments_page')) $default_comments_page .= ' selected="selected"';
125
+$default_comments_page .= '>'.__('last').'</option><option value="oldest"';
126
+if ('oldest' == get_option('default_comments_page')) $default_comments_page .= ' selected="selected"';
127
+$default_comments_page .= '>'.__('first').'</option></select>';
128 128
 
129
-printf( __('Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="number" step="1" min="0" id="comments_per_page" value="' . esc_attr(get_option('comments_per_page')) . '" class="small-text" />', $default_comments_page );
129
+printf(__('Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="number" step="1" min="0" id="comments_per_page" value="'.esc_attr(get_option('comments_per_page')).'" class="small-text" />', $default_comments_page);
130 130
 
131 131
 ?></label>
132 132
 <br />
133 133
 <label for="comment_order"><?php
134 134
 
135 135
 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
136
-if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
137
-$comment_order .= '>' . __('older') . '</option><option value="desc"';
138
-if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
139
-$comment_order .= '>' . __('newer') . '</option></select>';
136
+if ('asc' == get_option('comment_order')) $comment_order .= ' selected="selected"';
137
+$comment_order .= '>'.__('older').'</option><option value="desc"';
138
+if ('desc' == get_option('comment_order')) $comment_order .= ' selected="selected"';
139
+$comment_order .= '>'.__('newer').'</option></select>';
140 140
 
141
-printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
141
+printf(__('Comments should be displayed with the %s comments at the top of each page'), $comment_order);
142 142
 
143 143
 ?></label>
144 144
 </fieldset></td>
@@ -168,11 +168,11 @@  discard block
 block discarded – undo
168 168
 <tr>
169 169
 <th scope="row"><?php _e('Comment Moderation'); ?></th>
170 170
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Moderation'); ?></span></legend>
171
-<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="' . esc_attr(get_option('comment_max_links')) . '" class="small-text" />' ); ?></label></p>
171
+<p><label for="comment_max_links"><?php printf(__('Hold a comment in the queue if it contains %s or more links. (A common characteristic of comment spam is a large number of hyperlinks.)'), '<input name="comment_max_links" type="number" step="1" min="0" id="comment_max_links" value="'.esc_attr(get_option('comment_max_links')).'" class="small-text" />'); ?></label></p>
172 172
 
173 173
 <p><label for="moderation_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be held in the <a href="edit-comments.php?comment_status=moderated">moderation queue</a>. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.'); ?></label></p>
174 174
 <p>
175
-<textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea( get_option( 'moderation_keys' ) ); ?></textarea>
175
+<textarea name="moderation_keys" rows="10" cols="50" id="moderation_keys" class="large-text code"><?php echo esc_textarea(get_option('moderation_keys')); ?></textarea>
176 176
 </p>
177 177
 </fieldset></td>
178 178
 </tr>
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Comment Blacklist'); ?></span></legend>
182 182
 <p><label for="blacklist_keys"><?php _e('When a comment contains any of these words in its content, name, URL, e-mail, or IP, it will be marked as spam. One word or IP per line. It will match inside words, so &#8220;press&#8221; will match &#8220;WordPress&#8221;.'); ?></label></p>
183 183
 <p>
184
-<textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea( get_option( 'blacklist_keys' ) ); ?></textarea>
184
+<textarea name="blacklist_keys" rows="10" cols="50" id="blacklist_keys" class="large-text code"><?php echo esc_textarea(get_option('blacklist_keys')); ?></textarea>
185 185
 </p>
186 186
 </fieldset></td>
187 187
 </tr>
@@ -195,7 +195,7 @@  discard block
 block discarded – undo
195 195
 <?php
196 196
 // the above would be a good place to link to codex documentation on the gravatar functions, for putting it in themes. anything like that?
197 197
 
198
-$show_avatars = get_option( 'show_avatars' );
198
+$show_avatars = get_option('show_avatars');
199 199
 ?>
200 200
 
201 201
 <table class="form-table">
@@ -203,12 +203,12 @@  discard block
 block discarded – undo
203 203
 <th scope="row"><?php _e('Avatar Display'); ?></th>
204 204
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Avatar Display'); ?></span></legend>
205 205
 	<label for="show_avatars">
206
-		<input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked( $show_avatars, 1 ); ?> />
207
-		<?php _e( 'Show Avatars' ); ?>
206
+		<input type="checkbox" id="show_avatars" name="show_avatars" value="1" <?php checked($show_avatars, 1); ?> />
207
+		<?php _e('Show Avatars'); ?>
208 208
 	</label>
209 209
 </fieldset></td>
210 210
 </tr>
211
-<tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
211
+<tr class="avatar-settings<?php if ( ! $show_avatars) echo ' hide-if-js'; ?>">
212 212
 <th scope="row"><?php _e('Maximum Rating'); ?></th>
213 213
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend>
214 214
 
@@ -225,13 +225,13 @@  discard block
 block discarded – undo
225 225
 );
226 226
 foreach ($ratings as $key => $rating) :
227 227
 	$selected = (get_option('avatar_rating') == $key) ? 'checked="checked"' : '';
228
-	echo "\n\t<label><input type='radio' name='avatar_rating' value='" . esc_attr($key) . "' $selected/> $rating</label><br />";
228
+	echo "\n\t<label><input type='radio' name='avatar_rating' value='".esc_attr($key)."' $selected/> $rating</label><br />";
229 229
 endforeach;
230 230
 ?>
231 231
 
232 232
 </fieldset></td>
233 233
 </tr>
234
-<tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
234
+<tr class="avatar-settings<?php if ( ! $show_avatars) echo ' hide-if-js'; ?>">
235 235
 <th scope="row"><?php _e('Default Avatar'); ?></th>
236 236
 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend>
237 237
 
@@ -257,28 +257,28 @@  discard block
 block discarded – undo
257 257
  *
258 258
  * @param array $avatar_defaults Array of default avatars.
259 259
  */
260
-$avatar_defaults = apply_filters( 'avatar_defaults', $avatar_defaults );
261
-$default = get_option( 'avatar_default', 'mystery' );
260
+$avatar_defaults = apply_filters('avatar_defaults', $avatar_defaults);
261
+$default = get_option('avatar_default', 'mystery');
262 262
 $size = 32;
263 263
 $avatar_list = '';
264 264
 
265 265
 // Force avatars on to display these choices
266
-add_filter( 'pre_option_show_avatars', '__return_true', 100 );
266
+add_filter('pre_option_show_avatars', '__return_true', 100);
267 267
 
268
-foreach ( $avatar_defaults as $default_key => $default_name ) {
268
+foreach ($avatar_defaults as $default_key => $default_name) {
269 269
 	$selected = ($default == $default_key) ? 'checked="checked" ' : '';
270
-	$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='" . esc_attr($default_key) . "' {$selected}/> ";
270
+	$avatar_list .= "\n\t<label><input type='radio' name='avatar_default' id='avatar_{$default_key}' value='".esc_attr($default_key)."' {$selected}/> ";
271 271
 
272
-	$avatar = get_avatar( $user_email, $size, $default_key );
273
-	$avatar = preg_replace( "/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar );
274
-	$avatar = preg_replace( "/srcset='(.+?) 2x'/", "srcset='\$1&amp;forcedefault=1 2x'", $avatar );
272
+	$avatar = get_avatar($user_email, $size, $default_key);
273
+	$avatar = preg_replace("/src='(.+?)'/", "src='\$1&amp;forcedefault=1'", $avatar);
274
+	$avatar = preg_replace("/srcset='(.+?) 2x'/", "srcset='\$1&amp;forcedefault=1 2x'", $avatar);
275 275
 	$avatar_list .= $avatar;
276 276
 
277
-	$avatar_list .= ' ' . $default_name . '</label>';
277
+	$avatar_list .= ' '.$default_name.'</label>';
278 278
 	$avatar_list .= '<br />';
279 279
 }
280 280
 
281
-remove_filter( 'pre_option_show_avatars', '__return_true', 100 );
281
+remove_filter('pre_option_show_avatars', '__return_true', 100);
282 282
 
283 283
 /**
284 284
  * Filter the HTML output of the default avatar list.
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
  *
288 288
  * @param string $avatar_list HTML markup of the avatar list.
289 289
  */
290
-echo apply_filters( 'default_avatar_select', $avatar_list );
290
+echo apply_filters('default_avatar_select', $avatar_list);
291 291
 ?>
292 292
 
293 293
 </fieldset></td>
@@ -301,4 +301,4 @@  discard block
 block discarded – undo
301 301
 </form>
302 302
 </div>
303 303
 
304
-<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?>
304
+<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?>
Please login to merge, or discard this patch.
Braces   +29 added lines, -9 removed lines patch added patch discarded remove patch
@@ -8,8 +8,9 @@  discard block
 block discarded – undo
8 8
 /** WordPress Administration Bootstrap */
9 9
 require_once( dirname( __FILE__ ) . '/admin.php' );
10 10
 
11
-if ( ! current_user_can( 'manage_options' ) )
11
+if ( ! current_user_can( 'manage_options' ) ) {
12 12
 	wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) );
13
+}
13 14
 
14 15
 $title = __('Discussion Settings');
15 16
 $parent_file = 'options-general.php';
@@ -83,7 +84,10 @@  discard block
 block discarded – undo
83 84
 <label for="comment_registration">
84 85
 <input name="comment_registration" type="checkbox" id="comment_registration" value="1" <?php checked('1', get_option('comment_registration')); ?> />
85 86
 <?php _e('Users must be registered and logged in to comment'); ?>
86
-<?php if ( !get_option( 'users_can_register' ) && is_multisite() ) echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' ); ?>
87
+<?php if ( !get_option( 'users_can_register' ) && is_multisite() ) {
88
+	echo ' ' . __( '(Signup has been disabled. Only members of this site can comment.)' );
89
+}
90
+?>
87 91
 </label>
88 92
 <br />
89 93
 
@@ -107,7 +111,9 @@  discard block
 block discarded – undo
107 111
 $thread_comments_depth = '</label><label for="thread_comments_depth"><select name="thread_comments_depth" id="thread_comments_depth">';
108 112
 for ( $i = 2; $i <= $maxdeep; $i++ ) {
109 113
 	$thread_comments_depth .= "<option value='" . esc_attr($i) . "'";
110
-	if ( get_option('thread_comments_depth') == $i ) $thread_comments_depth .= " selected='selected'";
114
+	if ( get_option('thread_comments_depth') == $i ) {
115
+		$thread_comments_depth .= " selected='selected'";
116
+	}
111 117
 	$thread_comments_depth .= ">$i</option>";
112 118
 }
113 119
 $thread_comments_depth .= '</select>';
@@ -121,9 +127,13 @@  discard block
 block discarded – undo
121 127
 <?php
122 128
 
123 129
 $default_comments_page = '</label><label for="default_comments_page"><select name="default_comments_page" id="default_comments_page"><option value="newest"';
124
-if ( 'newest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
130
+if ( 'newest' == get_option('default_comments_page') ) {
131
+	$default_comments_page .= ' selected="selected"';
132
+}
125 133
 $default_comments_page .= '>' . __('last') . '</option><option value="oldest"';
126
-if ( 'oldest' == get_option('default_comments_page') ) $default_comments_page .= ' selected="selected"';
134
+if ( 'oldest' == get_option('default_comments_page') ) {
135
+	$default_comments_page .= ' selected="selected"';
136
+}
127 137
 $default_comments_page .= '>' . __('first') . '</option></select>';
128 138
 
129 139
 printf( __('Break comments into pages with %1$s top level comments per page and the %2$s page displayed by default'), '</label><label for="comments_per_page"><input name="comments_per_page" type="number" step="1" min="0" id="comments_per_page" value="' . esc_attr(get_option('comments_per_page')) . '" class="small-text" />', $default_comments_page );
@@ -133,9 +143,13 @@  discard block
 block discarded – undo
133 143
 <label for="comment_order"><?php
134 144
 
135 145
 $comment_order = '<select name="comment_order" id="comment_order"><option value="asc"';
136
-if ( 'asc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
146
+if ( 'asc' == get_option('comment_order') ) {
147
+	$comment_order .= ' selected="selected"';
148
+}
137 149
 $comment_order .= '>' . __('older') . '</option><option value="desc"';
138
-if ( 'desc' == get_option('comment_order') ) $comment_order .= ' selected="selected"';
150
+if ( 'desc' == get_option('comment_order') ) {
151
+	$comment_order .= ' selected="selected"';
152
+}
139 153
 $comment_order .= '>' . __('newer') . '</option></select>';
140 154
 
141 155
 printf( __('Comments should be displayed with the %s comments at the top of each page'), $comment_order );
@@ -208,7 +222,10 @@  discard block
 block discarded – undo
208 222
 	</label>
209 223
 </fieldset></td>
210 224
 </tr>
211
-<tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
225
+<tr class="avatar-settings<?php if ( ! $show_avatars ) {
226
+	echo ' hide-if-js';
227
+}
228
+?>">
212 229
 <th scope="row"><?php _e('Maximum Rating'); ?></th>
213 230
 <td><fieldset><legend class="screen-reader-text"><span><?php _e('Maximum Rating'); ?></span></legend>
214 231
 
@@ -231,7 +248,10 @@  discard block
 block discarded – undo
231 248
 
232 249
 </fieldset></td>
233 250
 </tr>
234
-<tr class="avatar-settings<?php if ( ! $show_avatars ) echo ' hide-if-js'; ?>">
251
+<tr class="avatar-settings<?php if ( ! $show_avatars ) {
252
+	echo ' hide-if-js';
253
+}
254
+?>">
235 255
 <th scope="row"><?php _e('Default Avatar'); ?></th>
236 256
 <td class="defaultavatarpicker"><fieldset><legend class="screen-reader-text"><span><?php _e('Default Avatar'); ?></span></legend>
237 257
 
Please login to merge, or discard this patch.
src/wp-admin/post-new.php 2 patches
Spacing   +25 added lines, -25 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 Administration Bootstrap */
10
-require_once( dirname( __FILE__ ) . '/admin.php' );
10
+require_once(dirname(__FILE__).'/admin.php');
11 11
 
12 12
 /**
13 13
  * @global string  $post_type
@@ -16,28 +16,28 @@  discard block
 block discarded – undo
16 16
  */
17 17
 global $post_type, $post_type_object, $post;
18 18
 
19
-if ( ! isset( $_GET['post_type'] ) ) {
19
+if ( ! isset($_GET['post_type'])) {
20 20
 	$post_type = 'post';
21
-} elseif ( in_array( $_GET['post_type'], get_post_types( array('show_ui' => true ) ) ) ) {
21
+} elseif (in_array($_GET['post_type'], get_post_types(array('show_ui' => true)))) {
22 22
 	$post_type = $_GET['post_type'];
23 23
 } else {
24
-	wp_die( __('Invalid post type') );
24
+	wp_die(__('Invalid post type'));
25 25
 }
26
-$post_type_object = get_post_type_object( $post_type );
26
+$post_type_object = get_post_type_object($post_type);
27 27
 
28
-if ( 'post' == $post_type ) {
28
+if ('post' == $post_type) {
29 29
 	$parent_file = 'edit.php';
30 30
 	$submenu_file = 'post-new.php';
31
-} elseif ( 'attachment' == $post_type ) {
32
-	if ( wp_redirect( admin_url( 'media-new.php' ) ) )
31
+} elseif ('attachment' == $post_type) {
32
+	if (wp_redirect(admin_url('media-new.php')))
33 33
 		exit;
34 34
 } else {
35 35
 	$submenu_file = "post-new.php?post_type=$post_type";
36
-	if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
36
+	if (isset($post_type_object) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true) {
37 37
 		$parent_file = $post_type_object->show_in_menu;
38 38
 		// What if there isn't a post-new.php item for this post type?
39
-		if ( ! isset( $_registered_pages[ get_plugin_page_hookname( "post-new.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) {
40
-			if (	isset( $_registered_pages[ get_plugin_page_hookname( "edit.php?post_type=$post_type", $post_type_object->show_in_menu ) ] ) ) {
39
+		if ( ! isset($_registered_pages[get_plugin_page_hookname("post-new.php?post_type=$post_type", $post_type_object->show_in_menu)])) {
40
+			if (isset($_registered_pages[get_plugin_page_hookname("edit.php?post_type=$post_type", $post_type_object->show_in_menu)])) {
41 41
 				// Fall back to edit.php for that post type, if it exists
42 42
 				$submenu_file = "edit.php?post_type=$post_type";
43 43
 			} else {
@@ -54,28 +54,28 @@  discard block
 block discarded – undo
54 54
 
55 55
 $editing = true;
56 56
 
57
-if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) )
58
-	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
57
+if ( ! current_user_can($post_type_object->cap->edit_posts) || ! current_user_can($post_type_object->cap->create_posts))
58
+	wp_die(__('Cheatin&#8217; uh?'), 403);
59 59
 
60 60
 // Schedule auto-draft cleanup
61
-if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
62
-	wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
61
+if ( ! wp_next_scheduled('wp_scheduled_auto_draft_delete'))
62
+	wp_schedule_event(time(), 'daily', 'wp_scheduled_auto_draft_delete');
63 63
 
64
-wp_enqueue_script( 'autosave' );
64
+wp_enqueue_script('autosave');
65 65
 
66
-if ( is_multisite() ) {
67
-	add_action( 'admin_footer', '_admin_notice_post_locked' );
66
+if (is_multisite()) {
67
+	add_action('admin_footer', '_admin_notice_post_locked');
68 68
 } else {
69
-	$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
69
+	$check_users = get_users(array('fields' => 'ID', 'number' => 2));
70 70
 
71
-	if ( count( $check_users ) > 1 )
72
-		add_action( 'admin_footer', '_admin_notice_post_locked' );
71
+	if (count($check_users) > 1)
72
+		add_action('admin_footer', '_admin_notice_post_locked');
73 73
 
74
-	unset( $check_users );
74
+	unset($check_users);
75 75
 }
76 76
 
77 77
 // Show post form.
78
-$post = get_default_post_to_edit( $post_type, true );
78
+$post = get_default_post_to_edit($post_type, true);
79 79
 $post_ID = $post->ID;
80
-include( ABSPATH . 'wp-admin/edit-form-advanced.php' );
81
-include( ABSPATH . 'wp-admin/admin-footer.php' );
80
+include(ABSPATH.'wp-admin/edit-form-advanced.php');
81
+include(ABSPATH.'wp-admin/admin-footer.php');
Please login to merge, or discard this patch.
Braces   +11 added lines, -7 removed lines patch added patch discarded remove patch
@@ -29,9 +29,10 @@  discard block
 block discarded – undo
29 29
 	$parent_file = 'edit.php';
30 30
 	$submenu_file = 'post-new.php';
31 31
 } elseif ( 'attachment' == $post_type ) {
32
-	if ( wp_redirect( admin_url( 'media-new.php' ) ) )
33
-		exit;
34
-} else {
32
+	if ( wp_redirect( admin_url( 'media-new.php' ) ) ) {
33
+			exit;
34
+	}
35
+	} else {
35 36
 	$submenu_file = "post-new.php?post_type=$post_type";
36 37
 	if ( isset( $post_type_object ) && $post_type_object->show_in_menu && $post_type_object->show_in_menu !== true ) {
37 38
 		$parent_file = $post_type_object->show_in_menu;
@@ -54,12 +55,14 @@  discard block
 block discarded – undo
54 55
 
55 56
 $editing = true;
56 57
 
57
-if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) )
58
+if ( ! current_user_can( $post_type_object->cap->edit_posts ) || ! current_user_can( $post_type_object->cap->create_posts ) ) {
58 59
 	wp_die( __( 'Cheatin&#8217; uh?' ), 403 );
60
+}
59 61
 
60 62
 // Schedule auto-draft cleanup
61
-if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) )
63
+if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) {
62 64
 	wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' );
65
+}
63 66
 
64 67
 wp_enqueue_script( 'autosave' );
65 68
 
@@ -68,8 +71,9 @@  discard block
 block discarded – undo
68 71
 } else {
69 72
 	$check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) );
70 73
 
71
-	if ( count( $check_users ) > 1 )
72
-		add_action( 'admin_footer', '_admin_notice_post_locked' );
74
+	if ( count( $check_users ) > 1 ) {
75
+			add_action( 'admin_footer', '_admin_notice_post_locked' );
76
+	}
73 77
 
74 78
 	unset( $check_users );
75 79
 }
Please login to merge, or discard this patch.
src/wp-admin/options-head.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -8,9 +8,9 @@
 block discarded – undo
8 8
  * @subpackage Administration
9 9
  */
10 10
 
11
-wp_reset_vars( array( 'action' ) );
11
+wp_reset_vars(array('action'));
12 12
 
13
-if ( isset( $_GET['updated'] ) && isset( $_GET['page'] ) ) {
13
+if (isset($_GET['updated']) && isset($_GET['page'])) {
14 14
 	// For backwards compat with plugins that don't use the Settings API and just set updated=1 in the redirect
15 15
 	add_settings_error('general', 'settings_updated', __('Settings saved.'), 'updated');
16 16
 }
Please login to merge, or discard this patch.
src/wp-admin/moderation.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,6 +7,6 @@
 block discarded – undo
7 7
  * @package WordPress
8 8
  * @subpackage Administration
9 9
  */
10
-require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' );
11
-wp_redirect( admin_url('edit-comments.php?comment_status=moderated') );
10
+require_once(dirname(dirname(__FILE__)).'/wp-load.php');
11
+wp_redirect(admin_url('edit-comments.php?comment_status=moderated'));
12 12
 exit;
Please login to merge, or discard this patch.
src/wp-admin/setup-config.php 3 patches
Switch Indentation   +102 added lines, -102 removed lines patch added patch discarded remove patch
@@ -99,35 +99,35 @@  discard block
 block discarded – undo
99 99
 }
100 100
 
101 101
 switch($step) {
102
-	case -1:
103
-		if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
104
-			setup_config_display_header( 'language-chooser' );
105
-			echo '<form id="setup" method="post" action="?step=0">';
106
-			wp_install_language_form( $languages );
107
-			echo '</form>';
108
-			break;
109
-		}
102
+		case -1:
103
+			if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
104
+				setup_config_display_header( 'language-chooser' );
105
+				echo '<form id="setup" method="post" action="?step=0">';
106
+				wp_install_language_form( $languages );
107
+				echo '</form>';
108
+				break;
109
+			}
110 110
 
111
-		// Deliberately fall through if we can't reach the translations API.
111
+			// Deliberately fall through if we can't reach the translations API.
112 112
 
113
-	case 0:
114
-		if ( ! empty( $language ) ) {
115
-			$loaded_language = wp_download_language_pack( $language );
116
-			if ( $loaded_language ) {
117
-				load_default_textdomain( $loaded_language );
118
-				$GLOBALS['wp_locale'] = new WP_Locale();
113
+		case 0:
114
+			if ( ! empty( $language ) ) {
115
+				$loaded_language = wp_download_language_pack( $language );
116
+				if ( $loaded_language ) {
117
+					load_default_textdomain( $loaded_language );
118
+					$GLOBALS['wp_locale'] = new WP_Locale();
119
+				}
119 120
 			}
120
-		}
121 121
 
122
-		setup_config_display_header();
123
-		$step_1 = 'setup-config.php?step=1';
124
-		if ( isset( $_REQUEST['noapi'] ) ) {
125
-			$step_1 .= '&amp;noapi';
126
-		}
127
-		if ( ! empty( $loaded_language ) ) {
128
-			$step_1 .= '&amp;language=' . $loaded_language;
129
-		}
130
-?>
122
+			setup_config_display_header();
123
+			$step_1 = 'setup-config.php?step=1';
124
+			if ( isset( $_REQUEST['noapi'] ) ) {
125
+				$step_1 .= '&amp;noapi';
126
+			}
127
+			if ( ! empty( $loaded_language ) ) {
128
+				$step_1 .= '&amp;language=' . $loaded_language;
129
+			}
130
+	?>
131 131
 
132 132
 <p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p>
133 133
 <ol>
@@ -139,21 +139,21 @@  discard block
 block discarded – undo
139 139
 </ol>
140 140
 <p>
141 141
 	<?php _e( 'We&#8217;re going to use this information to create a <code>wp-config.php</code> file.' ); ?>
142
-	<strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong>
142
+		<strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong>
143 143
 	<?php _e( "Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ); ?>
144 144
 </p>
145 145
 <p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p>
146 146
 
147 147
 <p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
148
-<?php
149
-	break;
148
+	<?php
149
+		break;
150 150
 
151
-	case 1:
152
-		load_default_textdomain( $language );
153
-		$GLOBALS['wp_locale'] = new WP_Locale();
151
+		case 1:
152
+			load_default_textdomain( $language );
153
+			$GLOBALS['wp_locale'] = new WP_Locale();
154 154
 
155
-		setup_config_display_header();
156
-	?>
155
+			setup_config_display_header();
156
+		?>
157 157
 <form method="post" action="setup-config.php?step=2">
158 158
 	<p><?php _e( "Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host." ); ?></p>
159 159
 	<table class="form-table">
@@ -184,100 +184,100 @@  discard block
 block discarded – undo
184 184
 		</tr>
185 185
 	</table>
186 186
 	<?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
187
-	<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
187
+		<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
188 188
 	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
189 189
 </form>
190 190
 <?php
191
-	break;
191
+		break;
192 192
 
193
-	case 2:
194
-	load_default_textdomain( $language );
195
-	$GLOBALS['wp_locale'] = new WP_Locale();
193
+		case 2:
194
+		load_default_textdomain( $language );
195
+		$GLOBALS['wp_locale'] = new WP_Locale();
196 196
 
197
-	$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
198
-	$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
199
-	$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
200
-	$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
201
-	$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
197
+		$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
198
+		$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
199
+		$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
200
+		$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
201
+		$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
202 202
 
203
-	$step_1 = 'setup-config.php?step=1';
204
-	$install = 'install.php';
205
-	if ( isset( $_REQUEST['noapi'] ) ) {
206
-		$step_1 .= '&amp;noapi';
207
-	}
203
+		$step_1 = 'setup-config.php?step=1';
204
+		$install = 'install.php';
205
+		if ( isset( $_REQUEST['noapi'] ) ) {
206
+			$step_1 .= '&amp;noapi';
207
+		}
208 208
 
209
-	if ( ! empty( $language ) ) {
210
-		$step_1 .= '&amp;language=' . $language;
211
-		$install .= '?language=' . $language;
212
-	} else {
213
-		$install .= '?language=en_US';
214
-	}
209
+		if ( ! empty( $language ) ) {
210
+			$step_1 .= '&amp;language=' . $language;
211
+			$install .= '?language=' . $language;
212
+		} else {
213
+			$install .= '?language=en_US';
214
+		}
215 215
 
216
-	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
216
+		$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
217 217
 
218
-	if ( empty( $prefix ) )
219
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
218
+		if ( empty( $prefix ) )
219
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
220 220
 
221
-	// Validate $prefix: it can only contain letters, numbers and underscores.
222
-	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
223
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
221
+		// Validate $prefix: it can only contain letters, numbers and underscores.
222
+		if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
223
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
224 224
 
225
-	// Test the db connection.
226
-	/**#@+
225
+		// Test the db connection.
226
+		/**#@+
227 227
 	 * @ignore
228 228
 	 */
229
-	define('DB_NAME', $dbname);
230
-	define('DB_USER', $uname);
231
-	define('DB_PASSWORD', $pwd);
232
-	define('DB_HOST', $dbhost);
233
-	/**#@-*/
229
+		define('DB_NAME', $dbname);
230
+		define('DB_USER', $uname);
231
+		define('DB_PASSWORD', $pwd);
232
+		define('DB_HOST', $dbhost);
233
+		/**#@-*/
234 234
 
235
-	// Re-construct $wpdb with these new values.
236
-	unset( $wpdb );
237
-	require_wp_db();
235
+		// Re-construct $wpdb with these new values.
236
+		unset( $wpdb );
237
+		require_wp_db();
238 238
 
239
-	/*
239
+		/*
240 240
 	 * The wpdb constructor bails when WP_SETUP_CONFIG is set, so we must
241 241
 	 * fire this manually. We'll fail here if the values are no good.
242 242
 	 */
243
-	$wpdb->db_connect();
244
-
245
-	if ( ! empty( $wpdb->error ) )
246
-		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
243
+		$wpdb->db_connect();
247 244
 
248
-	// Fetch or generate keys and salts.
249
-	$no_api = isset( $_POST['noapi'] );
250
-	if ( ! $no_api ) {
251
-		$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
252
-	}
245
+		if ( ! empty( $wpdb->error ) )
246
+			wp_die( $wpdb->error->get_error_message() . $tryagain_link );
253 247
 
254
-	if ( $no_api || is_wp_error( $secret_keys ) ) {
255
-		$secret_keys = array();
256
-		for ( $i = 0; $i < 8; $i++ ) {
257
-			$secret_keys[] = wp_generate_password( 64, true, true );
248
+		// Fetch or generate keys and salts.
249
+		$no_api = isset( $_POST['noapi'] );
250
+		if ( ! $no_api ) {
251
+			$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
258 252
 		}
259
-	} else {
260
-		$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
261
-		foreach ( $secret_keys as $k => $v ) {
262
-			$secret_keys[$k] = substr( $v, 28, 64 );
263
-		}
264
-	}
265 253
 
266
-	$key = 0;
267
-	// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
268
-	foreach ( $config_file as $line_num => $line ) {
269
-		if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
270
-			$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
271
-			continue;
254
+		if ( $no_api || is_wp_error( $secret_keys ) ) {
255
+			$secret_keys = array();
256
+			for ( $i = 0; $i < 8; $i++ ) {
257
+				$secret_keys[] = wp_generate_password( 64, true, true );
258
+			}
259
+		} else {
260
+			$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
261
+			foreach ( $secret_keys as $k => $v ) {
262
+				$secret_keys[$k] = substr( $v, 28, 64 );
263
+			}
272 264
 		}
273 265
 
274
-		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
275
-			continue;
266
+		$key = 0;
267
+		// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
268
+		foreach ( $config_file as $line_num => $line ) {
269
+			if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
270
+				$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
271
+				continue;
272
+			}
273
+
274
+			if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
275
+				continue;
276 276
 
277
-		$constant = $match[1];
278
-		$padding  = $match[2];
277
+			$constant = $match[1];
278
+			$padding  = $match[2];
279 279
 
280
-		switch ( $constant ) {
280
+			switch ( $constant ) {
281 281
 			case 'DB_NAME'     :
282 282
 			case 'DB_USER'     :
283 283
 			case 'DB_PASSWORD' :
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 			case 'NONCE_SALT'       :
300 300
 				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
301 301
 				break;
302
-		}
302
+			}
303 303
 	}
304 304
 	unset( $line );
305 305
 
Please login to merge, or discard this patch.
Spacing   +118 added lines, -118 removed lines patch added patch discarded remove patch
@@ -28,35 +28,35 @@  discard block
 block discarded – undo
28 28
  */
29 29
 error_reporting(0);
30 30
 
31
-define( 'ABSPATH', dirname( dirname( __FILE__ ) ) . '/' );
31
+define('ABSPATH', dirname(dirname(__FILE__)).'/');
32 32
 
33
-require( ABSPATH . 'wp-settings.php' );
33
+require(ABSPATH.'wp-settings.php');
34 34
 
35 35
 /** Load WordPress Administration Upgrade API */
36
-require_once( ABSPATH . 'wp-admin/includes/upgrade.php' );
36
+require_once(ABSPATH.'wp-admin/includes/upgrade.php');
37 37
 
38 38
 /** Load WordPress Translation Install API */
39
-require_once( ABSPATH . 'wp-admin/includes/translation-install.php' );
39
+require_once(ABSPATH.'wp-admin/includes/translation-install.php');
40 40
 
41 41
 nocache_headers();
42 42
 
43 43
 // Support wp-config-sample.php one level up, for the develop repo.
44
-if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
45
-	$config_file = file( ABSPATH . 'wp-config-sample.php' );
46
-elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) )
47
-	$config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
44
+if (file_exists(ABSPATH.'wp-config-sample.php'))
45
+	$config_file = file(ABSPATH.'wp-config-sample.php');
46
+elseif (file_exists(dirname(ABSPATH).'/wp-config-sample.php'))
47
+	$config_file = file(dirname(ABSPATH).'/wp-config-sample.php');
48 48
 else
49
-	wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) );
49
+	wp_die(__('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.'));
50 50
 
51 51
 // Check if wp-config.php has been created
52
-if ( file_exists( ABSPATH . 'wp-config.php' ) )
53
-	wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ), 'install.php' ) . '</p>' );
52
+if (file_exists(ABSPATH.'wp-config.php'))
53
+	wp_die('<p>'.sprintf(__("The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>."), 'install.php').'</p>');
54 54
 
55 55
 // Check if wp-config.php exists above the root directory but is not part of another install
56
-if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) )
57
-	wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>."), 'install.php' ) . '</p>' );
56
+if (file_exists(ABSPATH.'../wp-config.php') && ! file_exists(ABSPATH.'../wp-settings.php'))
57
+	wp_die('<p>'.sprintf(__("The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>."), 'install.php').'</p>');
58 58
 
59
-$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : -1;
59
+$step = isset($_GET['step']) ? (int) $_GET['step'] : -1;
60 60
 
61 61
 /**
62 62
  * Display setup wp-config.php file header.
@@ -69,41 +69,41 @@  discard block
 block discarded – undo
69 69
  *
70 70
  * @param string|array $body_classes
71 71
  */
72
-function setup_config_display_header( $body_classes = array() ) {
72
+function setup_config_display_header($body_classes = array()) {
73 73
 	$body_classes = (array) $body_classes;
74 74
 	$body_classes[] = 'wp-core-ui';
75
-	if ( is_rtl() ) {
75
+	if (is_rtl()) {
76 76
 		$body_classes[] = 'rtl';
77 77
 	}
78 78
 
79
-	header( 'Content-Type: text/html; charset=utf-8' );
79
+	header('Content-Type: text/html; charset=utf-8');
80 80
 ?>
81 81
 <!DOCTYPE html>
82
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
82
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if (is_rtl()) echo ' dir="rtl"'; ?>>
83 83
 <head>
84 84
 	<meta name="viewport" content="width=device-width" />
85 85
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
86
-	<title><?php _e( 'WordPress &rsaquo; Setup Configuration File' ); ?></title>
87
-	<?php wp_admin_css( 'install', true ); ?>
86
+	<title><?php _e('WordPress &rsaquo; Setup Configuration File'); ?></title>
87
+	<?php wp_admin_css('install', true); ?>
88 88
 </head>
89
-<body class="<?php echo implode( ' ', $body_classes ); ?>">
90
-<h1 id="logo"><a href="<?php esc_attr_e( 'https://wordpress.org/' ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1>
89
+<body class="<?php echo implode(' ', $body_classes); ?>">
90
+<h1 id="logo"><a href="<?php esc_attr_e('https://wordpress.org/'); ?>" tabindex="-1"><?php _e('WordPress'); ?></a></h1>
91 91
 <?php
92 92
 } // end function setup_config_display_header();
93 93
 
94 94
 $language = '';
95
-if ( ! empty( $_REQUEST['language'] ) ) {
96
-	$language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] );
97
-} elseif ( isset( $GLOBALS['wp_local_package'] ) ) {
95
+if ( ! empty($_REQUEST['language'])) {
96
+	$language = preg_replace('/[^a-zA-Z_]/', '', $_REQUEST['language']);
97
+} elseif (isset($GLOBALS['wp_local_package'])) {
98 98
 	$language = $GLOBALS['wp_local_package'];
99 99
 }
100 100
 
101
-switch($step) {
101
+switch ($step) {
102 102
 	case -1:
103
-		if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) {
104
-			setup_config_display_header( 'language-chooser' );
103
+		if (wp_can_install_language_pack() && empty($language) && ($languages = wp_get_available_translations())) {
104
+			setup_config_display_header('language-chooser');
105 105
 			echo '<form id="setup" method="post" action="?step=0">';
106
-			wp_install_language_form( $languages );
106
+			wp_install_language_form($languages);
107 107
 			echo '</form>';
108 108
 			break;
109 109
 		}
@@ -111,116 +111,116 @@  discard block
 block discarded – undo
111 111
 		// Deliberately fall through if we can't reach the translations API.
112 112
 
113 113
 	case 0:
114
-		if ( ! empty( $language ) ) {
115
-			$loaded_language = wp_download_language_pack( $language );
116
-			if ( $loaded_language ) {
117
-				load_default_textdomain( $loaded_language );
114
+		if ( ! empty($language)) {
115
+			$loaded_language = wp_download_language_pack($language);
116
+			if ($loaded_language) {
117
+				load_default_textdomain($loaded_language);
118 118
 				$GLOBALS['wp_locale'] = new WP_Locale();
119 119
 			}
120 120
 		}
121 121
 
122 122
 		setup_config_display_header();
123 123
 		$step_1 = 'setup-config.php?step=1';
124
-		if ( isset( $_REQUEST['noapi'] ) ) {
124
+		if (isset($_REQUEST['noapi'])) {
125 125
 			$step_1 .= '&amp;noapi';
126 126
 		}
127
-		if ( ! empty( $loaded_language ) ) {
128
-			$step_1 .= '&amp;language=' . $loaded_language;
127
+		if ( ! empty($loaded_language)) {
128
+			$step_1 .= '&amp;language='.$loaded_language;
129 129
 		}
130 130
 ?>
131 131
 
132
-<p><?php _e( 'Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.' ) ?></p>
132
+<p><?php _e('Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.') ?></p>
133 133
 <ol>
134
-	<li><?php _e( 'Database name' ); ?></li>
135
-	<li><?php _e( 'Database username' ); ?></li>
136
-	<li><?php _e( 'Database password' ); ?></li>
137
-	<li><?php _e( 'Database host' ); ?></li>
138
-	<li><?php _e( 'Table prefix (if you want to run more than one WordPress in a single database)' ); ?></li>
134
+	<li><?php _e('Database name'); ?></li>
135
+	<li><?php _e('Database username'); ?></li>
136
+	<li><?php _e('Database password'); ?></li>
137
+	<li><?php _e('Database host'); ?></li>
138
+	<li><?php _e('Table prefix (if you want to run more than one WordPress in a single database)'); ?></li>
139 139
 </ol>
140 140
 <p>
141
-	<?php _e( 'We&#8217;re going to use this information to create a <code>wp-config.php</code> file.' ); ?>
142
-	<strong><?php _e( "If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>." ); ?></strong>
143
-	<?php _e( "Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>." ); ?>
141
+	<?php _e('We&#8217;re going to use this information to create a <code>wp-config.php</code> file.'); ?>
142
+	<strong><?php _e("If for any reason this automatic file creation doesn&#8217;t work, don&#8217;t worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>."); ?></strong>
143
+	<?php _e("Need more help? <a href='https://codex.wordpress.org/Editing_wp-config.php'>We got it</a>."); ?>
144 144
 </p>
145
-<p><?php _e( "In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;" ); ?></p>
145
+<p><?php _e("In all likelihood, these items were supplied to you by your Web Host. If you do not have this information, then you will need to contact them before you can continue. If you&#8217;re all ready&hellip;"); ?></p>
146 146
 
147
-<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e( 'Let&#8217;s go!' ); ?></a></p>
147
+<p class="step"><a href="<?php echo $step_1; ?>" class="button button-large"><?php _e('Let&#8217;s go!'); ?></a></p>
148 148
 <?php
149 149
 	break;
150 150
 
151 151
 	case 1:
152
-		load_default_textdomain( $language );
152
+		load_default_textdomain($language);
153 153
 		$GLOBALS['wp_locale'] = new WP_Locale();
154 154
 
155 155
 		setup_config_display_header();
156 156
 	?>
157 157
 <form method="post" action="setup-config.php?step=2">
158
-	<p><?php _e( "Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host." ); ?></p>
158
+	<p><?php _e("Below you should enter your database connection details. If you&#8217;re not sure about these, contact your host."); ?></p>
159 159
 	<table class="form-table">
160 160
 		<tr>
161
-			<th scope="row"><label for="dbname"><?php _e( 'Database Name' ); ?></label></th>
161
+			<th scope="row"><label for="dbname"><?php _e('Database Name'); ?></label></th>
162 162
 			<td><input name="dbname" id="dbname" type="text" size="25" value="wordpress" /></td>
163
-			<td><?php _e( 'The name of the database you want to run WP in.' ); ?></td>
163
+			<td><?php _e('The name of the database you want to run WP in.'); ?></td>
164 164
 		</tr>
165 165
 		<tr>
166
-			<th scope="row"><label for="uname"><?php _e( 'User Name' ); ?></label></th>
167
-			<td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'username', 'example username' ), ENT_QUOTES ); ?>" /></td>
168
-			<td><?php _e( 'Your MySQL username' ); ?></td>
166
+			<th scope="row"><label for="uname"><?php _e('User Name'); ?></label></th>
167
+			<td><input name="uname" id="uname" type="text" size="25" value="<?php echo htmlspecialchars(_x('username', 'example username'), ENT_QUOTES); ?>" /></td>
168
+			<td><?php _e('Your MySQL username'); ?></td>
169 169
 		</tr>
170 170
 		<tr>
171
-			<th scope="row"><label for="pwd"><?php _e( 'Password' ); ?></label></th>
172
-			<td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars( _x( 'password', 'example password' ), ENT_QUOTES ); ?>" autocomplete="off" /></td>
173
-			<td><?php _e( '&hellip;and your MySQL password.' ); ?></td>
171
+			<th scope="row"><label for="pwd"><?php _e('Password'); ?></label></th>
172
+			<td><input name="pwd" id="pwd" type="text" size="25" value="<?php echo htmlspecialchars(_x('password', 'example password'), ENT_QUOTES); ?>" autocomplete="off" /></td>
173
+			<td><?php _e('&hellip;and your MySQL password.'); ?></td>
174 174
 		</tr>
175 175
 		<tr>
176
-			<th scope="row"><label for="dbhost"><?php _e( 'Database Host' ); ?></label></th>
176
+			<th scope="row"><label for="dbhost"><?php _e('Database Host'); ?></label></th>
177 177
 			<td><input name="dbhost" id="dbhost" type="text" size="25" value="localhost" /></td>
178
-			<td><?php _e( 'You should be able to get this info from your web host, if <code>localhost</code> does not work.' ); ?></td>
178
+			<td><?php _e('You should be able to get this info from your web host, if <code>localhost</code> does not work.'); ?></td>
179 179
 		</tr>
180 180
 		<tr>
181
-			<th scope="row"><label for="prefix"><?php _e( 'Table Prefix' ); ?></label></th>
181
+			<th scope="row"><label for="prefix"><?php _e('Table Prefix'); ?></label></th>
182 182
 			<td><input name="prefix" id="prefix" type="text" value="wp_" size="25" /></td>
183
-			<td><?php _e( 'If you want to run multiple WordPress installations in a single database, change this.' ); ?></td>
183
+			<td><?php _e('If you want to run multiple WordPress installations in a single database, change this.'); ?></td>
184 184
 		</tr>
185 185
 	</table>
186
-	<?php if ( isset( $_GET['noapi'] ) ) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
187
-	<input type="hidden" name="language" value="<?php echo esc_attr( $language ); ?>" />
188
-	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars( __( 'Submit' ), ENT_QUOTES ); ?>" class="button button-large" /></p>
186
+	<?php if (isset($_GET['noapi'])) { ?><input name="noapi" type="hidden" value="1" /><?php } ?>
187
+	<input type="hidden" name="language" value="<?php echo esc_attr($language); ?>" />
188
+	<p class="step"><input name="submit" type="submit" value="<?php echo htmlspecialchars(__('Submit'), ENT_QUOTES); ?>" class="button button-large" /></p>
189 189
 </form>
190 190
 <?php
191 191
 	break;
192 192
 
193 193
 	case 2:
194
-	load_default_textdomain( $language );
194
+	load_default_textdomain($language);
195 195
 	$GLOBALS['wp_locale'] = new WP_Locale();
196 196
 
197
-	$dbname = trim( wp_unslash( $_POST[ 'dbname' ] ) );
198
-	$uname = trim( wp_unslash( $_POST[ 'uname' ] ) );
199
-	$pwd = trim( wp_unslash( $_POST[ 'pwd' ] ) );
200
-	$dbhost = trim( wp_unslash( $_POST[ 'dbhost' ] ) );
201
-	$prefix = trim( wp_unslash( $_POST[ 'prefix' ] ) );
197
+	$dbname = trim(wp_unslash($_POST['dbname']));
198
+	$uname = trim(wp_unslash($_POST['uname']));
199
+	$pwd = trim(wp_unslash($_POST['pwd']));
200
+	$dbhost = trim(wp_unslash($_POST['dbhost']));
201
+	$prefix = trim(wp_unslash($_POST['prefix']));
202 202
 
203 203
 	$step_1 = 'setup-config.php?step=1';
204 204
 	$install = 'install.php';
205
-	if ( isset( $_REQUEST['noapi'] ) ) {
205
+	if (isset($_REQUEST['noapi'])) {
206 206
 		$step_1 .= '&amp;noapi';
207 207
 	}
208 208
 
209
-	if ( ! empty( $language ) ) {
210
-		$step_1 .= '&amp;language=' . $language;
211
-		$install .= '?language=' . $language;
209
+	if ( ! empty($language)) {
210
+		$step_1 .= '&amp;language='.$language;
211
+		$install .= '?language='.$language;
212 212
 	} else {
213 213
 		$install .= '?language=en_US';
214 214
 	}
215 215
 
216
-	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
216
+	$tryagain_link = '</p><p class="step"><a href="'.$step_1.'" onclick="javascript:history.go(-1);return false;" class="button button-large">'.__('Try again').'</a>';
217 217
 
218
-	if ( empty( $prefix ) )
219
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
218
+	if (empty($prefix))
219
+		wp_die(__('<strong>ERROR</strong>: "Table Prefix" must not be empty.'.$tryagain_link));
220 220
 
221 221
 	// Validate $prefix: it can only contain letters, numbers and underscores.
222
-	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
223
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
222
+	if (preg_match('|[^a-z0-9_]|i', $prefix))
223
+		wp_die(__('<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.'.$tryagain_link));
224 224
 
225 225
 	// Test the db connection.
226 226
 	/**#@+
@@ -233,7 +233,7 @@  discard block
 block discarded – undo
233 233
 	/**#@-*/
234 234
 
235 235
 	// Re-construct $wpdb with these new values.
236
-	unset( $wpdb );
236
+	unset($wpdb);
237 237
 	require_wp_db();
238 238
 
239 239
 	/*
@@ -242,51 +242,51 @@  discard block
 block discarded – undo
242 242
 	 */
243 243
 	$wpdb->db_connect();
244 244
 
245
-	if ( ! empty( $wpdb->error ) )
246
-		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
245
+	if ( ! empty($wpdb->error))
246
+		wp_die($wpdb->error->get_error_message().$tryagain_link);
247 247
 
248 248
 	// Fetch or generate keys and salts.
249
-	$no_api = isset( $_POST['noapi'] );
250
-	if ( ! $no_api ) {
251
-		$secret_keys = wp_remote_get( 'https://api.wordpress.org/secret-key/1.1/salt/' );
249
+	$no_api = isset($_POST['noapi']);
250
+	if ( ! $no_api) {
251
+		$secret_keys = wp_remote_get('https://api.wordpress.org/secret-key/1.1/salt/');
252 252
 	}
253 253
 
254
-	if ( $no_api || is_wp_error( $secret_keys ) ) {
254
+	if ($no_api || is_wp_error($secret_keys)) {
255 255
 		$secret_keys = array();
256
-		for ( $i = 0; $i < 8; $i++ ) {
257
-			$secret_keys[] = wp_generate_password( 64, true, true );
256
+		for ($i = 0; $i < 8; $i++) {
257
+			$secret_keys[] = wp_generate_password(64, true, true);
258 258
 		}
259 259
 	} else {
260
-		$secret_keys = explode( "\n", wp_remote_retrieve_body( $secret_keys ) );
261
-		foreach ( $secret_keys as $k => $v ) {
262
-			$secret_keys[$k] = substr( $v, 28, 64 );
260
+		$secret_keys = explode("\n", wp_remote_retrieve_body($secret_keys));
261
+		foreach ($secret_keys as $k => $v) {
262
+			$secret_keys[$k] = substr($v, 28, 64);
263 263
 		}
264 264
 	}
265 265
 
266 266
 	$key = 0;
267 267
 	// Not a PHP5-style by-reference foreach, as this file must be parseable by PHP4.
268
-	foreach ( $config_file as $line_num => $line ) {
269
-		if ( '$table_prefix  =' == substr( $line, 0, 16 ) ) {
270
-			$config_file[ $line_num ] = '$table_prefix  = \'' . addcslashes( $prefix, "\\'" ) . "';\r\n";
268
+	foreach ($config_file as $line_num => $line) {
269
+		if ('$table_prefix  =' == substr($line, 0, 16)) {
270
+			$config_file[$line_num] = '$table_prefix  = \''.addcslashes($prefix, "\\'")."';\r\n";
271 271
 			continue;
272 272
 		}
273 273
 
274
-		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
274
+		if ( ! preg_match('/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match))
275 275
 			continue;
276 276
 
277 277
 		$constant = $match[1];
278 278
 		$padding  = $match[2];
279 279
 
280
-		switch ( $constant ) {
280
+		switch ($constant) {
281 281
 			case 'DB_NAME'     :
282 282
 			case 'DB_USER'     :
283 283
 			case 'DB_PASSWORD' :
284 284
 			case 'DB_HOST'     :
285
-				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . addcslashes( constant( $constant ), "\\'" ) . "');\r\n";
285
+				$config_file[$line_num] = "define('".$constant."',".$padding."'".addcslashes(constant($constant), "\\'")."');\r\n";
286 286
 				break;
287 287
 			case 'DB_CHARSET'  :
288
-				if ( 'utf8mb4' === $wpdb->charset || ( ! $wpdb->charset && $wpdb->has_cap( 'utf8mb4' ) ) ) {
289
-					$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'utf8mb4');\r\n";
288
+				if ('utf8mb4' === $wpdb->charset || ( ! $wpdb->charset && $wpdb->has_cap('utf8mb4'))) {
289
+					$config_file[$line_num] = "define('".$constant."',".$padding."'utf8mb4');\r\n";
290 290
 				}
291 291
 				break;
292 292
 			case 'AUTH_KEY'         :
@@ -297,24 +297,24 @@  discard block
 block discarded – undo
297 297
 			case 'SECURE_AUTH_SALT' :
298 298
 			case 'LOGGED_IN_SALT'   :
299 299
 			case 'NONCE_SALT'       :
300
-				$config_file[ $line_num ] = "define('" . $constant . "'," . $padding . "'" . $secret_keys[$key++] . "');\r\n";
300
+				$config_file[$line_num] = "define('".$constant."',".$padding."'".$secret_keys[$key++]."');\r\n";
301 301
 				break;
302 302
 		}
303 303
 	}
304
-	unset( $line );
304
+	unset($line);
305 305
 
306
-	if ( ! is_writable(ABSPATH) ) :
306
+	if ( ! is_writable(ABSPATH)) :
307 307
 		setup_config_display_header();
308 308
 ?>
309
-<p><?php _e( "Sorry, but I can&#8217;t write the <code>wp-config.php</code> file." ); ?></p>
310
-<p><?php _e( 'You can create the <code>wp-config.php</code> manually and paste the following text into it.' ); ?></p>
309
+<p><?php _e("Sorry, but I can&#8217;t write the <code>wp-config.php</code> file."); ?></p>
310
+<p><?php _e('You can create the <code>wp-config.php</code> manually and paste the following text into it.'); ?></p>
311 311
 <textarea id="wp-config" cols="98" rows="15" class="code" readonly="readonly"><?php
312
-		foreach( $config_file as $line ) {
312
+		foreach ($config_file as $line) {
313 313
 			echo htmlentities($line, ENT_COMPAT, 'UTF-8');
314 314
 		}
315 315
 ?></textarea>
316
-<p><?php _e( 'After you&#8217;ve done that, click &#8220;Run the install.&#8221;' ); ?></p>
317
-<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
316
+<p><?php _e('After you&#8217;ve done that, click &#8220;Run the install.&#8221;'); ?></p>
317
+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e('Run the install'); ?></a></p>
318 318
 <script>
319 319
 (function(){
320 320
 if ( ! /iPad|iPod|iPhone/.test( navigator.userAgent ) ) {
@@ -330,27 +330,27 @@  discard block
 block discarded – undo
330 330
 		 * If this file doesn't exist, then we are using the wp-config-sample.php
331 331
 		 * file one level up, which is for the develop repo.
332 332
 		 */
333
-		if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
334
-			$path_to_wp_config = ABSPATH . 'wp-config.php';
333
+		if (file_exists(ABSPATH.'wp-config-sample.php'))
334
+			$path_to_wp_config = ABSPATH.'wp-config.php';
335 335
 		else
336
-			$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
336
+			$path_to_wp_config = dirname(ABSPATH).'/wp-config.php';
337 337
 
338
-		$handle = fopen( $path_to_wp_config, 'w' );
339
-		foreach( $config_file as $line ) {
340
-			fwrite( $handle, $line );
338
+		$handle = fopen($path_to_wp_config, 'w');
339
+		foreach ($config_file as $line) {
340
+			fwrite($handle, $line);
341 341
 		}
342
-		fclose( $handle );
343
-		chmod( $path_to_wp_config, 0666 );
342
+		fclose($handle);
343
+		chmod($path_to_wp_config, 0666);
344 344
 		setup_config_display_header();
345 345
 ?>
346
-<p><?php _e( "All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;" ); ?></p>
346
+<p><?php _e("All right, sparky! You&#8217;ve made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to&hellip;"); ?></p>
347 347
 
348
-<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e( 'Run the install' ); ?></a></p>
348
+<p class="step"><a href="<?php echo $install; ?>" class="button button-large"><?php _e('Run the install'); ?></a></p>
349 349
 <?php
350 350
 	endif;
351 351
 	break;
352 352
 }
353 353
 ?>
354
-<?php wp_print_scripts( 'language-chooser' ); ?>
354
+<?php wp_print_scripts('language-chooser'); ?>
355 355
 </body>
356 356
 </html>
Please login to merge, or discard this patch.
Braces   +30 added lines, -17 removed lines patch added patch discarded remove patch
@@ -41,20 +41,23 @@  discard block
 block discarded – undo
41 41
 nocache_headers();
42 42
 
43 43
 // Support wp-config-sample.php one level up, for the develop repo.
44
-if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
44
+if ( file_exists( ABSPATH . 'wp-config-sample.php' ) ) {
45 45
 	$config_file = file( ABSPATH . 'wp-config-sample.php' );
46
-elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) )
46
+} elseif ( file_exists( dirname( ABSPATH ) . '/wp-config-sample.php' ) ) {
47 47
 	$config_file = file( dirname( ABSPATH ) . '/wp-config-sample.php' );
48
-else
48
+} else {
49 49
 	wp_die( __( 'Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.' ) );
50
+}
50 51
 
51 52
 // Check if wp-config.php has been created
52
-if ( file_exists( ABSPATH . 'wp-config.php' ) )
53
+if ( file_exists( ABSPATH . 'wp-config.php' ) ) {
53 54
 	wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='%s'>installing now</a>." ), 'install.php' ) . '</p>' );
55
+}
54 56
 
55 57
 // Check if wp-config.php exists above the root directory but is not part of another install
56
-if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) )
58
+if ( file_exists(ABSPATH . '../wp-config.php' ) && ! file_exists( ABSPATH . '../wp-settings.php' ) ) {
57 59
 	wp_die( '<p>' . sprintf( __( "The file 'wp-config.php' already exists one level above your WordPress installation. If you need to reset any of the configuration items in this file, please delete it first. You may try <a href='install.php'>installing now</a>."), 'install.php' ) . '</p>' );
60
+}
58 61
 
59 62
 $step = isset( $_GET['step'] ) ? (int) $_GET['step'] : -1;
60 63
 
@@ -79,7 +82,10 @@  discard block
 block discarded – undo
79 82
 	header( 'Content-Type: text/html; charset=utf-8' );
80 83
 ?>
81 84
 <!DOCTYPE html>
82
-<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) echo ' dir="rtl"'; ?>>
85
+<html xmlns="http://www.w3.org/1999/xhtml"<?php if ( is_rtl() ) {
86
+	echo ' dir="rtl"';
87
+}
88
+?>>
83 89
 <head>
84 90
 	<meta name="viewport" content="width=device-width" />
85 91
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@@ -215,12 +221,14 @@  discard block
 block discarded – undo
215 221
 
216 222
 	$tryagain_link = '</p><p class="step"><a href="' . $step_1 . '" onclick="javascript:history.go(-1);return false;" class="button button-large">' . __( 'Try again' ) . '</a>';
217 223
 
218
-	if ( empty( $prefix ) )
219
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
224
+	if ( empty( $prefix ) ) {
225
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" must not be empty.' . $tryagain_link ) );
226
+	}
220 227
 
221 228
 	// Validate $prefix: it can only contain letters, numbers and underscores.
222
-	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) )
223
-		wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
229
+	if ( preg_match( '|[^a-z0-9_]|i', $prefix ) ) {
230
+			wp_die( __( '<strong>ERROR</strong>: "Table Prefix" can only contain numbers, letters, and underscores.' . $tryagain_link ) );
231
+	}
224 232
 
225 233
 	// Test the db connection.
226 234
 	/**#@+
@@ -242,8 +250,9 @@  discard block
 block discarded – undo
242 250
 	 */
243 251
 	$wpdb->db_connect();
244 252
 
245
-	if ( ! empty( $wpdb->error ) )
246
-		wp_die( $wpdb->error->get_error_message() . $tryagain_link );
253
+	if ( ! empty( $wpdb->error ) ) {
254
+			wp_die( $wpdb->error->get_error_message() . $tryagain_link );
255
+	}
247 256
 
248 257
 	// Fetch or generate keys and salts.
249 258
 	$no_api = isset( $_POST['noapi'] );
@@ -271,8 +280,9 @@  discard block
 block discarded – undo
271 280
 			continue;
272 281
 		}
273 282
 
274
-		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) )
275
-			continue;
283
+		if ( ! preg_match( '/^define\(\'([A-Z_]+)\',([ ]+)/', $line, $match ) ) {
284
+					continue;
285
+		}
276 286
 
277 287
 		$constant = $match[1];
278 288
 		$padding  = $match[2];
@@ -325,15 +335,18 @@  discard block
 block discarded – undo
325 335
 })();
326 336
 </script>
327 337
 <?php
328
-	else :
338
+	else {
339
+		:
329 340
 		/*
330 341
 		 * If this file doesn't exist, then we are using the wp-config-sample.php
331 342
 		 * file one level up, which is for the develop repo.
332 343
 		 */
333 344
 		if ( file_exists( ABSPATH . 'wp-config-sample.php' ) )
334 345
 			$path_to_wp_config = ABSPATH . 'wp-config.php';
335
-		else
336
-			$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
346
+	}
347
+		else {
348
+					$path_to_wp_config = dirname( ABSPATH ) . '/wp-config.php';
349
+		}
337 350
 
338 351
 		$handle = fopen( $path_to_wp_config, 'w' );
339 352
 		foreach( $config_file as $line ) {
Please login to merge, or discard this patch.