@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | // Back compat hooks |
20 | 20 | if ( 'category' == $taxonomy ) { |
21 | 21 | /** |
22 | - * Fires before the Edit Category form. |
|
22 | + * Fires before the Edit Category form. |
|
23 | 23 | * |
24 | 24 | * @since 2.1.0 |
25 | 25 | * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. |
@@ -49,16 +49,16 @@ discard block |
||
49 | 49 | do_action( 'edit_tag_form_pre', $tag ); |
50 | 50 | } |
51 | 51 | /** |
52 | - * Fires before the Edit Term form for all taxonomies. |
|
53 | - * |
|
54 | - * The dynamic portion of the hook name, `$taxonomy`, refers to |
|
55 | - * the taxonomy slug. |
|
56 | - * |
|
57 | - * @since 3.0.0 |
|
58 | - * |
|
59 | - * @param object $tag Current taxonomy term object. |
|
60 | - * @param string $taxonomy Current $taxonomy slug. |
|
61 | - */ |
|
52 | + * Fires before the Edit Term form for all taxonomies. |
|
53 | + * |
|
54 | + * The dynamic portion of the hook name, `$taxonomy`, refers to |
|
55 | + * the taxonomy slug. |
|
56 | + * |
|
57 | + * @since 3.0.0 |
|
58 | + * |
|
59 | + * @param object $tag Current taxonomy term object. |
|
60 | + * @param string $taxonomy Current $taxonomy slug. |
|
61 | + */ |
|
62 | 62 | do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> |
63 | 63 | |
64 | 64 | <div class="wrap"> |
@@ -67,13 +67,13 @@ discard block |
||
67 | 67 | <form name="edittag" id="edittag" method="post" action="edit-tags.php" class="validate" |
68 | 68 | <?php |
69 | 69 | /** |
70 | - * Fires inside the Edit Term form tag. |
|
71 | - * |
|
72 | - * The dynamic portion of the hook name, `$taxonomy`, refers to |
|
73 | - * the taxonomy slug. |
|
74 | - * |
|
75 | - * @since 3.7.0 |
|
76 | - */ |
|
70 | + * Fires inside the Edit Term form tag. |
|
71 | + * |
|
72 | + * The dynamic portion of the hook name, `$taxonomy`, refers to |
|
73 | + * the taxonomy slug. |
|
74 | + * |
|
75 | + * @since 3.7.0 |
|
76 | + */ |
|
77 | 77 | do_action( "{$taxonomy}_term_edit_form_tag" ); |
78 | 78 | ?>> |
79 | 79 | <input type="hidden" name="action" value="editedtag" /> |
@@ -205,15 +205,15 @@ discard block |
||
205 | 205 | do_action( 'edit_tag_form', $tag ); |
206 | 206 | } |
207 | 207 | /** |
208 | - * Fires at the end of the Edit Term form for all taxonomies. |
|
209 | - * |
|
210 | - * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
|
211 | - * |
|
212 | - * @since 3.0.0 |
|
213 | - * |
|
214 | - * @param object $tag Current taxonomy term object. |
|
215 | - * @param string $taxonomy Current taxonomy slug. |
|
216 | - */ |
|
208 | + * Fires at the end of the Edit Term form for all taxonomies. |
|
209 | + * |
|
210 | + * The dynamic portion of the hook name, `$taxonomy`, refers to the taxonomy slug. |
|
211 | + * |
|
212 | + * @since 3.0.0 |
|
213 | + * |
|
214 | + * @param object $tag Current taxonomy term object. |
|
215 | + * @param string $taxonomy Current taxonomy slug. |
|
216 | + */ |
|
217 | 217 | do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); |
218 | 218 | |
219 | 219 | submit_button( __('Update') ); |
@@ -7,17 +7,17 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( ! defined('ABSPATH')) |
|
11 | 11 | die('-1'); |
12 | 12 | |
13 | -if ( empty($tag_ID) ) { ?> |
|
14 | - <div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div> |
|
13 | +if (empty($tag_ID)) { ?> |
|
14 | + <div id="message" class="updated notice is-dismissible"><p><strong><?php _e('You did not select an item for editing.'); ?></strong></p></div> |
|
15 | 15 | <?php |
16 | 16 | return; |
17 | 17 | } |
18 | 18 | |
19 | 19 | // Back compat hooks |
20 | -if ( 'category' == $taxonomy ) { |
|
20 | +if ('category' == $taxonomy) { |
|
21 | 21 | /** |
22 | 22 | * Fires before the Edit Category form. |
23 | 23 | * |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * |
27 | 27 | * @param object $tag Current category term object. |
28 | 28 | */ |
29 | - do_action( 'edit_category_form_pre', $tag ); |
|
30 | -} elseif ( 'link_category' == $taxonomy ) { |
|
29 | + do_action('edit_category_form_pre', $tag); |
|
30 | +} elseif ('link_category' == $taxonomy) { |
|
31 | 31 | /** |
32 | 32 | * Fires before the Edit Link Category form. |
33 | 33 | * |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param object $tag Current link category term object. |
38 | 38 | */ |
39 | - do_action( 'edit_link_category_form_pre', $tag ); |
|
39 | + do_action('edit_link_category_form_pre', $tag); |
|
40 | 40 | } else { |
41 | 41 | /** |
42 | 42 | * Fires before the Edit Tag form. |
@@ -46,7 +46,7 @@ discard block |
||
46 | 46 | * |
47 | 47 | * @param object $tag Current tag term object. |
48 | 48 | */ |
49 | - do_action( 'edit_tag_form_pre', $tag ); |
|
49 | + do_action('edit_tag_form_pre', $tag); |
|
50 | 50 | } |
51 | 51 | /** |
52 | 52 | * Fires before the Edit Term form for all taxonomies. |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | * @param object $tag Current taxonomy term object. |
60 | 60 | * @param string $taxonomy Current $taxonomy slug. |
61 | 61 | */ |
62 | -do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> |
|
62 | +do_action("{$taxonomy}_pre_edit_form", $tag, $taxonomy); ?> |
|
63 | 63 | |
64 | 64 | <div class="wrap"> |
65 | 65 | <h1><?php echo $tax->labels->edit_item; ?></h1> |
@@ -74,21 +74,21 @@ discard block |
||
74 | 74 | * |
75 | 75 | * @since 3.7.0 |
76 | 76 | */ |
77 | -do_action( "{$taxonomy}_term_edit_form_tag" ); |
|
77 | +do_action("{$taxonomy}_term_edit_form_tag"); |
|
78 | 78 | ?>> |
79 | 79 | <input type="hidden" name="action" value="editedtag" /> |
80 | 80 | <input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag->term_id) ?>" /> |
81 | 81 | <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>" /> |
82 | -<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_' . $tag_ID); ?> |
|
82 | +<?php wp_original_referer_field(true, 'previous'); wp_nonce_field('update-tag_'.$tag_ID); ?> |
|
83 | 83 | <table class="form-table"> |
84 | 84 | <tr class="form-field form-required term-name-wrap"> |
85 | - <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
|
86 | - <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
85 | + <th scope="row"><label for="name"><?php _ex('Name', 'term name'); ?></label></th> |
|
86 | + <td><input name="name" id="name" type="text" value="<?php if (isset($tag->name)) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
87 | 87 | <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> |
88 | 88 | </tr> |
89 | -<?php if ( !global_terms_enabled() ) { ?> |
|
89 | +<?php if ( ! global_terms_enabled()) { ?> |
|
90 | 90 | <tr class="form-field term-slug-wrap"> |
91 | - <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th> |
|
91 | + <th scope="row"><label for="slug"><?php _e('Slug'); ?></label></th> |
|
92 | 92 | <?php |
93 | 93 | /** |
94 | 94 | * Filter the editable slug. |
@@ -101,15 +101,15 @@ discard block |
||
101 | 101 | * @param string $slug The editable slug. Will be either a term slug or post URI depending |
102 | 102 | * upon the context in which it is evaluated. |
103 | 103 | */ |
104 | - $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug ) : ''; |
|
104 | + $slug = isset($tag->slug) ? apply_filters('editable_slug', $tag->slug) : ''; |
|
105 | 105 | ?> |
106 | - <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> |
|
106 | + <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr($slug); ?>" size="40" /> |
|
107 | 107 | <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> |
108 | 108 | </tr> |
109 | 109 | <?php } ?> |
110 | -<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
|
110 | +<?php if (is_taxonomy_hierarchical($taxonomy)) : ?> |
|
111 | 111 | <tr class="form-field term-parent-wrap"> |
112 | - <th scope="row"><label for="parent"><?php _ex( 'Parent', 'term parent' ); ?></label></th> |
|
112 | + <th scope="row"><label for="parent"><?php _ex('Parent', 'term parent'); ?></label></th> |
|
113 | 113 | <td> |
114 | 114 | <?php |
115 | 115 | $dropdown_args = array( |
@@ -121,26 +121,26 @@ discard block |
||
121 | 121 | 'selected' => $tag->parent, |
122 | 122 | 'exclude_tree' => $tag->term_id, |
123 | 123 | 'hierarchical' => true, |
124 | - 'show_option_none' => __( 'None' ), |
|
124 | + 'show_option_none' => __('None'), |
|
125 | 125 | ); |
126 | 126 | |
127 | 127 | /** This filter is documented in wp-admin/edit-tags.php */ |
128 | - $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); |
|
129 | - wp_dropdown_categories( $dropdown_args ); ?> |
|
130 | - <?php if ( 'category' == $taxonomy ) : ?> |
|
128 | + $dropdown_args = apply_filters('taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit'); |
|
129 | + wp_dropdown_categories($dropdown_args); ?> |
|
130 | + <?php if ('category' == $taxonomy) : ?> |
|
131 | 131 | <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> |
132 | 132 | <?php endif; ?> |
133 | 133 | </td> |
134 | 134 | </tr> |
135 | 135 | <?php endif; // is_taxonomy_hierarchical() ?> |
136 | 136 | <tr class="form-field term-description-wrap"> |
137 | - <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> |
|
137 | + <th scope="row"><label for="description"><?php _e('Description'); ?></label></th> |
|
138 | 138 | <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea> |
139 | 139 | <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td> |
140 | 140 | </tr> |
141 | 141 | <?php |
142 | 142 | // Back compat hooks |
143 | - if ( 'category' == $taxonomy ) { |
|
143 | + if ('category' == $taxonomy) { |
|
144 | 144 | /** |
145 | 145 | * Fires after the Edit Category form fields are displayed. |
146 | 146 | * |
@@ -149,8 +149,8 @@ discard block |
||
149 | 149 | * |
150 | 150 | * @param object $tag Current category term object. |
151 | 151 | */ |
152 | - do_action( 'edit_category_form_fields', $tag ); |
|
153 | - } elseif ( 'link_category' == $taxonomy ) { |
|
152 | + do_action('edit_category_form_fields', $tag); |
|
153 | + } elseif ('link_category' == $taxonomy) { |
|
154 | 154 | /** |
155 | 155 | * Fires after the Edit Link Category form fields are displayed. |
156 | 156 | * |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @param object $tag Current link category term object. |
161 | 161 | */ |
162 | - do_action( 'edit_link_category_form_fields', $tag ); |
|
162 | + do_action('edit_link_category_form_fields', $tag); |
|
163 | 163 | } else { |
164 | 164 | /** |
165 | 165 | * Fires after the Edit Tag form fields are displayed. |
@@ -169,7 +169,7 @@ discard block |
||
169 | 169 | * |
170 | 170 | * @param object $tag Current tag term object. |
171 | 171 | */ |
172 | - do_action( 'edit_tag_form_fields', $tag ); |
|
172 | + do_action('edit_tag_form_fields', $tag); |
|
173 | 173 | } |
174 | 174 | /** |
175 | 175 | * Fires after the Edit Term form fields are displayed. |
@@ -182,17 +182,17 @@ discard block |
||
182 | 182 | * @param object $tag Current taxonomy term object. |
183 | 183 | * @param string $taxonomy Current taxonomy slug. |
184 | 184 | */ |
185 | - do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy ); |
|
185 | + do_action("{$taxonomy}_edit_form_fields", $tag, $taxonomy); |
|
186 | 186 | ?> |
187 | 187 | </table> |
188 | 188 | <?php |
189 | 189 | // Back compat hooks |
190 | -if ( 'category' == $taxonomy ) { |
|
190 | +if ('category' == $taxonomy) { |
|
191 | 191 | /** This action is documented in wp-admin/edit-tags.php */ |
192 | - do_action( 'edit_category_form', $tag ); |
|
193 | -} elseif ( 'link_category' == $taxonomy ) { |
|
192 | + do_action('edit_category_form', $tag); |
|
193 | +} elseif ('link_category' == $taxonomy) { |
|
194 | 194 | /** This action is documented in wp-admin/edit-tags.php */ |
195 | - do_action( 'edit_link_category_form', $tag ); |
|
195 | + do_action('edit_link_category_form', $tag); |
|
196 | 196 | } else { |
197 | 197 | /** |
198 | 198 | * Fires at the end of the Edit Term form. |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * |
203 | 203 | * @param object $tag Current taxonomy term object. |
204 | 204 | */ |
205 | - do_action( 'edit_tag_form', $tag ); |
|
205 | + do_action('edit_tag_form', $tag); |
|
206 | 206 | } |
207 | 207 | /** |
208 | 208 | * Fires at the end of the Edit Term form for all taxonomies. |
@@ -214,14 +214,14 @@ discard block |
||
214 | 214 | * @param object $tag Current taxonomy term object. |
215 | 215 | * @param string $taxonomy Current taxonomy slug. |
216 | 216 | */ |
217 | -do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); |
|
217 | +do_action("{$taxonomy}_edit_form", $tag, $taxonomy); |
|
218 | 218 | |
219 | -submit_button( __('Update') ); |
|
219 | +submit_button(__('Update')); |
|
220 | 220 | ?> |
221 | 221 | </form> |
222 | 222 | </div> |
223 | 223 | |
224 | -<?php if ( ! wp_is_mobile() ) : ?> |
|
224 | +<?php if ( ! wp_is_mobile()) : ?> |
|
225 | 225 | <script type="text/javascript"> |
226 | 226 | try{document.forms.edittag.name.focus();}catch(e){} |
227 | 227 | </script> |
@@ -7,8 +7,9 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( !defined('ABSPATH') ) |
|
10 | +if ( !defined('ABSPATH') ) { |
|
11 | 11 | die('-1'); |
12 | +} |
|
12 | 13 | |
13 | 14 | if ( empty($tag_ID) ) { ?> |
14 | 15 | <div id="message" class="updated notice is-dismissible"><p><strong><?php _e( 'You did not select an item for editing.' ); ?></strong></p></div> |
@@ -83,7 +84,10 @@ discard block |
||
83 | 84 | <table class="form-table"> |
84 | 85 | <tr class="form-field form-required term-name-wrap"> |
85 | 86 | <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
86 | - <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
87 | + <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) { |
|
88 | + echo esc_attr($tag->name); |
|
89 | +} |
|
90 | +?>" size="40" aria-required="true" /> |
|
87 | 91 | <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> |
88 | 92 | </tr> |
89 | 93 | <?php if ( !global_terms_enabled() ) { ?> |
@@ -8,5 +8,5 @@ |
||
8 | 8 | * @subpackage Administration |
9 | 9 | */ |
10 | 10 | |
11 | -_deprecated_file( basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php' ); |
|
12 | -require_once(ABSPATH . 'wp-admin/includes/upgrade.php'); |
|
11 | +_deprecated_file(basename(__FILE__), '2.5', 'wp-admin/includes/upgrade.php'); |
|
12 | +require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
@@ -241,85 +241,85 @@ discard block |
||
241 | 241 | } |
242 | 242 | |
243 | 243 | switch($step) { |
244 | - case 0: // Step 0 |
|
245 | - |
|
246 | - if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) { |
|
247 | - display_header( 'language-chooser' ); |
|
248 | - echo '<form id="setup" method="post" action="?step=1">'; |
|
249 | - wp_install_language_form( $languages ); |
|
250 | - echo '</form>'; |
|
251 | - break; |
|
252 | - } |
|
244 | + case 0: // Step 0 |
|
245 | + |
|
246 | + if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) { |
|
247 | + display_header( 'language-chooser' ); |
|
248 | + echo '<form id="setup" method="post" action="?step=1">'; |
|
249 | + wp_install_language_form( $languages ); |
|
250 | + echo '</form>'; |
|
251 | + break; |
|
252 | + } |
|
253 | 253 | |
254 | - // Deliberately fall through if we can't reach the translations API. |
|
254 | + // Deliberately fall through if we can't reach the translations API. |
|
255 | 255 | |
256 | - case 1: // Step 1, direct link or from language chooser. |
|
257 | - if ( ! empty( $language ) ) { |
|
258 | - $loaded_language = wp_download_language_pack( $language ); |
|
259 | - if ( $loaded_language ) { |
|
260 | - load_default_textdomain( $loaded_language ); |
|
261 | - $GLOBALS['wp_locale'] = new WP_Locale(); |
|
256 | + case 1: // Step 1, direct link or from language chooser. |
|
257 | + if ( ! empty( $language ) ) { |
|
258 | + $loaded_language = wp_download_language_pack( $language ); |
|
259 | + if ( $loaded_language ) { |
|
260 | + load_default_textdomain( $loaded_language ); |
|
261 | + $GLOBALS['wp_locale'] = new WP_Locale(); |
|
262 | + } |
|
262 | 263 | } |
263 | - } |
|
264 | 264 | |
265 | - display_header(); |
|
266 | -?> |
|
267 | -<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
|
265 | + display_header(); |
|
266 | + ?> |
|
267 | + <h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
|
268 | 268 | <p><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p> |
269 | 269 | |
270 | 270 | <h1><?php _e( 'Information needed' ); ?></h1> |
271 | 271 | <p><?php _e( 'Please provide the following information. Don’t worry, you can always change these settings later.' ); ?></p> |
272 | 272 | |
273 | -<?php |
|
274 | - display_setup_form(); |
|
275 | - break; |
|
276 | - case 2: |
|
277 | - if ( ! empty( $language ) && load_default_textdomain( $language ) ) { |
|
278 | - $loaded_language = $language; |
|
279 | - $GLOBALS['wp_locale'] = new WP_Locale(); |
|
280 | - } else { |
|
281 | - $loaded_language = 'en_US'; |
|
282 | - } |
|
283 | - |
|
284 | - if ( ! empty( $wpdb->error ) ) |
|
285 | - wp_die( $wpdb->error->get_error_message() ); |
|
286 | - |
|
287 | - display_header(); |
|
288 | - // Fill in the data we gathered |
|
289 | - $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
|
290 | - $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
|
291 | - $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : ''; |
|
292 | - $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : ''; |
|
293 | - $admin_email = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
294 | - $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0; |
|
295 | - |
|
296 | - // Check e-mail address. |
|
297 | - $error = false; |
|
298 | - if ( empty( $user_name ) ) { |
|
299 | - // TODO: poka-yoke |
|
300 | - display_setup_form( __( 'Please provide a valid username.' ) ); |
|
301 | - $error = true; |
|
302 | - } elseif ( $user_name != sanitize_user( $user_name, true ) ) { |
|
303 | - display_setup_form( __( 'The username you provided has invalid characters.' ) ); |
|
304 | - $error = true; |
|
305 | - } elseif ( $admin_password != $admin_password_check ) { |
|
306 | - // TODO: poka-yoke |
|
307 | - display_setup_form( __( 'Your passwords do not match. Please try again.' ) ); |
|
308 | - $error = true; |
|
309 | - } elseif ( empty( $admin_email ) ) { |
|
310 | - // TODO: poka-yoke |
|
311 | - display_setup_form( __( 'You must provide an email address.' ) ); |
|
312 | - $error = true; |
|
313 | - } elseif ( ! is_email( $admin_email ) ) { |
|
314 | - // TODO: poka-yoke |
|
315 | - display_setup_form( __( 'Sorry, that isn’t a valid email address. Email addresses look like <code>[email protected]</code>.' ) ); |
|
316 | - $error = true; |
|
317 | - } |
|
318 | - |
|
319 | - if ( $error === false ) { |
|
320 | - $wpdb->show_errors(); |
|
321 | - $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language ); |
|
322 | -?> |
|
273 | + <?php |
|
274 | + display_setup_form(); |
|
275 | + break; |
|
276 | + case 2: |
|
277 | + if ( ! empty( $language ) && load_default_textdomain( $language ) ) { |
|
278 | + $loaded_language = $language; |
|
279 | + $GLOBALS['wp_locale'] = new WP_Locale(); |
|
280 | + } else { |
|
281 | + $loaded_language = 'en_US'; |
|
282 | + } |
|
283 | + |
|
284 | + if ( ! empty( $wpdb->error ) ) |
|
285 | + wp_die( $wpdb->error->get_error_message() ); |
|
286 | + |
|
287 | + display_header(); |
|
288 | + // Fill in the data we gathered |
|
289 | + $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
|
290 | + $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
|
291 | + $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : ''; |
|
292 | + $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : ''; |
|
293 | + $admin_email = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
294 | + $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0; |
|
295 | + |
|
296 | + // Check e-mail address. |
|
297 | + $error = false; |
|
298 | + if ( empty( $user_name ) ) { |
|
299 | + // TODO: poka-yoke |
|
300 | + display_setup_form( __( 'Please provide a valid username.' ) ); |
|
301 | + $error = true; |
|
302 | + } elseif ( $user_name != sanitize_user( $user_name, true ) ) { |
|
303 | + display_setup_form( __( 'The username you provided has invalid characters.' ) ); |
|
304 | + $error = true; |
|
305 | + } elseif ( $admin_password != $admin_password_check ) { |
|
306 | + // TODO: poka-yoke |
|
307 | + display_setup_form( __( 'Your passwords do not match. Please try again.' ) ); |
|
308 | + $error = true; |
|
309 | + } elseif ( empty( $admin_email ) ) { |
|
310 | + // TODO: poka-yoke |
|
311 | + display_setup_form( __( 'You must provide an email address.' ) ); |
|
312 | + $error = true; |
|
313 | + } elseif ( ! is_email( $admin_email ) ) { |
|
314 | + // TODO: poka-yoke |
|
315 | + display_setup_form( __( 'Sorry, that isn’t a valid email address. Email addresses look like <code>[email protected]</code>.' ) ); |
|
316 | + $error = true; |
|
317 | + } |
|
318 | + |
|
319 | + if ( $error === false ) { |
|
320 | + $wpdb->show_errors(); |
|
321 | + $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language ); |
|
322 | + ?> |
|
323 | 323 | |
324 | 324 | <h1><?php _e( 'Success!' ); ?></h1> |
325 | 325 | |
@@ -333,19 +333,19 @@ discard block |
||
333 | 333 | <tr> |
334 | 334 | <th><?php _e( 'Password' ); ?></th> |
335 | 335 | <td><?php |
336 | - if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ): ?> |
|
337 | - <code><?php echo esc_html( $result['password'] ) ?></code><br /> |
|
336 | + if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ): ?> |
|
337 | + <code><?php echo esc_html( $result['password'] ) ?></code><br /> |
|
338 | 338 | <?php endif ?> |
339 | - <p><?php echo $result['password_message'] ?></p> |
|
339 | + <p><?php echo $result['password_message'] ?></p> |
|
340 | 340 | </td> |
341 | 341 | </tr> |
342 | 342 | </table> |
343 | 343 | |
344 | 344 | <p class="step"><a href="../wp-login.php" class="button button-large"><?php _e( 'Log In' ); ?></a></p> |
345 | 345 | |
346 | -<?php |
|
347 | - } |
|
348 | - break; |
|
346 | + <?php |
|
347 | + } |
|
348 | + break; |
|
349 | 349 | } |
350 | 350 | if ( !wp_is_mobile() ) { |
351 | 351 | ?> |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // Sanity check. |
10 | -if ( false ) { |
|
10 | +if (false) { |
|
11 | 11 | ?> |
12 | 12 | <!DOCTYPE html> |
13 | 13 | <html xmlns="http://www.w3.org/1999/xhtml"> |
@@ -30,23 +30,23 @@ discard block |
||
30 | 30 | * @since 1.5.1 |
31 | 31 | * @var bool |
32 | 32 | */ |
33 | -define( 'WP_INSTALLING', true ); |
|
33 | +define('WP_INSTALLING', true); |
|
34 | 34 | |
35 | 35 | /** Load WordPress Bootstrap */ |
36 | -require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
36 | +require_once(dirname(dirname(__FILE__)).'/wp-load.php'); |
|
37 | 37 | |
38 | 38 | /** Load WordPress Administration Upgrade API */ |
39 | -require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
39 | +require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
40 | 40 | |
41 | 41 | /** Load WordPress Translation Install API */ |
42 | -require_once( ABSPATH . 'wp-admin/includes/translation-install.php' ); |
|
42 | +require_once(ABSPATH.'wp-admin/includes/translation-install.php'); |
|
43 | 43 | |
44 | 44 | /** Load wpdb */ |
45 | -require_once( ABSPATH . WPINC . '/wp-db.php' ); |
|
45 | +require_once(ABSPATH.WPINC.'/wp-db.php'); |
|
46 | 46 | |
47 | 47 | nocache_headers(); |
48 | 48 | |
49 | -$step = isset( $_GET['step'] ) ? (int) $_GET['step'] : 0; |
|
49 | +$step = isset($_GET['step']) ? (int) $_GET['step'] : 0; |
|
50 | 50 | |
51 | 51 | /** |
52 | 52 | * Display install header. |
@@ -55,13 +55,13 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param string $body_classes |
57 | 57 | */ |
58 | -function display_header( $body_classes = '' ) { |
|
59 | - header( 'Content-Type: text/html; charset=utf-8' ); |
|
60 | - if ( is_rtl() ) { |
|
58 | +function display_header($body_classes = '') { |
|
59 | + header('Content-Type: text/html; charset=utf-8'); |
|
60 | + if (is_rtl()) { |
|
61 | 61 | $body_classes .= 'rtl'; |
62 | 62 | } |
63 | - if ( $body_classes ) { |
|
64 | - $body_classes = ' ' . $body_classes; |
|
63 | + if ($body_classes) { |
|
64 | + $body_classes = ' '.$body_classes; |
|
65 | 65 | } |
66 | 66 | ?> |
67 | 67 | <!DOCTYPE html> |
@@ -69,14 +69,14 @@ discard block |
||
69 | 69 | <head> |
70 | 70 | <meta name="viewport" content="width=device-width" /> |
71 | 71 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
72 | - <title><?php _e( 'WordPress › Installation' ); ?></title> |
|
72 | + <title><?php _e('WordPress › Installation'); ?></title> |
|
73 | 73 | <?php |
74 | - wp_admin_css( 'install', true ); |
|
75 | - wp_admin_css( 'dashicons', true ); |
|
74 | + wp_admin_css('install', true); |
|
75 | + wp_admin_css('dashicons', true); |
|
76 | 76 | ?> |
77 | 77 | </head> |
78 | 78 | <body class="wp-core-ui<?php echo $body_classes ?>"> |
79 | -<h1 id="logo"><a href="<?php echo esc_url( __( 'https://wordpress.org/' ) ); ?>" tabindex="-1"><?php _e( 'WordPress' ); ?></a></h1> |
|
79 | +<h1 id="logo"><a href="<?php echo esc_url(__('https://wordpress.org/')); ?>" tabindex="-1"><?php _e('WordPress'); ?></a></h1> |
|
80 | 80 | |
81 | 81 | <?php |
82 | 82 | } // end display_header() |
@@ -88,73 +88,73 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @param string|null $error |
90 | 90 | */ |
91 | -function display_setup_form( $error = null ) { |
|
91 | +function display_setup_form($error = null) { |
|
92 | 92 | global $wpdb; |
93 | 93 | |
94 | - $sql = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $wpdb->users ) ); |
|
95 | - $user_table = ( $wpdb->get_var( $sql ) != null ); |
|
94 | + $sql = $wpdb->prepare("SHOW TABLES LIKE %s", $wpdb->esc_like($wpdb->users)); |
|
95 | + $user_table = ($wpdb->get_var($sql) != null); |
|
96 | 96 | |
97 | 97 | // Ensure that Blogs appear in search engines by default. |
98 | 98 | $blog_public = 1; |
99 | - if ( isset( $_POST['weblog_title'] ) ) { |
|
100 | - $blog_public = isset( $_POST['blog_public'] ); |
|
99 | + if (isset($_POST['weblog_title'])) { |
|
100 | + $blog_public = isset($_POST['blog_public']); |
|
101 | 101 | } |
102 | 102 | |
103 | - $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
|
104 | - $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
|
105 | - $admin_email = isset( $_POST['admin_email'] ) ? trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
103 | + $weblog_title = isset($_POST['weblog_title']) ? trim(wp_unslash($_POST['weblog_title'])) : ''; |
|
104 | + $user_name = isset($_POST['user_name']) ? trim(wp_unslash($_POST['user_name'])) : ''; |
|
105 | + $admin_email = isset($_POST['admin_email']) ? trim(wp_unslash($_POST['admin_email'])) : ''; |
|
106 | 106 | |
107 | - if ( ! is_null( $error ) ) { |
|
107 | + if ( ! is_null($error)) { |
|
108 | 108 | ?> |
109 | 109 | <p class="message"><?php echo $error; ?></p> |
110 | 110 | <?php } ?> |
111 | 111 | <form id="setup" method="post" action="install.php?step=2" novalidate="novalidate"> |
112 | 112 | <table class="form-table"> |
113 | 113 | <tr> |
114 | - <th scope="row"><label for="weblog_title"><?php _e( 'Site Title' ); ?></label></th> |
|
115 | - <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr( $weblog_title ); ?>" /></td> |
|
114 | + <th scope="row"><label for="weblog_title"><?php _e('Site Title'); ?></label></th> |
|
115 | + <td><input name="weblog_title" type="text" id="weblog_title" size="25" value="<?php echo esc_attr($weblog_title); ?>" /></td> |
|
116 | 116 | </tr> |
117 | 117 | <tr> |
118 | 118 | <th scope="row"><label for="user_login"><?php _e('Username'); ?></label></th> |
119 | 119 | <td> |
120 | 120 | <?php |
121 | - if ( $user_table ) { |
|
121 | + if ($user_table) { |
|
122 | 122 | _e('User(s) already exists.'); |
123 | 123 | echo '<input name="user_name" type="hidden" value="admin" />'; |
124 | 124 | } else { |
125 | - ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr( sanitize_user( $user_name, true ) ); ?>" /> |
|
126 | - <p><?php _e( 'Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.' ); ?></p> |
|
125 | + ?><input name="user_name" type="text" id="user_login" size="25" value="<?php echo esc_attr(sanitize_user($user_name, true)); ?>" /> |
|
126 | + <p><?php _e('Usernames can have only alphanumeric characters, spaces, underscores, hyphens, periods, and the @ symbol.'); ?></p> |
|
127 | 127 | <?php |
128 | 128 | } ?> |
129 | 129 | </td> |
130 | 130 | </tr> |
131 | - <?php if ( ! $user_table ) : ?> |
|
131 | + <?php if ( ! $user_table) : ?> |
|
132 | 132 | <tr class="form-field form-required user-pass1-wrap"> |
133 | 133 | <th scope="row"> |
134 | 134 | <label for="pass1"> |
135 | - <?php _e( 'Password' ); ?> |
|
135 | + <?php _e('Password'); ?> |
|
136 | 136 | </label> |
137 | 137 | </th> |
138 | 138 | <td> |
139 | 139 | <div class=""> |
140 | - <?php $initial_password = isset( $_POST['admin_password'] ) ? stripslashes( $_POST['admin_password'] ) : wp_generate_password( 18 ); ?> |
|
141 | - <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr( $initial_password ); ?>" aria-describedby="pass-strength-result" /> |
|
142 | - <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset( $_POST['admin_password'] ); ?>" data-toggle="0" aria-label="<?php esc_attr_e( 'Hide password' ); ?>"> |
|
140 | + <?php $initial_password = isset($_POST['admin_password']) ? stripslashes($_POST['admin_password']) : wp_generate_password(18); ?> |
|
141 | + <input type="password" name="admin_password" id="pass1" class="regular-text" autocomplete="off" data-reveal="1" data-pw="<?php echo esc_attr($initial_password); ?>" aria-describedby="pass-strength-result" /> |
|
142 | + <button type="button" class="button button-secondary wp-hide-pw hide-if-no-js" data-start-masked="<?php echo (int) isset($_POST['admin_password']); ?>" data-toggle="0" aria-label="<?php esc_attr_e('Hide password'); ?>"> |
|
143 | 143 | <span class="dashicons dashicons-hidden"></span> |
144 | - <span class="text"><?php _e( 'Hide' ); ?></span> |
|
144 | + <span class="text"><?php _e('Hide'); ?></span> |
|
145 | 145 | </button> |
146 | 146 | <div id="pass-strength-result" aria-live="polite"></div> |
147 | 147 | </div> |
148 | 148 | <p><span class="description important hide-if-no-js"> |
149 | - <strong><?php _e( 'Important:' ); ?></strong> |
|
149 | + <strong><?php _e('Important:'); ?></strong> |
|
150 | 150 | <?php /* translators: The non-breaking space prevents 1Password from thinking the text "log in" should trigger a password save prompt. */ ?> |
151 | - <?php _e( 'You will need this password to log in. Please store it in a secure location.' ); ?></span></p> |
|
151 | + <?php _e('You will need this password to log in. Please store it in a secure location.'); ?></span></p> |
|
152 | 152 | </td> |
153 | 153 | </tr> |
154 | 154 | <tr class="form-field form-required user-pass2-wrap hide-if-js"> |
155 | 155 | <th scope="row"> |
156 | - <label for="pass2"><?php _e( 'Repeat Password' ); ?> |
|
157 | - <span class="description"><?php _e( '(required)' ); ?></span> |
|
156 | + <label for="pass2"><?php _e('Repeat Password'); ?> |
|
157 | + <span class="description"><?php _e('(required)'); ?></span> |
|
158 | 158 | </label> |
159 | 159 | </th> |
160 | 160 | <td> |
@@ -162,35 +162,35 @@ discard block |
||
162 | 162 | </td> |
163 | 163 | </tr> |
164 | 164 | <tr class="pw-weak"> |
165 | - <th scope="row"><?php _e( 'Confirm Password' ); ?></th> |
|
165 | + <th scope="row"><?php _e('Confirm Password'); ?></th> |
|
166 | 166 | <td> |
167 | 167 | <label> |
168 | 168 | <input type="checkbox" name="pw_weak" class="pw-checkbox" /> |
169 | - <?php _e( 'Confirm use of weak password' ); ?> |
|
169 | + <?php _e('Confirm use of weak password'); ?> |
|
170 | 170 | </label> |
171 | 171 | </td> |
172 | 172 | </tr> |
173 | 173 | <?php endif; ?> |
174 | 174 | <tr> |
175 | - <th scope="row"><label for="admin_email"><?php _e( 'Your E-mail' ); ?></label></th> |
|
176 | - <td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr( $admin_email ); ?>" /> |
|
177 | - <p><?php _e( 'Double-check your email address before continuing.' ); ?></p></td> |
|
175 | + <th scope="row"><label for="admin_email"><?php _e('Your E-mail'); ?></label></th> |
|
176 | + <td><input name="admin_email" type="email" id="admin_email" size="25" value="<?php echo esc_attr($admin_email); ?>" /> |
|
177 | + <p><?php _e('Double-check your email address before continuing.'); ?></p></td> |
|
178 | 178 | </tr> |
179 | 179 | <tr> |
180 | - <th scope="row"><?php _e( 'Privacy' ); ?></th> |
|
181 | - <td colspan="2"><label><input type="checkbox" name="blog_public" id="blog_public" value="1" <?php checked( $blog_public ); ?> /> <?php _e( 'Allow search engines to index this site' ); ?></label></td> |
|
180 | + <th scope="row"><?php _e('Privacy'); ?></th> |
|
181 | + <td colspan="2"><label><input type="checkbox" name="blog_public" id="blog_public" value="1" <?php checked($blog_public); ?> /> <?php _e('Allow search engines to index this site'); ?></label></td> |
|
182 | 182 | </tr> |
183 | 183 | </table> |
184 | - <p class="step"><?php submit_button( __( 'Install WordPress' ), 'large', 'Submit', false, array( 'id' => 'submit' ) ); ?></p> |
|
185 | - <input type="hidden" name="language" value="<?php echo isset( $_REQUEST['language'] ) ? esc_attr( $_REQUEST['language'] ) : ''; ?>" /> |
|
184 | + <p class="step"><?php submit_button(__('Install WordPress'), 'large', 'Submit', false, array('id' => 'submit')); ?></p> |
|
185 | + <input type="hidden" name="language" value="<?php echo isset($_REQUEST['language']) ? esc_attr($_REQUEST['language']) : ''; ?>" /> |
|
186 | 186 | </form> |
187 | 187 | <?php |
188 | 188 | } // end display_setup_form() |
189 | 189 | |
190 | 190 | // Let's check to make sure WP isn't already installed. |
191 | -if ( is_blog_installed() ) { |
|
191 | +if (is_blog_installed()) { |
|
192 | 192 | display_header(); |
193 | - die( '<h1>' . __( 'Already Installed' ) . '</h1><p>' . __( 'You appear to have already installed WordPress. To reinstall please clear your old database tables first.' ) . '</p><p class="step"><a href="../wp-login.php" class="button button-large">' . __( 'Log In' ) . '</a></p></body></html>' ); |
|
193 | + die('<h1>'.__('Already Installed').'</h1><p>'.__('You appear to have already installed WordPress. To reinstall please clear your old database tables first.').'</p><p class="step"><a href="../wp-login.php" class="button button-large">'.__('Log In').'</a></p></body></html>'); |
|
194 | 194 | } |
195 | 195 | |
196 | 196 | /** |
@@ -203,30 +203,30 @@ discard block |
||
203 | 203 | |
204 | 204 | $php_version = phpversion(); |
205 | 205 | $mysql_version = $wpdb->db_version(); |
206 | -$php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
|
207 | -$mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); |
|
206 | +$php_compat = version_compare($php_version, $required_php_version, '>='); |
|
207 | +$mysql_compat = version_compare($mysql_version, $required_mysql_version, '>=') || file_exists(WP_CONTENT_DIR.'/db.php'); |
|
208 | 208 | |
209 | -if ( !$mysql_compat && !$php_compat ) |
|
210 | - $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.' ), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
|
211 | -elseif ( !$php_compat ) |
|
212 | - $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_php_version, $php_version ); |
|
213 | -elseif ( !$mysql_compat ) |
|
214 | - $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_mysql_version, $mysql_version ); |
|
209 | +if ( ! $mysql_compat && ! $php_compat) |
|
210 | + $compat = sprintf(__('You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.'), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version); |
|
211 | +elseif ( ! $php_compat) |
|
212 | + $compat = sprintf(__('You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.'), $wp_version, $required_php_version, $php_version); |
|
213 | +elseif ( ! $mysql_compat) |
|
214 | + $compat = sprintf(__('You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.'), $wp_version, $required_mysql_version, $mysql_version); |
|
215 | 215 | |
216 | -if ( !$mysql_compat || !$php_compat ) { |
|
216 | +if ( ! $mysql_compat || ! $php_compat) { |
|
217 | 217 | display_header(); |
218 | - die( '<h1>' . __( 'Insufficient Requirements' ) . '</h1><p>' . $compat . '</p></body></html>' ); |
|
218 | + die('<h1>'.__('Insufficient Requirements').'</h1><p>'.$compat.'</p></body></html>'); |
|
219 | 219 | } |
220 | 220 | |
221 | -if ( ! is_string( $wpdb->base_prefix ) || '' === $wpdb->base_prefix ) { |
|
221 | +if ( ! is_string($wpdb->base_prefix) || '' === $wpdb->base_prefix) { |
|
222 | 222 | display_header(); |
223 | - die( '<h1>' . __( 'Configuration Error' ) . '</h1><p>' . __( 'Your <code>wp-config.php</code> file has an empty database table prefix, which is not supported.' ) . '</p></body></html>' ); |
|
223 | + die('<h1>'.__('Configuration Error').'</h1><p>'.__('Your <code>wp-config.php</code> file has an empty database table prefix, which is not supported.').'</p></body></html>'); |
|
224 | 224 | } |
225 | 225 | |
226 | 226 | // Set error message if DO_NOT_UPGRADE_GLOBAL_TABLES isn't set as it will break install. |
227 | -if ( defined( 'DO_NOT_UPGRADE_GLOBAL_TABLES' ) ) { |
|
227 | +if (defined('DO_NOT_UPGRADE_GLOBAL_TABLES')) { |
|
228 | 228 | display_header(); |
229 | - die( '<h1>' . __( 'Configuration Error' ) . '</h1><p>' . __( 'The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when installing WordPress.' ) . '</p></body></html>' ); |
|
229 | + die('<h1>'.__('Configuration Error').'</h1><p>'.__('The constant DO_NOT_UPGRADE_GLOBAL_TABLES cannot be defined when installing WordPress.').'</p></body></html>'); |
|
230 | 230 | } |
231 | 231 | |
232 | 232 | /** |
@@ -234,19 +234,19 @@ discard block |
||
234 | 234 | * @global WP_Locale $wp_locale |
235 | 235 | */ |
236 | 236 | $language = ''; |
237 | -if ( ! empty( $_REQUEST['language'] ) ) { |
|
238 | - $language = preg_replace( '/[^a-zA-Z_]/', '', $_REQUEST['language'] ); |
|
239 | -} elseif ( isset( $GLOBALS['wp_local_package'] ) ) { |
|
237 | +if ( ! empty($_REQUEST['language'])) { |
|
238 | + $language = preg_replace('/[^a-zA-Z_]/', '', $_REQUEST['language']); |
|
239 | +} elseif (isset($GLOBALS['wp_local_package'])) { |
|
240 | 240 | $language = $GLOBALS['wp_local_package']; |
241 | 241 | } |
242 | 242 | |
243 | -switch($step) { |
|
243 | +switch ($step) { |
|
244 | 244 | case 0: // Step 0 |
245 | 245 | |
246 | - if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) { |
|
247 | - display_header( 'language-chooser' ); |
|
246 | + if (wp_can_install_language_pack() && empty($language) && ($languages = wp_get_available_translations())) { |
|
247 | + display_header('language-chooser'); |
|
248 | 248 | echo '<form id="setup" method="post" action="?step=1">'; |
249 | - wp_install_language_form( $languages ); |
|
249 | + wp_install_language_form($languages); |
|
250 | 250 | echo '</form>'; |
251 | 251 | break; |
252 | 252 | } |
@@ -254,105 +254,105 @@ discard block |
||
254 | 254 | // Deliberately fall through if we can't reach the translations API. |
255 | 255 | |
256 | 256 | case 1: // Step 1, direct link or from language chooser. |
257 | - if ( ! empty( $language ) ) { |
|
258 | - $loaded_language = wp_download_language_pack( $language ); |
|
259 | - if ( $loaded_language ) { |
|
260 | - load_default_textdomain( $loaded_language ); |
|
257 | + if ( ! empty($language)) { |
|
258 | + $loaded_language = wp_download_language_pack($language); |
|
259 | + if ($loaded_language) { |
|
260 | + load_default_textdomain($loaded_language); |
|
261 | 261 | $GLOBALS['wp_locale'] = new WP_Locale(); |
262 | 262 | } |
263 | 263 | } |
264 | 264 | |
265 | 265 | display_header(); |
266 | 266 | ?> |
267 | -<h1><?php _ex( 'Welcome', 'Howdy' ); ?></h1> |
|
268 | -<p><?php _e( 'Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.' ); ?></p> |
|
267 | +<h1><?php _ex('Welcome', 'Howdy'); ?></h1> |
|
268 | +<p><?php _e('Welcome to the famous five-minute WordPress installation process! Just fill in the information below and you’ll be on your way to using the most extendable and powerful personal publishing platform in the world.'); ?></p> |
|
269 | 269 | |
270 | -<h1><?php _e( 'Information needed' ); ?></h1> |
|
271 | -<p><?php _e( 'Please provide the following information. Don’t worry, you can always change these settings later.' ); ?></p> |
|
270 | +<h1><?php _e('Information needed'); ?></h1> |
|
271 | +<p><?php _e('Please provide the following information. Don’t worry, you can always change these settings later.'); ?></p> |
|
272 | 272 | |
273 | 273 | <?php |
274 | 274 | display_setup_form(); |
275 | 275 | break; |
276 | 276 | case 2: |
277 | - if ( ! empty( $language ) && load_default_textdomain( $language ) ) { |
|
277 | + if ( ! empty($language) && load_default_textdomain($language)) { |
|
278 | 278 | $loaded_language = $language; |
279 | 279 | $GLOBALS['wp_locale'] = new WP_Locale(); |
280 | 280 | } else { |
281 | 281 | $loaded_language = 'en_US'; |
282 | 282 | } |
283 | 283 | |
284 | - if ( ! empty( $wpdb->error ) ) |
|
285 | - wp_die( $wpdb->error->get_error_message() ); |
|
284 | + if ( ! empty($wpdb->error)) |
|
285 | + wp_die($wpdb->error->get_error_message()); |
|
286 | 286 | |
287 | 287 | display_header(); |
288 | 288 | // Fill in the data we gathered |
289 | - $weblog_title = isset( $_POST['weblog_title'] ) ? trim( wp_unslash( $_POST['weblog_title'] ) ) : ''; |
|
290 | - $user_name = isset($_POST['user_name']) ? trim( wp_unslash( $_POST['user_name'] ) ) : ''; |
|
291 | - $admin_password = isset($_POST['admin_password']) ? wp_unslash( $_POST['admin_password'] ) : ''; |
|
292 | - $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash( $_POST['admin_password2'] ) : ''; |
|
293 | - $admin_email = isset( $_POST['admin_email'] ) ?trim( wp_unslash( $_POST['admin_email'] ) ) : ''; |
|
294 | - $public = isset( $_POST['blog_public'] ) ? (int) $_POST['blog_public'] : 0; |
|
289 | + $weblog_title = isset($_POST['weblog_title']) ? trim(wp_unslash($_POST['weblog_title'])) : ''; |
|
290 | + $user_name = isset($_POST['user_name']) ? trim(wp_unslash($_POST['user_name'])) : ''; |
|
291 | + $admin_password = isset($_POST['admin_password']) ? wp_unslash($_POST['admin_password']) : ''; |
|
292 | + $admin_password_check = isset($_POST['admin_password2']) ? wp_unslash($_POST['admin_password2']) : ''; |
|
293 | + $admin_email = isset($_POST['admin_email']) ? trim(wp_unslash($_POST['admin_email'])) : ''; |
|
294 | + $public = isset($_POST['blog_public']) ? (int) $_POST['blog_public'] : 0; |
|
295 | 295 | |
296 | 296 | // Check e-mail address. |
297 | 297 | $error = false; |
298 | - if ( empty( $user_name ) ) { |
|
298 | + if (empty($user_name)) { |
|
299 | 299 | // TODO: poka-yoke |
300 | - display_setup_form( __( 'Please provide a valid username.' ) ); |
|
300 | + display_setup_form(__('Please provide a valid username.')); |
|
301 | 301 | $error = true; |
302 | - } elseif ( $user_name != sanitize_user( $user_name, true ) ) { |
|
303 | - display_setup_form( __( 'The username you provided has invalid characters.' ) ); |
|
302 | + } elseif ($user_name != sanitize_user($user_name, true)) { |
|
303 | + display_setup_form(__('The username you provided has invalid characters.')); |
|
304 | 304 | $error = true; |
305 | - } elseif ( $admin_password != $admin_password_check ) { |
|
305 | + } elseif ($admin_password != $admin_password_check) { |
|
306 | 306 | // TODO: poka-yoke |
307 | - display_setup_form( __( 'Your passwords do not match. Please try again.' ) ); |
|
307 | + display_setup_form(__('Your passwords do not match. Please try again.')); |
|
308 | 308 | $error = true; |
309 | - } elseif ( empty( $admin_email ) ) { |
|
309 | + } elseif (empty($admin_email)) { |
|
310 | 310 | // TODO: poka-yoke |
311 | - display_setup_form( __( 'You must provide an email address.' ) ); |
|
311 | + display_setup_form(__('You must provide an email address.')); |
|
312 | 312 | $error = true; |
313 | - } elseif ( ! is_email( $admin_email ) ) { |
|
313 | + } elseif ( ! is_email($admin_email)) { |
|
314 | 314 | // TODO: poka-yoke |
315 | - display_setup_form( __( 'Sorry, that isn’t a valid email address. Email addresses look like <code>[email protected]</code>.' ) ); |
|
315 | + display_setup_form(__('Sorry, that isn’t a valid email address. Email addresses look like <code>[email protected]</code>.')); |
|
316 | 316 | $error = true; |
317 | 317 | } |
318 | 318 | |
319 | - if ( $error === false ) { |
|
319 | + if ($error === false) { |
|
320 | 320 | $wpdb->show_errors(); |
321 | - $result = wp_install( $weblog_title, $user_name, $admin_email, $public, '', wp_slash( $admin_password ), $loaded_language ); |
|
321 | + $result = wp_install($weblog_title, $user_name, $admin_email, $public, '', wp_slash($admin_password), $loaded_language); |
|
322 | 322 | ?> |
323 | 323 | |
324 | -<h1><?php _e( 'Success!' ); ?></h1> |
|
324 | +<h1><?php _e('Success!'); ?></h1> |
|
325 | 325 | |
326 | -<p><?php _e( 'WordPress has been installed. Were you expecting more steps? Sorry to disappoint.' ); ?></p> |
|
326 | +<p><?php _e('WordPress has been installed. Were you expecting more steps? Sorry to disappoint.'); ?></p> |
|
327 | 327 | |
328 | 328 | <table class="form-table install-success"> |
329 | 329 | <tr> |
330 | - <th><?php _e( 'Username' ); ?></th> |
|
331 | - <td><?php echo esc_html( sanitize_user( $user_name, true ) ); ?></td> |
|
330 | + <th><?php _e('Username'); ?></th> |
|
331 | + <td><?php echo esc_html(sanitize_user($user_name, true)); ?></td> |
|
332 | 332 | </tr> |
333 | 333 | <tr> |
334 | - <th><?php _e( 'Password' ); ?></th> |
|
334 | + <th><?php _e('Password'); ?></th> |
|
335 | 335 | <td><?php |
336 | - if ( ! empty( $result['password'] ) && empty( $admin_password_check ) ): ?> |
|
337 | - <code><?php echo esc_html( $result['password'] ) ?></code><br /> |
|
336 | + if ( ! empty($result['password']) && empty($admin_password_check)): ?> |
|
337 | + <code><?php echo esc_html($result['password']) ?></code><br /> |
|
338 | 338 | <?php endif ?> |
339 | 339 | <p><?php echo $result['password_message'] ?></p> |
340 | 340 | </td> |
341 | 341 | </tr> |
342 | 342 | </table> |
343 | 343 | |
344 | -<p class="step"><a href="../wp-login.php" class="button button-large"><?php _e( 'Log In' ); ?></a></p> |
|
344 | +<p class="step"><a href="../wp-login.php" class="button button-large"><?php _e('Log In'); ?></a></p> |
|
345 | 345 | |
346 | 346 | <?php |
347 | 347 | } |
348 | 348 | break; |
349 | 349 | } |
350 | -if ( !wp_is_mobile() ) { |
|
350 | +if ( ! wp_is_mobile()) { |
|
351 | 351 | ?> |
352 | 352 | <script type="text/javascript">var t = document.getElementById('weblog_title'); if (t){ t.focus(); }</script> |
353 | 353 | <?php } ?> |
354 | -<?php wp_print_scripts( 'user-profile' ); ?> |
|
355 | -<?php wp_print_scripts( 'language-chooser' ); ?> |
|
354 | +<?php wp_print_scripts('user-profile'); ?> |
|
355 | +<?php wp_print_scripts('language-chooser'); ?> |
|
356 | 356 | <script type="text/javascript"> |
357 | 357 | jQuery( function( $ ) { |
358 | 358 | $( '.hide-if-no-js' ).removeClass( 'hide-if-no-js' ); |
@@ -206,12 +206,13 @@ discard block |
||
206 | 206 | $php_compat = version_compare( $php_version, $required_php_version, '>=' ); |
207 | 207 | $mysql_compat = version_compare( $mysql_version, $required_mysql_version, '>=' ) || file_exists( WP_CONTENT_DIR . '/db.php' ); |
208 | 208 | |
209 | -if ( !$mysql_compat && !$php_compat ) |
|
209 | +if ( !$mysql_compat && !$php_compat ) { |
|
210 | 210 | $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher and MySQL version %3$s or higher. You are running PHP version %4$s and MySQL version %5$s.' ), $wp_version, $required_php_version, $required_mysql_version, $php_version, $mysql_version ); |
211 | -elseif ( !$php_compat ) |
|
211 | +} elseif ( !$php_compat ) { |
|
212 | 212 | $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires PHP version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_php_version, $php_version ); |
213 | -elseif ( !$mysql_compat ) |
|
213 | +} elseif ( !$mysql_compat ) { |
|
214 | 214 | $compat = sprintf( __( 'You cannot install because <a href="https://codex.wordpress.org/Version_%1$s">WordPress %1$s</a> requires MySQL version %2$s or higher. You are running version %3$s.' ), $wp_version, $required_mysql_version, $mysql_version ); |
215 | +} |
|
215 | 216 | |
216 | 217 | if ( !$mysql_compat || !$php_compat ) { |
217 | 218 | display_header(); |
@@ -281,8 +282,9 @@ discard block |
||
281 | 282 | $loaded_language = 'en_US'; |
282 | 283 | } |
283 | 284 | |
284 | - if ( ! empty( $wpdb->error ) ) |
|
285 | - wp_die( $wpdb->error->get_error_message() ); |
|
285 | + if ( ! empty( $wpdb->error ) ) { |
|
286 | + wp_die( $wpdb->error->get_error_message() ); |
|
287 | + } |
|
286 | 288 | |
287 | 289 | display_header(); |
288 | 290 | // Fill in the data we gathered |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Edit Comments Administration Screen. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Edit Comments Administration Screen. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -7,95 +7,95 @@ 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') ) |
|
12 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | +if ( ! current_user_can('edit_posts')) |
|
12 | + wp_die(__('Cheatin’ uh?'), 403); |
|
13 | 13 | |
14 | 14 | $wp_list_table = _get_list_table('WP_Comments_List_Table'); |
15 | 15 | $pagenum = $wp_list_table->get_pagenum(); |
16 | 16 | |
17 | 17 | $doaction = $wp_list_table->current_action(); |
18 | 18 | |
19 | -if ( $doaction ) { |
|
20 | - check_admin_referer( 'bulk-comments' ); |
|
19 | +if ($doaction) { |
|
20 | + check_admin_referer('bulk-comments'); |
|
21 | 21 | |
22 | - if ( 'delete_all' == $doaction && !empty( $_REQUEST['pagegen_timestamp'] ) ) { |
|
23 | - $comment_status = wp_unslash( $_REQUEST['comment_status'] ); |
|
24 | - $delete_time = wp_unslash( $_REQUEST['pagegen_timestamp'] ); |
|
25 | - $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 ) ); |
|
22 | + if ('delete_all' == $doaction && ! empty($_REQUEST['pagegen_timestamp'])) { |
|
23 | + $comment_status = wp_unslash($_REQUEST['comment_status']); |
|
24 | + $delete_time = wp_unslash($_REQUEST['pagegen_timestamp']); |
|
25 | + $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)); |
|
26 | 26 | $doaction = 'delete'; |
27 | - } elseif ( isset( $_REQUEST['delete_comments'] ) ) { |
|
27 | + } elseif (isset($_REQUEST['delete_comments'])) { |
|
28 | 28 | $comment_ids = $_REQUEST['delete_comments']; |
29 | - $doaction = ( $_REQUEST['action'] != -1 ) ? $_REQUEST['action'] : $_REQUEST['action2']; |
|
30 | - } elseif ( isset( $_REQUEST['ids'] ) ) { |
|
31 | - $comment_ids = array_map( 'absint', explode( ',', $_REQUEST['ids'] ) ); |
|
32 | - } elseif ( wp_get_referer() ) { |
|
33 | - wp_safe_redirect( wp_get_referer() ); |
|
29 | + $doaction = ($_REQUEST['action'] != -1) ? $_REQUEST['action'] : $_REQUEST['action2']; |
|
30 | + } elseif (isset($_REQUEST['ids'])) { |
|
31 | + $comment_ids = array_map('absint', explode(',', $_REQUEST['ids'])); |
|
32 | + } elseif (wp_get_referer()) { |
|
33 | + wp_safe_redirect(wp_get_referer()); |
|
34 | 34 | exit; |
35 | 35 | } |
36 | 36 | |
37 | 37 | $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; |
38 | 38 | |
39 | - $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); |
|
40 | - $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); |
|
39 | + $redirect_to = remove_query_arg(array('trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids'), wp_get_referer()); |
|
40 | + $redirect_to = add_query_arg('paged', $pagenum, $redirect_to); |
|
41 | 41 | |
42 | - foreach ( $comment_ids as $comment_id ) { // Check the permissions on each |
|
43 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
42 | + foreach ($comment_ids as $comment_id) { // Check the permissions on each |
|
43 | + if ( ! current_user_can('edit_comment', $comment_id)) |
|
44 | 44 | continue; |
45 | 45 | |
46 | - switch ( $doaction ) { |
|
46 | + switch ($doaction) { |
|
47 | 47 | case 'approve' : |
48 | - wp_set_comment_status( $comment_id, 'approve' ); |
|
48 | + wp_set_comment_status($comment_id, 'approve'); |
|
49 | 49 | $approved++; |
50 | 50 | break; |
51 | 51 | case 'unapprove' : |
52 | - wp_set_comment_status( $comment_id, 'hold' ); |
|
52 | + wp_set_comment_status($comment_id, 'hold'); |
|
53 | 53 | $unapproved++; |
54 | 54 | break; |
55 | 55 | case 'spam' : |
56 | - wp_spam_comment( $comment_id ); |
|
56 | + wp_spam_comment($comment_id); |
|
57 | 57 | $spammed++; |
58 | 58 | break; |
59 | 59 | case 'unspam' : |
60 | - wp_unspam_comment( $comment_id ); |
|
60 | + wp_unspam_comment($comment_id); |
|
61 | 61 | $unspammed++; |
62 | 62 | break; |
63 | 63 | case 'trash' : |
64 | - wp_trash_comment( $comment_id ); |
|
64 | + wp_trash_comment($comment_id); |
|
65 | 65 | $trashed++; |
66 | 66 | break; |
67 | 67 | case 'untrash' : |
68 | - wp_untrash_comment( $comment_id ); |
|
68 | + wp_untrash_comment($comment_id); |
|
69 | 69 | $untrashed++; |
70 | 70 | break; |
71 | 71 | case 'delete' : |
72 | - wp_delete_comment( $comment_id ); |
|
72 | + wp_delete_comment($comment_id); |
|
73 | 73 | $deleted++; |
74 | 74 | break; |
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
78 | - if ( $approved ) |
|
79 | - $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
|
80 | - if ( $unapproved ) |
|
81 | - $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
|
82 | - if ( $spammed ) |
|
83 | - $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
|
84 | - if ( $unspammed ) |
|
85 | - $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
|
86 | - if ( $trashed ) |
|
87 | - $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
|
88 | - if ( $untrashed ) |
|
89 | - $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
|
90 | - if ( $deleted ) |
|
91 | - $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
|
92 | - if ( $trashed || $spammed ) |
|
93 | - $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
|
94 | - |
|
95 | - wp_safe_redirect( $redirect_to ); |
|
78 | + if ($approved) |
|
79 | + $redirect_to = add_query_arg('approved', $approved, $redirect_to); |
|
80 | + if ($unapproved) |
|
81 | + $redirect_to = add_query_arg('unapproved', $unapproved, $redirect_to); |
|
82 | + if ($spammed) |
|
83 | + $redirect_to = add_query_arg('spammed', $spammed, $redirect_to); |
|
84 | + if ($unspammed) |
|
85 | + $redirect_to = add_query_arg('unspammed', $unspammed, $redirect_to); |
|
86 | + if ($trashed) |
|
87 | + $redirect_to = add_query_arg('trashed', $trashed, $redirect_to); |
|
88 | + if ($untrashed) |
|
89 | + $redirect_to = add_query_arg('untrashed', $untrashed, $redirect_to); |
|
90 | + if ($deleted) |
|
91 | + $redirect_to = add_query_arg('deleted', $deleted, $redirect_to); |
|
92 | + if ($trashed || $spammed) |
|
93 | + $redirect_to = add_query_arg('ids', join(',', $comment_ids), $redirect_to); |
|
94 | + |
|
95 | + wp_safe_redirect($redirect_to); |
|
96 | 96 | exit; |
97 | -} elseif ( ! empty( $_GET['_wp_http_referer'] ) ) { |
|
98 | - wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) ); |
|
97 | +} elseif ( ! empty($_GET['_wp_http_referer'])) { |
|
98 | + wp_redirect(remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI']))); |
|
99 | 99 | exit; |
100 | 100 | } |
101 | 101 | |
@@ -104,120 +104,120 @@ discard block |
||
104 | 104 | wp_enqueue_script('admin-comments'); |
105 | 105 | enqueue_comment_hotkeys_js(); |
106 | 106 | |
107 | -if ( $post_id ) |
|
108 | - $title = sprintf( __( 'Comments on “%s”' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) ); |
|
107 | +if ($post_id) |
|
108 | + $title = sprintf(__('Comments on “%s”'), wp_html_excerpt(_draft_or_post_title($post_id), 50, '…')); |
|
109 | 109 | else |
110 | 110 | $title = __('Comments'); |
111 | 111 | |
112 | -add_screen_option( 'per_page' ); |
|
112 | +add_screen_option('per_page'); |
|
113 | 113 | |
114 | -get_current_screen()->add_help_tab( array( |
|
114 | +get_current_screen()->add_help_tab(array( |
|
115 | 115 | 'id' => 'overview', |
116 | 116 | 'title' => __('Overview'), |
117 | 117 | 'content' => |
118 | - '<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>' |
|
119 | -) ); |
|
120 | -get_current_screen()->add_help_tab( array( |
|
118 | + '<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>' |
|
119 | +)); |
|
120 | +get_current_screen()->add_help_tab(array( |
|
121 | 121 | 'id' => 'moderating-comments', |
122 | 122 | 'title' => __('Moderating Comments'), |
123 | 123 | 'content' => |
124 | - '<p>' . __( 'A red bar on the left means the comment is waiting for you to moderate it.' ) . '</p>' . |
|
125 | - '<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>' . |
|
126 | - '<p>' . __( 'In the <strong>Comment</strong> column, above each comment it says “Submitted on,” followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site. Hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.' ) . '</p>' . |
|
127 | - '<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>' . |
|
128 | - '<p>' . __( 'Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.' ) . '</p>' |
|
129 | -) ); |
|
124 | + '<p>'.__('A red bar on the left means the comment is waiting for you to moderate it.').'</p>'. |
|
125 | + '<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>'. |
|
126 | + '<p>'.__('In the <strong>Comment</strong> column, above each comment it says “Submitted on,” followed by the date and time the comment was left on your site. Clicking on the date/time link will take you to that comment on your live site. Hovering over any comment gives you options to approve, reply (and approve), quick edit, edit, spam mark, or trash that comment.').'</p>'. |
|
127 | + '<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>'. |
|
128 | + '<p>'.__('Many people take advantage of keyboard shortcuts to moderate their comments more quickly. Use the link to the side to learn more.').'</p>' |
|
129 | +)); |
|
130 | 130 | |
131 | 131 | get_current_screen()->set_help_sidebar( |
132 | - '<p><strong>' . __( 'For more information:' ) . '</strong></p>' . |
|
133 | - '<p>' . __( '<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>' ) . '</p>' . |
|
134 | - '<p>' . __( '<a href="https://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>' ) . '</p>' . |
|
135 | - '<p>' . __( '<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>' ) . '</p>' . |
|
136 | - '<p>' . __( '<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>' ) . '</p>' |
|
132 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
133 | + '<p>'.__('<a href="https://codex.wordpress.org/Administration_Screens#Comments" target="_blank">Documentation on Comments</a>').'</p>'. |
|
134 | + '<p>'.__('<a href="https://codex.wordpress.org/Comment_Spam" target="_blank">Documentation on Comment Spam</a>').'</p>'. |
|
135 | + '<p>'.__('<a href="https://codex.wordpress.org/Keyboard_Shortcuts" target="_blank">Documentation on Keyboard Shortcuts</a>').'</p>'. |
|
136 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
137 | 137 | ); |
138 | 138 | |
139 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
139 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
140 | 140 | ?> |
141 | 141 | |
142 | 142 | <div class="wrap"> |
143 | 143 | <h1><?php |
144 | -if ( $post_id ) |
|
145 | - echo sprintf( __( 'Comments on “%s”' ), |
|
146 | - sprintf( '<a href="%s">%s</a>', |
|
147 | - get_edit_post_link( $post_id ), |
|
148 | - wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) |
|
144 | +if ($post_id) |
|
145 | + echo sprintf(__('Comments on “%s”'), |
|
146 | + sprintf('<a href="%s">%s</a>', |
|
147 | + get_edit_post_link($post_id), |
|
148 | + wp_html_excerpt(_draft_or_post_title($post_id), 50, '…') |
|
149 | 149 | ) |
150 | 150 | ); |
151 | 151 | else |
152 | - _e( 'Comments' ); |
|
152 | + _e('Comments'); |
|
153 | 153 | |
154 | -if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) |
|
155 | - echo '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '…' ) ) . '</span>'; ?> |
|
154 | +if (isset($_REQUEST['s']) && $_REQUEST['s']) |
|
155 | + echo '<span class="subtitle">'.sprintf(__('Search results for “%s”'), wp_html_excerpt(esc_html(wp_unslash($_REQUEST['s'])), 50, '…')).'</span>'; ?> |
|
156 | 156 | </h1> |
157 | 157 | |
158 | 158 | <?php |
159 | -if ( isset( $_REQUEST['error'] ) ) { |
|
159 | +if (isset($_REQUEST['error'])) { |
|
160 | 160 | $error = (int) $_REQUEST['error']; |
161 | 161 | $error_msg = ''; |
162 | - switch ( $error ) { |
|
162 | + switch ($error) { |
|
163 | 163 | case 1 : |
164 | - $error_msg = __( 'Invalid comment ID.' ); |
|
164 | + $error_msg = __('Invalid comment ID.'); |
|
165 | 165 | break; |
166 | 166 | case 2 : |
167 | - $error_msg = __( 'You are not allowed to edit comments on this post.' ); |
|
167 | + $error_msg = __('You are not allowed to edit comments on this post.'); |
|
168 | 168 | break; |
169 | 169 | } |
170 | - if ( $error_msg ) |
|
171 | - echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
|
170 | + if ($error_msg) |
|
171 | + echo '<div id="moderated" class="error"><p>'.$error_msg.'</p></div>'; |
|
172 | 172 | } |
173 | 173 | |
174 | -if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) { |
|
175 | - $approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; |
|
176 | - $deleted = isset( $_REQUEST['deleted'] ) ? (int) $_REQUEST['deleted'] : 0; |
|
177 | - $trashed = isset( $_REQUEST['trashed'] ) ? (int) $_REQUEST['trashed'] : 0; |
|
178 | - $untrashed = isset( $_REQUEST['untrashed'] ) ? (int) $_REQUEST['untrashed'] : 0; |
|
179 | - $spammed = isset( $_REQUEST['spammed'] ) ? (int) $_REQUEST['spammed'] : 0; |
|
180 | - $unspammed = isset( $_REQUEST['unspammed'] ) ? (int) $_REQUEST['unspammed'] : 0; |
|
181 | - $same = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0; |
|
174 | +if (isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same'])) { |
|
175 | + $approved = isset($_REQUEST['approved']) ? (int) $_REQUEST['approved'] : 0; |
|
176 | + $deleted = isset($_REQUEST['deleted']) ? (int) $_REQUEST['deleted'] : 0; |
|
177 | + $trashed = isset($_REQUEST['trashed']) ? (int) $_REQUEST['trashed'] : 0; |
|
178 | + $untrashed = isset($_REQUEST['untrashed']) ? (int) $_REQUEST['untrashed'] : 0; |
|
179 | + $spammed = isset($_REQUEST['spammed']) ? (int) $_REQUEST['spammed'] : 0; |
|
180 | + $unspammed = isset($_REQUEST['unspammed']) ? (int) $_REQUEST['unspammed'] : 0; |
|
181 | + $same = isset($_REQUEST['same']) ? (int) $_REQUEST['same'] : 0; |
|
182 | 182 | |
183 | - if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { |
|
184 | - if ( $approved > 0 ) |
|
185 | - $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); |
|
183 | + if ($approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0) { |
|
184 | + if ($approved > 0) |
|
185 | + $messages[] = sprintf(_n('%s comment approved', '%s comments approved', $approved), $approved); |
|
186 | 186 | |
187 | - if ( $spammed > 0 ) { |
|
187 | + if ($spammed > 0) { |
|
188 | 188 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
189 | - $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 />'; |
|
189 | + $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 />'; |
|
190 | 190 | } |
191 | 191 | |
192 | - if ( $unspammed > 0 ) |
|
193 | - $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); |
|
192 | + if ($unspammed > 0) |
|
193 | + $messages[] = sprintf(_n('%s comment restored from the spam', '%s comments restored from the spam', $unspammed), $unspammed); |
|
194 | 194 | |
195 | - if ( $trashed > 0 ) { |
|
195 | + if ($trashed > 0) { |
|
196 | 196 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
197 | - $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 />'; |
|
197 | + $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 />'; |
|
198 | 198 | } |
199 | 199 | |
200 | - if ( $untrashed > 0 ) |
|
201 | - $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); |
|
200 | + if ($untrashed > 0) |
|
201 | + $messages[] = sprintf(_n('%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed), $untrashed); |
|
202 | 202 | |
203 | - if ( $deleted > 0 ) |
|
204 | - $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); |
|
203 | + if ($deleted > 0) |
|
204 | + $messages[] = sprintf(_n('%s comment permanently deleted', '%s comments permanently deleted', $deleted), $deleted); |
|
205 | 205 | |
206 | - if ( $same > 0 && $comment = get_comment( $same ) ) { |
|
207 | - switch ( $comment->comment_approved ) { |
|
206 | + if ($same > 0 && $comment = get_comment($same)) { |
|
207 | + switch ($comment->comment_approved) { |
|
208 | 208 | case '1' : |
209 | - $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
|
209 | + $messages[] = __('This comment is already approved.').' <a href="'.esc_url(admin_url("comment.php?action=editcomment&c=$same")).'">'.__('Edit comment').'</a>'; |
|
210 | 210 | break; |
211 | 211 | case 'trash' : |
212 | - $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>'; |
|
212 | + $messages[] = __('This comment is already in the Trash.').' <a href="'.esc_url(admin_url('edit-comments.php?comment_status=trash')).'"> '.__('View Trash').'</a>'; |
|
213 | 213 | break; |
214 | 214 | case 'spam' : |
215 | - $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; |
|
215 | + $messages[] = __('This comment is already marked as spam.').' <a href="'.esc_url(admin_url("comment.php?action=editcomment&c=$same")).'">'.__('Edit comment').'</a>'; |
|
216 | 216 | break; |
217 | 217 | } |
218 | 218 | } |
219 | 219 | |
220 | - echo '<div id="moderated" class="updated notice is-dismissible"><p>' . implode( "<br/>\n", $messages ) . '</p></div>'; |
|
220 | + echo '<div id="moderated" class="updated notice is-dismissible"><p>'.implode("<br/>\n", $messages).'</p></div>'; |
|
221 | 221 | } |
222 | 222 | } |
223 | 223 | ?> |
@@ -226,20 +226,20 @@ discard block |
||
226 | 226 | |
227 | 227 | <form id="comments-form" method="get"> |
228 | 228 | |
229 | -<?php $wp_list_table->search_box( __( 'Search Comments' ), 'comment' ); ?> |
|
229 | +<?php $wp_list_table->search_box(__('Search Comments'), 'comment'); ?> |
|
230 | 230 | |
231 | -<?php if ( $post_id ) : ?> |
|
232 | -<input type="hidden" name="p" value="<?php echo esc_attr( intval( $post_id ) ); ?>" /> |
|
231 | +<?php if ($post_id) : ?> |
|
232 | +<input type="hidden" name="p" value="<?php echo esc_attr(intval($post_id)); ?>" /> |
|
233 | 233 | <?php endif; ?> |
234 | 234 | <input type="hidden" name="comment_status" value="<?php echo esc_attr($comment_status); ?>" /> |
235 | 235 | <input type="hidden" name="pagegen_timestamp" value="<?php echo esc_attr(current_time('mysql', 1)); ?>" /> |
236 | 236 | |
237 | -<input type="hidden" name="_total" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('total_items') ); ?>" /> |
|
238 | -<input type="hidden" name="_per_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('per_page') ); ?>" /> |
|
239 | -<input type="hidden" name="_page" value="<?php echo esc_attr( $wp_list_table->get_pagination_arg('page') ); ?>" /> |
|
237 | +<input type="hidden" name="_total" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('total_items')); ?>" /> |
|
238 | +<input type="hidden" name="_per_page" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('per_page')); ?>" /> |
|
239 | +<input type="hidden" name="_page" value="<?php echo esc_attr($wp_list_table->get_pagination_arg('page')); ?>" /> |
|
240 | 240 | |
241 | -<?php if ( isset($_REQUEST['paged']) ) { ?> |
|
242 | - <input type="hidden" name="paged" value="<?php echo esc_attr( absint( $_REQUEST['paged'] ) ); ?>" /> |
|
241 | +<?php if (isset($_REQUEST['paged'])) { ?> |
|
242 | + <input type="hidden" name="paged" value="<?php echo esc_attr(absint($_REQUEST['paged'])); ?>" /> |
|
243 | 243 | <?php } ?> |
244 | 244 | |
245 | 245 | <?php $wp_list_table->display(); ?> |
@@ -251,4 +251,4 @@ discard block |
||
251 | 251 | <?php |
252 | 252 | wp_comment_reply('-1', true, 'detail'); |
253 | 253 | wp_comment_trashnotice(); |
254 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
254 | +include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -8,8 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | -if ( !current_user_can('edit_posts') ) |
|
11 | +if ( !current_user_can('edit_posts') ) { |
|
12 | 12 | wp_die( __( 'Cheatin’ uh?' ), 403 ); |
13 | +} |
|
13 | 14 | |
14 | 15 | $wp_list_table = _get_list_table('WP_Comments_List_Table'); |
15 | 16 | $pagenum = $wp_list_table->get_pagenum(); |
@@ -40,8 +41,9 @@ discard block |
||
40 | 41 | $redirect_to = add_query_arg( 'paged', $pagenum, $redirect_to ); |
41 | 42 | |
42 | 43 | foreach ( $comment_ids as $comment_id ) { // Check the permissions on each |
43 | - if ( !current_user_can( 'edit_comment', $comment_id ) ) |
|
44 | - continue; |
|
44 | + if ( !current_user_can( 'edit_comment', $comment_id ) ) { |
|
45 | + continue; |
|
46 | + } |
|
45 | 47 | |
46 | 48 | switch ( $doaction ) { |
47 | 49 | case 'approve' : |
@@ -75,22 +77,30 @@ discard block |
||
75 | 77 | } |
76 | 78 | } |
77 | 79 | |
78 | - if ( $approved ) |
|
79 | - $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
|
80 | - if ( $unapproved ) |
|
81 | - $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
|
82 | - if ( $spammed ) |
|
83 | - $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
|
84 | - if ( $unspammed ) |
|
85 | - $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
|
86 | - if ( $trashed ) |
|
87 | - $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
|
88 | - if ( $untrashed ) |
|
89 | - $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
|
90 | - if ( $deleted ) |
|
91 | - $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
|
92 | - if ( $trashed || $spammed ) |
|
93 | - $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
|
80 | + if ( $approved ) { |
|
81 | + $redirect_to = add_query_arg( 'approved', $approved, $redirect_to ); |
|
82 | + } |
|
83 | + if ( $unapproved ) { |
|
84 | + $redirect_to = add_query_arg( 'unapproved', $unapproved, $redirect_to ); |
|
85 | + } |
|
86 | + if ( $spammed ) { |
|
87 | + $redirect_to = add_query_arg( 'spammed', $spammed, $redirect_to ); |
|
88 | + } |
|
89 | + if ( $unspammed ) { |
|
90 | + $redirect_to = add_query_arg( 'unspammed', $unspammed, $redirect_to ); |
|
91 | + } |
|
92 | + if ( $trashed ) { |
|
93 | + $redirect_to = add_query_arg( 'trashed', $trashed, $redirect_to ); |
|
94 | + } |
|
95 | + if ( $untrashed ) { |
|
96 | + $redirect_to = add_query_arg( 'untrashed', $untrashed, $redirect_to ); |
|
97 | + } |
|
98 | + if ( $deleted ) { |
|
99 | + $redirect_to = add_query_arg( 'deleted', $deleted, $redirect_to ); |
|
100 | + } |
|
101 | + if ( $trashed || $spammed ) { |
|
102 | + $redirect_to = add_query_arg( 'ids', join( ',', $comment_ids ), $redirect_to ); |
|
103 | + } |
|
94 | 104 | |
95 | 105 | wp_safe_redirect( $redirect_to ); |
96 | 106 | exit; |
@@ -104,10 +114,11 @@ discard block |
||
104 | 114 | wp_enqueue_script('admin-comments'); |
105 | 115 | enqueue_comment_hotkeys_js(); |
106 | 116 | |
107 | -if ( $post_id ) |
|
117 | +if ( $post_id ) { |
|
108 | 118 | $title = sprintf( __( 'Comments on “%s”' ), wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) ); |
109 | -else |
|
119 | +} else { |
|
110 | 120 | $title = __('Comments'); |
121 | +} |
|
111 | 122 | |
112 | 123 | add_screen_option( 'per_page' ); |
113 | 124 | |
@@ -141,18 +152,21 @@ discard block |
||
141 | 152 | |
142 | 153 | <div class="wrap"> |
143 | 154 | <h1><?php |
144 | -if ( $post_id ) |
|
155 | +if ( $post_id ) { |
|
145 | 156 | echo sprintf( __( 'Comments on “%s”' ), |
146 | 157 | sprintf( '<a href="%s">%s</a>', |
147 | 158 | get_edit_post_link( $post_id ), |
148 | 159 | wp_html_excerpt( _draft_or_post_title( $post_id ), 50, '…' ) |
149 | 160 | ) |
150 | 161 | ); |
151 | -else |
|
162 | +} else { |
|
152 | 163 | _e( 'Comments' ); |
164 | +} |
|
153 | 165 | |
154 | -if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) |
|
155 | - echo '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '…' ) ) . '</span>'; ?> |
|
166 | +if ( isset($_REQUEST['s']) && $_REQUEST['s'] ) { |
|
167 | + echo '<span class="subtitle">' . sprintf( __( 'Search results for “%s”' ), wp_html_excerpt( esc_html( wp_unslash( $_REQUEST['s'] ) ), 50, '…' ) ) . '</span>'; |
|
168 | +} |
|
169 | +?> |
|
156 | 170 | </h1> |
157 | 171 | |
158 | 172 | <?php |
@@ -167,9 +181,10 @@ discard block |
||
167 | 181 | $error_msg = __( 'You are not allowed to edit comments on this post.' ); |
168 | 182 | break; |
169 | 183 | } |
170 | - if ( $error_msg ) |
|
171 | - echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
|
172 | -} |
|
184 | + if ( $error_msg ) { |
|
185 | + echo '<div id="moderated" class="error"><p>' . $error_msg . '</p></div>'; |
|
186 | + } |
|
187 | + } |
|
173 | 188 | |
174 | 189 | if ( isset($_REQUEST['approved']) || isset($_REQUEST['deleted']) || isset($_REQUEST['trashed']) || isset($_REQUEST['untrashed']) || isset($_REQUEST['spammed']) || isset($_REQUEST['unspammed']) || isset($_REQUEST['same']) ) { |
175 | 190 | $approved = isset( $_REQUEST['approved'] ) ? (int) $_REQUEST['approved'] : 0; |
@@ -181,27 +196,31 @@ discard block |
||
181 | 196 | $same = isset( $_REQUEST['same'] ) ? (int) $_REQUEST['same'] : 0; |
182 | 197 | |
183 | 198 | if ( $approved > 0 || $deleted > 0 || $trashed > 0 || $untrashed > 0 || $spammed > 0 || $unspammed > 0 || $same > 0 ) { |
184 | - if ( $approved > 0 ) |
|
185 | - $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); |
|
199 | + if ( $approved > 0 ) { |
|
200 | + $messages[] = sprintf( _n( '%s comment approved', '%s comments approved', $approved ), $approved ); |
|
201 | + } |
|
186 | 202 | |
187 | 203 | if ( $spammed > 0 ) { |
188 | 204 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
189 | 205 | $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 />'; |
190 | 206 | } |
191 | 207 | |
192 | - if ( $unspammed > 0 ) |
|
193 | - $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); |
|
208 | + if ( $unspammed > 0 ) { |
|
209 | + $messages[] = sprintf( _n( '%s comment restored from the spam', '%s comments restored from the spam', $unspammed ), $unspammed ); |
|
210 | + } |
|
194 | 211 | |
195 | 212 | if ( $trashed > 0 ) { |
196 | 213 | $ids = isset($_REQUEST['ids']) ? $_REQUEST['ids'] : 0; |
197 | 214 | $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 />'; |
198 | 215 | } |
199 | 216 | |
200 | - if ( $untrashed > 0 ) |
|
201 | - $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); |
|
217 | + if ( $untrashed > 0 ) { |
|
218 | + $messages[] = sprintf( _n( '%s comment restored from the Trash', '%s comments restored from the Trash', $untrashed ), $untrashed ); |
|
219 | + } |
|
202 | 220 | |
203 | - if ( $deleted > 0 ) |
|
204 | - $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); |
|
221 | + if ( $deleted > 0 ) { |
|
222 | + $messages[] = sprintf( _n( '%s comment permanently deleted', '%s comments permanently deleted', $deleted ), $deleted ); |
|
223 | + } |
|
205 | 224 | |
206 | 225 | if ( $same > 0 && $comment = get_comment( $same ) ) { |
207 | 226 | switch ( $comment->comment_approved ) { |
@@ -1,10 +1,10 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Widgets administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Widgets administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | |
344 | 344 | <?php |
345 | 345 | /** |
346 | - * Fires before the Widgets administration page content loads. |
|
347 | - * |
|
348 | - * @since 3.0.0 |
|
349 | - */ |
|
346 | + * Fires before the Widgets administration page content loads. |
|
347 | + * |
|
348 | + * @since 3.0.0 |
|
349 | + */ |
|
350 | 350 | do_action( 'widgets_admin_page' ); ?> |
351 | 351 | |
352 | 352 | <div class="widget-liquid-left"> |
@@ -7,18 +7,18 @@ 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 | 12 | /** WordPress Administration Widgets API */ |
13 | -require_once(ABSPATH . 'wp-admin/includes/widgets.php'); |
|
13 | +require_once(ABSPATH.'wp-admin/includes/widgets.php'); |
|
14 | 14 | |
15 | -if ( ! current_user_can('edit_theme_options') ) |
|
16 | - wp_die( __( 'Cheatin’ uh?' ), 403 ); |
|
15 | +if ( ! current_user_can('edit_theme_options')) |
|
16 | + wp_die(__('Cheatin’ uh?'), 403); |
|
17 | 17 | |
18 | -$widgets_access = get_user_setting( 'widgets_access' ); |
|
19 | -if ( isset($_GET['widgets-access']) ) { |
|
18 | +$widgets_access = get_user_setting('widgets_access'); |
|
19 | +if (isset($_GET['widgets-access'])) { |
|
20 | 20 | $widgets_access = 'on' == $_GET['widgets-access'] ? 'on' : 'off'; |
21 | - set_user_setting( 'widgets_access', $widgets_access ); |
|
21 | + set_user_setting('widgets_access', $widgets_access); |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | return "$classes widgets_access "; |
31 | 31 | } |
32 | 32 | |
33 | -if ( 'on' == $widgets_access ) { |
|
34 | - add_filter( 'admin_body_class', 'wp_widgets_access_body_class' ); |
|
33 | +if ('on' == $widgets_access) { |
|
34 | + add_filter('admin_body_class', 'wp_widgets_access_body_class'); |
|
35 | 35 | } else { |
36 | 36 | wp_enqueue_script('admin-widgets'); |
37 | 37 | |
38 | - if ( wp_is_mobile() ) |
|
39 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
38 | + if (wp_is_mobile()) |
|
39 | + wp_enqueue_script('jquery-touch-punch'); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
@@ -45,68 +45,68 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @since 2.2.0 |
47 | 47 | */ |
48 | -do_action( 'sidebar_admin_setup' ); |
|
48 | +do_action('sidebar_admin_setup'); |
|
49 | 49 | |
50 | -$title = __( 'Widgets' ); |
|
50 | +$title = __('Widgets'); |
|
51 | 51 | $parent_file = 'themes.php'; |
52 | 52 | |
53 | -get_current_screen()->add_help_tab( array( |
|
53 | +get_current_screen()->add_help_tab(array( |
|
54 | 54 | 'id' => 'overview', |
55 | 55 | 'title' => __('Overview'), |
56 | 56 | 'content' => |
57 | - '<p>' . __('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.') . '</p> |
|
58 | - <p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.') . '</p>' |
|
59 | -) ); |
|
60 | -get_current_screen()->add_help_tab( array( |
|
57 | + '<p>'.__('Widgets are independent sections of content that can be placed into any widgetized area provided by your theme (commonly called sidebars). To populate your sidebars/widget areas with individual widgets, drag and drop the title bars into the desired area. By default, only the first widget area is expanded. To populate additional widget areas, click on their title bars to expand them.').'</p> |
|
58 | + <p>' . __('The Available Widgets section contains all the widgets you can choose from. Once you drag a widget into a sidebar, it will open to allow you to configure its settings. When you are happy with the widget settings, click the Save button and the widget will go live on your site. If you click Delete, it will remove the widget.').'</p>' |
|
59 | +)); |
|
60 | +get_current_screen()->add_help_tab(array( |
|
61 | 61 | 'id' => 'removing-reusing', |
62 | 62 | 'title' => __('Removing and Reusing'), |
63 | 63 | 'content' => |
64 | - '<p>' . __('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.') . '</p> |
|
65 | - <p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it’s not required.') . '</p> |
|
66 | - <p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.') . '</p>' |
|
67 | -) ); |
|
68 | -get_current_screen()->add_help_tab( array( |
|
64 | + '<p>'.__('If you want to remove the widget but save its setting for possible future use, just drag it into the Inactive Widgets area. You can add them back anytime from there. This is especially helpful when you switch to a theme with fewer or different widget areas.').'</p> |
|
65 | + <p>' . __('Widgets may be used multiple times. You can give each widget a title, to display on your site, but it’s not required.').'</p> |
|
66 | + <p>' . __('Enabling Accessibility Mode, via Screen Options, allows you to use Add and Edit buttons instead of using drag and drop.').'</p>' |
|
67 | +)); |
|
68 | +get_current_screen()->add_help_tab(array( |
|
69 | 69 | 'id' => 'missing-widgets', |
70 | 70 | 'title' => __('Missing Widgets'), |
71 | 71 | 'content' => |
72 | - '<p>' . __('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.') . '</p>' . |
|
73 | - '<p>' . __('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.') . '</p>' |
|
74 | -) ); |
|
72 | + '<p>'.__('Many themes show some sidebar widgets by default until you edit your sidebars, but they are not automatically displayed in your sidebar management tool. After you make your first widget change, you can re-add the default widgets by adding them from the Available Widgets area.').'</p>'. |
|
73 | + '<p>'.__('When changing themes, there is often some variation in the number and setup of widget areas/sidebars and sometimes these conflicts make the transition a bit less smooth. If you changed themes and seem to be missing widgets, scroll down on this screen to the Inactive Widgets area, where all of your widgets and their settings will have been saved.').'</p>' |
|
74 | +)); |
|
75 | 75 | |
76 | 76 | get_current_screen()->set_help_sidebar( |
77 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
78 | - '<p>' . __('<a href="https://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>') . '</p>' . |
|
79 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
77 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
78 | + '<p>'.__('<a href="https://codex.wordpress.org/Appearance_Widgets_Screen" target="_blank">Documentation on Widgets</a>').'</p>'. |
|
79 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
80 | 80 | ); |
81 | 81 | |
82 | -if ( ! current_theme_supports( 'widgets' ) ) { |
|
83 | - wp_die( __( 'The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.' ) ); |
|
82 | +if ( ! current_theme_supports('widgets')) { |
|
83 | + wp_die(__('The theme you are currently using isn’t widget-aware, meaning that it has no sidebars that you are able to change. For information on making your theme widget-aware, please <a href="https://codex.wordpress.org/Widgetizing_Themes">follow these instructions</a>.')); |
|
84 | 84 | } |
85 | 85 | |
86 | 86 | // These are the widgets grouped by sidebar |
87 | 87 | $sidebars_widgets = wp_get_sidebars_widgets(); |
88 | 88 | |
89 | -if ( empty( $sidebars_widgets ) ) |
|
89 | +if (empty($sidebars_widgets)) |
|
90 | 90 | $sidebars_widgets = wp_get_widget_defaults(); |
91 | 91 | |
92 | -foreach ( $sidebars_widgets as $sidebar_id => $widgets ) { |
|
93 | - if ( 'wp_inactive_widgets' == $sidebar_id ) |
|
92 | +foreach ($sidebars_widgets as $sidebar_id => $widgets) { |
|
93 | + if ('wp_inactive_widgets' == $sidebar_id) |
|
94 | 94 | continue; |
95 | 95 | |
96 | - if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) ) { |
|
97 | - if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar |
|
96 | + if ( ! isset($wp_registered_sidebars[$sidebar_id])) { |
|
97 | + if ( ! empty($widgets)) { // register the inactive_widgets area as sidebar |
|
98 | 98 | register_sidebar(array( |
99 | - 'name' => __( 'Inactive Sidebar (not used)' ), |
|
99 | + 'name' => __('Inactive Sidebar (not used)'), |
|
100 | 100 | 'id' => $sidebar_id, |
101 | 101 | 'class' => 'inactive-sidebar orphan-sidebar', |
102 | - 'description' => __( 'This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.' ), |
|
102 | + 'description' => __('This sidebar is no longer available and does not show anywhere on your site. Remove each of the widgets below to fully remove this inactive sidebar.'), |
|
103 | 103 | 'before_widget' => '', |
104 | 104 | 'after_widget' => '', |
105 | 105 | 'before_title' => '', |
106 | 106 | 'after_title' => '', |
107 | 107 | )); |
108 | 108 | } else { |
109 | - unset( $sidebars_widgets[ $sidebar_id ] ); |
|
109 | + unset($sidebars_widgets[$sidebar_id]); |
|
110 | 110 | } |
111 | 111 | } |
112 | 112 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | 'name' => __('Inactive Widgets'), |
117 | 117 | 'id' => 'wp_inactive_widgets', |
118 | 118 | 'class' => 'inactive-sidebar', |
119 | - 'description' => __( 'Drag widgets here to remove them from the sidebar but keep their settings.' ), |
|
119 | + 'description' => __('Drag widgets here to remove them from the sidebar but keep their settings.'), |
|
120 | 120 | 'before_widget' => '', |
121 | 121 | 'after_widget' => '', |
122 | 122 | 'before_title' => '', |
@@ -126,46 +126,46 @@ discard block |
||
126 | 126 | retrieve_widgets(); |
127 | 127 | |
128 | 128 | // We're saving a widget without js |
129 | -if ( isset($_POST['savewidget']) || isset($_POST['removewidget']) ) { |
|
129 | +if (isset($_POST['savewidget']) || isset($_POST['removewidget'])) { |
|
130 | 130 | $widget_id = $_POST['widget-id']; |
131 | 131 | check_admin_referer("save-delete-widget-$widget_id"); |
132 | 132 | |
133 | 133 | $number = isset($_POST['multi_number']) ? (int) $_POST['multi_number'] : ''; |
134 | - if ( $number ) { |
|
135 | - foreach ( $_POST as $key => $val ) { |
|
136 | - if ( is_array($val) && preg_match('/__i__|%i%/', key($val)) ) { |
|
137 | - $_POST[$key] = array( $number => array_shift($val) ); |
|
134 | + if ($number) { |
|
135 | + foreach ($_POST as $key => $val) { |
|
136 | + if (is_array($val) && preg_match('/__i__|%i%/', key($val))) { |
|
137 | + $_POST[$key] = array($number => array_shift($val)); |
|
138 | 138 | break; |
139 | 139 | } |
140 | 140 | } |
141 | 141 | } |
142 | 142 | |
143 | 143 | $sidebar_id = $_POST['sidebar']; |
144 | - $position = isset($_POST[$sidebar_id . '_position']) ? (int) $_POST[$sidebar_id . '_position'] - 1 : 0; |
|
144 | + $position = isset($_POST[$sidebar_id.'_position']) ? (int) $_POST[$sidebar_id.'_position'] - 1 : 0; |
|
145 | 145 | |
146 | 146 | $id_base = $_POST['id_base']; |
147 | 147 | $sidebar = isset($sidebars_widgets[$sidebar_id]) ? $sidebars_widgets[$sidebar_id] : array(); |
148 | 148 | |
149 | 149 | // Delete. |
150 | - if ( isset($_POST['removewidget']) && $_POST['removewidget'] ) { |
|
150 | + if (isset($_POST['removewidget']) && $_POST['removewidget']) { |
|
151 | 151 | |
152 | - if ( !in_array($widget_id, $sidebar, true) ) { |
|
153 | - wp_redirect( admin_url('widgets.php?error=0') ); |
|
152 | + if ( ! in_array($widget_id, $sidebar, true)) { |
|
153 | + wp_redirect(admin_url('widgets.php?error=0')); |
|
154 | 154 | exit; |
155 | 155 | } |
156 | 156 | |
157 | - $sidebar = array_diff( $sidebar, array($widget_id) ); |
|
158 | - $_POST = array('sidebar' => $sidebar_id, 'widget-' . $id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); |
|
157 | + $sidebar = array_diff($sidebar, array($widget_id)); |
|
158 | + $_POST = array('sidebar' => $sidebar_id, 'widget-'.$id_base => array(), 'the-widget-id' => $widget_id, 'delete_widget' => '1'); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | $_POST['widget-id'] = $sidebar; |
162 | 162 | |
163 | - foreach ( (array) $wp_registered_widget_updates as $name => $control ) { |
|
164 | - if ( $name != $id_base || !is_callable($control['callback']) ) |
|
163 | + foreach ((array) $wp_registered_widget_updates as $name => $control) { |
|
164 | + if ($name != $id_base || ! is_callable($control['callback'])) |
|
165 | 165 | continue; |
166 | 166 | |
167 | 167 | ob_start(); |
168 | - call_user_func_array( $control['callback'], $control['params'] ); |
|
168 | + call_user_func_array($control['callback'], $control['params']); |
|
169 | 169 | ob_end_clean(); |
170 | 170 | |
171 | 171 | break; |
@@ -174,36 +174,36 @@ discard block |
||
174 | 174 | $sidebars_widgets[$sidebar_id] = $sidebar; |
175 | 175 | |
176 | 176 | // Remove old position. |
177 | - if ( !isset($_POST['delete_widget']) ) { |
|
178 | - foreach ( $sidebars_widgets as $key => $sb ) { |
|
179 | - if ( is_array($sb) ) |
|
180 | - $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) ); |
|
177 | + if ( ! isset($_POST['delete_widget'])) { |
|
178 | + foreach ($sidebars_widgets as $key => $sb) { |
|
179 | + if (is_array($sb)) |
|
180 | + $sidebars_widgets[$key] = array_diff($sb, array($widget_id)); |
|
181 | 181 | } |
182 | - array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id ); |
|
182 | + array_splice($sidebars_widgets[$sidebar_id], $position, 0, $widget_id); |
|
183 | 183 | } |
184 | 184 | |
185 | 185 | wp_set_sidebars_widgets($sidebars_widgets); |
186 | - wp_redirect( admin_url('widgets.php?message=0') ); |
|
186 | + wp_redirect(admin_url('widgets.php?message=0')); |
|
187 | 187 | exit; |
188 | 188 | } |
189 | 189 | |
190 | 190 | // Output the widget form without js |
191 | -if ( isset($_GET['editwidget']) && $_GET['editwidget'] ) { |
|
191 | +if (isset($_GET['editwidget']) && $_GET['editwidget']) { |
|
192 | 192 | $widget_id = $_GET['editwidget']; |
193 | 193 | |
194 | - if ( isset($_GET['addnew']) ) { |
|
194 | + if (isset($_GET['addnew'])) { |
|
195 | 195 | // Default to the first sidebar |
196 | - $keys = array_keys( $wp_registered_sidebars ); |
|
197 | - $sidebar = reset( $keys ); |
|
196 | + $keys = array_keys($wp_registered_sidebars); |
|
197 | + $sidebar = reset($keys); |
|
198 | 198 | |
199 | - if ( isset($_GET['base']) && isset($_GET['num']) ) { // multi-widget |
|
199 | + if (isset($_GET['base']) && isset($_GET['num'])) { // multi-widget |
|
200 | 200 | // Copy minimal info from an existing instance of this widget to a new instance |
201 | - foreach ( $wp_registered_widget_controls as $control ) { |
|
202 | - if ( $_GET['base'] === $control['id_base'] ) { |
|
201 | + foreach ($wp_registered_widget_controls as $control) { |
|
202 | + if ($_GET['base'] === $control['id_base']) { |
|
203 | 203 | $control_callback = $control['callback']; |
204 | 204 | $multi_number = (int) $_GET['num']; |
205 | 205 | $control['params'][0]['number'] = -1; |
206 | - $widget_id = $control['id'] = $control['id_base'] . '-' . $multi_number; |
|
206 | + $widget_id = $control['id'] = $control['id_base'].'-'.$multi_number; |
|
207 | 207 | $wp_registered_widget_controls[$control['id']] = $control; |
208 | 208 | break; |
209 | 209 | } |
@@ -211,66 +211,66 @@ discard block |
||
211 | 211 | } |
212 | 212 | } |
213 | 213 | |
214 | - if ( isset($wp_registered_widget_controls[$widget_id]) && !isset($control) ) { |
|
214 | + if (isset($wp_registered_widget_controls[$widget_id]) && ! isset($control)) { |
|
215 | 215 | $control = $wp_registered_widget_controls[$widget_id]; |
216 | 216 | $control_callback = $control['callback']; |
217 | - } elseif ( !isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id]) ) { |
|
218 | - $name = esc_html( strip_tags($wp_registered_widgets[$widget_id]['name']) ); |
|
217 | + } elseif ( ! isset($wp_registered_widget_controls[$widget_id]) && isset($wp_registered_widgets[$widget_id])) { |
|
218 | + $name = esc_html(strip_tags($wp_registered_widgets[$widget_id]['name'])); |
|
219 | 219 | } |
220 | 220 | |
221 | - if ( !isset($name) ) |
|
222 | - $name = esc_html( strip_tags($control['name']) ); |
|
221 | + if ( ! isset($name)) |
|
222 | + $name = esc_html(strip_tags($control['name'])); |
|
223 | 223 | |
224 | - if ( !isset($sidebar) ) |
|
224 | + if ( ! isset($sidebar)) |
|
225 | 225 | $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets'; |
226 | 226 | |
227 | - if ( !isset($multi_number) ) |
|
227 | + if ( ! isset($multi_number)) |
|
228 | 228 | $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; |
229 | 229 | |
230 | 230 | $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id']; |
231 | 231 | |
232 | 232 | // Show the widget form. |
233 | - $width = ' style="width:' . max($control['width'], 350) . 'px"'; |
|
233 | + $width = ' style="width:'.max($control['width'], 350).'px"'; |
|
234 | 234 | $key = isset($_GET['key']) ? (int) $_GET['key'] : 0; |
235 | 235 | |
236 | - require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
236 | + require_once(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
237 | 237 | <div class="wrap"> |
238 | - <h1><?php echo esc_html( $title ); ?></h1> |
|
238 | + <h1><?php echo esc_html($title); ?></h1> |
|
239 | 239 | <div class="editwidget"<?php echo $width; ?>> |
240 | - <h3><?php printf( __( 'Widget %s' ), $name ); ?></h3> |
|
240 | + <h3><?php printf(__('Widget %s'), $name); ?></h3> |
|
241 | 241 | |
242 | 242 | <form action="widgets.php" method="post"> |
243 | 243 | <div class="widget-inside"> |
244 | 244 | <?php |
245 | - if ( is_callable( $control_callback ) ) |
|
246 | - call_user_func_array( $control_callback, $control['params'] ); |
|
245 | + if (is_callable($control_callback)) |
|
246 | + call_user_func_array($control_callback, $control['params']); |
|
247 | 247 | else |
248 | - echo '<p>' . __('There are no options for this widget.') . "</p>\n"; ?> |
|
248 | + echo '<p>'.__('There are no options for this widget.')."</p>\n"; ?> |
|
249 | 249 | </div> |
250 | 250 | |
251 | 251 | <p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p> |
252 | 252 | <div class="widget-position"> |
253 | 253 | <table class="widefat"><thead><tr><th><?php _e('Sidebar'); ?></th><th><?php _e('Position'); ?></th></tr></thead><tbody> |
254 | 254 | <?php |
255 | - foreach ( $wp_registered_sidebars as $sbname => $sbvalue ) { |
|
256 | - echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='" . esc_attr($sbname) . "'" . checked( $sbname, $sidebar, false ) . " /> $sbvalue[name]</label></td><td>"; |
|
257 | - if ( 'wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr( $sbname, 0, 16 ) ) { |
|
255 | + foreach ($wp_registered_sidebars as $sbname => $sbvalue) { |
|
256 | + echo "\t\t<tr><td><label><input type='radio' name='sidebar' value='".esc_attr($sbname)."'".checked($sbname, $sidebar, false)." /> $sbvalue[name]</label></td><td>"; |
|
257 | + if ('wp_inactive_widgets' == $sbname || 'orphaned_widgets' == substr($sbname, 0, 16)) { |
|
258 | 258 | echo ' '; |
259 | 259 | } else { |
260 | - if ( !isset($sidebars_widgets[$sbname]) || !is_array($sidebars_widgets[$sbname]) ) { |
|
260 | + if ( ! isset($sidebars_widgets[$sbname]) || ! is_array($sidebars_widgets[$sbname])) { |
|
261 | 261 | $j = 1; |
262 | 262 | $sidebars_widgets[$sbname] = array(); |
263 | 263 | } else { |
264 | 264 | $j = count($sidebars_widgets[$sbname]); |
265 | - if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
265 | + if (isset($_GET['addnew']) || ! in_array($widget_id, $sidebars_widgets[$sbname], true)) |
|
266 | 266 | $j++; |
267 | 267 | } |
268 | 268 | $selected = ''; |
269 | 269 | echo "\t\t<select name='{$sbname}_position'>\n"; |
270 | - echo "\t\t<option value=''>" . __('— Select —') . "</option>\n"; |
|
271 | - for ( $i = 1; $i <= $j; $i++ ) { |
|
272 | - if ( in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
273 | - $selected = selected( $i, $key + 1, false ); |
|
270 | + echo "\t\t<option value=''>".__('— Select —')."</option>\n"; |
|
271 | + for ($i = 1; $i <= $j; $i++) { |
|
272 | + if (in_array($widget_id, $sidebars_widgets[$sbname], true)) |
|
273 | + $selected = selected($i, $key + 1, false); |
|
274 | 274 | echo "\t\t<option value='$i'$selected> $i </option>\n"; |
275 | 275 | } |
276 | 276 | echo "\t\t</select>\n"; |
@@ -282,13 +282,13 @@ discard block |
||
282 | 282 | |
283 | 283 | <div class="widget-control-actions"> |
284 | 284 | <?php |
285 | - if ( isset($_GET['addnew']) ) { ?> |
|
285 | + if (isset($_GET['addnew'])) { ?> |
|
286 | 286 | <a href="widgets.php" class="button alignleft"><?php _e('Cancel'); ?></a> |
287 | 287 | <?php |
288 | 288 | } else { |
289 | - submit_button( __( 'Delete' ), 'button alignleft', 'removewidget', false ); |
|
289 | + submit_button(__('Delete'), 'button alignleft', 'removewidget', false); |
|
290 | 290 | } |
291 | - submit_button( __( 'Save Widget' ), 'button-primary alignright', 'savewidget', false ); ?> |
|
291 | + submit_button(__('Save Widget'), 'button-primary alignright', 'savewidget', false); ?> |
|
292 | 292 | <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr($widget_id); ?>" /> |
293 | 293 | <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr($id_base); ?>" /> |
294 | 294 | <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr($multi_number); ?>" /> |
@@ -299,7 +299,7 @@ discard block |
||
299 | 299 | </div> |
300 | 300 | </div> |
301 | 301 | <?php |
302 | - require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
302 | + require_once(ABSPATH.'wp-admin/admin-footer.php'); |
|
303 | 303 | exit; |
304 | 304 | } |
305 | 305 | |
@@ -312,32 +312,32 @@ discard block |
||
312 | 312 | __('Error in displaying the widget settings form.') |
313 | 313 | ); |
314 | 314 | |
315 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
315 | +require_once(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
316 | 316 | |
317 | 317 | <div class="wrap"> |
318 | 318 | <h1> |
319 | 319 | <?php |
320 | - echo esc_html( $title ); |
|
321 | - if ( current_user_can( 'customize' ) ) { |
|
320 | + echo esc_html($title); |
|
321 | + if (current_user_can('customize')) { |
|
322 | 322 | printf( |
323 | 323 | ' <a class="page-title-action hide-if-no-customize" href="%1$s">%2$s</a>', |
324 | - esc_url( add_query_arg( |
|
324 | + esc_url(add_query_arg( |
|
325 | 325 | array( |
326 | - array( 'autofocus' => array( 'panel' => 'widgets' ) ), |
|
327 | - 'return' => urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ) |
|
326 | + array('autofocus' => array('panel' => 'widgets')), |
|
327 | + 'return' => urlencode(wp_unslash($_SERVER['REQUEST_URI'])) |
|
328 | 328 | ), |
329 | - admin_url( 'customize.php' ) |
|
330 | - ) ), |
|
331 | - __( 'Manage in Customizer' ) |
|
329 | + admin_url('customize.php') |
|
330 | + )), |
|
331 | + __('Manage in Customizer') |
|
332 | 332 | ); |
333 | 333 | } |
334 | 334 | ?> |
335 | 335 | </h1> |
336 | 336 | |
337 | -<?php if ( isset($_GET['message']) && isset($messages[$_GET['message']]) ) { ?> |
|
337 | +<?php if (isset($_GET['message']) && isset($messages[$_GET['message']])) { ?> |
|
338 | 338 | <div id="message" class="updated notice is-dismissible"><p><?php echo $messages[$_GET['message']]; ?></p></div> |
339 | 339 | <?php } ?> |
340 | -<?php if ( isset($_GET['error']) && isset($errors[$_GET['error']]) ) { ?> |
|
340 | +<?php if (isset($_GET['error']) && isset($errors[$_GET['error']])) { ?> |
|
341 | 341 | <div id="message" class="error"><p><?php echo $errors[$_GET['error']]; ?></p></div> |
342 | 342 | <?php } ?> |
343 | 343 | |
@@ -347,7 +347,7 @@ discard block |
||
347 | 347 | * |
348 | 348 | * @since 3.0.0 |
349 | 349 | */ |
350 | -do_action( 'widgets_admin_page' ); ?> |
|
350 | +do_action('widgets_admin_page'); ?> |
|
351 | 351 | |
352 | 352 | <div class="widget-liquid-left"> |
353 | 353 | <div id="widgets-left"> |
@@ -371,16 +371,16 @@ discard block |
||
371 | 371 | <?php |
372 | 372 | |
373 | 373 | $theme_sidebars = array(); |
374 | -foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) { |
|
375 | - if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) { |
|
374 | +foreach ($wp_registered_sidebars as $sidebar => $registered_sidebar) { |
|
375 | + if (false !== strpos($registered_sidebar['class'], 'inactive-sidebar') || 'orphaned_widgets' == substr($sidebar, 0, 16)) { |
|
376 | 376 | $wrap_class = 'widgets-holder-wrap'; |
377 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
378 | - $wrap_class .= ' ' . $registered_sidebar['class']; |
|
377 | + if ( ! empty($registered_sidebar['class'])) |
|
378 | + $wrap_class .= ' '.$registered_sidebar['class']; |
|
379 | 379 | |
380 | 380 | ?> |
381 | - <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
|
381 | + <div class="<?php echo esc_attr($wrap_class); ?>"> |
|
382 | 382 | <div class="widget-holder inactive"> |
383 | - <?php wp_list_widget_controls( $registered_sidebar['id'], $registered_sidebar['name'] ); ?> |
|
383 | + <?php wp_list_widget_controls($registered_sidebar['id'], $registered_sidebar['name']); ?> |
|
384 | 384 | <div class="clear"></div> |
385 | 385 | </div> |
386 | 386 | </div> |
@@ -398,10 +398,10 @@ discard block |
||
398 | 398 | |
399 | 399 | $i = $split = 0; |
400 | 400 | $single_sidebar_class = ''; |
401 | -$sidebars_count = count( $theme_sidebars ); |
|
401 | +$sidebars_count = count($theme_sidebars); |
|
402 | 402 | |
403 | -if ( $sidebars_count > 1 ) { |
|
404 | - $split = ceil( $sidebars_count / 2 ); |
|
403 | +if ($sidebars_count > 1) { |
|
404 | + $split = ceil($sidebars_count / 2); |
|
405 | 405 | } else { |
406 | 406 | $single_sidebar_class = ' class="single-sidebar"'; |
407 | 407 | } |
@@ -412,23 +412,23 @@ discard block |
||
412 | 412 | <div class="sidebars-column-1"> |
413 | 413 | <?php |
414 | 414 | |
415 | -foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) { |
|
415 | +foreach ($theme_sidebars as $sidebar => $registered_sidebar) { |
|
416 | 416 | $wrap_class = 'widgets-holder-wrap'; |
417 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
418 | - $wrap_class .= ' sidebar-' . $registered_sidebar['class']; |
|
417 | + if ( ! empty($registered_sidebar['class'])) |
|
418 | + $wrap_class .= ' sidebar-'.$registered_sidebar['class']; |
|
419 | 419 | |
420 | - if ( $i > 0 ) |
|
420 | + if ($i > 0) |
|
421 | 421 | $wrap_class .= ' closed'; |
422 | 422 | |
423 | - if ( $split && $i == $split ) { |
|
423 | + if ($split && $i == $split) { |
|
424 | 424 | ?> |
425 | 425 | </div><div class="sidebars-column-2"> |
426 | 426 | <?php |
427 | 427 | } |
428 | 428 | |
429 | 429 | ?> |
430 | - <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
|
431 | - <?php wp_list_widget_controls( $sidebar, $registered_sidebar['name'] ); // Show the control forms for each of the widgets in this sidebar ?> |
|
430 | + <div class="<?php echo esc_attr($wrap_class); ?>"> |
|
431 | + <?php wp_list_widget_controls($sidebar, $registered_sidebar['name']); // Show the control forms for each of the widgets in this sidebar ?> |
|
432 | 432 | </div> |
433 | 433 | <?php |
434 | 434 | |
@@ -440,7 +440,7 @@ discard block |
||
440 | 440 | </div> |
441 | 441 | </div> |
442 | 442 | <form method="post"> |
443 | -<?php wp_nonce_field( 'save-sidebar-widgets', '_wpnonce_widgets', false ); ?> |
|
443 | +<?php wp_nonce_field('save-sidebar-widgets', '_wpnonce_widgets', false); ?> |
|
444 | 444 | </form> |
445 | 445 | <br class="clear" /> |
446 | 446 | </div> |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | <div class="widgets-chooser"> |
449 | 449 | <ul class="widgets-chooser-sidebars"></ul> |
450 | 450 | <div class="widgets-chooser-actions"> |
451 | - <button class="button-secondary"><?php _e( 'Cancel' ); ?></button> |
|
452 | - <button class="button-primary"><?php _e( 'Add Widget' ); ?></button> |
|
451 | + <button class="button-secondary"><?php _e('Cancel'); ?></button> |
|
452 | + <button class="button-primary"><?php _e('Add Widget'); ?></button> |
|
453 | 453 | </div> |
454 | 454 | </div> |
455 | 455 | |
@@ -460,5 +460,5 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @since 2.2.0 |
462 | 462 | */ |
463 | -do_action( 'sidebar_admin_page' ); |
|
464 | -require_once( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
463 | +do_action('sidebar_admin_page'); |
|
464 | +require_once(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -12,8 +12,9 @@ discard block |
||
12 | 12 | /** WordPress Administration Widgets API */ |
13 | 13 | require_once(ABSPATH . 'wp-admin/includes/widgets.php'); |
14 | 14 | |
15 | -if ( ! current_user_can('edit_theme_options') ) |
|
15 | +if ( ! current_user_can('edit_theme_options') ) { |
|
16 | 16 | wp_die( __( 'Cheatin’ uh?' ), 403 ); |
17 | +} |
|
17 | 18 | |
18 | 19 | $widgets_access = get_user_setting( 'widgets_access' ); |
19 | 20 | if ( isset($_GET['widgets-access']) ) { |
@@ -35,9 +36,10 @@ discard block |
||
35 | 36 | } else { |
36 | 37 | wp_enqueue_script('admin-widgets'); |
37 | 38 | |
38 | - if ( wp_is_mobile() ) |
|
39 | - wp_enqueue_script( 'jquery-touch-punch' ); |
|
40 | -} |
|
39 | + if ( wp_is_mobile() ) { |
|
40 | + wp_enqueue_script( 'jquery-touch-punch' ); |
|
41 | + } |
|
42 | + } |
|
41 | 43 | |
42 | 44 | /** |
43 | 45 | * Fires early before the Widgets administration screen loads, |
@@ -86,12 +88,14 @@ discard block |
||
86 | 88 | // These are the widgets grouped by sidebar |
87 | 89 | $sidebars_widgets = wp_get_sidebars_widgets(); |
88 | 90 | |
89 | -if ( empty( $sidebars_widgets ) ) |
|
91 | +if ( empty( $sidebars_widgets ) ) { |
|
90 | 92 | $sidebars_widgets = wp_get_widget_defaults(); |
93 | +} |
|
91 | 94 | |
92 | 95 | foreach ( $sidebars_widgets as $sidebar_id => $widgets ) { |
93 | - if ( 'wp_inactive_widgets' == $sidebar_id ) |
|
94 | - continue; |
|
96 | + if ( 'wp_inactive_widgets' == $sidebar_id ) { |
|
97 | + continue; |
|
98 | + } |
|
95 | 99 | |
96 | 100 | if ( !isset( $wp_registered_sidebars[ $sidebar_id ] ) ) { |
97 | 101 | if ( ! empty( $widgets ) ) { // register the inactive_widgets area as sidebar |
@@ -161,8 +165,9 @@ discard block |
||
161 | 165 | $_POST['widget-id'] = $sidebar; |
162 | 166 | |
163 | 167 | foreach ( (array) $wp_registered_widget_updates as $name => $control ) { |
164 | - if ( $name != $id_base || !is_callable($control['callback']) ) |
|
165 | - continue; |
|
168 | + if ( $name != $id_base || !is_callable($control['callback']) ) { |
|
169 | + continue; |
|
170 | + } |
|
166 | 171 | |
167 | 172 | ob_start(); |
168 | 173 | call_user_func_array( $control['callback'], $control['params'] ); |
@@ -176,8 +181,9 @@ discard block |
||
176 | 181 | // Remove old position. |
177 | 182 | if ( !isset($_POST['delete_widget']) ) { |
178 | 183 | foreach ( $sidebars_widgets as $key => $sb ) { |
179 | - if ( is_array($sb) ) |
|
180 | - $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) ); |
|
184 | + if ( is_array($sb) ) { |
|
185 | + $sidebars_widgets[$key] = array_diff( $sb, array($widget_id) ); |
|
186 | + } |
|
181 | 187 | } |
182 | 188 | array_splice( $sidebars_widgets[$sidebar_id], $position, 0, $widget_id ); |
183 | 189 | } |
@@ -218,14 +224,17 @@ discard block |
||
218 | 224 | $name = esc_html( strip_tags($wp_registered_widgets[$widget_id]['name']) ); |
219 | 225 | } |
220 | 226 | |
221 | - if ( !isset($name) ) |
|
222 | - $name = esc_html( strip_tags($control['name']) ); |
|
227 | + if ( !isset($name) ) { |
|
228 | + $name = esc_html( strip_tags($control['name']) ); |
|
229 | + } |
|
223 | 230 | |
224 | - if ( !isset($sidebar) ) |
|
225 | - $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets'; |
|
231 | + if ( !isset($sidebar) ) { |
|
232 | + $sidebar = isset($_GET['sidebar']) ? $_GET['sidebar'] : 'wp_inactive_widgets'; |
|
233 | + } |
|
226 | 234 | |
227 | - if ( !isset($multi_number) ) |
|
228 | - $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; |
|
235 | + if ( !isset($multi_number) ) { |
|
236 | + $multi_number = isset($control['params'][0]['number']) ? $control['params'][0]['number'] : ''; |
|
237 | + } |
|
229 | 238 | |
230 | 239 | $id_base = isset($control['id_base']) ? $control['id_base'] : $control['id']; |
231 | 240 | |
@@ -242,10 +251,12 @@ discard block |
||
242 | 251 | <form action="widgets.php" method="post"> |
243 | 252 | <div class="widget-inside"> |
244 | 253 | <?php |
245 | - if ( is_callable( $control_callback ) ) |
|
246 | - call_user_func_array( $control_callback, $control['params'] ); |
|
247 | - else |
|
248 | - echo '<p>' . __('There are no options for this widget.') . "</p>\n"; ?> |
|
254 | + if ( is_callable( $control_callback ) ) { |
|
255 | + call_user_func_array( $control_callback, $control['params'] ); |
|
256 | + } else { |
|
257 | + echo '<p>' . __('There are no options for this widget.') . "</p>\n"; |
|
258 | + } |
|
259 | + ?> |
|
249 | 260 | </div> |
250 | 261 | |
251 | 262 | <p class="describe"><?php _e('Select both the sidebar for this widget and the position of the widget in that sidebar.'); ?></p> |
@@ -262,15 +273,17 @@ discard block |
||
262 | 273 | $sidebars_widgets[$sbname] = array(); |
263 | 274 | } else { |
264 | 275 | $j = count($sidebars_widgets[$sbname]); |
265 | - if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
266 | - $j++; |
|
276 | + if ( isset($_GET['addnew']) || !in_array($widget_id, $sidebars_widgets[$sbname], true) ) { |
|
277 | + $j++; |
|
278 | + } |
|
267 | 279 | } |
268 | 280 | $selected = ''; |
269 | 281 | echo "\t\t<select name='{$sbname}_position'>\n"; |
270 | 282 | echo "\t\t<option value=''>" . __('— Select —') . "</option>\n"; |
271 | 283 | for ( $i = 1; $i <= $j; $i++ ) { |
272 | - if ( in_array($widget_id, $sidebars_widgets[$sbname], true) ) |
|
273 | - $selected = selected( $i, $key + 1, false ); |
|
284 | + if ( in_array($widget_id, $sidebars_widgets[$sbname], true) ) { |
|
285 | + $selected = selected( $i, $key + 1, false ); |
|
286 | + } |
|
274 | 287 | echo "\t\t<option value='$i'$selected> $i </option>\n"; |
275 | 288 | } |
276 | 289 | echo "\t\t</select>\n"; |
@@ -374,8 +387,9 @@ discard block |
||
374 | 387 | foreach ( $wp_registered_sidebars as $sidebar => $registered_sidebar ) { |
375 | 388 | if ( false !== strpos( $registered_sidebar['class'], 'inactive-sidebar' ) || 'orphaned_widgets' == substr( $sidebar, 0, 16 ) ) { |
376 | 389 | $wrap_class = 'widgets-holder-wrap'; |
377 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
378 | - $wrap_class .= ' ' . $registered_sidebar['class']; |
|
390 | + if ( !empty( $registered_sidebar['class'] ) ) { |
|
391 | + $wrap_class .= ' ' . $registered_sidebar['class']; |
|
392 | + } |
|
379 | 393 | |
380 | 394 | ?> |
381 | 395 | <div class="<?php echo esc_attr( $wrap_class ); ?>"> |
@@ -414,11 +428,13 @@ discard block |
||
414 | 428 | |
415 | 429 | foreach ( $theme_sidebars as $sidebar => $registered_sidebar ) { |
416 | 430 | $wrap_class = 'widgets-holder-wrap'; |
417 | - if ( !empty( $registered_sidebar['class'] ) ) |
|
418 | - $wrap_class .= ' sidebar-' . $registered_sidebar['class']; |
|
431 | + if ( !empty( $registered_sidebar['class'] ) ) { |
|
432 | + $wrap_class .= ' sidebar-' . $registered_sidebar['class']; |
|
433 | + } |
|
419 | 434 | |
420 | - if ( $i > 0 ) |
|
421 | - $wrap_class .= ' closed'; |
|
435 | + if ( $i > 0 ) { |
|
436 | + $wrap_class .= ' closed'; |
|
437 | + } |
|
422 | 438 | |
423 | 439 | if ( $split && $i == $split ) { |
424 | 440 | ?> |
@@ -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('themes.php') ); |
|
12 | +wp_redirect(network_admin_url('themes.php')); |
|
13 | 13 | exit; |
@@ -6,55 +6,55 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | // TODO route this pages via a specific iframe handler instead of the do_action below |
9 | -if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
|
10 | - define( 'IFRAME_REQUEST', true ); |
|
9 | +if ( ! defined('IFRAME_REQUEST') && isset($_GET['tab']) && ('plugin-information' == $_GET['tab'])) |
|
10 | + define('IFRAME_REQUEST', true); |
|
11 | 11 | |
12 | 12 | /** |
13 | 13 | * WordPress Administration Bootstrap. |
14 | 14 | */ |
15 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
15 | +require_once(dirname(__FILE__).'/admin.php'); |
|
16 | 16 | |
17 | -if ( ! current_user_can('install_plugins') ) |
|
17 | +if ( ! current_user_can('install_plugins')) |
|
18 | 18 | wp_die(__('You do not have sufficient permissions to install plugins on this site.')); |
19 | 19 | |
20 | -if ( is_multisite() && ! is_network_admin() ) { |
|
21 | - wp_redirect( network_admin_url( 'plugin-install.php' ) ); |
|
20 | +if (is_multisite() && ! is_network_admin()) { |
|
21 | + wp_redirect(network_admin_url('plugin-install.php')); |
|
22 | 22 | exit(); |
23 | 23 | } |
24 | 24 | |
25 | 25 | $wp_list_table = _get_list_table('WP_Plugin_Install_List_Table'); |
26 | 26 | $pagenum = $wp_list_table->get_pagenum(); |
27 | 27 | |
28 | -if ( ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
|
29 | - $location = remove_query_arg( '_wp_http_referer', wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
28 | +if ( ! empty($_REQUEST['_wp_http_referer'])) { |
|
29 | + $location = remove_query_arg('_wp_http_referer', wp_unslash($_SERVER['REQUEST_URI'])); |
|
30 | 30 | |
31 | - if ( ! empty( $_REQUEST['paged'] ) ) { |
|
32 | - $location = add_query_arg( 'paged', (int) $_REQUEST['paged'], $location ); |
|
31 | + if ( ! empty($_REQUEST['paged'])) { |
|
32 | + $location = add_query_arg('paged', (int) $_REQUEST['paged'], $location); |
|
33 | 33 | } |
34 | 34 | |
35 | - wp_redirect( $location ); |
|
35 | + wp_redirect($location); |
|
36 | 36 | exit; |
37 | 37 | } |
38 | 38 | |
39 | 39 | $wp_list_table->prepare_items(); |
40 | 40 | |
41 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
41 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
42 | 42 | |
43 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
44 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
43 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
44 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
45 | 45 | exit; |
46 | 46 | } |
47 | 47 | |
48 | -$title = __( 'Add Plugins' ); |
|
48 | +$title = __('Add Plugins'); |
|
49 | 49 | $parent_file = 'plugins.php'; |
50 | 50 | |
51 | -wp_enqueue_script( 'plugin-install' ); |
|
52 | -if ( 'plugin-information' != $tab ) |
|
51 | +wp_enqueue_script('plugin-install'); |
|
52 | +if ('plugin-information' != $tab) |
|
53 | 53 | add_thickbox(); |
54 | 54 | |
55 | 55 | $body_id = $tab; |
56 | 56 | |
57 | -wp_enqueue_script( 'updates' ); |
|
57 | +wp_enqueue_script('updates'); |
|
58 | 58 | |
59 | 59 | /** |
60 | 60 | * Fires before each tab on the Install Plugins screen is loaded. |
@@ -64,54 +64,54 @@ discard block |
||
64 | 64 | * |
65 | 65 | * @since 2.7.0 |
66 | 66 | */ |
67 | -do_action( "install_plugins_pre_$tab" ); |
|
67 | +do_action("install_plugins_pre_$tab"); |
|
68 | 68 | |
69 | -get_current_screen()->add_help_tab( array( |
|
69 | +get_current_screen()->add_help_tab(array( |
|
70 | 70 | 'id' => 'overview', |
71 | 71 | 'title' => __('Overview'), |
72 | 72 | 'content' => |
73 | - '<p>' . sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'https://wordpress.org/plugins/') . '</p>' |
|
74 | -) ); |
|
75 | -get_current_screen()->add_help_tab( array( |
|
73 | + '<p>'.sprintf(__('Plugins hook into WordPress to extend its functionality with custom features. Plugins are developed independently from the core WordPress application by thousands of developers all over the world. All plugins in the official <a href="%s" target="_blank">WordPress.org Plugin Directory</a> are compatible with the license WordPress uses. You can find new plugins to install by searching or browsing the Directory right here in your own Plugins section.'), 'https://wordpress.org/plugins/').'</p>' |
|
74 | +)); |
|
75 | +get_current_screen()->add_help_tab(array( |
|
76 | 76 | 'id' => 'adding-plugins', |
77 | 77 | 'title' => __('Adding Plugins'), |
78 | 78 | 'content' => |
79 | - '<p>' . __('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.') . '</p>' . |
|
80 | - '<p>' . __('If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links in the upper left of the screen. These sections rotate regularly.') . '</p>' . |
|
81 | - '<p>' . __('You can also browse a user’s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.') . '</p>' . |
|
82 | - '<p>' . __('If you want to install a plugin that you’ve downloaded elsewhere, click the Upload link in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.') . '</p>' |
|
83 | -) ); |
|
79 | + '<p>'.__('If you know what you’re looking for, Search is your best bet. The Search screen has options to search the WordPress.org Plugin Directory for a particular Term, Author, or Tag. You can also search the directory by selecting popular tags. Tags in larger type mean more plugins have been labeled with that tag.').'</p>'. |
|
80 | + '<p>'.__('If you just want to get an idea of what’s available, you can browse Featured and Popular plugins by using the links in the upper left of the screen. These sections rotate regularly.').'</p>'. |
|
81 | + '<p>'.__('You can also browse a user’s favorite plugins, by using the Favorites link in the upper left of the screen and entering their WordPress.org username.').'</p>'. |
|
82 | + '<p>'.__('If you want to install a plugin that you’ve downloaded elsewhere, click the Upload link in the upper left. You will be prompted to upload the .zip package, and once uploaded, you can activate the new plugin.').'</p>' |
|
83 | +)); |
|
84 | 84 | |
85 | 85 | get_current_screen()->set_help_sidebar( |
86 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
87 | - '<p>' . __('<a href="https://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>') . '</p>' . |
|
88 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
86 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
87 | + '<p>'.__('<a href="https://codex.wordpress.org/Plugins_Add_New_Screen" target="_blank">Documentation on Installing Plugins</a>').'</p>'. |
|
88 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
89 | 89 | ); |
90 | 90 | |
91 | 91 | /** |
92 | 92 | * WordPress Administration Template Header. |
93 | 93 | */ |
94 | -include(ABSPATH . 'wp-admin/admin-header.php'); |
|
94 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
95 | 95 | ?> |
96 | 96 | <div class="wrap"> |
97 | 97 | <h1> |
98 | 98 | <?php |
99 | - echo esc_html( $title ); |
|
100 | - if ( ! empty( $tabs['upload'] ) && current_user_can( 'upload_plugins' ) ) { |
|
101 | - if ( $tab === 'upload' ) { |
|
102 | - $href = self_admin_url( 'plugin-install.php' ); |
|
103 | - $text = _x( 'Browse', 'plugins' ); |
|
99 | + echo esc_html($title); |
|
100 | + if ( ! empty($tabs['upload']) && current_user_can('upload_plugins')) { |
|
101 | + if ($tab === 'upload') { |
|
102 | + $href = self_admin_url('plugin-install.php'); |
|
103 | + $text = _x('Browse', 'plugins'); |
|
104 | 104 | } else { |
105 | - $href = self_admin_url( 'plugin-install.php?tab=upload' ); |
|
106 | - $text = __( 'Upload Plugin' ); |
|
105 | + $href = self_admin_url('plugin-install.php?tab=upload'); |
|
106 | + $text = __('Upload Plugin'); |
|
107 | 107 | } |
108 | - echo ' <a href="' . $href . '" class="upload page-title-action">' . $text . '</a>'; |
|
108 | + echo ' <a href="'.$href.'" class="upload page-title-action">'.$text.'</a>'; |
|
109 | 109 | } |
110 | 110 | ?> |
111 | 111 | </h1> |
112 | 112 | |
113 | 113 | <?php |
114 | -if ( $tab !== 'upload' ) { |
|
114 | +if ($tab !== 'upload') { |
|
115 | 115 | $wp_list_table->views(); |
116 | 116 | echo '<br class="clear" />'; |
117 | 117 | } |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | * |
127 | 127 | * @param int $paged The current page number of the plugins list table. |
128 | 128 | */ |
129 | -do_action( "install_plugins_$tab", $paged ); ?> |
|
129 | +do_action("install_plugins_$tab", $paged); ?> |
|
130 | 130 | </div> |
131 | 131 | |
132 | 132 | <?php |
@@ -135,4 +135,4 @@ discard block |
||
135 | 135 | /** |
136 | 136 | * WordPress Administration Template Footer. |
137 | 137 | */ |
138 | -include(ABSPATH . 'wp-admin/admin-footer.php'); |
|
138 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -6,16 +6,18 @@ discard block |
||
6 | 6 | * @subpackage Administration |
7 | 7 | */ |
8 | 8 | // TODO route this pages via a specific iframe handler instead of the do_action below |
9 | -if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) |
|
9 | +if ( !defined( 'IFRAME_REQUEST' ) && isset( $_GET['tab'] ) && ( 'plugin-information' == $_GET['tab'] ) ) { |
|
10 | 10 | define( 'IFRAME_REQUEST', true ); |
11 | +} |
|
11 | 12 | |
12 | 13 | /** |
13 | 14 | * WordPress Administration Bootstrap. |
14 | 15 | */ |
15 | 16 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
16 | 17 | |
17 | -if ( ! current_user_can('install_plugins') ) |
|
18 | +if ( ! current_user_can('install_plugins') ) { |
|
18 | 19 | wp_die(__('You do not have sufficient permissions to install plugins on this site.')); |
20 | +} |
|
19 | 21 | |
20 | 22 | if ( is_multisite() && ! is_network_admin() ) { |
21 | 23 | wp_redirect( network_admin_url( 'plugin-install.php' ) ); |
@@ -49,8 +51,9 @@ discard block |
||
49 | 51 | $parent_file = 'plugins.php'; |
50 | 52 | |
51 | 53 | wp_enqueue_script( 'plugin-install' ); |
52 | -if ( 'plugin-information' != $tab ) |
|
54 | +if ( 'plugin-information' != $tab ) { |
|
53 | 55 | add_thickbox(); |
56 | +} |
|
54 | 57 | |
55 | 58 | $body_id = $tab; |
56 | 59 |
@@ -13,35 +13,35 @@ discard block |
||
13 | 13 | * |
14 | 14 | * @since 2.1.0 |
15 | 15 | */ |
16 | -define( 'DOING_AJAX', true ); |
|
17 | -if ( ! defined( 'WP_ADMIN' ) ) { |
|
18 | - define( 'WP_ADMIN', true ); |
|
16 | +define('DOING_AJAX', true); |
|
17 | +if ( ! defined('WP_ADMIN')) { |
|
18 | + define('WP_ADMIN', true); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | /** Load WordPress Bootstrap */ |
22 | -require_once( dirname( dirname( __FILE__ ) ) . '/wp-load.php' ); |
|
22 | +require_once(dirname(dirname(__FILE__)).'/wp-load.php'); |
|
23 | 23 | |
24 | 24 | /** Allow for cross-domain requests (from the frontend). */ |
25 | 25 | send_origin_headers(); |
26 | 26 | |
27 | 27 | // Require an action parameter |
28 | -if ( empty( $_REQUEST['action'] ) ) |
|
29 | - die( '0' ); |
|
28 | +if (empty($_REQUEST['action'])) |
|
29 | + die('0'); |
|
30 | 30 | |
31 | 31 | /** Load WordPress Administration APIs */ |
32 | -require_once( ABSPATH . 'wp-admin/includes/admin.php' ); |
|
32 | +require_once(ABSPATH.'wp-admin/includes/admin.php'); |
|
33 | 33 | |
34 | 34 | /** Load Ajax Handlers for WordPress Core */ |
35 | -require_once( ABSPATH . 'wp-admin/includes/ajax-actions.php' ); |
|
35 | +require_once(ABSPATH.'wp-admin/includes/ajax-actions.php'); |
|
36 | 36 | |
37 | -@header( 'Content-Type: text/html; charset=' . get_option( 'blog_charset' ) ); |
|
38 | -@header( 'X-Robots-Tag: noindex' ); |
|
37 | +@header('Content-Type: text/html; charset='.get_option('blog_charset')); |
|
38 | +@header('X-Robots-Tag: noindex'); |
|
39 | 39 | |
40 | 40 | send_nosniff_header(); |
41 | 41 | nocache_headers(); |
42 | 42 | |
43 | 43 | /** This action is documented in wp-admin/admin.php */ |
44 | -do_action( 'admin_init' ); |
|
44 | +do_action('admin_init'); |
|
45 | 45 | |
46 | 46 | $core_actions_get = array( |
47 | 47 | 'fetch-list', 'ajax-tag-search', 'wp-compression-test', 'imgedit-preview', 'oembed-cache', |
@@ -69,15 +69,15 @@ discard block |
||
69 | 69 | $core_actions_post[] = 'wp-fullscreen-save-post'; |
70 | 70 | |
71 | 71 | // Register core Ajax calls. |
72 | -if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) |
|
73 | - add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); |
|
72 | +if ( ! empty($_GET['action']) && in_array($_GET['action'], $core_actions_get)) |
|
73 | + add_action('wp_ajax_'.$_GET['action'], 'wp_ajax_'.str_replace('-', '_', $_GET['action']), 1); |
|
74 | 74 | |
75 | -if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) |
|
76 | - add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 ); |
|
75 | +if ( ! empty($_POST['action']) && in_array($_POST['action'], $core_actions_post)) |
|
76 | + add_action('wp_ajax_'.$_POST['action'], 'wp_ajax_'.str_replace('-', '_', $_POST['action']), 1); |
|
77 | 77 | |
78 | -add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 ); |
|
78 | +add_action('wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1); |
|
79 | 79 | |
80 | -if ( is_user_logged_in() ) { |
|
80 | +if (is_user_logged_in()) { |
|
81 | 81 | /** |
82 | 82 | * Fires authenticated AJAX actions for logged-in users. |
83 | 83 | * |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @since 2.1.0 |
88 | 88 | */ |
89 | - do_action( 'wp_ajax_' . $_REQUEST['action'] ); |
|
89 | + do_action('wp_ajax_'.$_REQUEST['action']); |
|
90 | 90 | } else { |
91 | 91 | /** |
92 | 92 | * Fires non-authenticated AJAX actions for logged-out users. |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @since 2.8.0 |
98 | 98 | */ |
99 | - do_action( 'wp_ajax_nopriv_' . $_REQUEST['action'] ); |
|
99 | + do_action('wp_ajax_nopriv_'.$_REQUEST['action']); |
|
100 | 100 | } |
101 | 101 | // Default status |
102 | -die( '0' ); |
|
102 | +die('0'); |
@@ -25,8 +25,9 @@ discard block |
||
25 | 25 | send_origin_headers(); |
26 | 26 | |
27 | 27 | // Require an action parameter |
28 | -if ( empty( $_REQUEST['action'] ) ) |
|
28 | +if ( empty( $_REQUEST['action'] ) ) { |
|
29 | 29 | die( '0' ); |
30 | +} |
|
30 | 31 | |
31 | 32 | /** Load WordPress Administration APIs */ |
32 | 33 | require_once( ABSPATH . 'wp-admin/includes/admin.php' ); |
@@ -69,11 +70,13 @@ discard block |
||
69 | 70 | $core_actions_post[] = 'wp-fullscreen-save-post'; |
70 | 71 | |
71 | 72 | // Register core Ajax calls. |
72 | -if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) |
|
73 | +if ( ! empty( $_GET['action'] ) && in_array( $_GET['action'], $core_actions_get ) ) { |
|
73 | 74 | add_action( 'wp_ajax_' . $_GET['action'], 'wp_ajax_' . str_replace( '-', '_', $_GET['action'] ), 1 ); |
75 | +} |
|
74 | 76 | |
75 | -if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) |
|
77 | +if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $core_actions_post ) ) { |
|
76 | 78 | add_action( 'wp_ajax_' . $_POST['action'], 'wp_ajax_' . str_replace( '-', '_', $_POST['action'] ), 1 ); |
79 | +} |
|
77 | 80 | |
78 | 81 | add_action( 'wp_ajax_nopriv_heartbeat', 'wp_ajax_nopriv_heartbeat', 1 ); |
79 | 82 |
@@ -1,10 +1,10 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Writing settings administration panel. |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - */ |
|
3 | + * Writing settings administration panel. |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + */ |
|
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
@@ -7,56 +7,56 @@ 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 ( ! current_user_can( 'manage_options' ) ) |
|
13 | - wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); |
|
12 | +if ( ! current_user_can('manage_options')) |
|
13 | + wp_die(__('You do not have sufficient permissions to manage options for this site.')); |
|
14 | 14 | |
15 | 15 | $title = __('Writing Settings'); |
16 | 16 | $parent_file = 'options-general.php'; |
17 | 17 | |
18 | -get_current_screen()->add_help_tab( array( |
|
18 | +get_current_screen()->add_help_tab(array( |
|
19 | 19 | 'id' => 'overview', |
20 | 20 | 'title' => __('Overview'), |
21 | - 'content' => '<p>' . __('You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within the dashboard, while the rest control external publishing methods. For more information on any of these methods, use the documentation links.') . '</p>' . |
|
22 | - '<p>' . __('You must click the Save Changes button at the bottom of the screen for new settings to take effect.') . '</p>', |
|
23 | -) ); |
|
21 | + 'content' => '<p>'.__('You can submit content in several different ways; this screen holds the settings for all of them. The top section controls the editor within the dashboard, while the rest control external publishing methods. For more information on any of these methods, use the documentation links.').'</p>'. |
|
22 | + '<p>'.__('You must click the Save Changes button at the bottom of the screen for new settings to take effect.').'</p>', |
|
23 | +)); |
|
24 | 24 | |
25 | 25 | /** This filter is documented in wp-admin/options.php */ |
26 | -if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { |
|
27 | - get_current_screen()->add_help_tab( array( |
|
26 | +if (apply_filters('enable_post_by_email_configuration', true)) { |
|
27 | + get_current_screen()->add_help_tab(array( |
|
28 | 28 | 'id' => 'options-postemail', |
29 | - 'title' => __( 'Post Via Email' ), |
|
30 | - 'content' => '<p>' . __( 'Post via email settings allow you to send your WordPress install an email with the content of your post. You must set up a secret e-mail account with POP3 access to use this, and any mail received at this address will be posted, so it’s a good idea to keep this address very secret.' ) . '</p>', |
|
31 | - ) ); |
|
29 | + 'title' => __('Post Via Email'), |
|
30 | + 'content' => '<p>'.__('Post via email settings allow you to send your WordPress install an email with the content of your post. You must set up a secret e-mail account with POP3 access to use this, and any mail received at this address will be posted, so it’s a good idea to keep this address very secret.').'</p>', |
|
31 | + )); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | /** This filter is documented in wp-admin/options-writing.php */ |
35 | -if ( apply_filters( 'enable_update_services_configuration', true ) ) { |
|
36 | - get_current_screen()->add_help_tab( array( |
|
35 | +if (apply_filters('enable_update_services_configuration', true)) { |
|
36 | + get_current_screen()->add_help_tab(array( |
|
37 | 37 | 'id' => 'options-services', |
38 | - 'title' => __( 'Update Services' ), |
|
39 | - 'content' => '<p>' . __( 'If desired, WordPress will automatically alert various services of your new posts.' ) . '</p>', |
|
40 | - ) ); |
|
38 | + 'title' => __('Update Services'), |
|
39 | + 'content' => '<p>'.__('If desired, WordPress will automatically alert various services of your new posts.').'</p>', |
|
40 | + )); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | get_current_screen()->set_help_sidebar( |
44 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
45 | - '<p>' . __('<a href="https://codex.wordpress.org/Settings_Writing_Screen" target="_blank">Documentation on Writing Settings</a>') . '</p>' . |
|
46 | - '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>' |
|
44 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
45 | + '<p>'.__('<a href="https://codex.wordpress.org/Settings_Writing_Screen" target="_blank">Documentation on Writing Settings</a>').'</p>'. |
|
46 | + '<p>'.__('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>').'</p>' |
|
47 | 47 | ); |
48 | 48 | |
49 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
49 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
50 | 50 | ?> |
51 | 51 | |
52 | 52 | <div class="wrap"> |
53 | -<h1><?php echo esc_html( $title ); ?></h1> |
|
53 | +<h1><?php echo esc_html($title); ?></h1> |
|
54 | 54 | |
55 | 55 | <form method="post" action="options.php"> |
56 | 56 | <?php settings_fields('writing'); ?> |
57 | 57 | |
58 | 58 | <table class="form-table"> |
59 | -<?php if ( get_site_option( 'initial_db_version' ) < 32453 ) : ?> |
|
59 | +<?php if (get_site_option('initial_db_version') < 32453) : ?> |
|
60 | 60 | <tr> |
61 | 61 | <th scope="row"><?php _e('Formatting') ?></th> |
62 | 62 | <td><fieldset><legend class="screen-reader-text"><span><?php _e('Formatting') ?></span></legend> |
@@ -77,21 +77,21 @@ discard block |
||
77 | 77 | </tr> |
78 | 78 | <?php |
79 | 79 | $post_formats = get_post_format_strings(); |
80 | -unset( $post_formats['standard'] ); |
|
80 | +unset($post_formats['standard']); |
|
81 | 81 | ?> |
82 | 82 | <tr> |
83 | 83 | <th scope="row"><label for="default_post_format"><?php _e('Default Post Format') ?></label></th> |
84 | 84 | <td> |
85 | 85 | <select name="default_post_format" id="default_post_format"> |
86 | - <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option> |
|
87 | -<?php foreach ( $post_formats as $format_slug => $format_name ): ?> |
|
88 | - <option<?php selected( get_option( 'default_post_format' ), $format_slug ); ?> value="<?php echo esc_attr( $format_slug ); ?>"><?php echo esc_html( $format_name ); ?></option> |
|
86 | + <option value="0"><?php echo get_post_format_string('standard'); ?></option> |
|
87 | +<?php foreach ($post_formats as $format_slug => $format_name): ?> |
|
88 | + <option<?php selected(get_option('default_post_format'), $format_slug); ?> value="<?php echo esc_attr($format_slug); ?>"><?php echo esc_html($format_name); ?></option> |
|
89 | 89 | <?php endforeach; ?> |
90 | 90 | </select> |
91 | 91 | </td> |
92 | 92 | </tr> |
93 | 93 | <?php |
94 | -if ( get_option( 'link_manager_enabled' ) ) : |
|
94 | +if (get_option('link_manager_enabled')) : |
|
95 | 95 | ?> |
96 | 96 | <tr> |
97 | 97 | <th scope="row"><label for="default_link_category"><?php _e('Default Link Category') ?></label></th> |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | |
112 | 112 | <?php |
113 | 113 | /** This filter is documented in wp-admin/options.php */ |
114 | -if ( apply_filters( 'enable_post_by_email_configuration', true ) ) { |
|
114 | +if (apply_filters('enable_post_by_email_configuration', true)) { |
|
115 | 115 | ?> |
116 | 116 | <h3 class="title"><?php _e('Post via e-mail') ?></h3> |
117 | 117 | <p><?php printf(__('To post to WordPress by e-mail you must set up a secret e-mail account with POP3 access. Any mail received at this address will be posted, so it’s a good idea to keep this address very secret. Here are three random strings you could use: <kbd>%s</kbd>, <kbd>%s</kbd>, <kbd>%s</kbd>.'), wp_generate_password(8, false), wp_generate_password(8, false), wp_generate_password(8, false)) ?></p> |
@@ -154,15 +154,15 @@ discard block |
||
154 | 154 | * |
155 | 155 | * @param bool $enable Whether to enable the Update Services settings area. Default true. |
156 | 156 | */ |
157 | -if ( apply_filters( 'enable_update_services_configuration', true ) ) { |
|
157 | +if (apply_filters('enable_update_services_configuration', true)) { |
|
158 | 158 | ?> |
159 | 159 | <h3 class="title"><?php _e('Update Services') ?></h3> |
160 | 160 | |
161 | -<?php if ( 1 == get_option('blog_public') ) : ?> |
|
161 | +<?php if (1 == get_option('blog_public')) : ?> |
|
162 | 162 | |
163 | 163 | <p><label for="ping_sites"><?php _e('When you publish a new post, WordPress automatically notifies the following site update services. For more about this, see <a href="https://codex.wordpress.org/Update_Services">Update Services</a> on the Codex. Separate multiple service <abbr title="Universal Resource Locator">URL</abbr>s with line breaks.') ?></label></p> |
164 | 164 | |
165 | -<textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3"><?php echo esc_textarea( get_option('ping_sites') ); ?></textarea> |
|
165 | +<textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3"><?php echo esc_textarea(get_option('ping_sites')); ?></textarea> |
|
166 | 166 | |
167 | 167 | <?php else : ?> |
168 | 168 | |
@@ -177,4 +177,4 @@ discard block |
||
177 | 177 | </form> |
178 | 178 | </div> |
179 | 179 | |
180 | -<?php include( ABSPATH . 'wp-admin/admin-footer.php' ); ?> |
|
180 | +<?php include(ABSPATH.'wp-admin/admin-footer.php'); ?> |
@@ -9,8 +9,9 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( ! current_user_can( 'manage_options' ) ) |
|
12 | +if ( ! current_user_can( 'manage_options' ) ) { |
|
13 | 13 | wp_die( __( 'You do not have sufficient permissions to manage options for this site.' ) ); |
14 | +} |
|
14 | 15 | |
15 | 16 | $title = __('Writing Settings'); |
16 | 17 | $parent_file = 'options-general.php'; |
@@ -164,9 +165,12 @@ discard block |
||
164 | 165 | |
165 | 166 | <textarea name="ping_sites" id="ping_sites" class="large-text code" rows="3"><?php echo esc_textarea( get_option('ping_sites') ); ?></textarea> |
166 | 167 | |
167 | -<?php else : ?> |
|
168 | +<?php else { |
|
169 | + : ?> |
|
168 | 170 | |
169 | - <p><?php printf(__('WordPress is not notifying any <a href="https://codex.wordpress.org/Update_Services">Update Services</a> because of your site’s <a href="%s">visibility settings</a>.'), 'options-reading.php'); ?></p> |
|
171 | + <p><?php printf(__('WordPress is not notifying any <a href="https://codex.wordpress.org/Update_Services">Update Services</a> because of your site’s <a href="%s">visibility settings</a>.'), 'options-reading.php'); |
|
172 | +} |
|
173 | +?></p> |
|
170 | 174 | |
171 | 175 | <?php endif; ?> |
172 | 176 | <?php } // multisite ?> |