@@ -118,10 +118,11 @@ discard block |
||
118 | 118 | if ( is_wp_error( $user_id ) ) { |
119 | 119 | $add_user_errors = $user_id; |
120 | 120 | } else { |
121 | - if ( current_user_can( 'list_users' ) ) |
|
122 | - $redirect = 'users.php?update=add&id=' . $user_id; |
|
123 | - else |
|
124 | - $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); |
|
121 | + if ( current_user_can( 'list_users' ) ) { |
|
122 | + $redirect = 'users.php?update=add&id=' . $user_id; |
|
123 | + } else { |
|
124 | + $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); |
|
125 | + } |
|
125 | 126 | wp_redirect( $redirect ); |
126 | 127 | die(); |
127 | 128 | } |
@@ -166,8 +167,9 @@ discard block |
||
166 | 167 | $parent_file = 'users.php'; |
167 | 168 | |
168 | 169 | $do_both = false; |
169 | -if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') ) |
|
170 | +if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') ) { |
|
170 | 171 | $do_both = true; |
172 | +} |
|
171 | 173 | |
172 | 174 | $help = '<p>' . __('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.') . '</p>'; |
173 | 175 | |
@@ -261,8 +263,9 @@ discard block |
||
261 | 263 | break; |
262 | 264 | } |
263 | 265 | } else { |
264 | - if ( 'add' == $_GET['update'] ) |
|
265 | - $messages[] = __('User added.'); |
|
266 | + if ( 'add' == $_GET['update'] ) { |
|
267 | + $messages[] = __('User added.'); |
|
268 | + } |
|
266 | 269 | } |
267 | 270 | } |
268 | 271 | ?> |
@@ -279,23 +282,26 @@ discard block |
||
279 | 282 | <div class="error"> |
280 | 283 | <ul> |
281 | 284 | <?php |
282 | - foreach ( $errors->get_error_messages() as $err ) |
|
283 | - echo "<li>$err</li>\n"; |
|
285 | + foreach ( $errors->get_error_messages() as $err ) { |
|
286 | + echo "<li>$err</li>\n"; |
|
287 | + } |
|
284 | 288 | ?> |
285 | 289 | </ul> |
286 | 290 | </div> |
287 | 291 | <?php endif; |
288 | 292 | |
289 | 293 | if ( ! empty( $messages ) ) { |
290 | - foreach ( $messages as $msg ) |
|
291 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
292 | -} ?> |
|
294 | + foreach ( $messages as $msg ) { |
|
295 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
296 | + } |
|
297 | + } ?> |
|
293 | 298 | |
294 | 299 | <?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?> |
295 | 300 | <div class="error"> |
296 | 301 | <?php |
297 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
298 | - echo "<p>$message</p>"; |
|
302 | + foreach ( $add_user_errors->get_error_messages() as $message ) { |
|
303 | + echo "<p>$message</p>"; |
|
304 | + } |
|
299 | 305 | ?> |
300 | 306 | </div> |
301 | 307 | <?php endif; ?> |
@@ -303,8 +309,9 @@ discard block |
||
303 | 309 | |
304 | 310 | <?php |
305 | 311 | if ( is_multisite() ) { |
306 | - if ( $do_both ) |
|
307 | - echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>'; |
|
312 | + if ( $do_both ) { |
|
313 | + echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>'; |
|
314 | + } |
|
308 | 315 | if ( !is_super_admin() ) { |
309 | 316 | echo '<p>' . __( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>'; |
310 | 317 | $label = __('Email'); |
@@ -365,9 +372,10 @@ discard block |
||
365 | 372 | } // is_multisite() |
366 | 373 | |
367 | 374 | if ( current_user_can( 'create_users') ) { |
368 | - if ( $do_both ) |
|
369 | - echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>'; |
|
370 | -?> |
|
375 | + if ( $do_both ) { |
|
376 | + echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>'; |
|
377 | + } |
|
378 | + ?> |
|
371 | 379 | <p><?php _e('Create a brand new user and add them to this site.'); ?></p> |
372 | 380 | <form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php |
373 | 381 | /** This action is documented in wp-admin/user-new.php */ |
@@ -461,8 +469,9 @@ discard block |
||
461 | 469 | <th scope="row"><label for="role"><?php _e('Role'); ?></label></th> |
462 | 470 | <td><select name="role" id="role"> |
463 | 471 | <?php |
464 | - if ( !$new_user_role ) |
|
465 | - $new_user_role = !empty($current_role) ? $current_role : get_option('default_role'); |
|
472 | + if ( !$new_user_role ) { |
|
473 | + $new_user_role = !empty($current_role) ? $current_role : get_option('default_role'); |
|
474 | + } |
|
466 | 475 | wp_dropdown_roles($new_user_role); |
467 | 476 | ?> |
468 | 477 | </select> |
@@ -209,9 +209,9 @@ |
||
209 | 209 | ) ); |
210 | 210 | |
211 | 211 | get_current_screen()->set_help_sidebar( |
212 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
213 | - '<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen">Documentation on Adding New Users</a>') . '</p>' . |
|
214 | - '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
|
212 | + '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
213 | + '<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen">Documentation on Adding New Users</a>') . '</p>' . |
|
214 | + '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
|
215 | 215 | ); |
216 | 216 | |
217 | 217 | wp_enqueue_script('wp-ajax-response'); |
@@ -7,53 +7,53 @@ discard block |
||
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 ( is_multisite() ) { |
|
13 | - if ( ! current_user_can( 'create_users' ) && ! current_user_can( 'promote_users' ) ) { |
|
12 | +if (is_multisite()) { |
|
13 | + if ( ! current_user_can('create_users') && ! current_user_can('promote_users')) { |
|
14 | 14 | wp_die( |
15 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
16 | - '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>', |
|
15 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
16 | + '<p>'.__('Sorry, you are not allowed to add users to this network.').'</p>', |
|
17 | 17 | 403 |
18 | 18 | ); |
19 | 19 | } |
20 | -} elseif ( ! current_user_can( 'create_users' ) ) { |
|
20 | +} elseif ( ! current_user_can('create_users')) { |
|
21 | 21 | wp_die( |
22 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
23 | - '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>', |
|
22 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
23 | + '<p>'.__('Sorry, you are not allowed to create users.').'</p>', |
|
24 | 24 | 403 |
25 | 25 | ); |
26 | 26 | } |
27 | 27 | |
28 | -if ( is_multisite() ) { |
|
29 | - add_filter( 'wpmu_signup_user_notification_email', 'admin_created_user_email' ); |
|
28 | +if (is_multisite()) { |
|
29 | + add_filter('wpmu_signup_user_notification_email', 'admin_created_user_email'); |
|
30 | 30 | } |
31 | 31 | |
32 | -if ( isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action'] ) { |
|
33 | - check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
|
32 | +if (isset($_REQUEST['action']) && 'adduser' == $_REQUEST['action']) { |
|
33 | + check_admin_referer('add-user', '_wpnonce_add-user'); |
|
34 | 34 | |
35 | 35 | $user_details = null; |
36 | - $user_email = wp_unslash( $_REQUEST['email'] ); |
|
37 | - if ( false !== strpos( $user_email, '@' ) ) { |
|
38 | - $user_details = get_user_by( 'email', $user_email ); |
|
36 | + $user_email = wp_unslash($_REQUEST['email']); |
|
37 | + if (false !== strpos($user_email, '@')) { |
|
38 | + $user_details = get_user_by('email', $user_email); |
|
39 | 39 | } else { |
40 | - if ( is_super_admin() ) { |
|
41 | - $user_details = get_user_by( 'login', $user_email ); |
|
40 | + if (is_super_admin()) { |
|
41 | + $user_details = get_user_by('login', $user_email); |
|
42 | 42 | } else { |
43 | - wp_redirect( add_query_arg( array('update' => 'enter_email'), 'user-new.php' ) ); |
|
43 | + wp_redirect(add_query_arg(array('update' => 'enter_email'), 'user-new.php')); |
|
44 | 44 | die(); |
45 | 45 | } |
46 | 46 | } |
47 | 47 | |
48 | - if ( !$user_details ) { |
|
49 | - wp_redirect( add_query_arg( array('update' => 'does_not_exist'), 'user-new.php' ) ); |
|
48 | + if ( ! $user_details) { |
|
49 | + wp_redirect(add_query_arg(array('update' => 'does_not_exist'), 'user-new.php')); |
|
50 | 50 | die(); |
51 | 51 | } |
52 | 52 | |
53 | - if ( ! current_user_can( 'promote_user', $user_details->ID ) ) { |
|
53 | + if ( ! current_user_can('promote_user', $user_details->ID)) { |
|
54 | 54 | wp_die( |
55 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
56 | - '<p>' . __( 'Sorry, you are not allowed to add users to this network.' ) . '</p>', |
|
55 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
56 | + '<p>'.__('Sorry, you are not allowed to add users to this network.').'</p>', |
|
57 | 57 | 403 |
58 | 58 | ); |
59 | 59 | } |
@@ -63,18 +63,18 @@ discard block |
||
63 | 63 | $redirect = 'user-new.php'; |
64 | 64 | $username = $user_details->user_login; |
65 | 65 | $user_id = $user_details->ID; |
66 | - if ( ( $username != null && !is_super_admin( $user_id ) ) && ( array_key_exists($blog_id, get_blogs_of_user($user_id)) ) ) { |
|
67 | - $redirect = add_query_arg( array('update' => 'addexisting'), 'user-new.php' ); |
|
66 | + if (($username != null && ! is_super_admin($user_id)) && (array_key_exists($blog_id, get_blogs_of_user($user_id)))) { |
|
67 | + $redirect = add_query_arg(array('update' => 'addexisting'), 'user-new.php'); |
|
68 | 68 | } else { |
69 | - if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { |
|
70 | - add_existing_user_to_blog( array( 'user_id' => $user_id, 'role' => $_REQUEST[ 'role' ] ) ); |
|
71 | - $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' , 'user_id' => $user_id ), 'user-new.php' ); |
|
69 | + if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) { |
|
70 | + add_existing_user_to_blog(array('user_id' => $user_id, 'role' => $_REQUEST['role'])); |
|
71 | + $redirect = add_query_arg(array('update' => 'addnoconfirmation', 'user_id' => $user_id), 'user-new.php'); |
|
72 | 72 | } else { |
73 | - $newuser_key = substr( md5( $user_id ), 0, 5 ); |
|
74 | - add_option( 'new_user_' . $newuser_key, array( 'user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST[ 'role' ] ) ); |
|
73 | + $newuser_key = substr(md5($user_id), 0, 5); |
|
74 | + add_option('new_user_'.$newuser_key, array('user_id' => $user_id, 'email' => $user_details->user_email, 'role' => $_REQUEST['role'])); |
|
75 | 75 | |
76 | 76 | $roles = get_editable_roles(); |
77 | - $role = $roles[ $_REQUEST['role'] ]; |
|
77 | + $role = $roles[$_REQUEST['role']]; |
|
78 | 78 | |
79 | 79 | /** |
80 | 80 | * Fires immediately after a user is invited to join a site, but before the notification is sent. |
@@ -85,59 +85,59 @@ discard block |
||
85 | 85 | * @param array $role The role of invited user. |
86 | 86 | * @param string $newuser_key The key of the invitation. |
87 | 87 | */ |
88 | - do_action( 'invite_user', $user_id, $role, $newuser_key ); |
|
88 | + do_action('invite_user', $user_id, $role, $newuser_key); |
|
89 | 89 | |
90 | - $switched_locale = switch_to_locale( get_user_locale( $user_details ) ); |
|
90 | + $switched_locale = switch_to_locale(get_user_locale($user_details)); |
|
91 | 91 | |
92 | 92 | /* translators: 1: Site name, 2: site URL, 3: role, 4: activation URL */ |
93 | - $message = __( 'Hi, |
|
93 | + $message = __('Hi, |
|
94 | 94 | |
95 | 95 | You\'ve been invited to join \'%1$s\' at |
96 | 96 | %2$s with the role of %3$s. |
97 | 97 | |
98 | 98 | Please click the following link to confirm the invite: |
99 | 99 | %4$s' ); |
100 | - wp_mail( $new_user_email, sprintf( __( '[%s] Joining confirmation' ), wp_specialchars_decode( get_option( 'blogname' ) ) ), sprintf( $message, get_option( 'blogname' ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ), home_url( "/newbloguser/$newuser_key/" ) ) ); |
|
100 | + wp_mail($new_user_email, sprintf(__('[%s] Joining confirmation'), wp_specialchars_decode(get_option('blogname'))), sprintf($message, get_option('blogname'), home_url(), wp_specialchars_decode(translate_user_role($role['name'])), home_url("/newbloguser/$newuser_key/"))); |
|
101 | 101 | |
102 | - if ( $switched_locale ) { |
|
102 | + if ($switched_locale) { |
|
103 | 103 | restore_previous_locale(); |
104 | 104 | } |
105 | 105 | |
106 | - $redirect = add_query_arg( array('update' => 'add'), 'user-new.php' ); |
|
106 | + $redirect = add_query_arg(array('update' => 'add'), 'user-new.php'); |
|
107 | 107 | } |
108 | 108 | } |
109 | - wp_redirect( $redirect ); |
|
109 | + wp_redirect($redirect); |
|
110 | 110 | die(); |
111 | -} elseif ( isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action'] ) { |
|
112 | - check_admin_referer( 'create-user', '_wpnonce_create-user' ); |
|
111 | +} elseif (isset($_REQUEST['action']) && 'createuser' == $_REQUEST['action']) { |
|
112 | + check_admin_referer('create-user', '_wpnonce_create-user'); |
|
113 | 113 | |
114 | - if ( ! current_user_can( 'create_users' ) ) { |
|
114 | + if ( ! current_user_can('create_users')) { |
|
115 | 115 | wp_die( |
116 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
117 | - '<p>' . __( 'Sorry, you are not allowed to create users.' ) . '</p>', |
|
116 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
117 | + '<p>'.__('Sorry, you are not allowed to create users.').'</p>', |
|
118 | 118 | 403 |
119 | 119 | ); |
120 | 120 | } |
121 | 121 | |
122 | - if ( ! is_multisite() ) { |
|
122 | + if ( ! is_multisite()) { |
|
123 | 123 | $user_id = edit_user(); |
124 | 124 | |
125 | - if ( is_wp_error( $user_id ) ) { |
|
125 | + if (is_wp_error($user_id)) { |
|
126 | 126 | $add_user_errors = $user_id; |
127 | 127 | } else { |
128 | - if ( current_user_can( 'list_users' ) ) |
|
129 | - $redirect = 'users.php?update=add&id=' . $user_id; |
|
128 | + if (current_user_can('list_users')) |
|
129 | + $redirect = 'users.php?update=add&id='.$user_id; |
|
130 | 130 | else |
131 | - $redirect = add_query_arg( 'update', 'add', 'user-new.php' ); |
|
132 | - wp_redirect( $redirect ); |
|
131 | + $redirect = add_query_arg('update', 'add', 'user-new.php'); |
|
132 | + wp_redirect($redirect); |
|
133 | 133 | die(); |
134 | 134 | } |
135 | 135 | } else { |
136 | 136 | // Adding a new user to this site |
137 | - $new_user_email = wp_unslash( $_REQUEST['email'] ); |
|
138 | - $user_details = wpmu_validate_user_signup( $_REQUEST['user_login'], $new_user_email ); |
|
139 | - if ( is_wp_error( $user_details[ 'errors' ] ) && !empty( $user_details[ 'errors' ]->errors ) ) { |
|
140 | - $add_user_errors = $user_details[ 'errors' ]; |
|
137 | + $new_user_email = wp_unslash($_REQUEST['email']); |
|
138 | + $user_details = wpmu_validate_user_signup($_REQUEST['user_login'], $new_user_email); |
|
139 | + if (is_wp_error($user_details['errors']) && ! empty($user_details['errors']->errors)) { |
|
140 | + $add_user_errors = $user_details['errors']; |
|
141 | 141 | } else { |
142 | 142 | /** |
143 | 143 | * Filters the user_login, also known as the username, before it is added to the site. |
@@ -146,24 +146,24 @@ discard block |
||
146 | 146 | * |
147 | 147 | * @param string $user_login The sanitized username. |
148 | 148 | */ |
149 | - $new_user_login = apply_filters( 'pre_user_login', sanitize_user( wp_unslash( $_REQUEST['user_login'] ), true ) ); |
|
150 | - if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { |
|
151 | - add_filter( 'wpmu_signup_user_notification', '__return_false' ); // Disable confirmation email |
|
152 | - add_filter( 'wpmu_welcome_user_notification', '__return_false' ); // Disable welcome email |
|
149 | + $new_user_login = apply_filters('pre_user_login', sanitize_user(wp_unslash($_REQUEST['user_login']), true)); |
|
150 | + if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) { |
|
151 | + add_filter('wpmu_signup_user_notification', '__return_false'); // Disable confirmation email |
|
152 | + add_filter('wpmu_welcome_user_notification', '__return_false'); // Disable welcome email |
|
153 | 153 | } |
154 | - wpmu_signup_user( $new_user_login, $new_user_email, array( 'add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'] ) ); |
|
155 | - if ( isset( $_POST[ 'noconfirmation' ] ) && current_user_can( 'manage_network_users' ) ) { |
|
156 | - $key = $wpdb->get_var( $wpdb->prepare( "SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email ) ); |
|
157 | - $new_user = wpmu_activate_signup( $key ); |
|
158 | - if ( is_wp_error( $new_user ) ) { |
|
159 | - $redirect = add_query_arg( array( 'update' => 'addnoconfirmation' ), 'user-new.php' ); |
|
154 | + wpmu_signup_user($new_user_login, $new_user_email, array('add_to_blog' => $wpdb->blogid, 'new_role' => $_REQUEST['role'])); |
|
155 | + if (isset($_POST['noconfirmation']) && current_user_can('manage_network_users')) { |
|
156 | + $key = $wpdb->get_var($wpdb->prepare("SELECT activation_key FROM {$wpdb->signups} WHERE user_login = %s AND user_email = %s", $new_user_login, $new_user_email)); |
|
157 | + $new_user = wpmu_activate_signup($key); |
|
158 | + if (is_wp_error($new_user)) { |
|
159 | + $redirect = add_query_arg(array('update' => 'addnoconfirmation'), 'user-new.php'); |
|
160 | 160 | } else { |
161 | - $redirect = add_query_arg( array( 'update' => 'addnoconfirmation', 'user_id' => $new_user['user_id'] ), 'user-new.php' ); |
|
161 | + $redirect = add_query_arg(array('update' => 'addnoconfirmation', 'user_id' => $new_user['user_id']), 'user-new.php'); |
|
162 | 162 | } |
163 | 163 | } else { |
164 | - $redirect = add_query_arg( array('update' => 'newuserconfirmation'), 'user-new.php' ); |
|
164 | + $redirect = add_query_arg(array('update' => 'newuserconfirmation'), 'user-new.php'); |
|
165 | 165 | } |
166 | - wp_redirect( $redirect ); |
|
166 | + wp_redirect($redirect); |
|
167 | 167 | die(); |
168 | 168 | } |
169 | 169 | } |
@@ -173,49 +173,49 @@ discard block |
||
173 | 173 | $parent_file = 'users.php'; |
174 | 174 | |
175 | 175 | $do_both = false; |
176 | -if ( is_multisite() && current_user_can('promote_users') && current_user_can('create_users') ) |
|
176 | +if (is_multisite() && current_user_can('promote_users') && current_user_can('create_users')) |
|
177 | 177 | $do_both = true; |
178 | 178 | |
179 | -$help = '<p>' . __('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.') . '</p>'; |
|
179 | +$help = '<p>'.__('To add a new user to your site, fill in the form on this screen and click the Add New User button at the bottom.').'</p>'; |
|
180 | 180 | |
181 | -if ( is_multisite() ) { |
|
182 | - $help .= '<p>' . __('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user’s name to Edit the user profile under Network Admin > All Users.') . '</p>' . |
|
183 | - '<p>' . __('New users will receive an email letting them know they’ve been added as a user for your site. This email will also contain their password. Check the box if you don’t want the user to receive a welcome email.') . '</p>'; |
|
181 | +if (is_multisite()) { |
|
182 | + $help .= '<p>'.__('Because this is a multisite installation, you may add accounts that already exist on the Network by specifying a username or email, and defining a role. For more options, such as specifying a password, you have to be a Network Administrator and use the hover link under an existing user’s name to Edit the user profile under Network Admin > All Users.').'</p>'. |
|
183 | + '<p>'.__('New users will receive an email letting them know they’ve been added as a user for your site. This email will also contain their password. Check the box if you don’t want the user to receive a welcome email.').'</p>'; |
|
184 | 184 | } else { |
185 | - $help .= '<p>' . __('New users are automatically assigned a password, which they can change after logging in. You can view or edit the assigned password by clicking the Show Password button. The username cannot be changed once the user has been added.') . '</p>' . |
|
185 | + $help .= '<p>'.__('New users are automatically assigned a password, which they can change after logging in. You can view or edit the assigned password by clicking the Show Password button. The username cannot be changed once the user has been added.').'</p>'. |
|
186 | 186 | |
187 | - '<p>' . __('By default, new users will receive an email letting them know they’ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you don’t want to send the new user a welcome email.') . '</p>'; |
|
187 | + '<p>'.__('By default, new users will receive an email letting them know they’ve been added as a user for your site. This email will also contain a password reset link. Uncheck the box if you don’t want to send the new user a welcome email.').'</p>'; |
|
188 | 188 | } |
189 | 189 | |
190 | -$help .= '<p>' . __('Remember to click the Add New User button at the bottom of this screen when you are finished.') . '</p>'; |
|
190 | +$help .= '<p>'.__('Remember to click the Add New User button at the bottom of this screen when you are finished.').'</p>'; |
|
191 | 191 | |
192 | -get_current_screen()->add_help_tab( array( |
|
192 | +get_current_screen()->add_help_tab(array( |
|
193 | 193 | 'id' => 'overview', |
194 | 194 | 'title' => __('Overview'), |
195 | 195 | 'content' => $help, |
196 | -) ); |
|
196 | +)); |
|
197 | 197 | |
198 | -get_current_screen()->add_help_tab( array( |
|
198 | +get_current_screen()->add_help_tab(array( |
|
199 | 199 | 'id' => 'user-roles', |
200 | 200 | 'title' => __('User Roles'), |
201 | -'content' => '<p>' . __('Here is a basic overview of the different user roles and the permissions associated with each one:') . '</p>' . |
|
202 | - '<ul>' . |
|
203 | - '<li>' . __('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.') . '</li>' . |
|
204 | - '<li>' . __('Contributors can write and manage their posts but not publish posts or upload media files.') . '</li>' . |
|
205 | - '<li>' . __('Authors can publish and manage their own posts, and are able to upload files.') . '</li>' . |
|
206 | - '<li>' . __('Editors can publish posts, manage posts as well as manage other people’s posts, etc.') . '</li>' . |
|
207 | - '<li>' . __('Administrators have access to all the administration features.') . '</li>' . |
|
201 | +'content' => '<p>'.__('Here is a basic overview of the different user roles and the permissions associated with each one:').'</p>'. |
|
202 | + '<ul>'. |
|
203 | + '<li>'.__('Subscribers can read comments/comment/receive newsletters, etc. but cannot create regular site content.').'</li>'. |
|
204 | + '<li>'.__('Contributors can write and manage their posts but not publish posts or upload media files.').'</li>'. |
|
205 | + '<li>'.__('Authors can publish and manage their own posts, and are able to upload files.').'</li>'. |
|
206 | + '<li>'.__('Editors can publish posts, manage posts as well as manage other people’s posts, etc.').'</li>'. |
|
207 | + '<li>'.__('Administrators have access to all the administration features.').'</li>'. |
|
208 | 208 | '</ul>' |
209 | -) ); |
|
209 | +)); |
|
210 | 210 | |
211 | 211 | get_current_screen()->set_help_sidebar( |
212 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
213 | - '<p>' . __('<a href="https://codex.wordpress.org/Users_Add_New_Screen">Documentation on Adding New Users</a>') . '</p>' . |
|
214 | - '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
|
212 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
213 | + '<p>'.__('<a href="https://codex.wordpress.org/Users_Add_New_Screen">Documentation on Adding New Users</a>').'</p>'. |
|
214 | + '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>' |
|
215 | 215 | ); |
216 | 216 | |
217 | 217 | wp_enqueue_script('wp-ajax-response'); |
218 | -wp_enqueue_script( 'user-profile' ); |
|
218 | +wp_enqueue_script('user-profile'); |
|
219 | 219 | |
220 | 220 | /** |
221 | 221 | * Filters whether to enable user auto-complete for non-super admins in Multisite. |
@@ -224,26 +224,26 @@ discard block |
||
224 | 224 | * |
225 | 225 | * @param bool $enable Whether to enable auto-complete for non-super admins. Default false. |
226 | 226 | */ |
227 | -if ( is_multisite() && current_user_can( 'promote_users' ) && ! wp_is_large_network( 'users' ) |
|
228 | - && ( is_super_admin() || apply_filters( 'autocomplete_users_for_site_admins', false ) ) |
|
227 | +if (is_multisite() && current_user_can('promote_users') && ! wp_is_large_network('users') |
|
228 | + && (is_super_admin() || apply_filters('autocomplete_users_for_site_admins', false)) |
|
229 | 229 | ) { |
230 | - wp_enqueue_script( 'user-suggest' ); |
|
230 | + wp_enqueue_script('user-suggest'); |
|
231 | 231 | } |
232 | 232 | |
233 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
233 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
234 | 234 | |
235 | -if ( isset($_GET['update']) ) { |
|
235 | +if (isset($_GET['update'])) { |
|
236 | 236 | $messages = array(); |
237 | - if ( is_multisite() ) { |
|
237 | + if (is_multisite()) { |
|
238 | 238 | $edit_link = ''; |
239 | - if ( ( isset( $_GET['user_id'] ) ) ) { |
|
240 | - $user_id_new = absint( $_GET['user_id'] ); |
|
241 | - if ( $user_id_new ) { |
|
242 | - $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); |
|
239 | + if ((isset($_GET['user_id']))) { |
|
240 | + $user_id_new = absint($_GET['user_id']); |
|
241 | + if ($user_id_new) { |
|
242 | + $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_id_new))); |
|
243 | 243 | } |
244 | 244 | } |
245 | 245 | |
246 | - switch ( $_GET['update'] ) { |
|
246 | + switch ($_GET['update']) { |
|
247 | 247 | case "newuserconfirmation": |
248 | 248 | $messages[] = __('Invitation email sent to new user. A confirmation link must be clicked before their account is created.'); |
249 | 249 | break; |
@@ -251,11 +251,11 @@ discard block |
||
251 | 251 | $messages[] = __('Invitation email sent to user. A confirmation link must be clicked for them to be added to your site.'); |
252 | 252 | break; |
253 | 253 | case "addnoconfirmation": |
254 | - if ( empty( $edit_link ) ) { |
|
255 | - $messages[] = __( 'User has been added to your site.' ); |
|
254 | + if (empty($edit_link)) { |
|
255 | + $messages[] = __('User has been added to your site.'); |
|
256 | 256 | } else { |
257 | 257 | /* translators: %s: edit page url */ |
258 | - $messages[] = sprintf( __( 'User has been added to your site. <a href="%s">Edit user</a>' ), $edit_link ); |
|
258 | + $messages[] = sprintf(__('User has been added to your site. <a href="%s">Edit user</a>'), $edit_link); |
|
259 | 259 | } |
260 | 260 | break; |
261 | 261 | case "addexisting": |
@@ -269,40 +269,40 @@ discard block |
||
269 | 269 | break; |
270 | 270 | } |
271 | 271 | } else { |
272 | - if ( 'add' == $_GET['update'] ) |
|
272 | + if ('add' == $_GET['update']) |
|
273 | 273 | $messages[] = __('User added.'); |
274 | 274 | } |
275 | 275 | } |
276 | 276 | ?> |
277 | 277 | <div class="wrap"> |
278 | 278 | <h1 id="add-new-user"><?php |
279 | -if ( current_user_can( 'create_users' ) ) { |
|
280 | - _e( 'Add New User' ); |
|
281 | -} elseif ( current_user_can( 'promote_users' ) ) { |
|
282 | - _e( 'Add Existing User' ); |
|
279 | +if (current_user_can('create_users')) { |
|
280 | + _e('Add New User'); |
|
281 | +} elseif (current_user_can('promote_users')) { |
|
282 | + _e('Add Existing User'); |
|
283 | 283 | } ?> |
284 | 284 | </h1> |
285 | 285 | |
286 | -<?php if ( isset($errors) && is_wp_error( $errors ) ) : ?> |
|
286 | +<?php if (isset($errors) && is_wp_error($errors)) : ?> |
|
287 | 287 | <div class="error"> |
288 | 288 | <ul> |
289 | 289 | <?php |
290 | - foreach ( $errors->get_error_messages() as $err ) |
|
290 | + foreach ($errors->get_error_messages() as $err) |
|
291 | 291 | echo "<li>$err</li>\n"; |
292 | 292 | ?> |
293 | 293 | </ul> |
294 | 294 | </div> |
295 | 295 | <?php endif; |
296 | 296 | |
297 | -if ( ! empty( $messages ) ) { |
|
298 | - foreach ( $messages as $msg ) |
|
299 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
297 | +if ( ! empty($messages)) { |
|
298 | + foreach ($messages as $msg) |
|
299 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
300 | 300 | } ?> |
301 | 301 | |
302 | -<?php if ( isset($add_user_errors) && is_wp_error( $add_user_errors ) ) : ?> |
|
302 | +<?php if (isset($add_user_errors) && is_wp_error($add_user_errors)) : ?> |
|
303 | 303 | <div class="error"> |
304 | 304 | <?php |
305 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
305 | + foreach ($add_user_errors->get_error_messages() as $message) |
|
306 | 306 | echo "<p>$message</p>"; |
307 | 307 | ?> |
308 | 308 | </div> |
@@ -310,15 +310,15 @@ discard block |
||
310 | 310 | <div id="ajax-response"></div> |
311 | 311 | |
312 | 312 | <?php |
313 | -if ( is_multisite() ) { |
|
314 | - if ( $do_both ) |
|
315 | - echo '<h2 id="add-existing-user">' . __( 'Add Existing User' ) . '</h2>'; |
|
316 | - if ( !is_super_admin() ) { |
|
317 | - echo '<p>' . __( 'Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>'; |
|
313 | +if (is_multisite()) { |
|
314 | + if ($do_both) |
|
315 | + echo '<h2 id="add-existing-user">'.__('Add Existing User').'</h2>'; |
|
316 | + if ( ! is_super_admin()) { |
|
317 | + echo '<p>'.__('Enter the email address of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.').'</p>'; |
|
318 | 318 | $label = __('Email'); |
319 | 319 | $type = 'email'; |
320 | 320 | } else { |
321 | - echo '<p>' . __( 'Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.' ) . '</p>'; |
|
321 | + echo '<p>'.__('Enter the email address or username of an existing user on this network to invite them to this site. That person will be sent an email asking them to confirm the invite.').'</p>'; |
|
322 | 322 | $label = __('Email or Username'); |
323 | 323 | $type = 'text'; |
324 | 324 | } |
@@ -329,10 +329,10 @@ discard block |
||
329 | 329 | * |
330 | 330 | * @since 3.0.0 |
331 | 331 | */ |
332 | - do_action( 'user_new_form_tag' ); |
|
332 | + do_action('user_new_form_tag'); |
|
333 | 333 | ?>> |
334 | 334 | <input name="action" type="hidden" value="adduser" /> |
335 | -<?php wp_nonce_field( 'add-user', '_wpnonce_add-user' ) ?> |
|
335 | +<?php wp_nonce_field('add-user', '_wpnonce_add-user') ?> |
|
336 | 336 | |
337 | 337 | <table class="form-table"> |
338 | 338 | <tr class="form-field form-required"> |
@@ -342,16 +342,16 @@ discard block |
||
342 | 342 | <tr class="form-field"> |
343 | 343 | <th scope="row"><label for="adduser-role"><?php _e('Role'); ?></label></th> |
344 | 344 | <td><select name="role" id="adduser-role"> |
345 | - <?php wp_dropdown_roles( get_option('default_role') ); ?> |
|
345 | + <?php wp_dropdown_roles(get_option('default_role')); ?> |
|
346 | 346 | </select> |
347 | 347 | </td> |
348 | 348 | </tr> |
349 | -<?php if ( current_user_can( 'manage_network_users' ) ) { ?> |
|
349 | +<?php if (current_user_can('manage_network_users')) { ?> |
|
350 | 350 | <tr> |
351 | - <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th> |
|
351 | + <th scope="row"><?php _e('Skip Confirmation Email'); ?></th> |
|
352 | 352 | <td> |
353 | 353 | <input type="checkbox" name="noconfirmation" id="adduser-noconfirmation" value="1" /> |
354 | - <label for="adduser-noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label> |
|
354 | + <label for="adduser-noconfirmation"><?php _e('Add the user without sending an email that requires their confirmation.'); ?></label> |
|
355 | 355 | </td> |
356 | 356 | </tr> |
357 | 357 | <?php } ?> |
@@ -368,48 +368,48 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @param string $type A contextual string specifying which type of new user form the hook follows. |
370 | 370 | */ |
371 | -do_action( 'user_new_form', 'add-existing-user' ); |
|
371 | +do_action('user_new_form', 'add-existing-user'); |
|
372 | 372 | ?> |
373 | -<?php submit_button( __( 'Add Existing User' ), 'primary', 'adduser', true, array( 'id' => 'addusersub' ) ); ?> |
|
373 | +<?php submit_button(__('Add Existing User'), 'primary', 'adduser', true, array('id' => 'addusersub')); ?> |
|
374 | 374 | </form> |
375 | 375 | <?php |
376 | 376 | } // is_multisite() |
377 | 377 | |
378 | -if ( current_user_can( 'create_users') ) { |
|
379 | - if ( $do_both ) |
|
380 | - echo '<h2 id="create-new-user">' . __( 'Add New User' ) . '</h2>'; |
|
378 | +if (current_user_can('create_users')) { |
|
379 | + if ($do_both) |
|
380 | + echo '<h2 id="create-new-user">'.__('Add New User').'</h2>'; |
|
381 | 381 | ?> |
382 | 382 | <p><?php _e('Create a brand new user and add them to this site.'); ?></p> |
383 | 383 | <form method="post" name="createuser" id="createuser" class="validate" novalidate="novalidate"<?php |
384 | 384 | /** This action is documented in wp-admin/user-new.php */ |
385 | - do_action( 'user_new_form_tag' ); |
|
385 | + do_action('user_new_form_tag'); |
|
386 | 386 | ?>> |
387 | 387 | <input name="action" type="hidden" value="createuser" /> |
388 | -<?php wp_nonce_field( 'create-user', '_wpnonce_create-user' ); ?> |
|
388 | +<?php wp_nonce_field('create-user', '_wpnonce_create-user'); ?> |
|
389 | 389 | <?php |
390 | 390 | // Load up the passed data, else set to a default. |
391 | -$creating = isset( $_POST['createuser'] ); |
|
391 | +$creating = isset($_POST['createuser']); |
|
392 | 392 | |
393 | -$new_user_login = $creating && isset( $_POST['user_login'] ) ? wp_unslash( $_POST['user_login'] ) : ''; |
|
394 | -$new_user_firstname = $creating && isset( $_POST['first_name'] ) ? wp_unslash( $_POST['first_name'] ) : ''; |
|
395 | -$new_user_lastname = $creating && isset( $_POST['last_name'] ) ? wp_unslash( $_POST['last_name'] ) : ''; |
|
396 | -$new_user_email = $creating && isset( $_POST['email'] ) ? wp_unslash( $_POST['email'] ) : ''; |
|
397 | -$new_user_uri = $creating && isset( $_POST['url'] ) ? wp_unslash( $_POST['url'] ) : ''; |
|
398 | -$new_user_role = $creating && isset( $_POST['role'] ) ? wp_unslash( $_POST['role'] ) : ''; |
|
399 | -$new_user_send_notification = $creating && ! isset( $_POST['send_user_notification'] ) ? false : true; |
|
400 | -$new_user_ignore_pass = $creating && isset( $_POST['noconfirmation'] ) ? wp_unslash( $_POST['noconfirmation'] ) : ''; |
|
393 | +$new_user_login = $creating && isset($_POST['user_login']) ? wp_unslash($_POST['user_login']) : ''; |
|
394 | +$new_user_firstname = $creating && isset($_POST['first_name']) ? wp_unslash($_POST['first_name']) : ''; |
|
395 | +$new_user_lastname = $creating && isset($_POST['last_name']) ? wp_unslash($_POST['last_name']) : ''; |
|
396 | +$new_user_email = $creating && isset($_POST['email']) ? wp_unslash($_POST['email']) : ''; |
|
397 | +$new_user_uri = $creating && isset($_POST['url']) ? wp_unslash($_POST['url']) : ''; |
|
398 | +$new_user_role = $creating && isset($_POST['role']) ? wp_unslash($_POST['role']) : ''; |
|
399 | +$new_user_send_notification = $creating && ! isset($_POST['send_user_notification']) ? false : true; |
|
400 | +$new_user_ignore_pass = $creating && isset($_POST['noconfirmation']) ? wp_unslash($_POST['noconfirmation']) : ''; |
|
401 | 401 | |
402 | 402 | ?> |
403 | 403 | <table class="form-table"> |
404 | 404 | <tr class="form-field form-required"> |
405 | 405 | <th scope="row"><label for="user_login"><?php _e('Username'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
406 | - <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr( $new_user_login ); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td> |
|
406 | + <td><input name="user_login" type="text" id="user_login" value="<?php echo esc_attr($new_user_login); ?>" aria-required="true" autocapitalize="none" autocorrect="off" maxlength="60" /></td> |
|
407 | 407 | </tr> |
408 | 408 | <tr class="form-field form-required"> |
409 | 409 | <th scope="row"><label for="email"><?php _e('Email'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
410 | - <td><input name="email" type="email" id="email" value="<?php echo esc_attr( $new_user_email ); ?>" /></td> |
|
410 | + <td><input name="email" type="email" id="email" value="<?php echo esc_attr($new_user_email); ?>" /></td> |
|
411 | 411 | </tr> |
412 | -<?php if ( !is_multisite() ) { ?> |
|
412 | +<?php if ( ! is_multisite()) { ?> |
|
413 | 413 | <tr class="form-field"> |
414 | 414 | <th scope="row"><label for="first_name"><?php _e('First Name') ?> </label></th> |
415 | 415 | <td><input name="first_name" type="text" id="first_name" value="<?php echo esc_attr($new_user_firstname); ?>" /></td> |
@@ -420,54 +420,54 @@ discard block |
||
420 | 420 | </tr> |
421 | 421 | <tr class="form-field"> |
422 | 422 | <th scope="row"><label for="url"><?php _e('Website') ?></label></th> |
423 | - <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr( $new_user_uri ); ?>" /></td> |
|
423 | + <td><input name="url" type="url" id="url" class="code" value="<?php echo esc_attr($new_user_uri); ?>" /></td> |
|
424 | 424 | </tr> |
425 | 425 | <tr class="form-field form-required user-pass1-wrap"> |
426 | 426 | <th scope="row"> |
427 | 427 | <label for="pass1"> |
428 | - <?php _e( 'Password' ); ?> |
|
429 | - <span class="description hide-if-js"><?php _e( '(required)' ); ?></span> |
|
428 | + <?php _e('Password'); ?> |
|
429 | + <span class="description hide-if-js"><?php _e('(required)'); ?></span> |
|
430 | 430 | </label> |
431 | 431 | </th> |
432 | 432 | <td> |
433 | 433 | <input class="hidden" value=" " /><!-- #24364 workaround --> |
434 | - <button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e( 'Show password' ); ?></button> |
|
434 | + <button type="button" class="button wp-generate-pw hide-if-no-js"><?php _e('Show password'); ?></button> |
|
435 | 435 | <div class="wp-pwd hide-if-js"> |
436 | - <?php $initial_password = wp_generate_password( 24 ); ?> |
|
436 | + <?php $initial_password = wp_generate_password(24); ?> |
|
437 | 437 | <span class="password-input-wrapper"> |
438 | - <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> |
|
438 | + <input type="password" name="pass1" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr($initial_password); ?>" aria-describedby="pass-strength-result" /> |
|
439 | 439 | </span> |
440 | - <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
|
440 | + <button type="button" class="button wp-hide-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Hide password'); ?>"> |
|
441 | 441 | <span class="dashicons dashicons-hidden"></span> |
442 | - <span class="text"><?php _e( 'Hide' ); ?></span> |
|
442 | + <span class="text"><?php _e('Hide'); ?></span> |
|
443 | 443 | </button> |
444 | - <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e( 'Cancel password change' ); ?>"> |
|
445 | - <span class="text"><?php _e( 'Cancel' ); ?></span> |
|
444 | + <button type="button" class="button wp-cancel-pw hide-if-no-js" data-toggle="0" aria-label="<?php esc_attr_e('Cancel password change'); ?>"> |
|
445 | + <span class="text"><?php _e('Cancel'); ?></span> |
|
446 | 446 | </button> |
447 | 447 | <div style="display:none" id="pass-strength-result" aria-live="polite"></div> |
448 | 448 | </div> |
449 | 449 | </td> |
450 | 450 | </tr> |
451 | 451 | <tr class="form-field form-required user-pass2-wrap hide-if-js"> |
452 | - <th scope="row"><label for="pass2"><?php _e( 'Repeat Password' ); ?> <span class="description"><?php _e( '(required)' ); ?></span></label></th> |
|
452 | + <th scope="row"><label for="pass2"><?php _e('Repeat Password'); ?> <span class="description"><?php _e('(required)'); ?></span></label></th> |
|
453 | 453 | <td> |
454 | 454 | <input name="pass2" type="password" id="pass2" autocomplete="off" /> |
455 | 455 | </td> |
456 | 456 | </tr> |
457 | 457 | <tr class="pw-weak"> |
458 | - <th><?php _e( 'Confirm Password' ); ?></th> |
|
458 | + <th><?php _e('Confirm Password'); ?></th> |
|
459 | 459 | <td> |
460 | 460 | <label> |
461 | 461 | <input type="checkbox" name="pw_weak" class="pw-checkbox" /> |
462 | - <?php _e( 'Confirm use of weak password' ); ?> |
|
462 | + <?php _e('Confirm use of weak password'); ?> |
|
463 | 463 | </label> |
464 | 464 | </td> |
465 | 465 | </tr> |
466 | 466 | <tr> |
467 | - <th scope="row"><?php _e( 'Send User Notification' ) ?></th> |
|
467 | + <th scope="row"><?php _e('Send User Notification') ?></th> |
|
468 | 468 | <td> |
469 | - <input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked( $new_user_send_notification ); ?> /> |
|
470 | - <label for="send_user_notification"><?php _e( 'Send the new user an email about their account.' ); ?></label> |
|
469 | + <input type="checkbox" name="send_user_notification" id="send_user_notification" value="1" <?php checked($new_user_send_notification); ?> /> |
|
470 | + <label for="send_user_notification"><?php _e('Send the new user an email about their account.'); ?></label> |
|
471 | 471 | </td> |
472 | 472 | </tr> |
473 | 473 | <?php } // !is_multisite ?> |
@@ -475,19 +475,19 @@ discard block |
||
475 | 475 | <th scope="row"><label for="role"><?php _e('Role'); ?></label></th> |
476 | 476 | <td><select name="role" id="role"> |
477 | 477 | <?php |
478 | - if ( !$new_user_role ) |
|
479 | - $new_user_role = !empty($current_role) ? $current_role : get_option('default_role'); |
|
478 | + if ( ! $new_user_role) |
|
479 | + $new_user_role = ! empty($current_role) ? $current_role : get_option('default_role'); |
|
480 | 480 | wp_dropdown_roles($new_user_role); |
481 | 481 | ?> |
482 | 482 | </select> |
483 | 483 | </td> |
484 | 484 | </tr> |
485 | - <?php if ( is_multisite() && current_user_can( 'manage_network_users' ) ) { ?> |
|
485 | + <?php if (is_multisite() && current_user_can('manage_network_users')) { ?> |
|
486 | 486 | <tr> |
487 | - <th scope="row"><?php _e( 'Skip Confirmation Email' ); ?></th> |
|
487 | + <th scope="row"><?php _e('Skip Confirmation Email'); ?></th> |
|
488 | 488 | <td> |
489 | - <input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked( $new_user_ignore_pass ); ?> /> |
|
490 | - <label for="noconfirmation"><?php _e( 'Add the user without sending an email that requires their confirmation.' ); ?></label> |
|
489 | + <input type="checkbox" name="noconfirmation" id="noconfirmation" value="1" <?php checked($new_user_ignore_pass); ?> /> |
|
490 | + <label for="noconfirmation"><?php _e('Add the user without sending an email that requires their confirmation.'); ?></label> |
|
491 | 491 | </td> |
492 | 492 | </tr> |
493 | 493 | <?php } ?> |
@@ -495,13 +495,13 @@ discard block |
||
495 | 495 | |
496 | 496 | <?php |
497 | 497 | /** This action is documented in wp-admin/user-new.php */ |
498 | -do_action( 'user_new_form', 'add-new-user' ); |
|
498 | +do_action('user_new_form', 'add-new-user'); |
|
499 | 499 | ?> |
500 | 500 | |
501 | -<?php submit_button( __( 'Add New User' ), 'primary', 'createuser', true, array( 'id' => 'createusersub' ) ); ?> |
|
501 | +<?php submit_button(__('Add New User'), 'primary', 'createuser', true, array('id' => 'createusersub')); ?> |
|
502 | 502 | |
503 | 503 | </form> |
504 | 504 | <?php } // current_user_can('create_users') ?> |
505 | 505 | </div> |
506 | 506 | <?php |
507 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
507 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -29,9 +29,10 @@ discard block |
||
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; |
@@ -63,8 +64,9 @@ discard block |
||
63 | 64 | } |
64 | 65 | |
65 | 66 | // Schedule auto-draft cleanup |
66 | -if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) |
|
67 | +if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) { |
|
67 | 68 | wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); |
69 | +} |
|
68 | 70 | |
69 | 71 | wp_enqueue_script( 'autosave' ); |
70 | 72 | |
@@ -73,8 +75,9 @@ discard block |
||
73 | 75 | } else { |
74 | 76 | $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); |
75 | 77 | |
76 | - if ( count( $check_users ) > 1 ) |
|
77 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
78 | + if ( count( $check_users ) > 1 ) { |
|
79 | + add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
80 | + } |
|
78 | 81 | |
79 | 82 | unset( $check_users ); |
80 | 83 | } |
@@ -7,7 +7,7 @@ discard block |
||
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 |
||
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,33 +54,33 @@ discard block |
||
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 ) ) { |
|
57 | +if ( ! current_user_can($post_type_object->cap->edit_posts) || ! current_user_can($post_type_object->cap->create_posts)) { |
|
58 | 58 | wp_die( |
59 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
60 | - '<p>' . __( 'Sorry, you are not allowed to create posts as this user.' ) . '</p>', |
|
59 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
60 | + '<p>'.__('Sorry, you are not allowed to create posts as this user.').'</p>', |
|
61 | 61 | 403 |
62 | 62 | ); |
63 | 63 | } |
64 | 64 | |
65 | 65 | // Schedule auto-draft cleanup |
66 | -if ( ! wp_next_scheduled( 'wp_scheduled_auto_draft_delete' ) ) |
|
67 | - wp_schedule_event( time(), 'daily', 'wp_scheduled_auto_draft_delete' ); |
|
66 | +if ( ! wp_next_scheduled('wp_scheduled_auto_draft_delete')) |
|
67 | + wp_schedule_event(time(), 'daily', 'wp_scheduled_auto_draft_delete'); |
|
68 | 68 | |
69 | -wp_enqueue_script( 'autosave' ); |
|
69 | +wp_enqueue_script('autosave'); |
|
70 | 70 | |
71 | -if ( is_multisite() ) { |
|
72 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
71 | +if (is_multisite()) { |
|
72 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
73 | 73 | } else { |
74 | - $check_users = get_users( array( 'fields' => 'ID', 'number' => 2 ) ); |
|
74 | + $check_users = get_users(array('fields' => 'ID', 'number' => 2)); |
|
75 | 75 | |
76 | - if ( count( $check_users ) > 1 ) |
|
77 | - add_action( 'admin_footer', '_admin_notice_post_locked' ); |
|
76 | + if (count($check_users) > 1) |
|
77 | + add_action('admin_footer', '_admin_notice_post_locked'); |
|
78 | 78 | |
79 | - unset( $check_users ); |
|
79 | + unset($check_users); |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | // Show post form. |
83 | -$post = get_default_post_to_edit( $post_type, true ); |
|
83 | +$post = get_default_post_to_edit($post_type, true); |
|
84 | 84 | $post_ID = $post->ID; |
85 | -include( ABSPATH . 'wp-admin/edit-form-advanced.php' ); |
|
86 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
85 | +include(ABSPATH.'wp-admin/edit-form-advanced.php'); |
|
86 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -7,7 +7,7 @@ |
||
7 | 7 | * @since 3.0.0 |
8 | 8 | */ |
9 | 9 | |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -wp_redirect( network_admin_url() ); |
|
12 | +wp_redirect(network_admin_url()); |
|
13 | 13 | exit; |
@@ -12,17 +12,19 @@ discard block |
||
12 | 12 | /** Load WordPress Administration Bootstrap */ |
13 | 13 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
14 | 14 | |
15 | -if (!current_user_can('upload_files')) |
|
15 | +if (!current_user_can('upload_files')) { |
|
16 | 16 | wp_die(__('You do not have permission to upload files.')); |
17 | +} |
|
17 | 18 | |
18 | 19 | wp_enqueue_script('plupload-handlers'); |
19 | 20 | |
20 | 21 | $post_id = 0; |
21 | 22 | if ( isset( $_REQUEST['post_id'] ) ) { |
22 | 23 | $post_id = absint( $_REQUEST['post_id'] ); |
23 | - if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) |
|
24 | - $post_id = 0; |
|
25 | -} |
|
24 | + if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) { |
|
25 | + $post_id = 0; |
|
26 | + } |
|
27 | + } |
|
26 | 28 | |
27 | 29 | if ( $_POST ) { |
28 | 30 | if ( isset($_POST['html-upload']) && !empty($_FILES) ) { |
@@ -61,8 +63,9 @@ discard block |
||
61 | 63 | |
62 | 64 | $form_class = 'media-upload-form type-form validate'; |
63 | 65 | |
64 | -if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) |
|
66 | +if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) { |
|
65 | 67 | $form_class .= ' html-uploader'; |
68 | +} |
|
66 | 69 | ?> |
67 | 70 | <div class="wrap"> |
68 | 71 | <h1><?php echo esc_html( $title ); ?></h1> |
@@ -10,64 +10,64 @@ discard block |
||
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 | -if (!current_user_can('upload_files')) |
|
15 | +if ( ! current_user_can('upload_files')) |
|
16 | 16 | wp_die(__('Sorry, you are not allowed to upload files.')); |
17 | 17 | |
18 | 18 | wp_enqueue_script('plupload-handlers'); |
19 | 19 | |
20 | 20 | $post_id = 0; |
21 | -if ( isset( $_REQUEST['post_id'] ) ) { |
|
22 | - $post_id = absint( $_REQUEST['post_id'] ); |
|
23 | - if ( ! get_post( $post_id ) || ! current_user_can( 'edit_post', $post_id ) ) |
|
21 | +if (isset($_REQUEST['post_id'])) { |
|
22 | + $post_id = absint($_REQUEST['post_id']); |
|
23 | + if ( ! get_post($post_id) || ! current_user_can('edit_post', $post_id)) |
|
24 | 24 | $post_id = 0; |
25 | 25 | } |
26 | 26 | |
27 | -if ( $_POST ) { |
|
28 | - if ( isset($_POST['html-upload']) && !empty($_FILES) ) { |
|
27 | +if ($_POST) { |
|
28 | + if (isset($_POST['html-upload']) && ! empty($_FILES)) { |
|
29 | 29 | check_admin_referer('media-form'); |
30 | 30 | // Upload File button was clicked |
31 | - $upload_id = media_handle_upload( 'async-upload', $post_id ); |
|
32 | - if ( is_wp_error( $upload_id ) ) { |
|
33 | - wp_die( $upload_id ); |
|
31 | + $upload_id = media_handle_upload('async-upload', $post_id); |
|
32 | + if (is_wp_error($upload_id)) { |
|
33 | + wp_die($upload_id); |
|
34 | 34 | } |
35 | 35 | } |
36 | - wp_redirect( admin_url( 'upload.php' ) ); |
|
36 | + wp_redirect(admin_url('upload.php')); |
|
37 | 37 | exit; |
38 | 38 | } |
39 | 39 | |
40 | 40 | $title = __('Upload New Media'); |
41 | 41 | $parent_file = 'upload.php'; |
42 | 42 | |
43 | -get_current_screen()->add_help_tab( array( |
|
43 | +get_current_screen()->add_help_tab(array( |
|
44 | 44 | 'id' => 'overview', |
45 | 45 | 'title' => __('Overview'), |
46 | 46 | 'content' => |
47 | - '<p>' . __('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:') . '</p>' . |
|
48 | - '<ul>' . |
|
49 | - '<li>' . __('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.') . '</li>' . |
|
50 | - '<li>' . __('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.') . '</li>' . |
|
51 | - '<li>' . __('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.') . '</li>' . |
|
47 | + '<p>'.__('You can upload media files here without creating a post first. This allows you to upload files to use with posts and pages later and/or to get a web link for a particular file that you can share. There are three options for uploading files:').'</p>'. |
|
48 | + '<ul>'. |
|
49 | + '<li>'.__('<strong>Drag and drop</strong> your files into the area below. Multiple files are allowed.').'</li>'. |
|
50 | + '<li>'.__('Clicking <strong>Select Files</strong> opens a navigation window showing you files in your operating system. Selecting <strong>Open</strong> after clicking on the file you want activates a progress bar on the uploader screen.').'</li>'. |
|
51 | + '<li>'.__('Revert to the <strong>Browser Uploader</strong> by clicking the link below the drag and drop box.').'</li>'. |
|
52 | 52 | '</ul>' |
53 | -) ); |
|
53 | +)); |
|
54 | 54 | get_current_screen()->set_help_sidebar( |
55 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
56 | - '<p>' . __('<a href="https://codex.wordpress.org/Media_Add_New_Screen">Documentation on Uploading Media Files</a>') . '</p>' . |
|
57 | - '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>' |
|
55 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
56 | + '<p>'.__('<a href="https://codex.wordpress.org/Media_Add_New_Screen">Documentation on Uploading Media Files</a>').'</p>'. |
|
57 | + '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>' |
|
58 | 58 | ); |
59 | 59 | |
60 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
60 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
61 | 61 | |
62 | 62 | $form_class = 'media-upload-form type-form validate'; |
63 | 63 | |
64 | -if ( get_user_setting('uploader') || isset( $_GET['browser-uploader'] ) ) |
|
64 | +if (get_user_setting('uploader') || isset($_GET['browser-uploader'])) |
|
65 | 65 | $form_class .= ' html-uploader'; |
66 | 66 | ?> |
67 | 67 | <div class="wrap"> |
68 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
68 | + <h1><?php echo esc_html($title); ?></h1> |
|
69 | 69 | |
70 | - <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo esc_attr( $form_class ); ?>" id="file-form"> |
|
70 | + <form enctype="multipart/form-data" method="post" action="<?php echo admin_url('media-new.php'); ?>" class="<?php echo esc_attr($form_class); ?>" id="file-form"> |
|
71 | 71 | |
72 | 72 | <?php media_upload_form(); ?> |
73 | 73 | |
@@ -81,4 +81,4 @@ discard block |
||
81 | 81 | </div> |
82 | 82 | |
83 | 83 | <?php |
84 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
84 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -177,9 +177,12 @@ |
||
177 | 177 | </tr> |
178 | 178 | <?php |
179 | 179 | // For any other site, the scheme, domain, and path can all be changed. |
180 | - else : ?> |
|
180 | + else { |
|
181 | + : ?> |
|
181 | 182 | <tr class="form-field form-required"> |
182 | - <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th> |
|
183 | + <th scope="row"><?php _e( 'Site Address (URL)' ); |
|
184 | + } |
|
185 | + ?></th> |
|
183 | 186 | <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td> |
184 | 187 | </tr> |
185 | 188 | <?php endif; ?> |
@@ -8,74 +8,74 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! current_user_can( 'manage_sites' ) ) { |
|
14 | - wp_die( __( 'Sorry, you are not allowed to edit this site.' ) ); |
|
13 | +if ( ! current_user_can('manage_sites')) { |
|
14 | + wp_die(__('Sorry, you are not allowed to edit this site.')); |
|
15 | 15 | } |
16 | 16 | |
17 | -get_current_screen()->add_help_tab( array( |
|
17 | +get_current_screen()->add_help_tab(array( |
|
18 | 18 | 'id' => 'overview', |
19 | - 'title' => __( 'Overview' ), |
|
19 | + 'title' => __('Overview'), |
|
20 | 20 | 'content' => |
21 | - '<p>' . __( 'The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.' ) . '</p>' . |
|
22 | - '<p>' . __( '<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.' ) . '</p>' . |
|
23 | - '<p>' . __( '<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.' ) . '</p>' . |
|
24 | - '<p>' . sprintf( __( '<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.' ), network_admin_url( 'themes.php' ) ) . '</p>' . |
|
25 | - '<p>' . __( '<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.' ) . '</p>' |
|
26 | -) ); |
|
21 | + '<p>'.__('The menu is for editing information specific to individual sites, particularly if the admin area of a site is unavailable.').'</p>'. |
|
22 | + '<p>'.__('<strong>Info</strong> — The site URL is rarely edited as this can cause the site to not work properly. The Registered date and Last Updated date are displayed. Network admins can mark a site as archived, spam, deleted and mature, to remove from public listings or disable.').'</p>'. |
|
23 | + '<p>'.__('<strong>Users</strong> — This displays the users associated with this site. You can also change their role, reset their password, or remove them from the site. Removing the user from the site does not remove the user from the network.').'</p>'. |
|
24 | + '<p>'.sprintf(__('<strong>Themes</strong> — This area shows themes that are not already enabled across the network. Enabling a theme in this menu makes it accessible to this site. It does not activate the theme, but allows it to show in the site’s Appearance menu. To enable a theme for the entire network, see the <a href="%s">Network Themes</a> screen.'), network_admin_url('themes.php')).'</p>'. |
|
25 | + '<p>'.__('<strong>Settings</strong> — This page shows a list of all settings associated with this site. Some are created by WordPress and others are created by plugins you activate. Note that some fields are grayed out and say Serialized Data. You cannot modify these values due to the way the setting is stored in the database.').'</p>' |
|
26 | +)); |
|
27 | 27 | |
28 | 28 | get_current_screen()->set_help_sidebar( |
29 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
30 | - '<p>' . __( '<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>' ) . '</p>' . |
|
31 | - '<p>' . __( '<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>' ) . '</p>' |
|
29 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
30 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>').'</p>'. |
|
31 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>').'</p>' |
|
32 | 32 | ); |
33 | 33 | |
34 | -$id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
34 | +$id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
35 | 35 | |
36 | -if ( ! $id ) { |
|
37 | - wp_die( __('Invalid site ID.') ); |
|
36 | +if ( ! $id) { |
|
37 | + wp_die(__('Invalid site ID.')); |
|
38 | 38 | } |
39 | 39 | |
40 | -$details = get_site( $id ); |
|
41 | -if ( ! $details ) { |
|
42 | - wp_die( __( 'The requested site does not exist.' ) ); |
|
40 | +$details = get_site($id); |
|
41 | +if ( ! $details) { |
|
42 | + wp_die(__('The requested site does not exist.')); |
|
43 | 43 | } |
44 | 44 | |
45 | -if ( ! can_edit_network( $details->site_id ) ) { |
|
46 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
45 | +if ( ! can_edit_network($details->site_id)) { |
|
46 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
47 | 47 | } |
48 | 48 | |
49 | -$parsed_scheme = parse_url( $details->siteurl, PHP_URL_SCHEME ); |
|
50 | -$is_main_site = is_main_site( $id ); |
|
49 | +$parsed_scheme = parse_url($details->siteurl, PHP_URL_SCHEME); |
|
50 | +$is_main_site = is_main_site($id); |
|
51 | 51 | |
52 | -if ( isset( $_REQUEST['action'] ) && 'update-site' == $_REQUEST['action'] ) { |
|
53 | - check_admin_referer( 'edit-site' ); |
|
52 | +if (isset($_REQUEST['action']) && 'update-site' == $_REQUEST['action']) { |
|
53 | + check_admin_referer('edit-site'); |
|
54 | 54 | |
55 | - switch_to_blog( $id ); |
|
55 | + switch_to_blog($id); |
|
56 | 56 | |
57 | 57 | // Rewrite rules can't be flushed during switch to blog. |
58 | - delete_option( 'rewrite_rules' ); |
|
58 | + delete_option('rewrite_rules'); |
|
59 | 59 | |
60 | - $blog_data = wp_unslash( $_POST['blog'] ); |
|
60 | + $blog_data = wp_unslash($_POST['blog']); |
|
61 | 61 | $blog_data['scheme'] = $parsed_scheme; |
62 | 62 | |
63 | - if ( $is_main_site ) { |
|
63 | + if ($is_main_site) { |
|
64 | 64 | // On the network's main site, don't allow the domain or path to change. |
65 | 65 | $blog_data['domain'] = $details->domain; |
66 | 66 | $blog_data['path'] = $details->path; |
67 | 67 | } else { |
68 | 68 | // For any other site, the scheme, domain, and path can all be changed. We first |
69 | 69 | // need to ensure a scheme has been provided, otherwise fallback to the existing. |
70 | - $new_url_scheme = parse_url( $blog_data['url'], PHP_URL_SCHEME ); |
|
70 | + $new_url_scheme = parse_url($blog_data['url'], PHP_URL_SCHEME); |
|
71 | 71 | |
72 | - if ( ! $new_url_scheme ) { |
|
73 | - $blog_data['url'] = esc_url( $parsed_scheme . '://' . $blog_data['url'] ); |
|
72 | + if ( ! $new_url_scheme) { |
|
73 | + $blog_data['url'] = esc_url($parsed_scheme.'://'.$blog_data['url']); |
|
74 | 74 | } |
75 | - $update_parsed_url = parse_url( $blog_data['url'] ); |
|
75 | + $update_parsed_url = parse_url($blog_data['url']); |
|
76 | 76 | |
77 | 77 | // If a path is not provided, use the default of `/`. |
78 | - if ( ! isset( $update_parsed_url['path'] ) ) { |
|
78 | + if ( ! isset($update_parsed_url['path'])) { |
|
79 | 79 | $update_parsed_url['path'] = '/'; |
80 | 80 | } |
81 | 81 | |
@@ -84,119 +84,119 @@ discard block |
||
84 | 84 | $blog_data['path'] = $update_parsed_url['path']; |
85 | 85 | } |
86 | 86 | |
87 | - $existing_details = get_site( $id ); |
|
88 | - $blog_data_checkboxes = array( 'public', 'archived', 'spam', 'mature', 'deleted' ); |
|
89 | - foreach ( $blog_data_checkboxes as $c ) { |
|
90 | - if ( ! in_array( $existing_details->$c, array( 0, 1 ) ) ) { |
|
91 | - $blog_data[ $c ] = $existing_details->$c; |
|
87 | + $existing_details = get_site($id); |
|
88 | + $blog_data_checkboxes = array('public', 'archived', 'spam', 'mature', 'deleted'); |
|
89 | + foreach ($blog_data_checkboxes as $c) { |
|
90 | + if ( ! in_array($existing_details->$c, array(0, 1))) { |
|
91 | + $blog_data[$c] = $existing_details->$c; |
|
92 | 92 | } else { |
93 | - $blog_data[ $c ] = isset( $_POST['blog'][ $c ] ) ? 1 : 0; |
|
93 | + $blog_data[$c] = isset($_POST['blog'][$c]) ? 1 : 0; |
|
94 | 94 | } |
95 | 95 | } |
96 | 96 | |
97 | - update_blog_details( $id, $blog_data ); |
|
97 | + update_blog_details($id, $blog_data); |
|
98 | 98 | |
99 | 99 | // Maybe update home and siteurl options. |
100 | - $new_details = get_site( $id ); |
|
100 | + $new_details = get_site($id); |
|
101 | 101 | |
102 | - $old_home_url = trailingslashit( esc_url( get_option( 'home' ) ) ); |
|
103 | - $old_home_parsed = parse_url( $old_home_url ); |
|
102 | + $old_home_url = trailingslashit(esc_url(get_option('home'))); |
|
103 | + $old_home_parsed = parse_url($old_home_url); |
|
104 | 104 | |
105 | - if ( $old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path ) { |
|
106 | - $new_home_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); |
|
107 | - update_option( 'home', $new_home_url ); |
|
105 | + if ($old_home_parsed['host'] === $existing_details->domain && $old_home_parsed['path'] === $existing_details->path) { |
|
106 | + $new_home_url = untrailingslashit(esc_url_raw($blog_data['scheme'].'://'.$new_details->domain.$new_details->path)); |
|
107 | + update_option('home', $new_home_url); |
|
108 | 108 | } |
109 | 109 | |
110 | - $old_site_url = trailingslashit( esc_url( get_option( 'siteurl' ) ) ); |
|
111 | - $old_site_parsed = parse_url( $old_site_url ); |
|
110 | + $old_site_url = trailingslashit(esc_url(get_option('siteurl'))); |
|
111 | + $old_site_parsed = parse_url($old_site_url); |
|
112 | 112 | |
113 | - if ( $old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path ) { |
|
114 | - $new_site_url = untrailingslashit( esc_url_raw( $blog_data['scheme'] . '://' . $new_details->domain . $new_details->path ) ); |
|
115 | - update_option( 'siteurl', $new_site_url ); |
|
113 | + if ($old_site_parsed['host'] === $existing_details->domain && $old_site_parsed['path'] === $existing_details->path) { |
|
114 | + $new_site_url = untrailingslashit(esc_url_raw($blog_data['scheme'].'://'.$new_details->domain.$new_details->path)); |
|
115 | + update_option('siteurl', $new_site_url); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | restore_current_blog(); |
119 | - wp_redirect( add_query_arg( array( 'update' => 'updated', 'id' => $id ), 'site-info.php' ) ); |
|
119 | + wp_redirect(add_query_arg(array('update' => 'updated', 'id' => $id), 'site-info.php')); |
|
120 | 120 | exit; |
121 | 121 | } |
122 | 122 | |
123 | -if ( isset( $_GET['update'] ) ) { |
|
123 | +if (isset($_GET['update'])) { |
|
124 | 124 | $messages = array(); |
125 | - if ( 'updated' == $_GET['update'] ) { |
|
126 | - $messages[] = __( 'Site info updated.' ); |
|
125 | + if ('updated' == $_GET['update']) { |
|
126 | + $messages[] = __('Site info updated.'); |
|
127 | 127 | } |
128 | 128 | } |
129 | 129 | |
130 | 130 | /* translators: %s: site name */ |
131 | -$title = sprintf( __( 'Edit Site: %s' ), esc_html( $details->blogname ) ); |
|
131 | +$title = sprintf(__('Edit Site: %s'), esc_html($details->blogname)); |
|
132 | 132 | |
133 | 133 | $parent_file = 'sites.php'; |
134 | 134 | $submenu_file = 'sites.php'; |
135 | 135 | |
136 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
136 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
137 | 137 | |
138 | 138 | ?> |
139 | 139 | |
140 | 140 | <div class="wrap"> |
141 | 141 | <h1 id="edit-site"><?php echo $title; ?></h1> |
142 | -<p class="edit-site-actions"><a href="<?php echo esc_url( get_home_url( $id, '/' ) ); ?>"><?php _e( 'Visit' ); ?></a> | <a href="<?php echo esc_url( get_admin_url( $id ) ); ?>"><?php _e( 'Dashboard' ); ?></a></p> |
|
142 | +<p class="edit-site-actions"><a href="<?php echo esc_url(get_home_url($id, '/')); ?>"><?php _e('Visit'); ?></a> | <a href="<?php echo esc_url(get_admin_url($id)); ?>"><?php _e('Dashboard'); ?></a></p> |
|
143 | 143 | <?php |
144 | 144 | |
145 | -network_edit_site_nav( array( |
|
145 | +network_edit_site_nav(array( |
|
146 | 146 | 'blog_id' => $id, |
147 | 147 | 'selected' => 'site-info' |
148 | -) ); |
|
148 | +)); |
|
149 | 149 | |
150 | -if ( ! empty( $messages ) ) { |
|
151 | - foreach ( $messages as $msg ) { |
|
152 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
150 | +if ( ! empty($messages)) { |
|
151 | + foreach ($messages as $msg) { |
|
152 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
153 | 153 | } |
154 | 154 | } |
155 | 155 | ?> |
156 | 156 | <form method="post" action="site-info.php?action=update-site"> |
157 | - <?php wp_nonce_field( 'edit-site' ); ?> |
|
158 | - <input type="hidden" name="id" value="<?php echo esc_attr( $id ) ?>" /> |
|
157 | + <?php wp_nonce_field('edit-site'); ?> |
|
158 | + <input type="hidden" name="id" value="<?php echo esc_attr($id) ?>" /> |
|
159 | 159 | <table class="form-table"> |
160 | 160 | <?php |
161 | 161 | // The main site of the network should not be updated on this page. |
162 | - if ( $is_main_site ) : ?> |
|
162 | + if ($is_main_site) : ?> |
|
163 | 163 | <tr class="form-field"> |
164 | - <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th> |
|
165 | - <td><?php echo esc_url( $details->domain . $details->path ); ?></td> |
|
164 | + <th scope="row"><?php _e('Site Address (URL)'); ?></th> |
|
165 | + <td><?php echo esc_url($details->domain.$details->path); ?></td> |
|
166 | 166 | </tr> |
167 | 167 | <?php |
168 | 168 | // For any other site, the scheme, domain, and path can all be changed. |
169 | 169 | else : ?> |
170 | 170 | <tr class="form-field form-required"> |
171 | - <th scope="row"><?php _e( 'Site Address (URL)' ); ?></th> |
|
172 | - <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme . '://' . esc_attr( $details->domain ) . esc_attr( $details->path ); ?>" /></td> |
|
171 | + <th scope="row"><?php _e('Site Address (URL)'); ?></th> |
|
172 | + <td><input name="blog[url]" type="text" id="url" value="<?php echo $parsed_scheme.'://'.esc_attr($details->domain).esc_attr($details->path); ?>" /></td> |
|
173 | 173 | </tr> |
174 | 174 | <?php endif; ?> |
175 | 175 | |
176 | 176 | <tr class="form-field"> |
177 | - <th scope="row"><label for="blog_registered"><?php _ex( 'Registered', 'site' ) ?></label></th> |
|
178 | - <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr( $details->registered ) ?>" /></td> |
|
177 | + <th scope="row"><label for="blog_registered"><?php _ex('Registered', 'site') ?></label></th> |
|
178 | + <td><input name="blog[registered]" type="text" id="blog_registered" value="<?php echo esc_attr($details->registered) ?>" /></td> |
|
179 | 179 | </tr> |
180 | 180 | <tr class="form-field"> |
181 | - <th scope="row"><label for="blog_last_updated"><?php _e( 'Last Updated' ); ?></label></th> |
|
182 | - <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr( $details->last_updated ) ?>" /></td> |
|
181 | + <th scope="row"><label for="blog_last_updated"><?php _e('Last Updated'); ?></label></th> |
|
182 | + <td><input name="blog[last_updated]" type="text" id="blog_last_updated" value="<?php echo esc_attr($details->last_updated) ?>" /></td> |
|
183 | 183 | </tr> |
184 | 184 | <?php |
185 | - $attribute_fields = array( 'public' => __( 'Public' ) ); |
|
186 | - if ( ! $is_main_site ) { |
|
187 | - $attribute_fields['archived'] = __( 'Archived' ); |
|
188 | - $attribute_fields['spam'] = _x( 'Spam', 'site' ); |
|
189 | - $attribute_fields['deleted'] = __( 'Deleted' ); |
|
185 | + $attribute_fields = array('public' => __('Public')); |
|
186 | + if ( ! $is_main_site) { |
|
187 | + $attribute_fields['archived'] = __('Archived'); |
|
188 | + $attribute_fields['spam'] = _x('Spam', 'site'); |
|
189 | + $attribute_fields['deleted'] = __('Deleted'); |
|
190 | 190 | } |
191 | - $attribute_fields['mature'] = __( 'Mature' ); |
|
191 | + $attribute_fields['mature'] = __('Mature'); |
|
192 | 192 | ?> |
193 | 193 | <tr> |
194 | - <th scope="row"><?php _e( 'Attributes' ); ?></th> |
|
194 | + <th scope="row"><?php _e('Attributes'); ?></th> |
|
195 | 195 | <td> |
196 | 196 | <fieldset> |
197 | - <legend class="screen-reader-text"><?php _e( 'Set site attributes' ) ?></legend> |
|
198 | - <?php foreach ( $attribute_fields as $field_key => $field_label ) : ?> |
|
199 | - <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked( (bool) $details->$field_key, true ); disabled( ! in_array( $details->$field_key, array( 0, 1 ) ) ); ?> /> |
|
197 | + <legend class="screen-reader-text"><?php _e('Set site attributes') ?></legend> |
|
198 | + <?php foreach ($attribute_fields as $field_key => $field_label) : ?> |
|
199 | + <label><input type="checkbox" name="blog[<?php echo $field_key; ?>]" value="1" <?php checked((bool) $details->$field_key, true); disabled( ! in_array($details->$field_key, array(0, 1))); ?> /> |
|
200 | 200 | <?php echo $field_label; ?></label><br/> |
201 | 201 | <?php endforeach; ?> |
202 | 202 | <fieldset> |
@@ -208,4 +208,4 @@ discard block |
||
208 | 208 | |
209 | 209 | </div> |
210 | 210 | <?php |
211 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
211 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -115,12 +115,12 @@ |
||
115 | 115 | } |
116 | 116 | |
117 | 117 | /** |
118 | - * Fires after a new user has been created via the network site-new.php page. |
|
119 | - * |
|
120 | - * @since 4.4.0 |
|
121 | - * |
|
122 | - * @param int $user_id ID of the newly created user. |
|
123 | - */ |
|
118 | + * Fires after a new user has been created via the network site-new.php page. |
|
119 | + * |
|
120 | + * @since 4.4.0 |
|
121 | + * |
|
122 | + * @param int $user_id ID of the newly created user. |
|
123 | + */ |
|
124 | 124 | do_action( 'network_site_new_created_user', $user_id ); |
125 | 125 | } |
126 | 126 |
@@ -8,48 +8,48 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | 13 | /** WordPress Translation Install API */ |
14 | -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
14 | +require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
17 | - wp_die( __( 'Sorry, you are not allowed to add sites to this network.' ) ); |
|
16 | +if ( ! current_user_can('manage_sites')) |
|
17 | + wp_die(__('Sorry, you are not allowed to add sites to this network.')); |
|
18 | 18 | |
19 | -get_current_screen()->add_help_tab( array( |
|
19 | +get_current_screen()->add_help_tab(array( |
|
20 | 20 | 'id' => 'overview', |
21 | 21 | 'title' => __('Overview'), |
22 | 22 | 'content' => |
23 | - '<p>' . __('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.') . '</p>' . |
|
24 | - '<p>' . __('If the admin email for the new site does not exist in the database, a new user will also be created.') . '</p>' |
|
25 | -) ); |
|
23 | + '<p>'.__('This screen is for Super Admins to add new sites to the network. This is not affected by the registration settings.').'</p>'. |
|
24 | + '<p>'.__('If the admin email for the new site does not exist in the database, a new user will also be created.').'</p>' |
|
25 | +)); |
|
26 | 26 | |
27 | 27 | get_current_screen()->set_help_sidebar( |
28 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
29 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>') . '</p>' . |
|
30 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>') . '</p>' |
|
28 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
29 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Sites_Screen">Documentation on Site Management</a>').'</p>'. |
|
30 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>').'</p>' |
|
31 | 31 | ); |
32 | 32 | |
33 | -if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { |
|
34 | - check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); |
|
33 | +if (isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action']) { |
|
34 | + check_admin_referer('add-blog', '_wpnonce_add-blog'); |
|
35 | 35 | |
36 | - if ( ! is_array( $_POST['blog'] ) ) |
|
37 | - wp_die( __( 'Can’t create an empty site.' ) ); |
|
36 | + if ( ! is_array($_POST['blog'])) |
|
37 | + wp_die(__('Can’t create an empty site.')); |
|
38 | 38 | |
39 | 39 | $blog = $_POST['blog']; |
40 | 40 | $domain = ''; |
41 | - if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) |
|
42 | - $domain = strtolower( $blog['domain'] ); |
|
41 | + if (preg_match('|^([a-zA-Z0-9-])+$|', $blog['domain'])) |
|
42 | + $domain = strtolower($blog['domain']); |
|
43 | 43 | |
44 | 44 | // If not a subdomain install, make sure the domain isn't a reserved word |
45 | - if ( ! is_subdomain_install() ) { |
|
45 | + if ( ! is_subdomain_install()) { |
|
46 | 46 | $subdirectory_reserved_names = get_subdirectory_reserved_names(); |
47 | 47 | |
48 | - if ( in_array( $domain, $subdirectory_reserved_names ) ) { |
|
48 | + if (in_array($domain, $subdirectory_reserved_names)) { |
|
49 | 49 | wp_die( |
50 | 50 | /* translators: %s: reserved names list */ |
51 | - sprintf( __( 'The following words are reserved for use by WordPress functions and cannot be used as blog names: %s' ), |
|
52 | - '<code>' . implode( '</code>, <code>', $subdirectory_reserved_names ) . '</code>' |
|
51 | + sprintf(__('The following words are reserved for use by WordPress functions and cannot be used as blog names: %s'), |
|
52 | + '<code>'.implode('</code>, <code>', $subdirectory_reserved_names).'</code>' |
|
53 | 53 | ) |
54 | 54 | ); |
55 | 55 | } |
@@ -62,40 +62,40 @@ discard block |
||
62 | 62 | ); |
63 | 63 | |
64 | 64 | // Handle translation install for the new site. |
65 | - if ( isset( $_POST['WPLANG'] ) ) { |
|
66 | - if ( '' === $_POST['WPLANG'] ) { |
|
65 | + if (isset($_POST['WPLANG'])) { |
|
66 | + if ('' === $_POST['WPLANG']) { |
|
67 | 67 | $meta['WPLANG'] = ''; // en_US |
68 | - } elseif ( wp_can_install_language_pack() ) { |
|
69 | - $language = wp_download_language_pack( wp_unslash( $_POST['WPLANG'] ) ); |
|
70 | - if ( $language ) { |
|
68 | + } elseif (wp_can_install_language_pack()) { |
|
69 | + $language = wp_download_language_pack(wp_unslash($_POST['WPLANG'])); |
|
70 | + if ($language) { |
|
71 | 71 | $meta['WPLANG'] = $language; |
72 | 72 | } |
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - if ( empty( $domain ) ) |
|
77 | - wp_die( __( 'Missing or invalid site address.' ) ); |
|
76 | + if (empty($domain)) |
|
77 | + wp_die(__('Missing or invalid site address.')); |
|
78 | 78 | |
79 | - if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { |
|
80 | - wp_die( __( 'Missing email address.' ) ); |
|
79 | + if (isset($blog['email']) && '' === trim($blog['email'])) { |
|
80 | + wp_die(__('Missing email address.')); |
|
81 | 81 | } |
82 | 82 | |
83 | - $email = sanitize_email( $blog['email'] ); |
|
84 | - if ( ! is_email( $email ) ) { |
|
85 | - wp_die( __( 'Invalid email address.' ) ); |
|
83 | + $email = sanitize_email($blog['email']); |
|
84 | + if ( ! is_email($email)) { |
|
85 | + wp_die(__('Invalid email address.')); |
|
86 | 86 | } |
87 | 87 | |
88 | - if ( is_subdomain_install() ) { |
|
89 | - $newdomain = $domain . '.' . preg_replace( '|^www\.|', '', get_network()->domain ); |
|
88 | + if (is_subdomain_install()) { |
|
89 | + $newdomain = $domain.'.'.preg_replace('|^www\.|', '', get_network()->domain); |
|
90 | 90 | $path = get_network()->path; |
91 | 91 | } else { |
92 | 92 | $newdomain = get_network()->domain; |
93 | - $path = get_network()->path . $domain . '/'; |
|
93 | + $path = get_network()->path.$domain.'/'; |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | $password = 'N/A'; |
97 | 97 | $user_id = email_exists($email); |
98 | - if ( !$user_id ) { // Create a new user with a random password |
|
98 | + if ( ! $user_id) { // Create a new user with a random password |
|
99 | 99 | /** |
100 | 100 | * Fires immediately before a new user is created via the network site-new.php page. |
101 | 101 | * |
@@ -103,16 +103,16 @@ discard block |
||
103 | 103 | * |
104 | 104 | * @param string $email Email of the non-existent user. |
105 | 105 | */ |
106 | - do_action( 'pre_network_site_new_created_user', $email ); |
|
106 | + do_action('pre_network_site_new_created_user', $email); |
|
107 | 107 | |
108 | - $user_id = username_exists( $domain ); |
|
109 | - if ( $user_id ) { |
|
110 | - wp_die( __( 'The domain or path entered conflicts with an existing username.' ) ); |
|
108 | + $user_id = username_exists($domain); |
|
109 | + if ($user_id) { |
|
110 | + wp_die(__('The domain or path entered conflicts with an existing username.')); |
|
111 | 111 | } |
112 | - $password = wp_generate_password( 12, false ); |
|
113 | - $user_id = wpmu_create_user( $domain, $password, $email ); |
|
114 | - if ( false === $user_id ) { |
|
115 | - wp_die( __( 'There was an error creating the user.' ) ); |
|
112 | + $password = wp_generate_password(12, false); |
|
113 | + $user_id = wpmu_create_user($domain, $password, $email); |
|
114 | + if (false === $user_id) { |
|
115 | + wp_die(__('There was an error creating the user.')); |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | /** |
@@ -122,129 +122,129 @@ discard block |
||
122 | 122 | * |
123 | 123 | * @param int $user_id ID of the newly created user. |
124 | 124 | */ |
125 | - do_action( 'network_site_new_created_user', $user_id ); |
|
125 | + do_action('network_site_new_created_user', $user_id); |
|
126 | 126 | } |
127 | 127 | |
128 | 128 | $wpdb->hide_errors(); |
129 | - $id = wpmu_create_blog( $newdomain, $path, $title, $user_id, $meta, get_current_network_id() ); |
|
129 | + $id = wpmu_create_blog($newdomain, $path, $title, $user_id, $meta, get_current_network_id()); |
|
130 | 130 | $wpdb->show_errors(); |
131 | - if ( ! is_wp_error( $id ) ) { |
|
132 | - if ( ! is_super_admin( $user_id ) && !get_user_option( 'primary_blog', $user_id ) ) { |
|
133 | - update_user_option( $user_id, 'primary_blog', $id, true ); |
|
131 | + if ( ! is_wp_error($id)) { |
|
132 | + if ( ! is_super_admin($user_id) && ! get_user_option('primary_blog', $user_id)) { |
|
133 | + update_user_option($user_id, 'primary_blog', $id, true); |
|
134 | 134 | } |
135 | 135 | |
136 | 136 | wp_mail( |
137 | - get_site_option( 'admin_email' ), |
|
137 | + get_site_option('admin_email'), |
|
138 | 138 | sprintf( |
139 | 139 | /* translators: %s: network name */ |
140 | - __( '[%s] New Site Created' ), |
|
140 | + __('[%s] New Site Created'), |
|
141 | 141 | get_network()->site_name |
142 | 142 | ), |
143 | 143 | sprintf( |
144 | 144 | /* translators: 1: user login, 2: site url, 3: site name/title */ |
145 | - __( 'New site created by %1$s |
|
145 | + __('New site created by %1$s |
|
146 | 146 | |
147 | 147 | Address: %2$s |
148 | 148 | Name: %3$s' ), |
149 | 149 | $current_user->user_login, |
150 | - get_site_url( $id ), |
|
151 | - wp_unslash( $title ) |
|
150 | + get_site_url($id), |
|
151 | + wp_unslash($title) |
|
152 | 152 | ), |
153 | 153 | sprintf( |
154 | 154 | 'From: "%1$s" <%2$s>', |
155 | - _x( 'Site Admin', 'email "From" field' ), |
|
156 | - get_site_option( 'admin_email' ) |
|
155 | + _x('Site Admin', 'email "From" field'), |
|
156 | + get_site_option('admin_email') |
|
157 | 157 | ) |
158 | 158 | ); |
159 | - wpmu_welcome_notification( $id, $user_id, $password, $title, array( 'public' => 1 ) ); |
|
160 | - wp_redirect( add_query_arg( array( 'update' => 'added', 'id' => $id ), 'site-new.php' ) ); |
|
159 | + wpmu_welcome_notification($id, $user_id, $password, $title, array('public' => 1)); |
|
160 | + wp_redirect(add_query_arg(array('update' => 'added', 'id' => $id), 'site-new.php')); |
|
161 | 161 | exit; |
162 | 162 | } else { |
163 | - wp_die( $id->get_error_message() ); |
|
163 | + wp_die($id->get_error_message()); |
|
164 | 164 | } |
165 | 165 | } |
166 | 166 | |
167 | -if ( isset($_GET['update']) ) { |
|
167 | +if (isset($_GET['update'])) { |
|
168 | 168 | $messages = array(); |
169 | - if ( 'added' == $_GET['update'] ) |
|
169 | + if ('added' == $_GET['update']) |
|
170 | 170 | $messages[] = sprintf( |
171 | 171 | /* translators: 1: dashboard url, 2: network admin edit url */ |
172 | - __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), |
|
173 | - esc_url( get_admin_url( absint( $_GET['id'] ) ) ), |
|
174 | - network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) |
|
172 | + __('Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>'), |
|
173 | + esc_url(get_admin_url(absint($_GET['id']))), |
|
174 | + network_admin_url('site-info.php?id='.absint($_GET['id'])) |
|
175 | 175 | ); |
176 | 176 | } |
177 | 177 | |
178 | 178 | $title = __('Add New Site'); |
179 | 179 | $parent_file = 'sites.php'; |
180 | 180 | |
181 | -wp_enqueue_script( 'user-suggest' ); |
|
181 | +wp_enqueue_script('user-suggest'); |
|
182 | 182 | |
183 | -require( ABSPATH . 'wp-admin/admin-header.php' ); |
|
183 | +require(ABSPATH.'wp-admin/admin-header.php'); |
|
184 | 184 | |
185 | 185 | ?> |
186 | 186 | |
187 | 187 | <div class="wrap"> |
188 | -<h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1> |
|
188 | +<h1 id="add-new-site"><?php _e('Add New Site'); ?></h1> |
|
189 | 189 | <?php |
190 | -if ( ! empty( $messages ) ) { |
|
191 | - foreach ( $messages as $msg ) |
|
192 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
190 | +if ( ! empty($messages)) { |
|
191 | + foreach ($messages as $msg) |
|
192 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
193 | 193 | } ?> |
194 | -<form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate"> |
|
195 | -<?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> |
|
194 | +<form method="post" action="<?php echo network_admin_url('site-new.php?action=add-site'); ?>" novalidate="novalidate"> |
|
195 | +<?php wp_nonce_field('add-blog', '_wpnonce_add-blog') ?> |
|
196 | 196 | <table class="form-table"> |
197 | 197 | <tr class="form-field form-required"> |
198 | - <th scope="row"><label for="site-address"><?php _e( 'Site Address (URL)' ) ?></label></th> |
|
198 | + <th scope="row"><label for="site-address"><?php _e('Site Address (URL)') ?></label></th> |
|
199 | 199 | <td> |
200 | - <?php if ( is_subdomain_install() ) { ?> |
|
201 | - <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace( '|^www\.|', '', get_network()->domain ); ?></span> |
|
200 | + <?php if (is_subdomain_install()) { ?> |
|
201 | + <input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off"/><span class="no-break">.<?php echo preg_replace('|^www\.|', '', get_network()->domain); ?></span> |
|
202 | 202 | <?php } else { |
203 | - echo get_network()->domain . get_network()->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" /> |
|
203 | + echo get_network()->domain.get_network()->path ?><input name="blog[domain]" type="text" class="regular-text" id="site-address" aria-describedby="site-address-desc" autocapitalize="none" autocorrect="off" /> |
|
204 | 204 | <?php } |
205 | - echo '<p class="description" id="site-address-desc">' . __( 'Only lowercase letters (a-z), numbers, and hyphens are allowed.' ) . '</p>'; |
|
205 | + echo '<p class="description" id="site-address-desc">'.__('Only lowercase letters (a-z), numbers, and hyphens are allowed.').'</p>'; |
|
206 | 206 | ?> |
207 | 207 | </td> |
208 | 208 | </tr> |
209 | 209 | <tr class="form-field form-required"> |
210 | - <th scope="row"><label for="site-title"><?php _e( 'Site Title' ) ?></label></th> |
|
210 | + <th scope="row"><label for="site-title"><?php _e('Site Title') ?></label></th> |
|
211 | 211 | <td><input name="blog[title]" type="text" class="regular-text" id="site-title" /></td> |
212 | 212 | </tr> |
213 | 213 | <?php |
214 | 214 | $languages = get_available_languages(); |
215 | 215 | $translations = wp_get_available_translations(); |
216 | - if ( ! empty( $languages ) || ! empty( $translations ) ) : |
|
216 | + if ( ! empty($languages) || ! empty($translations)) : |
|
217 | 217 | ?> |
218 | 218 | <tr class="form-field form-required"> |
219 | - <th scope="row"><label for="site-language"><?php _e( 'Site Language' ); ?></label></th> |
|
219 | + <th scope="row"><label for="site-language"><?php _e('Site Language'); ?></label></th> |
|
220 | 220 | <td> |
221 | 221 | <?php |
222 | 222 | // Network default. |
223 | - $lang = get_site_option( 'WPLANG' ); |
|
223 | + $lang = get_site_option('WPLANG'); |
|
224 | 224 | |
225 | 225 | // Use English if the default isn't available. |
226 | - if ( ! in_array( $lang, $languages ) ) { |
|
226 | + if ( ! in_array($lang, $languages)) { |
|
227 | 227 | $lang = ''; |
228 | 228 | } |
229 | 229 | |
230 | - wp_dropdown_languages( array( |
|
230 | + wp_dropdown_languages(array( |
|
231 | 231 | 'name' => 'WPLANG', |
232 | 232 | 'id' => 'site-language', |
233 | 233 | 'selected' => $lang, |
234 | 234 | 'languages' => $languages, |
235 | 235 | 'translations' => $translations, |
236 | 236 | 'show_available_translations' => wp_can_install_language_pack(), |
237 | - ) ); |
|
237 | + )); |
|
238 | 238 | ?> |
239 | 239 | </td> |
240 | 240 | </tr> |
241 | 241 | <?php endif; // Languages. ?> |
242 | 242 | <tr class="form-field form-required"> |
243 | - <th scope="row"><label for="admin-email"><?php _e( 'Admin Email' ) ?></label></th> |
|
243 | + <th scope="row"><label for="admin-email"><?php _e('Admin Email') ?></label></th> |
|
244 | 244 | <td><input name="blog[email]" type="email" class="regular-text wp-suggest-user" id="admin-email" data-autocomplete-type="search" data-autocomplete-field="user_email" /></td> |
245 | 245 | </tr> |
246 | 246 | <tr class="form-field"> |
247 | - <td colspan="2"><?php _e( 'A new user will be created if the above email address is not in the database.' ) ?><br /><?php _e( 'The username and password will be mailed to this email address.' ) ?></td> |
|
247 | + <td colspan="2"><?php _e('A new user will be created if the above email address is not in the database.') ?><br /><?php _e('The username and password will be mailed to this email address.') ?></td> |
|
248 | 248 | </tr> |
249 | 249 | </table> |
250 | 250 | |
@@ -254,11 +254,11 @@ discard block |
||
254 | 254 | * |
255 | 255 | * @since 4.5.0 |
256 | 256 | */ |
257 | - do_action( 'network_site_new_form' ); |
|
257 | + do_action('network_site_new_form'); |
|
258 | 258 | |
259 | - submit_button( __( 'Add Site' ), 'primary', 'add-site' ); |
|
259 | + submit_button(__('Add Site'), 'primary', 'add-site'); |
|
260 | 260 | ?> |
261 | 261 | </form> |
262 | 262 | </div> |
263 | 263 | <?php |
264 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
264 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -13,8 +13,9 @@ discard block |
||
13 | 13 | /** WordPress Translation Install API */ |
14 | 14 | require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
15 | 15 | |
16 | -if ( ! current_user_can( 'manage_sites' ) ) |
|
16 | +if ( ! current_user_can( 'manage_sites' ) ) { |
|
17 | 17 | wp_die( __( 'Sorry, you are not allowed to add sites to this network.' ) ); |
18 | +} |
|
18 | 19 | |
19 | 20 | get_current_screen()->add_help_tab( array( |
20 | 21 | 'id' => 'overview', |
@@ -33,13 +34,15 @@ discard block |
||
33 | 34 | if ( isset($_REQUEST['action']) && 'add-site' == $_REQUEST['action'] ) { |
34 | 35 | check_admin_referer( 'add-blog', '_wpnonce_add-blog' ); |
35 | 36 | |
36 | - if ( ! is_array( $_POST['blog'] ) ) |
|
37 | - wp_die( __( 'Can’t create an empty site.' ) ); |
|
37 | + if ( ! is_array( $_POST['blog'] ) ) { |
|
38 | + wp_die( __( 'Can’t create an empty site.' ) ); |
|
39 | + } |
|
38 | 40 | |
39 | 41 | $blog = $_POST['blog']; |
40 | 42 | $domain = ''; |
41 | - if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) |
|
42 | - $domain = strtolower( $blog['domain'] ); |
|
43 | + if ( preg_match( '|^([a-zA-Z0-9-])+$|', $blog['domain'] ) ) { |
|
44 | + $domain = strtolower( $blog['domain'] ); |
|
45 | + } |
|
43 | 46 | |
44 | 47 | // If not a subdomain install, make sure the domain isn't a reserved word |
45 | 48 | if ( ! is_subdomain_install() ) { |
@@ -73,8 +76,9 @@ discard block |
||
73 | 76 | } |
74 | 77 | } |
75 | 78 | |
76 | - if ( empty( $domain ) ) |
|
77 | - wp_die( __( 'Missing or invalid site address.' ) ); |
|
79 | + if ( empty( $domain ) ) { |
|
80 | + wp_die( __( 'Missing or invalid site address.' ) ); |
|
81 | + } |
|
78 | 82 | |
79 | 83 | if ( isset( $blog['email'] ) && '' === trim( $blog['email'] ) ) { |
80 | 84 | wp_die( __( 'Missing email address.' ) ); |
@@ -166,14 +170,15 @@ discard block |
||
166 | 170 | |
167 | 171 | if ( isset($_GET['update']) ) { |
168 | 172 | $messages = array(); |
169 | - if ( 'added' == $_GET['update'] ) |
|
170 | - $messages[] = sprintf( |
|
173 | + if ( 'added' == $_GET['update'] ) { |
|
174 | + $messages[] = sprintf( |
|
171 | 175 | /* translators: 1: dashboard url, 2: network admin edit url */ |
172 | 176 | __( 'Site added. <a href="%1$s">Visit Dashboard</a> or <a href="%2$s">Edit Site</a>' ), |
173 | 177 | esc_url( get_admin_url( absint( $_GET['id'] ) ) ), |
174 | 178 | network_admin_url( 'site-info.php?id=' . absint( $_GET['id'] ) ) |
175 | 179 | ); |
176 | -} |
|
180 | + } |
|
181 | + } |
|
177 | 182 | |
178 | 183 | $title = __('Add New Site'); |
179 | 184 | $parent_file = 'sites.php'; |
@@ -188,9 +193,10 @@ discard block |
||
188 | 193 | <h1 id="add-new-site"><?php _e( 'Add New Site' ); ?></h1> |
189 | 194 | <?php |
190 | 195 | if ( ! empty( $messages ) ) { |
191 | - foreach ( $messages as $msg ) |
|
192 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
193 | -} ?> |
|
196 | + foreach ( $messages as $msg ) { |
|
197 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
198 | + } |
|
199 | + } ?> |
|
194 | 200 | <form method="post" action="<?php echo network_admin_url( 'site-new.php?action=add-site' ); ?>" novalidate="novalidate"> |
195 | 201 | <?php wp_nonce_field( 'add-blog', '_wpnonce_add-blog' ) ?> |
196 | 202 | <table class="form-table"> |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | wp_defer_comment_counting( true ); |
48 | 48 | |
49 | 49 | foreach ( $comment_ids as $comment_id ) { // Check the permissions on each |
50 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
51 | - continue; |
|
50 | + if ( !current_user_can( 'edit_comment', $comment_id ) ) { |
|
51 | + continue; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | switch ( $doaction ) { |
54 | 55 | case 'approve' : |
@@ -84,22 +85,30 @@ discard block |
||
84 | 85 | |
85 | 86 | wp_defer_comment_counting( false ); |
86 | 87 | |
87 | - if ( $approved ) |
|
88 | - $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
|
89 | - if ( $unapproved ) |
|
90 | - $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
|
91 | - if ( $spammed ) |
|
92 | - $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
|
93 | - if ( $unspammed ) |
|
94 | - $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
|
95 | - if ( $trashed ) |
|
96 | - $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
|
97 | - if ( $untrashed ) |
|
98 | - $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
|
99 | - if ( $deleted ) |
|
100 | - $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
|
101 | - if ( $trashed || $spammed ) |
|
102 | - $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
|
88 | + if ( $approved ) { |
|
89 | + $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
|
90 | + } |
|
91 | + if ( $unapproved ) { |
|
92 | + $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
|
93 | + } |
|
94 | + if ( $spammed ) { |
|
95 | + $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
|
96 | + } |
|
97 | + if ( $unspammed ) { |
|
98 | + $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
|
99 | + } |
|
100 | + if ( $trashed ) { |
|
101 | + $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
|
102 | + } |
|
103 | + if ( $untrashed ) { |
|
104 | + $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
|
105 | + } |
|
106 | + if ( $deleted ) { |
|
107 | + $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
|
108 | + } |
|
109 | + if ( $trashed || $spammed ) { |
|
110 | + $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
|
111 | + } |
|
103 | 112 | |
104 | 113 | wp_safe_redirect( $redirect_to ); |
105 | 114 | exit; |
@@ -213,9 +222,10 @@ discard block |
||
213 | 222 | $error_msg = __( 'You are not allowed to edit comments on this post.' ); |
214 | 223 | break; |
215 | 224 | } |
216 | - if ( $error_msg ) |
|
217 | - echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
|
218 | -} |
|
225 | + if ( $error_msg ) { |
|
226 | + echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
|
227 | + } |
|
228 | + } |
|
219 | 229 | |
220 | 230 | if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) { |
221 | 231 | $approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; |
@@ -7,11 +7,11 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | -if ( ! current_user_can( 'edit_posts' ) ) { |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | +if ( ! current_user_can('edit_posts')) { |
|
12 | 12 | wp_die( |
13 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
14 | - '<p>' . __( 'Sorry, you are not allowed to edit comments.' ) . '</p>', |
|
13 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
14 | + '<p>'.__('Sorry, you are not allowed to edit comments.').'</p>', |
|
15 | 15 | 403 |
16 | 16 | ); |
17 | 17 | } |
@@ -21,68 +21,68 @@ discard block |
||
21 | 21 | |
22 | 22 | $doaction = $wp_list_table->current_action(); |
23 | 23 | |
24 | -if ( $doaction ) { |
|
25 | - check_admin_referer( 'bulk-comments' ); |
|
24 | +if ($doaction) { |
|
25 | + check_admin_referer('bulk-comments'); |
|
26 | 26 | |
27 | - if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) { |
|
28 | - $comment_status = wp_unslash( $_REQUEST['comment_status'] ); |
|
29 | - $delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] ); |
|
30 | - $comment_ids = $wpdb->get_col( $wpdb->prepare( "SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time ) ); |
|
27 | + if ('delete_all' == $doaction && ! empty($_REQUEST['pagegen_timestamp'])) { |
|
28 | + $comment_status = wp_unslash($_REQUEST['comment_status']); |
|
29 | + $delete_time = wp_unslash($_REQUEST['pagegen_timestamp']); |
|
30 | + $comment_ids = $wpdb->get_col($wpdb->prepare("SELECT comment_ID FROM $wpdb->comments WHERE comment_approved = %s AND %s > comment_date_gmt", $comment_status, $delete_time)); |
|
31 | 31 | $doaction = 'delete'; |
32 | - } elseif ( isset( $_REQUEST['delete_comments'] ) ) { |
|
32 | + } elseif (isset($_REQUEST['delete_comments'])) { |
|
33 | 33 | $comment_ids = $_REQUEST['delete_comments']; |
34 | - $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; |
|
35 | - } elseif ( isset( $_REQUEST['ids'] ) ) { |
|
36 | - $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); |
|
37 | - } elseif ( wp_get_referer() ) { |
|
38 | - wp_safe_redirect( wp_get_referer() ); |
|
34 | + $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2']; |
|
35 | + } elseif (isset($_REQUEST['ids'])) { |
|
36 | + $comment_ids = array_map('absint', explode(',', $_REQUEST['ids'])); |
|
37 | + } elseif (wp_get_referer()) { |
|
38 | + wp_safe_redirect(wp_get_referer()); |
|
39 | 39 | exit; |
40 | 40 | } |
41 | 41 | |
42 | 42 | $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; |
43 | 43 | |
44 | - $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); |
|
45 | - $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); |
|
44 | + $redirect_to = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer()); |
|
45 | + $redirect_to = add_query_arg('paged', $pagenum, $redirect_to); |
|
46 | 46 | |
47 | - wp_defer_comment_counting( true ); |
|
47 | + wp_defer_comment_counting(true); |
|
48 | 48 | |
49 | - foreach ( $comment_ids as $comment_id ) { // Check the permissions on each |
|
50 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
49 | + foreach ($comment_ids as $comment_id) { // Check the permissions on each |
|
50 | + if ( ! current_user_can('edit_comment', $comment_id)) |
|
51 | 51 | continue; |
52 | 52 | |
53 | - switch ( $doaction ) { |
|
53 | + switch ($doaction) { |
|
54 | 54 | case 'approve' : |
55 | - wp_set_comment_status( $comment_id, 'approve' ); |
|
55 | + wp_set_comment_status($comment_id, 'approve'); |
|
56 | 56 | $approved++; |
57 | 57 | break; |
58 | 58 | case 'unapprove' : |
59 | - wp_set_comment_status( $comment_id, 'hold' ); |
|
59 | + wp_set_comment_status($comment_id, 'hold'); |
|
60 | 60 | $unapproved++; |
61 | 61 | break; |
62 | 62 | case 'spam' : |
63 | - wp_spam_comment( $comment_id ); |
|
63 | + wp_spam_comment($comment_id); |
|
64 | 64 | $spammed++; |
65 | 65 | break; |
66 | 66 | case 'unspam' : |
67 | - wp_unspam_comment( $comment_id ); |
|
67 | + wp_unspam_comment($comment_id); |
|
68 | 68 | $unspammed++; |
69 | 69 | break; |
70 | 70 | case 'trash' : |
71 | - wp_trash_comment( $comment_id ); |
|
71 | + wp_trash_comment($comment_id); |
|
72 | 72 | $trashed++; |
73 | 73 | break; |
74 | 74 | case 'untrash' : |
75 | - wp_untrash_comment( $comment_id ); |
|
75 | + wp_untrash_comment($comment_id); |
|
76 | 76 | $untrashed++; |
77 | 77 | break; |
78 | 78 | case 'delete' : |
79 | - wp_delete_comment( $comment_id ); |
|
79 | + wp_delete_comment($comment_id); |
|
80 | 80 | $deleted++; |
81 | 81 | break; |
82 | 82 | } |
83 | 83 | } |
84 | 84 | |
85 | - if ( ! in_array( $doaction, array( 'approve', 'unapprove', 'spam', 'unspam', 'trash', 'delete' ), true ) ) { |
|
85 | + if ( ! in_array($doaction, array('approve', 'unapprove', 'spam', 'unspam', 'trash', 'delete'), true)) { |
|
86 | 86 | $screen = get_current_screen()->id; |
87 | 87 | |
88 | 88 | /** |
@@ -99,32 +99,32 @@ discard block |
||
99 | 99 | * @param string $doaction The action being taken. |
100 | 100 | * @param array $items The items to take the action on. |
101 | 101 | */ |
102 | - $redirect_to = apply_filters( "handle_bulk_actions-{$screen}", $redirect_to, $doaction, $comment_ids ); |
|
102 | + $redirect_to = apply_filters("handle_bulk_actions-{$screen}", $redirect_to, $doaction, $comment_ids); |
|
103 | 103 | } |
104 | 104 | |
105 | - wp_defer_comment_counting( false ); |
|
106 | - |
|
107 | - if ( $approved ) |
|
108 | - $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
|
109 | - if ( $unapproved ) |
|
110 | - $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
|
111 | - if ( $spammed ) |
|
112 | - $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
|
113 | - if ( $unspammed ) |
|
114 | - $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
|
115 | - if ( $trashed ) |
|
116 | - $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
|
117 | - if ( $untrashed ) |
|
118 | - $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
|
119 | - if ( $deleted ) |
|
120 | - $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
|
121 | - if ( $trashed || $spammed ) |
|
122 | - $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
|
123 | - |
|
124 | - wp_safe_redirect( $redirect_to ); |
|
105 | + wp_defer_comment_counting(false); |
|
106 | + |
|
107 | + if ($approved) |
|
108 | + $redirect_to = add_query_arg('approved', $approved, $redirect_to); |
|
109 | + if ($unapproved) |
|
110 | + $redirect_to = add_query_arg('unapproved', $unapproved, $redirect_to); |
|
111 | + if ($spammed) |
|
112 | + $redirect_to = add_query_arg('spammed', $spammed, $redirect_to); |
|
113 | + if ($unspammed) |
|
114 | + $redirect_to = add_query_arg('unspammed', $unspammed, $redirect_to); |
|
115 | + if ($trashed) |
|
116 | + $redirect_to = add_query_arg('trashed', $trashed, $redirect_to); |
|
117 | + if ($untrashed) |
|
118 | + $redirect_to = add_query_arg('untrashed', $untrashed, $redirect_to); |
|
119 | + if ($deleted) |
|
120 | + $redirect_to = add_query_arg('deleted', $deleted, $redirect_to); |
|
121 | + if ($trashed || $spammed) |
|
122 | + $redirect_to = add_query_arg('ids', join(',', $comment_ids), $redirect_to); |
|
123 | + |
|
124 | + wp_safe_redirect($redirect_to); |
|
125 | 125 | exit; |
126 | -} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
|
127 | - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
126 | +} elseif ( ! empty($_GET['_wp_http_referer'])) { |
|
127 | + wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']))); |
|
128 | 128 | exit; |
129 | 129 | } |
130 | 130 | |
@@ -133,91 +133,91 @@ discard block |
||
133 | 133 | wp_enqueue_script('admin-comments'); |
134 | 134 | enqueue_comment_hotkeys_js(); |
135 | 135 | |
136 | -if ( $post_id ) { |
|
137 | - $comments_count = wp_count_comments( $post_id ); |
|
138 | - $draft_or_post_title = wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ); |
|
139 | - if ( $comments_count->moderated > 0 ) { |
|
136 | +if ($post_id) { |
|
137 | + $comments_count = wp_count_comments($post_id); |
|
138 | + $draft_or_post_title = wp_html_excerpt(_draft_or_post_title($post_id), 50, '…'); |
|
139 | + if ($comments_count->moderated > 0) { |
|
140 | 140 | /* translators: 1: comments count 2: post title */ |
141 | - $title = sprintf( __( 'Comments (%1$s) on “%2$s”' ), |
|
142 | - number_format_i18n( $comments_count->moderated ), |
|
141 | + $title = sprintf(__('Comments (%1$s) on “%2$s”'), |
|
142 | + number_format_i18n($comments_count->moderated), |
|
143 | 143 | $draft_or_post_title |
144 | 144 | ); |
145 | 145 | } else { |
146 | 146 | /* translators: %s: post title */ |
147 | - $title = sprintf( __( 'Comments on “%s”' ), |
|
147 | + $title = sprintf(__('Comments on “%s”'), |
|
148 | 148 | $draft_or_post_title |
149 | 149 | ); |
150 | 150 | } |
151 | 151 | } else { |
152 | 152 | $comments_count = wp_count_comments(); |
153 | - if ( $comments_count->moderated > 0 ) { |
|
153 | + if ($comments_count->moderated > 0) { |
|
154 | 154 | /* translators: %s: comments count */ |
155 | - $title = sprintf( __( 'Comments (%s)' ), |
|
156 | - number_format_i18n( $comments_count->moderated ) |
|
155 | + $title = sprintf(__('Comments (%s)'), |
|
156 | + number_format_i18n($comments_count->moderated) |
|
157 | 157 | ); |
158 | 158 | } else { |
159 | - $title = __( 'Comments' ); |
|
159 | + $title = __('Comments'); |
|
160 | 160 | } |
161 | 161 | } |
162 | 162 | |
163 | -add_screen_option( 'per_page' ); |
|
163 | +add_screen_option('per_page'); |
|
164 | 164 | |
165 | -get_current_screen()->add_help_tab( array( |
|
165 | +get_current_screen()->add_help_tab(array( |
|
166 | 166 | 'id' => 'overview', |
167 | 167 | 'title' => __('Overview'), |
168 | 168 | 'content' => |
169 | - '<p>' . __( 'You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.' ) . '</p>' |
|
170 | -) ); |
|
171 | -get_current_screen()->add_help_tab( array( |
|
169 | + '<p>'.__('You can manage comments made on your site similar to the way you manage posts and other content. This screen is customizable in the same ways as other management screens, and you can act on comments using the on-hover action links or the Bulk Actions.').'</p>' |
|
170 | +)); |
|
171 | +get_current_screen()->add_help_tab(array( |
|
172 | 172 | 'id' => 'moderating-comments', |
173 | 173 | 'title' => __('Moderating Comments'), |
174 | 174 | 'content' => |
175 | - '<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' . |
|
176 | - '<p>' . __( 'In the <strong>Author</strong> column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.' ) . '</p>' . |
|
177 | - '<p>' . __( 'In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' . |
|
178 | - '<p>' . __( 'In the <strong>In Response To</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.' ) . '</p>' . |
|
179 | - '<p>' . __( 'In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.' ) . '</p>' . |
|
180 | - '<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>' |
|
181 | -) ); |
|
175 | + '<p>'.__('A red bar on the left means the comment is waiting for you to moderate it.').'</p>'. |
|
176 | + '<p>'.__('In the <strong>Author</strong> column, in addition to the author’s name, email address, and blog URL, the commenter’s IP address is shown. Clicking on this link will show you all the comments made from this IP address.').'</p>'. |
|
177 | + '<p>'.__('In the <strong>Comment</strong> column, hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.').'</p>'. |
|
178 | + '<p>'.__('In the <strong>In Response To</strong> column, there are three elements. The text is the name of the post that inspired the comment, and links to the post editor for that entry. The View Post link leads to that post on your live site. The small bubble with the number in it shows the number of approved comments that post has received. If there are pending comments, a red notification circle with the number of pending comments is displayed. Clicking the notification circle will filter the comments screen to show only pending comments on that post.').'</p>'. |
|
179 | + '<p>'.__('In the <strong>Submitted On</strong> column, the date and time the comment was left on your site appears. Clicking on the date/time link will take you to that comment on your live site.').'</p>'. |
|
180 | + '<p>'.__('Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.').'</p>' |
|
181 | +)); |
|
182 | 182 | |
183 | 183 | get_current_screen()->set_help_sidebar( |
184 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
185 | - '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>' ) . '</p>' . |
|
186 | - '<p>' . __( '<a href="https://codex.wordpress.org/Comment_Spam">Documentation on Comment Spam</a>' ) . '</p>' . |
|
187 | - '<p>' . __( '<a href="https://codex.wordpress.org/Keyboard_Shortcuts">Documentation on Keyboard Shortcuts</a>' ) . '</p>' . |
|
188 | - '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
|
184 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
185 | + '<p>'.__('<a href="https://codex.wordpress.org/Administration_Screens#Comments">Documentation on Comments</a>').'</p>'. |
|
186 | + '<p>'.__('<a href="https://codex.wordpress.org/Comment_Spam">Documentation on Comment Spam</a>').'</p>'. |
|
187 | + '<p>'.__('<a href="https://codex.wordpress.org/Keyboard_Shortcuts">Documentation on Keyboard Shortcuts</a>').'</p>'. |
|
188 | + '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>' |
|
189 | 189 | ); |
190 | 190 | |
191 | -get_current_screen()->set_screen_reader_content( array( |
|
192 | - 'heading_views' => __( 'Filter comments list' ), |
|
193 | - 'heading_pagination' => __( 'Comments list navigation' ), |
|
194 | - 'heading_list' => __( 'Comments list' ), |
|
195 | -) ); |
|
191 | +get_current_screen()->set_screen_reader_content(array( |
|
192 | + 'heading_views' => __('Filter comments list'), |
|
193 | + 'heading_pagination' => __('Comments list navigation'), |
|
194 | + 'heading_list' => __('Comments list'), |
|
195 | +)); |
|
196 | 196 | |
197 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
197 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
198 | 198 | ?> |
199 | 199 | |
200 | 200 | <div class="wrap"> |
201 | 201 | <h1 class="wp-heading-inline"><?php |
202 | -if ( $post_id ) { |
|
202 | +if ($post_id) { |
|
203 | 203 | /* translators: %s: link to post */ |
204 | - printf( __( 'Comments on “%s”' ), |
|
205 | - sprintf( '<a href="%1$s">%2$s</a>', |
|
206 | - get_edit_post_link( $post_id ), |
|
207 | - wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) |
|
204 | + printf(__('Comments on “%s”'), |
|
205 | + sprintf('<a href="%1$s">%2$s</a>', |
|
206 | + get_edit_post_link($post_id), |
|
207 | + wp_html_excerpt(_draft_or_post_title($post_id), 50, '…') |
|
208 | 208 | ) |
209 | 209 | ); |
210 | 210 | } else { |
211 | - _e( 'Comments' ); |
|
211 | + _e('Comments'); |
|
212 | 212 | } |
213 | 213 | ?></h1> |
214 | 214 | |
215 | 215 | <?php |
216 | -if ( isset($_REQUEST['s']) && strlen( $_REQUEST['s'] ) ) { |
|
216 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
217 | 217 | echo '<span class="subtitle">'; |
218 | 218 | /* translators: %s: search keywords */ |
219 | - printf( __( 'Search results for “%s”' ), |
|
220 | - wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '…' ) |
|
219 | + printf(__('Search results for “%s”'), |
|
220 | + wp_html_excerpt(esc_html(wp_unslash($_REQUEST['s'])), 50, '…') |
|
221 | 221 | ); |
222 | 222 | echo '</span>'; |
223 | 223 | } |
@@ -226,78 +226,78 @@ discard block |
||
226 | 226 | <hr class="wp-header-end"> |
227 | 227 | |
228 | 228 | <?php |
229 | -if ( isset( $_REQUEST['error'] ) ) { |
|
229 | +if (isset($_REQUEST['error'])) { |
|
230 | 230 | $error = (int) $_REQUEST['error']; |
231 | 231 | $error_msg = ''; |
232 | - switch ( $error ) { |
|
232 | + switch ($error) { |
|
233 | 233 | case 1 : |
234 | - $error_msg = __( 'Invalid comment ID.' ); |
|
234 | + $error_msg = __('Invalid comment ID.'); |
|
235 | 235 | break; |
236 | 236 | case 2 : |
237 | - $error_msg = __( 'Sorry, you are not allowed to edit comments on this post.' ); |
|
237 | + $error_msg = __('Sorry, you are not allowed to edit comments on this post.'); |
|
238 | 238 | break; |
239 | 239 | } |
240 | - if ( $error_msg ) |
|
241 | - echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
|
240 | + if ($error_msg) |
|
241 | + echo '<div id="moderated" class="error"><p>'.$error_msg.'</p></div>'; |
|
242 | 242 | } |
243 | 243 | |
244 | -if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) { |
|
245 | - $approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; |
|
246 | - $deleted = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0; |
|
247 | - $trashed = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0; |
|
248 | - $untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0; |
|
249 | - $spammed = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0; |
|
250 | - $unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0; |
|
251 | - $same = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0; |
|
252 | - |
|
253 | - if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { |
|
254 | - if ( $approved > 0 ) { |
|
244 | +if (isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same'])) { |
|
245 | + $approved = isset($_REQUEST['approved']) ? (int) $_REQUEST['approved'] : 0; |
|
246 | + $deleted = isset($_REQUEST['deleted']) ? (int) $_REQUEST['deleted'] : 0; |
|
247 | + $trashed = isset($_REQUEST['trashed']) ? (int) $_REQUEST['trashed'] : 0; |
|
248 | + $untrashed = isset($_REQUEST['untrashed']) ? (int) $_REQUEST['untrashed'] : 0; |
|
249 | + $spammed = isset($_REQUEST['spammed']) ? (int) $_REQUEST['spammed'] : 0; |
|
250 | + $unspammed = isset($_REQUEST['unspammed']) ? (int) $_REQUEST['unspammed'] : 0; |
|
251 | + $same = isset($_REQUEST['same']) ? (int) $_REQUEST['same'] : 0; |
|
252 | + |
|
253 | + if ($approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0) { |
|
254 | + if ($approved > 0) { |
|
255 | 255 | /* translators: %s: number of comments approved */ |
256 | - $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); |
|
256 | + $messages[] = sprintf(_n('%s comment approved', '%s comments approved', $approved), $approved); |
|
257 | 257 | } |
258 | 258 | |
259 | - if ( $spammed > 0 ) { |
|
259 | + if ($spammed > 0) { |
|
260 | 260 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
261 | 261 | /* translators: %s: number of comments marked as spam */ |
262 | - $messages[] = sprintf( _n( '%s comment marked as spam.', '%s comments marked as spam.', $spammed ), $spammed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; |
|
262 | + $messages[] = sprintf(_n('%s comment marked as spam.', '%s comments marked as spam.', $spammed), $spammed).' <a href="'.esc_url(wp_nonce_url("edit-comments.php?doaction=undo&action=unspam&ids=$ids", "bulk-comments")).'">'.__('Undo').'</a><br />'; |
|
263 | 263 | } |
264 | 264 | |
265 | - if ( $unspammed > 0 ) { |
|
265 | + if ($unspammed > 0) { |
|
266 | 266 | /* translators: %s: number of comments restored from the spam */ |
267 | - $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); |
|
267 | + $messages[] = sprintf(_n('%s comment restored from the spam', '%s comments restored from the spam', $unspammed), $unspammed); |
|
268 | 268 | } |
269 | 269 | |
270 | - if ( $trashed > 0 ) { |
|
270 | + if ($trashed > 0) { |
|
271 | 271 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
272 | 272 | /* translators: %s: number of comments moved to the Trash */ |
273 | - $messages[] = sprintf( _n( '%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed ), $trashed ) . ' <a href="' . esc_url( wp_nonce_url( "edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments" ) ) . '">' . __('Undo') . '</a><br />'; |
|
273 | + $messages[] = sprintf(_n('%s comment moved to the Trash.', '%s comments moved to the Trash.', $trashed), $trashed).' <a href="'.esc_url(wp_nonce_url("edit-comments.php?doaction=undo&action=untrash&ids=$ids", "bulk-comments")).'">'.__('Undo').'</a><br />'; |
|
274 | 274 | } |
275 | 275 | |
276 | - if ( $untrashed > 0 ) { |
|
276 | + if ($untrashed > 0) { |
|
277 | 277 | /* translators: %s: number of comments restored from the Trash */ |
278 | - $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); |
|
278 | + $messages[] = sprintf(_n('%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed), $untrashed); |
|
279 | 279 | } |
280 | 280 | |
281 | - if ( $deleted > 0 ) { |
|
281 | + if ($deleted > 0) { |
|
282 | 282 | /* translators: %s: number of comments permanently deleted */ |
283 | - $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); |
|
283 | + $messages[] = sprintf(_n('%s comment permanently deleted', '%s comments permanently deleted', $deleted), $deleted); |
|
284 | 284 | } |
285 | 285 | |
286 | - if ( $same > 0 && $comment = get_comment( $same ) ) { |
|
287 | - switch ( $comment->comment_approved ) { |
|
286 | + if ($same > 0 && $comment = get_comment($same)) { |
|
287 | + switch ($comment->comment_approved) { |
|
288 | 288 | case '1' : |
289 | - $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
|
289 | + $messages[] = __('This comment is already approved.').' <a href="'.esc_url(admin_url("comment.php?action=editcomment&c=$same")).'">'.__('Edit comment').'</a>'; |
|
290 | 290 | break; |
291 | 291 | case 'trash' : |
292 | - $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>'; |
|
292 | + $messages[] = __('This comment is already in the Trash.').' <a href="'.esc_url(admin_url('edit-comments.php?comment_status=trash')).'"> '.__('View Trash').'</a>'; |
|
293 | 293 | break; |
294 | 294 | case 'spam' : |
295 | - $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
|
295 | + $messages[] = __('This comment is already marked as spam.').' <a href="'.esc_url(admin_url("comment.php?action=editcomment&c=$same")).'">'.__('Edit comment').'</a>'; |
|
296 | 296 | break; |
297 | 297 | } |
298 | 298 | } |
299 | 299 | |
300 | - echo '<div id="moderated" class="updated notice is-dismissible"><p>' . implode( "<br/>\n", $messages ) . '</p></div>'; |
|
300 | + echo '<div id="moderated" class="updated notice is-dismissible"><p>'.implode("<br/>\n", $messages).'</p></div>'; |
|
301 | 301 | } |
302 | 302 | } |
303 | 303 | ?> |
@@ -306,20 +306,20 @@ discard block |
||
306 | 306 | |
307 | 307 | <form id="comments-form" method="get"> |
308 | 308 | |
309 | -<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> |
|
309 | +<?php $wp_list_table->search_box(__('Search Comments'), 'comment'); ?> |
|
310 | 310 | |
311 | -<?php if ( $post_id ) : ?> |
|
312 | -<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" /> |
|
311 | +<?php if ($post_id) : ?> |
|
312 | +<input type="hidden" name="p" value="<?php echo esc_attr(intval($post_id)); ?>" /> |
|
313 | 313 | <?php endif; ?> |
314 | 314 | <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" /> |
315 | 315 | <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" /> |
316 | 316 | |
317 | -<input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" /> |
|
318 | -<input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" /> |
|
319 | -<input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" /> |
|
317 | +<input type="hidden" name="_total" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('total_items')); ?>" /> |
|
318 | +<input type="hidden" name="_per_page" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('per_page')); ?>" /> |
|
319 | +<input type="hidden" name="_page" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('page')); ?>" /> |
|
320 | 320 | |
321 | -<?php if ( isset($_REQUEST['paged']) ) { ?> |
|
322 | - <input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" /> |
|
321 | +<?php if (isset($_REQUEST['paged'])) { ?> |
|
322 | + <input type="hidden" name="paged" value="<?php echo esc_attr(absint($_REQUEST['paged'])); ?>" /> |
|
323 | 323 | <?php } ?> |
324 | 324 | |
325 | 325 | <?php $wp_list_table->display(); ?> |
@@ -331,4 +331,4 @@ discard block |
||
331 | 331 | <?php |
332 | 332 | wp_comment_reply('-1', true, 'detail'); |
333 | 333 | wp_comment_trashnotice(); |
334 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
334 | +include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -97,10 +97,11 @@ |
||
97 | 97 | if ( ! network_domain_check() ) { |
98 | 98 | $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install ); |
99 | 99 | if ( is_wp_error( $result ) ) { |
100 | - if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) |
|
101 | - network_step2( $result ); |
|
102 | - else |
|
103 | - network_step1( $result ); |
|
100 | + if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) { |
|
101 | + network_step2( $result ); |
|
102 | + } else { |
|
103 | + network_step1( $result ); |
|
104 | + } |
|
104 | 105 | } else { |
105 | 106 | network_step2(); |
106 | 107 | } |
@@ -10,104 +10,104 @@ discard block |
||
10 | 10 | * @subpackage Administration |
11 | 11 | */ |
12 | 12 | |
13 | -define( 'WP_INSTALLING_NETWORK', true ); |
|
13 | +define('WP_INSTALLING_NETWORK', true); |
|
14 | 14 | |
15 | 15 | /** WordPress Administration Bootstrap */ |
16 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
16 | +require_once(dirname(__FILE__).'/admin.php'); |
|
17 | 17 | |
18 | -if ( ! is_super_admin() ) { |
|
19 | - wp_die( __( 'Sorry, you are not allowed to manage options for this site.' ) ); |
|
18 | +if ( ! is_super_admin()) { |
|
19 | + wp_die(__('Sorry, you are not allowed to manage options for this site.')); |
|
20 | 20 | } |
21 | 21 | |
22 | -if ( is_multisite() ) { |
|
23 | - if ( ! is_network_admin() ) { |
|
24 | - wp_redirect( network_admin_url( 'setup.php' ) ); |
|
22 | +if (is_multisite()) { |
|
23 | + if ( ! is_network_admin()) { |
|
24 | + wp_redirect(network_admin_url('setup.php')); |
|
25 | 25 | exit; |
26 | 26 | } |
27 | 27 | |
28 | - if ( ! defined( 'MULTISITE' ) ) { |
|
29 | - wp_die( __( 'The Network creation panel is not for WordPress MU networks.' ) ); |
|
28 | + if ( ! defined('MULTISITE')) { |
|
29 | + wp_die(__('The Network creation panel is not for WordPress MU networks.')); |
|
30 | 30 | } |
31 | 31 | } |
32 | 32 | |
33 | -require_once( dirname( __FILE__ ) . '/includes/network.php' ); |
|
33 | +require_once(dirname(__FILE__).'/includes/network.php'); |
|
34 | 34 | |
35 | 35 | // We need to create references to ms global tables to enable Network. |
36 | -foreach ( $wpdb->tables( 'ms_global' ) as $table => $prefixed_table ) { |
|
36 | +foreach ($wpdb->tables('ms_global') as $table => $prefixed_table) { |
|
37 | 37 | $wpdb->$table = $prefixed_table; |
38 | 38 | } |
39 | 39 | |
40 | -if ( ! network_domain_check() && ( ! defined( 'WP_ALLOW_MULTISITE' ) || ! WP_ALLOW_MULTISITE ) ) { |
|
40 | +if ( ! network_domain_check() && ( ! defined('WP_ALLOW_MULTISITE') || ! WP_ALLOW_MULTISITE)) { |
|
41 | 41 | wp_die( |
42 | 42 | printf( |
43 | 43 | /* translators: 1: WP_ALLOW_MULTISITE 2: wp-config.php */ |
44 | - __( 'You must define the %1$s constant as true in your %2$s file to allow creation of a Network.' ), |
|
44 | + __('You must define the %1$s constant as true in your %2$s file to allow creation of a Network.'), |
|
45 | 45 | '<code>WP_ALLOW_MULTISITE</code>', |
46 | 46 | '<code>wp-config.php</code>' |
47 | 47 | ) |
48 | 48 | ); |
49 | 49 | } |
50 | 50 | |
51 | -if ( is_network_admin() ) { |
|
52 | - $title = __( 'Network Setup' ); |
|
51 | +if (is_network_admin()) { |
|
52 | + $title = __('Network Setup'); |
|
53 | 53 | $parent_file = 'settings.php'; |
54 | 54 | } else { |
55 | - $title = __( 'Create a Network of WordPress Sites' ); |
|
55 | + $title = __('Create a Network of WordPress Sites'); |
|
56 | 56 | $parent_file = 'tools.php'; |
57 | 57 | } |
58 | 58 | |
59 | -$network_help = '<p>' . __('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.') . '</p>' . |
|
60 | - '<p>' . __('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).') . '</p>' . |
|
61 | - '<p>' . __('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.') . '</p>' . |
|
62 | - '<p>' . __('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).') . '</p>' . |
|
63 | - '<p>' . __('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.') . '</p>' . |
|
64 | - '<p>' . __('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed in a future version.') . '</p>' . |
|
65 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
66 | - '<p>' . __( '<a href="https://codex.wordpress.org/Create_A_Network">Documentation on Creating a Network</a>' ) . '</p>' . |
|
67 | - '<p>' . __( '<a href="https://codex.wordpress.org/Tools_Network_Screen">Documentation on the Network Screen</a>' ) . '</p>'; |
|
68 | - |
|
69 | -get_current_screen()->add_help_tab( array( |
|
59 | +$network_help = '<p>'.__('This screen allows you to configure a network as having subdomains (<code>site1.example.com</code>) or subdirectories (<code>example.com/site1</code>). Subdomains require wildcard subdomains to be enabled in Apache and DNS records, if your host allows it.').'</p>'. |
|
60 | + '<p>'.__('Choose subdomains or subdirectories; this can only be switched afterwards by reconfiguring your install. Fill out the network details, and click install. If this does not work, you may have to add a wildcard DNS record (for subdomains) or change to another setting in Permalinks (for subdirectories).').'</p>'. |
|
61 | + '<p>'.__('The next screen for Network Setup will give you individually-generated lines of code to add to your wp-config.php and .htaccess files. Make sure the settings of your FTP client make files starting with a dot visible, so that you can find .htaccess; you may have to create this file if it really is not there. Make backup copies of those two files.').'</p>'. |
|
62 | + '<p>'.__('Add the designated lines of code to wp-config.php (just before <code>/*...stop editing...*/</code>) and <code>.htaccess</code> (replacing the existing WordPress rules).').'</p>'. |
|
63 | + '<p>'.__('Once you add this code and refresh your browser, multisite should be enabled. This screen, now in the Network Admin navigation menu, will keep an archive of the added code. You can toggle between Network Admin and Site Admin by clicking on the Network Admin or an individual site name under the My Sites dropdown in the Toolbar.').'</p>'. |
|
64 | + '<p>'.__('The choice of subdirectory sites is disabled if this setup is more than a month old because of permalink problems with “/blog/” from the main site. This disabling will be addressed in a future version.').'</p>'. |
|
65 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
66 | + '<p>'.__('<a href="https://codex.wordpress.org/Create_A_Network">Documentation on Creating a Network</a>').'</p>'. |
|
67 | + '<p>'.__('<a href="https://codex.wordpress.org/Tools_Network_Screen">Documentation on the Network Screen</a>').'</p>'; |
|
68 | + |
|
69 | +get_current_screen()->add_help_tab(array( |
|
70 | 70 | 'id' => 'network', |
71 | 71 | 'title' => __('Network'), |
72 | 72 | 'content' => $network_help, |
73 | -) ); |
|
73 | +)); |
|
74 | 74 | |
75 | 75 | get_current_screen()->set_help_sidebar( |
76 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
77 | - '<p>' . __( '<a href="https://codex.wordpress.org/Create_A_Network">Documentation on Creating a Network</a>' ) . '</p>' . |
|
78 | - '<p>' . __( '<a href="https://codex.wordpress.org/Tools_Network_Screen">Documentation on the Network Screen</a>' ) . '</p>' . |
|
79 | - '<p>' . __( '<a href="https://wordpress.org/support/">Support Forums</a>' ) . '</p>' |
|
76 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
77 | + '<p>'.__('<a href="https://codex.wordpress.org/Create_A_Network">Documentation on Creating a Network</a>').'</p>'. |
|
78 | + '<p>'.__('<a href="https://codex.wordpress.org/Tools_Network_Screen">Documentation on the Network Screen</a>').'</p>'. |
|
79 | + '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>' |
|
80 | 80 | ); |
81 | 81 | |
82 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
82 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
83 | 83 | ?> |
84 | 84 | <div class="wrap"> |
85 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
85 | +<h1><?php echo esc_html($title); ?></h1> |
|
86 | 86 | |
87 | 87 | <?php |
88 | -if ( $_POST ) { |
|
88 | +if ($_POST) { |
|
89 | 89 | |
90 | - check_admin_referer( 'install-network-1' ); |
|
90 | + check_admin_referer('install-network-1'); |
|
91 | 91 | |
92 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
92 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
93 | 93 | // Create network tables. |
94 | 94 | install_network(); |
95 | - $base = parse_url( trailingslashit( get_option( 'home' ) ), PHP_URL_PATH ); |
|
96 | - $subdomain_install = allow_subdomain_install() ? !empty( $_POST['subdomain_install'] ) : false; |
|
97 | - if ( ! network_domain_check() ) { |
|
98 | - $result = populate_network( 1, get_clean_basedomain(), sanitize_email( $_POST['email'] ), wp_unslash( $_POST['sitename'] ), $base, $subdomain_install ); |
|
99 | - if ( is_wp_error( $result ) ) { |
|
100 | - if ( 1 == count( $result->get_error_codes() ) && 'no_wildcard_dns' == $result->get_error_code() ) |
|
101 | - network_step2( $result ); |
|
95 | + $base = parse_url(trailingslashit(get_option('home')), PHP_URL_PATH); |
|
96 | + $subdomain_install = allow_subdomain_install() ? ! empty($_POST['subdomain_install']) : false; |
|
97 | + if ( ! network_domain_check()) { |
|
98 | + $result = populate_network(1, get_clean_basedomain(), sanitize_email($_POST['email']), wp_unslash($_POST['sitename']), $base, $subdomain_install); |
|
99 | + if (is_wp_error($result)) { |
|
100 | + if (1 == count($result->get_error_codes()) && 'no_wildcard_dns' == $result->get_error_code()) |
|
101 | + network_step2($result); |
|
102 | 102 | else |
103 | - network_step1( $result ); |
|
103 | + network_step1($result); |
|
104 | 104 | } else { |
105 | 105 | network_step2(); |
106 | 106 | } |
107 | 107 | } else { |
108 | 108 | network_step2(); |
109 | 109 | } |
110 | -} elseif ( is_multisite() || network_domain_check() ) { |
|
110 | +} elseif (is_multisite() || network_domain_check()) { |
|
111 | 111 | network_step2(); |
112 | 112 | } else { |
113 | 113 | network_step1(); |
@@ -115,4 +115,4 @@ discard block |
||
115 | 115 | ?> |
116 | 116 | </div> |
117 | 117 | |
118 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
118 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -119,7 +119,10 @@ |
||
119 | 119 | <table class="form-table"> |
120 | 120 | <tr class="form-field form-required term-name-wrap"> |
121 | 121 | <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
122 | - <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
122 | + <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) { |
|
123 | + echo esc_attr($tag->name); |
|
124 | +} |
|
125 | +?>" size="40" aria-required="true" /> |
|
123 | 126 | <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> |
124 | 127 | </tr> |
125 | 128 | <?php if ( !global_terms_enabled() ) { ?> |
@@ -14,7 +14,7 @@ |
||
14 | 14 | // Back compat hooks |
15 | 15 | if ( 'category' == $taxonomy ) { |
16 | 16 | /** |
17 | - * Fires before the Edit Category form. |
|
17 | + * Fires before the Edit Category form. |
|
18 | 18 | * |
19 | 19 | * @since 2.1.0 |
20 | 20 | * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | - die( '-1' ); |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | + die('-1'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Back compat hooks |
15 | -if ( 'category' == $taxonomy ) { |
|
15 | +if ('category' == $taxonomy) { |
|
16 | 16 | /** |
17 | 17 | * Fires before the Edit Category form. |
18 | 18 | * |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param object $tag Current category term object. |
23 | 23 | */ |
24 | - do_action( 'edit_category_form_pre', $tag ); |
|
25 | -} elseif ( 'link_category' == $taxonomy ) { |
|
24 | + do_action('edit_category_form_pre', $tag); |
|
25 | +} elseif ('link_category' == $taxonomy) { |
|
26 | 26 | /** |
27 | 27 | * Fires before the Edit Link Category form. |
28 | 28 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param object $tag Current link category term object. |
33 | 33 | */ |
34 | - do_action( 'edit_link_category_form_pre', $tag ); |
|
34 | + do_action('edit_link_category_form_pre', $tag); |
|
35 | 35 | } else { |
36 | 36 | /** |
37 | 37 | * Fires before the Edit Tag form. |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param object $tag Current tag term object. |
43 | 43 | */ |
44 | - do_action( 'edit_tag_form_pre', $tag ); |
|
44 | + do_action('edit_tag_form_pre', $tag); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Use with caution, see https://codex.wordpress.org/Function_Reference/wp_reset_vars |
49 | 49 | */ |
50 | -wp_reset_vars( array( 'wp_http_referer' ) ); |
|
50 | +wp_reset_vars(array('wp_http_referer')); |
|
51 | 51 | |
52 | -$wp_http_referer = remove_query_arg( array( 'action', 'message', 'tag_ID' ), $wp_http_referer ); |
|
52 | +$wp_http_referer = remove_query_arg(array('action', 'message', 'tag_ID'), $wp_http_referer); |
|
53 | 53 | |
54 | 54 | /** Also used by Edit Tags */ |
55 | -require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); |
|
55 | +require_once(ABSPATH.'wp-admin/includes/edit-tag-messages.php'); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Fires before the Edit Term form for all taxonomies. |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | * @param object $tag Current taxonomy term object. |
66 | 66 | * @param string $taxonomy Current $taxonomy slug. |
67 | 67 | */ |
68 | -do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> |
|
68 | +do_action("{$taxonomy}_pre_edit_form", $tag, $taxonomy); ?> |
|
69 | 69 | |
70 | 70 | <div class="wrap"> |
71 | 71 | <h1><?php echo $tax->labels->edit_item; ?></h1> |
72 | 72 | |
73 | -<?php if ( $message ) : ?> |
|
73 | +<?php if ($message) : ?> |
|
74 | 74 | <div id="message" class="updated"> |
75 | 75 | <p><strong><?php echo $message; ?></strong></p> |
76 | - <?php if ( $wp_http_referer ) { ?> |
|
77 | - <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php |
|
76 | + <?php if ($wp_http_referer) { ?> |
|
77 | + <p><a href="<?php echo esc_url($wp_http_referer); ?>"><?php |
|
78 | 78 | /* translators: %s: taxonomy name */ |
79 | - printf( _x( '← Back to %s', 'admin screen' ), $tax->labels->name ); |
|
79 | + printf(_x('← Back to %s', 'admin screen'), $tax->labels->name); |
|
80 | 80 | ?></a></p> |
81 | 81 | <?php } ?> |
82 | 82 | </div> |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 3.7.0 |
94 | 94 | */ |
95 | -do_action( "{$taxonomy}_term_edit_form_tag" ); |
|
95 | +do_action("{$taxonomy}_term_edit_form_tag"); |
|
96 | 96 | ?>> |
97 | 97 | <input type="hidden" name="action" value="editedtag"/> |
98 | -<input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ) ?>"/> |
|
99 | -<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ) ?>"/> |
|
98 | +<input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag_ID) ?>"/> |
|
99 | +<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>"/> |
|
100 | 100 | <?php |
101 | -wp_original_referer_field( true, 'previous' ); |
|
102 | -wp_nonce_field( 'update-tag_' . $tag_ID ); |
|
101 | +wp_original_referer_field(true, 'previous'); |
|
102 | +wp_nonce_field('update-tag_'.$tag_ID); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Fires at the beginning of the Edit Term form. |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | * @param object $tag Current taxonomy term object. |
114 | 114 | * @param string $taxonomy Current $taxonomy slug. |
115 | 115 | */ |
116 | -do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy ); |
|
116 | +do_action("{$taxonomy}_term_edit_form_top", $tag, $taxonomy); |
|
117 | 117 | ?> |
118 | 118 | <table class="form-table"> |
119 | 119 | <tr class="form-field form-required term-name-wrap"> |
120 | - <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
|
121 | - <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
120 | + <th scope="row"><label for="name"><?php _ex('Name', 'term name'); ?></label></th> |
|
121 | + <td><input name="name" id="name" type="text" value="<?php if (isset($tag->name)) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
122 | 122 | <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> |
123 | 123 | </tr> |
124 | -<?php if ( !global_terms_enabled() ) { ?> |
|
124 | +<?php if ( ! global_terms_enabled()) { ?> |
|
125 | 125 | <tr class="form-field term-slug-wrap"> |
126 | - <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th> |
|
126 | + <th scope="row"><label for="slug"><?php _e('Slug'); ?></label></th> |
|
127 | 127 | <?php |
128 | 128 | /** |
129 | 129 | * Filters the editable slug. |
@@ -138,15 +138,15 @@ discard block |
||
138 | 138 | * upon the context in which it is evaluated. |
139 | 139 | * @param object|WP_Post $tag Term or WP_Post object. |
140 | 140 | */ |
141 | - $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : ''; |
|
141 | + $slug = isset($tag->slug) ? apply_filters('editable_slug', $tag->slug, $tag) : ''; |
|
142 | 142 | ?> |
143 | - <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> |
|
143 | + <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr($slug); ?>" size="40" /> |
|
144 | 144 | <p class="description"><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td> |
145 | 145 | </tr> |
146 | 146 | <?php } ?> |
147 | -<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
|
147 | +<?php if (is_taxonomy_hierarchical($taxonomy)) : ?> |
|
148 | 148 | <tr class="form-field term-parent-wrap"> |
149 | - <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th> |
|
149 | + <th scope="row"><label for="parent"><?php _ex('Parent', 'term parent'); ?></label></th> |
|
150 | 150 | <td> |
151 | 151 | <?php |
152 | 152 | $dropdown_args = array( |
@@ -158,26 +158,26 @@ discard block |
||
158 | 158 | 'selected' => $tag->parent, |
159 | 159 | 'exclude_tree' => $tag->term_id, |
160 | 160 | 'hierarchical' => true, |
161 | - 'show_option_none' => __( 'None' ), |
|
161 | + 'show_option_none' => __('None'), |
|
162 | 162 | ); |
163 | 163 | |
164 | 164 | /** This filter is documented in wp-admin/edit-tags.php */ |
165 | - $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); |
|
166 | - wp_dropdown_categories( $dropdown_args ); ?> |
|
167 | - <?php if ( 'category' == $taxonomy ) : ?> |
|
165 | + $dropdown_args = apply_filters('taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit'); |
|
166 | + wp_dropdown_categories($dropdown_args); ?> |
|
167 | + <?php if ('category' == $taxonomy) : ?> |
|
168 | 168 | <p class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p> |
169 | 169 | <?php endif; ?> |
170 | 170 | </td> |
171 | 171 | </tr> |
172 | 172 | <?php endif; // is_taxonomy_hierarchical() ?> |
173 | 173 | <tr class="form-field term-description-wrap"> |
174 | - <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> |
|
174 | + <th scope="row"><label for="description"><?php _e('Description'); ?></label></th> |
|
175 | 175 | <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea> |
176 | 176 | <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td> |
177 | 177 | </tr> |
178 | 178 | <?php |
179 | 179 | // Back compat hooks |
180 | - if ( 'category' == $taxonomy ) { |
|
180 | + if ('category' == $taxonomy) { |
|
181 | 181 | /** |
182 | 182 | * Fires after the Edit Category form fields are displayed. |
183 | 183 | * |
@@ -186,8 +186,8 @@ discard block |
||
186 | 186 | * |
187 | 187 | * @param object $tag Current category term object. |
188 | 188 | */ |
189 | - do_action( 'edit_category_form_fields', $tag ); |
|
190 | - } elseif ( 'link_category' == $taxonomy ) { |
|
189 | + do_action('edit_category_form_fields', $tag); |
|
190 | + } elseif ('link_category' == $taxonomy) { |
|
191 | 191 | /** |
192 | 192 | * Fires after the Edit Link Category form fields are displayed. |
193 | 193 | * |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * |
197 | 197 | * @param object $tag Current link category term object. |
198 | 198 | */ |
199 | - do_action( 'edit_link_category_form_fields', $tag ); |
|
199 | + do_action('edit_link_category_form_fields', $tag); |
|
200 | 200 | } else { |
201 | 201 | /** |
202 | 202 | * Fires after the Edit Tag form fields are displayed. |
@@ -206,7 +206,7 @@ discard block |
||
206 | 206 | * |
207 | 207 | * @param object $tag Current tag term object. |
208 | 208 | */ |
209 | - do_action( 'edit_tag_form_fields', $tag ); |
|
209 | + do_action('edit_tag_form_fields', $tag); |
|
210 | 210 | } |
211 | 211 | /** |
212 | 212 | * Fires after the Edit Term form fields are displayed. |
@@ -219,17 +219,17 @@ discard block |
||
219 | 219 | * @param object $tag Current taxonomy term object. |
220 | 220 | * @param string $taxonomy Current taxonomy slug. |
221 | 221 | */ |
222 | - do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy ); |
|
222 | + do_action("{$taxonomy}_edit_form_fields", $tag, $taxonomy); |
|
223 | 223 | ?> |
224 | 224 | </table> |
225 | 225 | <?php |
226 | 226 | // Back compat hooks |
227 | -if ( 'category' == $taxonomy ) { |
|
227 | +if ('category' == $taxonomy) { |
|
228 | 228 | /** This action is documented in wp-admin/edit-tags.php */ |
229 | - do_action( 'edit_category_form', $tag ); |
|
230 | -} elseif ( 'link_category' == $taxonomy ) { |
|
229 | + do_action('edit_category_form', $tag); |
|
230 | +} elseif ('link_category' == $taxonomy) { |
|
231 | 231 | /** This action is documented in wp-admin/edit-tags.php */ |
232 | - do_action( 'edit_link_category_form', $tag ); |
|
232 | + do_action('edit_link_category_form', $tag); |
|
233 | 233 | } else { |
234 | 234 | /** |
235 | 235 | * Fires at the end of the Edit Term form. |
@@ -239,7 +239,7 @@ discard block |
||
239 | 239 | * |
240 | 240 | * @param object $tag Current taxonomy term object. |
241 | 241 | */ |
242 | - do_action( 'edit_tag_form', $tag ); |
|
242 | + do_action('edit_tag_form', $tag); |
|
243 | 243 | } |
244 | 244 | /** |
245 | 245 | * Fires at the end of the Edit Term form for all taxonomies. |
@@ -251,14 +251,14 @@ discard block |
||
251 | 251 | * @param object $tag Current taxonomy term object. |
252 | 252 | * @param string $taxonomy Current taxonomy slug. |
253 | 253 | */ |
254 | -do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); |
|
254 | +do_action("{$taxonomy}_edit_form", $tag, $taxonomy); |
|
255 | 255 | |
256 | -submit_button( __('Update') ); |
|
256 | +submit_button(__('Update')); |
|
257 | 257 | ?> |
258 | 258 | </form> |
259 | 259 | </div> |
260 | 260 | |
261 | -<?php if ( ! wp_is_mobile() ) : ?> |
|
261 | +<?php if ( ! wp_is_mobile()) : ?> |
|
262 | 262 | <script type="text/javascript"> |
263 | 263 | try{document.forms.edittag.name.focus();}catch(e){} |
264 | 264 | </script> |