@@ -1355,13 +1355,13 @@ |
||
1355 | 1355 | } |
1356 | 1356 | |
1357 | 1357 | /** |
1358 | - * Filters the notice output for the 'Browse Happy' nag meta box. |
|
1359 | - * |
|
1360 | - * @since 3.2.0 |
|
1361 | - * |
|
1362 | - * @param string $notice The notice content. |
|
1363 | - * @param array $response An array containing web browser information. |
|
1364 | - */ |
|
1358 | + * Filters the notice output for the 'Browse Happy' nag meta box. |
|
1359 | + * |
|
1360 | + * @since 3.2.0 |
|
1361 | + * |
|
1362 | + * @param string $notice The notice content. |
|
1363 | + * @param array $response An array containing web browser information. |
|
1364 | + */ |
|
1365 | 1365 | echo apply_filters( 'browse-happy-notice', $notice, $response ); |
1366 | 1366 | } |
1367 | 1367 |
@@ -26,43 +26,43 @@ discard block |
||
26 | 26 | |
27 | 27 | $response = wp_check_browser_version(); |
28 | 28 | |
29 | - if ( $response && $response['upgrade'] ) { |
|
30 | - add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' ); |
|
31 | - if ( $response['insecure'] ) |
|
32 | - wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' ); |
|
29 | + if ($response && $response['upgrade']) { |
|
30 | + add_filter('postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class'); |
|
31 | + if ($response['insecure']) |
|
32 | + wp_add_dashboard_widget('dashboard_browser_nag', __('You are using an insecure browser!'), 'wp_dashboard_browser_nag'); |
|
33 | 33 | else |
34 | - wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' ); |
|
34 | + wp_add_dashboard_widget('dashboard_browser_nag', __('Your browser is out of date!'), 'wp_dashboard_browser_nag'); |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | // Right Now |
38 | - if ( is_blog_admin() && current_user_can('edit_posts') ) |
|
39 | - wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); |
|
38 | + if (is_blog_admin() && current_user_can('edit_posts')) |
|
39 | + wp_add_dashboard_widget('dashboard_right_now', __('At a Glance'), 'wp_dashboard_right_now'); |
|
40 | 40 | |
41 | - if ( is_network_admin() ) |
|
42 | - wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); |
|
41 | + if (is_network_admin()) |
|
42 | + wp_add_dashboard_widget('network_dashboard_right_now', __('Right Now'), 'wp_network_dashboard_right_now'); |
|
43 | 43 | |
44 | 44 | // Activity Widget |
45 | - if ( is_blog_admin() ) { |
|
46 | - wp_add_dashboard_widget( 'dashboard_activity', __( 'Activity' ), 'wp_dashboard_site_activity' ); |
|
45 | + if (is_blog_admin()) { |
|
46 | + wp_add_dashboard_widget('dashboard_activity', __('Activity'), 'wp_dashboard_site_activity'); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | // QuickPress Widget |
50 | - if ( is_blog_admin() && current_user_can( get_post_type_object( 'post' )->cap->create_posts ) ) { |
|
51 | - $quick_draft_title = sprintf( '<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __( 'Quick Draft' ), __( 'Your Recent Drafts' ) ); |
|
52 | - wp_add_dashboard_widget( 'dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press' ); |
|
50 | + if (is_blog_admin() && current_user_can(get_post_type_object('post')->cap->create_posts)) { |
|
51 | + $quick_draft_title = sprintf('<span class="hide-if-no-js">%1$s</span> <span class="hide-if-js">%2$s</span>', __('Quick Draft'), __('Your Recent Drafts')); |
|
52 | + wp_add_dashboard_widget('dashboard_quick_press', $quick_draft_title, 'wp_dashboard_quick_press'); |
|
53 | 53 | } |
54 | 54 | |
55 | 55 | // WordPress Events and News |
56 | - wp_add_dashboard_widget( 'dashboard_primary', __( 'WordPress Events and News' ), 'wp_dashboard_events_news' ); |
|
56 | + wp_add_dashboard_widget('dashboard_primary', __('WordPress Events and News'), 'wp_dashboard_events_news'); |
|
57 | 57 | |
58 | - if ( is_network_admin() ) { |
|
58 | + if (is_network_admin()) { |
|
59 | 59 | |
60 | 60 | /** |
61 | 61 | * Fires after core widgets for the Network Admin dashboard have been registered. |
62 | 62 | * |
63 | 63 | * @since 3.1.0 |
64 | 64 | */ |
65 | - do_action( 'wp_network_dashboard_setup' ); |
|
65 | + do_action('wp_network_dashboard_setup'); |
|
66 | 66 | |
67 | 67 | /** |
68 | 68 | * Filters the list of widgets to load for the Network Admin dashboard. |
@@ -71,15 +71,15 @@ discard block |
||
71 | 71 | * |
72 | 72 | * @param array $dashboard_widgets An array of dashboard widgets. |
73 | 73 | */ |
74 | - $dashboard_widgets = apply_filters( 'wp_network_dashboard_widgets', array() ); |
|
75 | - } elseif ( is_user_admin() ) { |
|
74 | + $dashboard_widgets = apply_filters('wp_network_dashboard_widgets', array()); |
|
75 | + } elseif (is_user_admin()) { |
|
76 | 76 | |
77 | 77 | /** |
78 | 78 | * Fires after core widgets for the User Admin dashboard have been registered. |
79 | 79 | * |
80 | 80 | * @since 3.1.0 |
81 | 81 | */ |
82 | - do_action( 'wp_user_dashboard_setup' ); |
|
82 | + do_action('wp_user_dashboard_setup'); |
|
83 | 83 | |
84 | 84 | /** |
85 | 85 | * Filters the list of widgets to load for the User Admin dashboard. |
@@ -88,7 +88,7 @@ discard block |
||
88 | 88 | * |
89 | 89 | * @param array $dashboard_widgets An array of dashboard widgets. |
90 | 90 | */ |
91 | - $dashboard_widgets = apply_filters( 'wp_user_dashboard_widgets', array() ); |
|
91 | + $dashboard_widgets = apply_filters('wp_user_dashboard_widgets', array()); |
|
92 | 92 | } else { |
93 | 93 | |
94 | 94 | /** |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * |
97 | 97 | * @since 2.5.0 |
98 | 98 | */ |
99 | - do_action( 'wp_dashboard_setup' ); |
|
99 | + do_action('wp_dashboard_setup'); |
|
100 | 100 | |
101 | 101 | /** |
102 | 102 | * Filters the list of widgets to load for the admin dashboard. |
@@ -105,28 +105,28 @@ discard block |
||
105 | 105 | * |
106 | 106 | * @param array $dashboard_widgets An array of dashboard widgets. |
107 | 107 | */ |
108 | - $dashboard_widgets = apply_filters( 'wp_dashboard_widgets', array() ); |
|
108 | + $dashboard_widgets = apply_filters('wp_dashboard_widgets', array()); |
|
109 | 109 | } |
110 | 110 | |
111 | - foreach ( $dashboard_widgets as $widget_id ) { |
|
112 | - $name = empty( $wp_registered_widgets[$widget_id]['all_link'] ) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name'] . " <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>" . __('View all') . '</a>'; |
|
113 | - wp_add_dashboard_widget( $widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback'] ); |
|
111 | + foreach ($dashboard_widgets as $widget_id) { |
|
112 | + $name = empty($wp_registered_widgets[$widget_id]['all_link']) ? $wp_registered_widgets[$widget_id]['name'] : $wp_registered_widgets[$widget_id]['name']." <a href='{$wp_registered_widgets[$widget_id]['all_link']}' class='edit-box open-box'>".__('View all').'</a>'; |
|
113 | + wp_add_dashboard_widget($widget_id, $name, $wp_registered_widgets[$widget_id]['callback'], $wp_registered_widget_controls[$widget_id]['callback']); |
|
114 | 114 | } |
115 | 115 | |
116 | - if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id']) ) { |
|
117 | - check_admin_referer( 'edit-dashboard-widget_' . $_POST['widget_id'], 'dashboard-widget-nonce' ); |
|
116 | + if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget_id'])) { |
|
117 | + check_admin_referer('edit-dashboard-widget_'.$_POST['widget_id'], 'dashboard-widget-nonce'); |
|
118 | 118 | ob_start(); // hack - but the same hack wp-admin/widgets.php uses |
119 | - wp_dashboard_trigger_widget_control( $_POST['widget_id'] ); |
|
119 | + wp_dashboard_trigger_widget_control($_POST['widget_id']); |
|
120 | 120 | ob_end_clean(); |
121 | - wp_redirect( remove_query_arg( 'edit' ) ); |
|
121 | + wp_redirect(remove_query_arg('edit')); |
|
122 | 122 | exit; |
123 | 123 | } |
124 | 124 | |
125 | 125 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
126 | - do_action( 'do_meta_boxes', $screen->id, 'normal', '' ); |
|
126 | + do_action('do_meta_boxes', $screen->id, 'normal', ''); |
|
127 | 127 | |
128 | 128 | /** This action is documented in wp-admin/edit-form-advanced.php */ |
129 | - do_action( 'do_meta_boxes', $screen->id, 'side', '' ); |
|
129 | + do_action('do_meta_boxes', $screen->id, 'side', ''); |
|
130 | 130 | } |
131 | 131 | |
132 | 132 | /** |
@@ -144,41 +144,41 @@ discard block |
||
144 | 144 | * @param array $callback_args Optional. Data that should be set as the $args property of the widget array |
145 | 145 | * (which is the second parameter passed to your callback). Default null. |
146 | 146 | */ |
147 | -function wp_add_dashboard_widget( $widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null ) { |
|
147 | +function wp_add_dashboard_widget($widget_id, $widget_name, $callback, $control_callback = null, $callback_args = null) { |
|
148 | 148 | $screen = get_current_screen(); |
149 | 149 | global $wp_dashboard_control_callbacks; |
150 | 150 | |
151 | - $private_callback_args = array( '__widget_basename' => $widget_name ); |
|
151 | + $private_callback_args = array('__widget_basename' => $widget_name); |
|
152 | 152 | |
153 | - if ( is_null( $callback_args ) ) { |
|
153 | + if (is_null($callback_args)) { |
|
154 | 154 | $callback_args = $private_callback_args; |
155 | - } else if ( is_array( $callback_args ) ) { |
|
156 | - $callback_args = array_merge( $callback_args, $private_callback_args ); |
|
155 | + } else if (is_array($callback_args)) { |
|
156 | + $callback_args = array_merge($callback_args, $private_callback_args); |
|
157 | 157 | } |
158 | 158 | |
159 | - if ( $control_callback && current_user_can( 'edit_dashboard' ) && is_callable( $control_callback ) ) { |
|
159 | + if ($control_callback && current_user_can('edit_dashboard') && is_callable($control_callback)) { |
|
160 | 160 | $wp_dashboard_control_callbacks[$widget_id] = $control_callback; |
161 | - if ( isset( $_GET['edit'] ) && $widget_id == $_GET['edit'] ) { |
|
162 | - list($url) = explode( '#', add_query_arg( 'edit', false ), 2 ); |
|
163 | - $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( $url ) . '">' . __( 'Cancel' ) . '</a></span>'; |
|
161 | + if (isset($_GET['edit']) && $widget_id == $_GET['edit']) { |
|
162 | + list($url) = explode('#', add_query_arg('edit', false), 2); |
|
163 | + $widget_name .= ' <span class="postbox-title-action"><a href="'.esc_url($url).'">'.__('Cancel').'</a></span>'; |
|
164 | 164 | $callback = '_wp_dashboard_control_callback'; |
165 | 165 | } else { |
166 | - list($url) = explode( '#', add_query_arg( 'edit', $widget_id ), 2 ); |
|
167 | - $widget_name .= ' <span class="postbox-title-action"><a href="' . esc_url( "$url#$widget_id" ) . '" class="edit-box open-box">' . __( 'Configure' ) . '</a></span>'; |
|
166 | + list($url) = explode('#', add_query_arg('edit', $widget_id), 2); |
|
167 | + $widget_name .= ' <span class="postbox-title-action"><a href="'.esc_url("$url#$widget_id").'" class="edit-box open-box">'.__('Configure').'</a></span>'; |
|
168 | 168 | } |
169 | 169 | } |
170 | 170 | |
171 | - $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); |
|
171 | + $side_widgets = array('dashboard_quick_press', 'dashboard_primary'); |
|
172 | 172 | |
173 | 173 | $location = 'normal'; |
174 | - if ( in_array($widget_id, $side_widgets) ) |
|
174 | + if (in_array($widget_id, $side_widgets)) |
|
175 | 175 | $location = 'side'; |
176 | 176 | |
177 | 177 | $priority = 'core'; |
178 | - if ( 'dashboard_browser_nag' === $widget_id ) |
|
178 | + if ('dashboard_browser_nag' === $widget_id) |
|
179 | 179 | $priority = 'high'; |
180 | 180 | |
181 | - add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args ); |
|
181 | + add_meta_box($widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args); |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | /** |
@@ -190,12 +190,12 @@ discard block |
||
190 | 190 | * @param mixed $dashboard |
191 | 191 | * @param array $meta_box |
192 | 192 | */ |
193 | -function _wp_dashboard_control_callback( $dashboard, $meta_box ) { |
|
193 | +function _wp_dashboard_control_callback($dashboard, $meta_box) { |
|
194 | 194 | echo '<form method="post" class="dashboard-widget-control-form wp-clearfix">'; |
195 | - wp_dashboard_trigger_widget_control( $meta_box['id'] ); |
|
196 | - wp_nonce_field( 'edit-dashboard-widget_' . $meta_box['id'], 'dashboard-widget-nonce' ); |
|
197 | - echo '<input type="hidden" name="widget_id" value="' . esc_attr($meta_box['id']) . '" />'; |
|
198 | - submit_button( __('Submit') ); |
|
195 | + wp_dashboard_trigger_widget_control($meta_box['id']); |
|
196 | + wp_nonce_field('edit-dashboard-widget_'.$meta_box['id'], 'dashboard-widget-nonce'); |
|
197 | + echo '<input type="hidden" name="widget_id" value="'.esc_attr($meta_box['id']).'" />'; |
|
198 | + submit_button(__('Submit')); |
|
199 | 199 | echo '</form>'; |
200 | 200 | } |
201 | 201 | |
@@ -206,31 +206,31 @@ discard block |
||
206 | 206 | */ |
207 | 207 | function wp_dashboard() { |
208 | 208 | $screen = get_current_screen(); |
209 | - $columns = absint( $screen->get_columns() ); |
|
209 | + $columns = absint($screen->get_columns()); |
|
210 | 210 | $columns_css = ''; |
211 | - if ( $columns ) { |
|
211 | + if ($columns) { |
|
212 | 212 | $columns_css = " columns-$columns"; |
213 | 213 | } |
214 | 214 | |
215 | 215 | ?> |
216 | 216 | <div id="dashboard-widgets" class="metabox-holder<?php echo $columns_css; ?>"> |
217 | 217 | <div id="postbox-container-1" class="postbox-container"> |
218 | - <?php do_meta_boxes( $screen->id, 'normal', '' ); ?> |
|
218 | + <?php do_meta_boxes($screen->id, 'normal', ''); ?> |
|
219 | 219 | </div> |
220 | 220 | <div id="postbox-container-2" class="postbox-container"> |
221 | - <?php do_meta_boxes( $screen->id, 'side', '' ); ?> |
|
221 | + <?php do_meta_boxes($screen->id, 'side', ''); ?> |
|
222 | 222 | </div> |
223 | 223 | <div id="postbox-container-3" class="postbox-container"> |
224 | - <?php do_meta_boxes( $screen->id, 'column3', '' ); ?> |
|
224 | + <?php do_meta_boxes($screen->id, 'column3', ''); ?> |
|
225 | 225 | </div> |
226 | 226 | <div id="postbox-container-4" class="postbox-container"> |
227 | - <?php do_meta_boxes( $screen->id, 'column4', '' ); ?> |
|
227 | + <?php do_meta_boxes($screen->id, 'column4', ''); ?> |
|
228 | 228 | </div> |
229 | 229 | </div> |
230 | 230 | |
231 | 231 | <?php |
232 | - wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); |
|
233 | - wp_nonce_field( 'meta-box-order', 'meta-box-order-nonce', false ); |
|
232 | + wp_nonce_field('closedpostboxes', 'closedpostboxesnonce', false); |
|
233 | + wp_nonce_field('meta-box-order', 'meta-box-order-nonce', false); |
|
234 | 234 | |
235 | 235 | } |
236 | 236 | |
@@ -251,42 +251,42 @@ discard block |
||
251 | 251 | <ul> |
252 | 252 | <?php |
253 | 253 | // Posts and Pages |
254 | - foreach ( array( 'post', 'page' ) as $post_type ) { |
|
255 | - $num_posts = wp_count_posts( $post_type ); |
|
256 | - if ( $num_posts && $num_posts->publish ) { |
|
257 | - if ( 'post' == $post_type ) { |
|
258 | - $text = _n( '%s Post', '%s Posts', $num_posts->publish ); |
|
254 | + foreach (array('post', 'page') as $post_type) { |
|
255 | + $num_posts = wp_count_posts($post_type); |
|
256 | + if ($num_posts && $num_posts->publish) { |
|
257 | + if ('post' == $post_type) { |
|
258 | + $text = _n('%s Post', '%s Posts', $num_posts->publish); |
|
259 | 259 | } else { |
260 | - $text = _n( '%s Page', '%s Pages', $num_posts->publish ); |
|
260 | + $text = _n('%s Page', '%s Pages', $num_posts->publish); |
|
261 | 261 | } |
262 | - $text = sprintf( $text, number_format_i18n( $num_posts->publish ) ); |
|
263 | - $post_type_object = get_post_type_object( $post_type ); |
|
264 | - if ( $post_type_object && current_user_can( $post_type_object->cap->edit_posts ) ) { |
|
265 | - printf( '<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text ); |
|
262 | + $text = sprintf($text, number_format_i18n($num_posts->publish)); |
|
263 | + $post_type_object = get_post_type_object($post_type); |
|
264 | + if ($post_type_object && current_user_can($post_type_object->cap->edit_posts)) { |
|
265 | + printf('<li class="%1$s-count"><a href="edit.php?post_type=%1$s">%2$s</a></li>', $post_type, $text); |
|
266 | 266 | } else { |
267 | - printf( '<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text ); |
|
267 | + printf('<li class="%1$s-count"><span>%2$s</span></li>', $post_type, $text); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | } |
271 | 271 | } |
272 | 272 | // Comments |
273 | 273 | $num_comm = wp_count_comments(); |
274 | - if ( $num_comm && ( $num_comm->approved || $num_comm->moderated ) ) { |
|
275 | - $text = sprintf( _n( '%s Comment', '%s Comments', $num_comm->approved ), number_format_i18n( $num_comm->approved ) ); |
|
274 | + if ($num_comm && ($num_comm->approved || $num_comm->moderated)) { |
|
275 | + $text = sprintf(_n('%s Comment', '%s Comments', $num_comm->approved), number_format_i18n($num_comm->approved)); |
|
276 | 276 | ?> |
277 | 277 | <li class="comment-count"><a href="edit-comments.php"><?php echo $text; ?></a></li> |
278 | 278 | <?php |
279 | - $moderated_comments_count_i18n = number_format_i18n( $num_comm->moderated ); |
|
279 | + $moderated_comments_count_i18n = number_format_i18n($num_comm->moderated); |
|
280 | 280 | /* translators: Number of comments in moderation */ |
281 | - $text = sprintf( _nx( '%s in moderation', '%s in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n ); |
|
281 | + $text = sprintf(_nx('%s in moderation', '%s in moderation', $num_comm->moderated, 'comments'), $moderated_comments_count_i18n); |
|
282 | 282 | /* translators: Number of comments in moderation */ |
283 | - $aria_label = sprintf( _nx( '%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments' ), $moderated_comments_count_i18n ); |
|
283 | + $aria_label = sprintf(_nx('%s comment in moderation', '%s comments in moderation', $num_comm->moderated, 'comments'), $moderated_comments_count_i18n); |
|
284 | 284 | ?> |
285 | 285 | <li class="comment-mod-count<?php |
286 | - if ( ! $num_comm->moderated ) { |
|
286 | + if ( ! $num_comm->moderated) { |
|
287 | 287 | echo ' hidden'; |
288 | 288 | } |
289 | - ?>"><a href="edit-comments.php?comment_status=moderated" aria-label="<?php esc_attr_e( $aria_label ); ?>"><?php echo $text; ?></a></li> |
|
289 | + ?>"><a href="edit-comments.php?comment_status=moderated" aria-label="<?php esc_attr_e($aria_label); ?>"><?php echo $text; ?></a></li> |
|
290 | 290 | <?php |
291 | 291 | } |
292 | 292 | |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | * |
302 | 302 | * @param array $items Array of extra 'At a Glance' widget items. |
303 | 303 | */ |
304 | - $elements = apply_filters( 'dashboard_glance_items', array() ); |
|
304 | + $elements = apply_filters('dashboard_glance_items', array()); |
|
305 | 305 | |
306 | - if ( $elements ) { |
|
307 | - echo '<li>' . implode( "</li>\n<li>", $elements ) . "</li>\n"; |
|
306 | + if ($elements) { |
|
307 | + echo '<li>'.implode("</li>\n<li>", $elements)."</li>\n"; |
|
308 | 308 | } |
309 | 309 | |
310 | 310 | ?> |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | update_right_now_message(); |
314 | 314 | |
315 | 315 | // Check if search engines are asked not to index this site. |
316 | - if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '0' == get_option( 'blog_public' ) ) { |
|
316 | + if ( ! is_network_admin() && ! is_user_admin() && current_user_can('manage_options') && '0' == get_option('blog_public')) { |
|
317 | 317 | |
318 | 318 | /** |
319 | 319 | * Filters the link title attribute for the 'Search Engines Discouraged' |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * |
327 | 327 | * @param string $title Default attribute text. |
328 | 328 | */ |
329 | - $title = apply_filters( 'privacy_on_link_title', '' ); |
|
329 | + $title = apply_filters('privacy_on_link_title', ''); |
|
330 | 330 | |
331 | 331 | /** |
332 | 332 | * Filters the link label for the 'Search Engines Discouraged' message |
@@ -338,7 +338,7 @@ discard block |
||
338 | 338 | * |
339 | 339 | * @param string $content Default text. |
340 | 340 | */ |
341 | - $content = apply_filters( 'privacy_on_link_text' , __( 'Search Engines Discouraged' ) ); |
|
341 | + $content = apply_filters('privacy_on_link_text', __('Search Engines Discouraged')); |
|
342 | 342 | $title_attr = '' === $title ? '' : " title='$title'"; |
343 | 343 | |
344 | 344 | echo "<p><a href='options-reading.php'$title_attr>$content</a></p>"; |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * |
360 | 360 | * @since 2.5.0 |
361 | 361 | */ |
362 | - do_action( 'rightnow_end' ); |
|
362 | + do_action('rightnow_end'); |
|
363 | 363 | |
364 | 364 | /** |
365 | 365 | * Fires at the end of the 'At a Glance' dashboard widget. |
@@ -368,11 +368,11 @@ discard block |
||
368 | 368 | * |
369 | 369 | * @since 2.0.0 |
370 | 370 | */ |
371 | - do_action( 'activity_box_end' ); |
|
371 | + do_action('activity_box_end'); |
|
372 | 372 | |
373 | 373 | $actions = ob_get_clean(); |
374 | 374 | |
375 | - if ( !empty( $actions ) ) : ?> |
|
375 | + if ( ! empty($actions)) : ?> |
|
376 | 376 | <div class="sub"> |
377 | 377 | <?php echo $actions; ?> |
378 | 378 | </div> |
@@ -384,28 +384,28 @@ discard block |
||
384 | 384 | */ |
385 | 385 | function wp_network_dashboard_right_now() { |
386 | 386 | $actions = array(); |
387 | - if ( current_user_can('create_sites') ) |
|
388 | - $actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>'; |
|
389 | - if ( current_user_can('create_users') ) |
|
390 | - $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>'; |
|
387 | + if (current_user_can('create_sites')) |
|
388 | + $actions['create-site'] = '<a href="'.network_admin_url('site-new.php').'">'.__('Create a New Site').'</a>'; |
|
389 | + if (current_user_can('create_users')) |
|
390 | + $actions['create-user'] = '<a href="'.network_admin_url('user-new.php').'">'.__('Create a New User').'</a>'; |
|
391 | 391 | |
392 | 392 | $c_users = get_user_count(); |
393 | 393 | $c_blogs = get_blog_count(); |
394 | 394 | |
395 | 395 | /* translators: 1: Number of users on the network */ |
396 | - $user_text = sprintf( _n( '%s user', '%s users', $c_users ), number_format_i18n( $c_users ) ); |
|
396 | + $user_text = sprintf(_n('%s user', '%s users', $c_users), number_format_i18n($c_users)); |
|
397 | 397 | /* translators: 1: Number of sites on the network */ |
398 | - $blog_text = sprintf( _n( '%s site', '%s sites', $c_blogs ), number_format_i18n( $c_blogs ) ); |
|
398 | + $blog_text = sprintf(_n('%s site', '%s sites', $c_blogs), number_format_i18n($c_blogs)); |
|
399 | 399 | |
400 | 400 | /* translators: 1: Text indicating the number of sites on the network, 2: Text indicating the number of users on the network */ |
401 | - $sentence = sprintf( __( 'You have %1$s and %2$s.' ), $blog_text, $user_text ); |
|
401 | + $sentence = sprintf(__('You have %1$s and %2$s.'), $blog_text, $user_text); |
|
402 | 402 | |
403 | - if ( $actions ) { |
|
403 | + if ($actions) { |
|
404 | 404 | echo '<ul class="subsubsub">'; |
405 | - foreach ( $actions as $class => $action ) { |
|
406 | - $actions[ $class ] = "\t<li class='$class'>$action"; |
|
405 | + foreach ($actions as $class => $action) { |
|
406 | + $actions[$class] = "\t<li class='$class'>$action"; |
|
407 | 407 | } |
408 | - echo implode( " |</li>\n", $actions ) . "</li>\n"; |
|
408 | + echo implode(" |</li>\n", $actions)."</li>\n"; |
|
409 | 409 | echo '</ul>'; |
410 | 410 | } |
411 | 411 | ?> |
@@ -423,22 +423,22 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @param null $unused |
425 | 425 | */ |
426 | - do_action( 'wpmuadminresult', '' ); |
|
426 | + do_action('wpmuadminresult', ''); |
|
427 | 427 | ?> |
428 | 428 | |
429 | 429 | <form action="<?php echo network_admin_url('users.php'); ?>" method="get"> |
430 | 430 | <p> |
431 | - <label class="screen-reader-text" for="search-users"><?php _e( 'Search Users' ); ?></label> |
|
431 | + <label class="screen-reader-text" for="search-users"><?php _e('Search Users'); ?></label> |
|
432 | 432 | <input type="search" name="s" value="" size="30" autocomplete="off" id="search-users"/> |
433 | - <?php submit_button( __( 'Search Users' ), '', false, false, array( 'id' => 'submit_users' ) ); ?> |
|
433 | + <?php submit_button(__('Search Users'), '', false, false, array('id' => 'submit_users')); ?> |
|
434 | 434 | </p> |
435 | 435 | </form> |
436 | 436 | |
437 | 437 | <form action="<?php echo network_admin_url('sites.php'); ?>" method="get"> |
438 | 438 | <p> |
439 | - <label class="screen-reader-text" for="search-sites"><?php _e( 'Search Sites' ); ?></label> |
|
439 | + <label class="screen-reader-text" for="search-sites"><?php _e('Search Sites'); ?></label> |
|
440 | 440 | <input type="search" name="s" value="" size="30" autocomplete="off" id="search-sites"/> |
441 | - <?php submit_button( __( 'Search Sites' ), '', false, false, array( 'id' => 'submit_sites' ) ); ?> |
|
441 | + <?php submit_button(__('Search Sites'), '', false, false, array('id' => 'submit_sites')); ?> |
|
442 | 442 | </p> |
443 | 443 | </form> |
444 | 444 | <?php |
@@ -447,14 +447,14 @@ discard block |
||
447 | 447 | * |
448 | 448 | * @since MU |
449 | 449 | */ |
450 | - do_action( 'mu_rightnow_end' ); |
|
450 | + do_action('mu_rightnow_end'); |
|
451 | 451 | |
452 | 452 | /** |
453 | 453 | * Fires at the end of the 'Right Now' widget in the Network Admin dashboard. |
454 | 454 | * |
455 | 455 | * @since MU |
456 | 456 | */ |
457 | - do_action( 'mu_activity_box_end' ); |
|
457 | + do_action('mu_activity_box_end'); |
|
458 | 458 | } |
459 | 459 | |
460 | 460 | /** |
@@ -466,37 +466,37 @@ discard block |
||
466 | 466 | * |
467 | 467 | * @param string $error_msg Optional. Error message. Default false. |
468 | 468 | */ |
469 | -function wp_dashboard_quick_press( $error_msg = false ) { |
|
469 | +function wp_dashboard_quick_press($error_msg = false) { |
|
470 | 470 | global $post_ID; |
471 | 471 | |
472 | - if ( ! current_user_can( 'edit_posts' ) ) { |
|
472 | + if ( ! current_user_can('edit_posts')) { |
|
473 | 473 | return; |
474 | 474 | } |
475 | 475 | |
476 | 476 | /* Check if a new auto-draft (= no new post_ID) is needed or if the old can be used */ |
477 | - $last_post_id = (int) get_user_option( 'dashboard_quick_press_last_post_id' ); // Get the last post_ID |
|
478 | - if ( $last_post_id ) { |
|
479 | - $post = get_post( $last_post_id ); |
|
480 | - if ( empty( $post ) || $post->post_status != 'auto-draft' ) { // auto-draft doesn't exists anymore |
|
481 | - $post = get_default_post_to_edit( 'post', true ); |
|
482 | - update_user_option( get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID |
|
477 | + $last_post_id = (int) get_user_option('dashboard_quick_press_last_post_id'); // Get the last post_ID |
|
478 | + if ($last_post_id) { |
|
479 | + $post = get_post($last_post_id); |
|
480 | + if (empty($post) || $post->post_status != 'auto-draft') { // auto-draft doesn't exists anymore |
|
481 | + $post = get_default_post_to_edit('post', true); |
|
482 | + update_user_option(get_current_user_id(), 'dashboard_quick_press_last_post_id', (int) $post->ID); // Save post_ID |
|
483 | 483 | } else { |
484 | 484 | $post->post_title = ''; // Remove the auto draft title |
485 | 485 | } |
486 | 486 | } else { |
487 | - $post = get_default_post_to_edit( 'post' , true); |
|
487 | + $post = get_default_post_to_edit('post', true); |
|
488 | 488 | $user_id = get_current_user_id(); |
489 | 489 | // Don't create an option if this is a super admin who does not belong to this site. |
490 | - if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) |
|
491 | - update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID |
|
490 | + if (in_array(get_current_blog_id(), array_keys(get_blogs_of_user($user_id)))) |
|
491 | + update_user_option($user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID); // Save post_ID |
|
492 | 492 | } |
493 | 493 | |
494 | 494 | $post_ID = (int) $post->ID; |
495 | 495 | ?> |
496 | 496 | |
497 | - <form name="post" action="<?php echo esc_url( admin_url( 'post.php' ) ); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js"> |
|
497 | + <form name="post" action="<?php echo esc_url(admin_url('post.php')); ?>" method="post" id="quick-press" class="initial-form hide-if-no-js"> |
|
498 | 498 | |
499 | - <?php if ( $error_msg ) : ?> |
|
499 | + <?php if ($error_msg) : ?> |
|
500 | 500 | <div class="error"><?php echo $error_msg; ?></div> |
501 | 501 | <?php endif; ?> |
502 | 502 | |
@@ -505,14 +505,14 @@ discard block |
||
505 | 505 | |
506 | 506 | <?php |
507 | 507 | /** This filter is documented in wp-admin/edit-form-advanced.php */ |
508 | - echo apply_filters( 'enter_title_here', __( 'Title' ), $post ); |
|
508 | + echo apply_filters('enter_title_here', __('Title'), $post); |
|
509 | 509 | ?> |
510 | 510 | </label> |
511 | 511 | <input type="text" name="post_title" id="title" autocomplete="off" /> |
512 | 512 | </div> |
513 | 513 | |
514 | 514 | <div class="textarea-wrap" id="description-wrap"> |
515 | - <label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e( 'What’s on your mind?' ); ?></label> |
|
515 | + <label class="screen-reader-text prompt" for="content" id="content-prompt-text"><?php _e('What’s on your mind?'); ?></label> |
|
516 | 516 | <textarea name="content" id="content" class="mceEditor" rows="3" cols="15" autocomplete="off"></textarea> |
517 | 517 | </div> |
518 | 518 | |
@@ -520,8 +520,8 @@ discard block |
||
520 | 520 | <input type="hidden" name="action" id="quickpost-action" value="post-quickdraft-save" /> |
521 | 521 | <input type="hidden" name="post_ID" value="<?php echo $post_ID; ?>" /> |
522 | 522 | <input type="hidden" name="post_type" value="post" /> |
523 | - <?php wp_nonce_field( 'add-post' ); ?> |
|
524 | - <?php submit_button( __( 'Save Draft' ), 'primary', 'save', false, array( 'id' => 'save-post' ) ); ?> |
|
523 | + <?php wp_nonce_field('add-post'); ?> |
|
524 | + <?php submit_button(__('Save Draft'), 'primary', 'save', false, array('id' => 'save-post')); ?> |
|
525 | 525 | <br class="clear" /> |
526 | 526 | </p> |
527 | 527 | |
@@ -537,8 +537,8 @@ discard block |
||
537 | 537 | * |
538 | 538 | * @param array $drafts |
539 | 539 | */ |
540 | -function wp_dashboard_recent_drafts( $drafts = false ) { |
|
541 | - if ( ! $drafts ) { |
|
540 | +function wp_dashboard_recent_drafts($drafts = false) { |
|
541 | + if ( ! $drafts) { |
|
542 | 542 | $query_args = array( |
543 | 543 | 'post_type' => 'post', |
544 | 544 | 'post_status' => 'draft', |
@@ -555,30 +555,30 @@ discard block |
||
555 | 555 | * |
556 | 556 | * @param array $query_args The query arguments for the 'Recent Drafts' dashboard widget. |
557 | 557 | */ |
558 | - $query_args = apply_filters( 'dashboard_recent_drafts_query_args', $query_args ); |
|
558 | + $query_args = apply_filters('dashboard_recent_drafts_query_args', $query_args); |
|
559 | 559 | |
560 | - $drafts = get_posts( $query_args ); |
|
561 | - if ( ! $drafts ) { |
|
560 | + $drafts = get_posts($query_args); |
|
561 | + if ( ! $drafts) { |
|
562 | 562 | return; |
563 | 563 | } |
564 | 564 | } |
565 | 565 | |
566 | 566 | echo '<div class="drafts">'; |
567 | - if ( count( $drafts ) > 3 ) { |
|
568 | - echo '<p class="view-all"><a href="' . esc_url( admin_url( 'edit.php?post_status=draft' ) ) . '">' . __( 'View all drafts' ) . "</a></p>\n"; |
|
567 | + if (count($drafts) > 3) { |
|
568 | + echo '<p class="view-all"><a href="'.esc_url(admin_url('edit.php?post_status=draft')).'">'.__('View all drafts')."</a></p>\n"; |
|
569 | 569 | } |
570 | - echo '<h2 class="hide-if-no-js">' . __( 'Your Recent Drafts' ) . "</h2>\n<ul>"; |
|
570 | + echo '<h2 class="hide-if-no-js">'.__('Your Recent Drafts')."</h2>\n<ul>"; |
|
571 | 571 | |
572 | - $drafts = array_slice( $drafts, 0, 3 ); |
|
573 | - foreach ( $drafts as $draft ) { |
|
574 | - $url = get_edit_post_link( $draft->ID ); |
|
575 | - $title = _draft_or_post_title( $draft->ID ); |
|
572 | + $drafts = array_slice($drafts, 0, 3); |
|
573 | + foreach ($drafts as $draft) { |
|
574 | + $url = get_edit_post_link($draft->ID); |
|
575 | + $title = _draft_or_post_title($draft->ID); |
|
576 | 576 | echo "<li>\n"; |
577 | 577 | /* translators: %s: post title */ |
578 | - echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>'; |
|
579 | - echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>'; |
|
580 | - if ( $the_content = wp_trim_words( $draft->post_content, 10 ) ) { |
|
581 | - echo '<p>' . $the_content . '</p>'; |
|
578 | + echo '<div class="draft-title"><a href="'.esc_url($url).'" aria-label="'.esc_attr(sprintf(__('Edit “%s”'), $title)).'">'.esc_html($title).'</a>'; |
|
579 | + echo '<time datetime="'.get_the_time('c', $draft).'">'.get_the_time(__('F j, Y'), $draft).'</time></div>'; |
|
580 | + if ($the_content = wp_trim_words($draft->post_content, 10)) { |
|
581 | + echo '<p>'.$the_content.'</p>'; |
|
582 | 582 | } |
583 | 583 | echo "</li>\n"; |
584 | 584 | } |
@@ -596,20 +596,20 @@ discard block |
||
596 | 596 | * @param WP_Comment $comment The current comment. |
597 | 597 | * @param bool $show_date Optional. Whether to display the date. |
598 | 598 | */ |
599 | -function _wp_dashboard_recent_comments_row( &$comment, $show_date = true ) { |
|
599 | +function _wp_dashboard_recent_comments_row(&$comment, $show_date = true) { |
|
600 | 600 | $GLOBALS['comment'] = clone $comment; |
601 | 601 | |
602 | - if ( $comment->comment_post_ID > 0 ) { |
|
602 | + if ($comment->comment_post_ID > 0) { |
|
603 | 603 | |
604 | - $comment_post_title = _draft_or_post_title( $comment->comment_post_ID ); |
|
605 | - $comment_post_url = get_the_permalink( $comment->comment_post_ID ); |
|
604 | + $comment_post_title = _draft_or_post_title($comment->comment_post_ID); |
|
605 | + $comment_post_url = get_the_permalink($comment->comment_post_ID); |
|
606 | 606 | $comment_post_link = "<a href='$comment_post_url'>$comment_post_title</a>"; |
607 | 607 | } else { |
608 | 608 | $comment_post_link = ''; |
609 | 609 | } |
610 | 610 | |
611 | 611 | $actions_string = ''; |
612 | - if ( current_user_can( 'edit_comment', $comment->comment_ID ) ) { |
|
612 | + if (current_user_can('edit_comment', $comment->comment_ID)) { |
|
613 | 613 | // Pre-order it: Approve | Reply | Edit | Spam | Trash. |
614 | 614 | $actions = array( |
615 | 615 | 'approve' => '', 'unapprove' => '', |
@@ -620,28 +620,28 @@ discard block |
||
620 | 620 | 'view' => '', |
621 | 621 | ); |
622 | 622 | |
623 | - $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
|
624 | - $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
|
623 | + $del_nonce = esc_html('_wpnonce='.wp_create_nonce("delete-comment_$comment->comment_ID")); |
|
624 | + $approve_nonce = esc_html('_wpnonce='.wp_create_nonce("approve-comment_$comment->comment_ID")); |
|
625 | 625 | |
626 | - $approve_url = esc_url( "comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); |
|
627 | - $unapprove_url = esc_url( "comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce" ); |
|
628 | - $spam_url = esc_url( "comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
|
629 | - $trash_url = esc_url( "comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
|
630 | - $delete_url = esc_url( "comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce" ); |
|
626 | + $approve_url = esc_url("comment.php?action=approvecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce"); |
|
627 | + $unapprove_url = esc_url("comment.php?action=unapprovecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$approve_nonce"); |
|
628 | + $spam_url = esc_url("comment.php?action=spamcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce"); |
|
629 | + $trash_url = esc_url("comment.php?action=trashcomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce"); |
|
630 | + $delete_url = esc_url("comment.php?action=deletecomment&p=$comment->comment_post_ID&c=$comment->comment_ID&$del_nonce"); |
|
631 | 631 | |
632 | - $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
|
633 | - $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
|
634 | - $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>". __( 'Edit' ) . '</a>'; |
|
635 | - $actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\'' . $comment->comment_ID . '\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" aria-label="' . esc_attr__( 'Reply to this comment' ) . '" href="#">' . __( 'Reply' ) . '</a>'; |
|
636 | - $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' aria-label='" . esc_attr__( 'Mark this comment as spam' ) . "'>" . /* translators: mark as spam link */ _x( 'Spam', 'verb' ) . '</a>'; |
|
632 | + $actions['approve'] = "<a href='$approve_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' class='vim-a' aria-label='".esc_attr__('Approve this comment')."'>".__('Approve').'</a>'; |
|
633 | + $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' class='vim-u' aria-label='".esc_attr__('Unapprove this comment')."'>".__('Unapprove').'</a>'; |
|
634 | + $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='".esc_attr__('Edit this comment')."'>".__('Edit').'</a>'; |
|
635 | + $actions['reply'] = '<a onclick="window.commentReply && commentReply.open(\''.$comment->comment_ID.'\',\''.$comment->comment_post_ID.'\');return false;" class="vim-r hide-if-no-js" aria-label="'.esc_attr__('Reply to this comment').'" href="#">'.__('Reply').'</a>'; |
|
636 | + $actions['spam'] = "<a href='$spam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::spam=1' class='vim-s vim-destructive' aria-label='".esc_attr__('Mark this comment as spam')."'>"./* translators: mark as spam link */ _x('Spam', 'verb').'</a>'; |
|
637 | 637 | |
638 | - if ( ! EMPTY_TRASH_DAYS ) { |
|
639 | - $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>'; |
|
638 | + if ( ! EMPTY_TRASH_DAYS) { |
|
639 | + $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='".esc_attr__('Delete this comment permanently')."'>".__('Delete Permanently').'</a>'; |
|
640 | 640 | } else { |
641 | - $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Move this comment to the Trash' ) . "'>" . _x( 'Trash', 'verb' ) . '</a>'; |
|
641 | + $actions['trash'] = "<a href='$trash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::trash=1' class='delete vim-d vim-destructive' aria-label='".esc_attr__('Move this comment to the Trash')."'>"._x('Trash', 'verb').'</a>'; |
|
642 | 642 | } |
643 | 643 | |
644 | - $actions['view'] = '<a class="comment-link" href="' . esc_url( get_comment_link( $comment ) ) . '" aria-label="' . esc_attr__( 'View this comment' ) . '">' . __( 'View' ) . '</a>'; |
|
644 | + $actions['view'] = '<a class="comment-link" href="'.esc_url(get_comment_link($comment)).'" aria-label="'.esc_attr__('View this comment').'">'.__('View').'</a>'; |
|
645 | 645 | |
646 | 646 | /** |
647 | 647 | * Filters the action links displayed for each comment in the 'Recent Comments' |
@@ -654,19 +654,19 @@ discard block |
||
654 | 654 | * 'Delete', and 'Trash'. |
655 | 655 | * @param WP_Comment $comment The comment object. |
656 | 656 | */ |
657 | - $actions = apply_filters( 'comment_row_actions', array_filter($actions), $comment ); |
|
657 | + $actions = apply_filters('comment_row_actions', array_filter($actions), $comment); |
|
658 | 658 | |
659 | 659 | $i = 0; |
660 | - foreach ( $actions as $action => $link ) { |
|
660 | + foreach ($actions as $action => $link) { |
|
661 | 661 | ++$i; |
662 | - ( ( ('approve' == $action || 'unapprove' == $action) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
|
662 | + ((('approve' == $action || 'unapprove' == $action) && 2 === $i) || 1 === $i) ? $sep = '' : $sep = ' | '; |
|
663 | 663 | |
664 | 664 | // Reply and quickedit need a hide-if-no-js span |
665 | - if ( 'reply' == $action || 'quickedit' == $action ) { |
|
665 | + if ('reply' == $action || 'quickedit' == $action) { |
|
666 | 666 | $action .= ' hide-if-no-js'; |
667 | 667 | } |
668 | 668 | |
669 | - if ( 'view' === $action && '1' !== $comment->comment_approved ) { |
|
669 | + if ('view' === $action && '1' !== $comment->comment_approved) { |
|
670 | 670 | $action .= ' hidden'; |
671 | 671 | } |
672 | 672 | $actions_string .= "<span class='$action'>$sep$link</span>"; |
@@ -674,30 +674,30 @@ discard block |
||
674 | 674 | } |
675 | 675 | ?> |
676 | 676 | |
677 | - <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class( array( 'comment-item', wp_get_comment_status( $comment ) ), $comment ); ?>> |
|
677 | + <li id="comment-<?php echo $comment->comment_ID; ?>" <?php comment_class(array('comment-item', wp_get_comment_status($comment)), $comment); ?>> |
|
678 | 678 | |
679 | - <?php echo get_avatar( $comment, 50, 'mystery' ); ?> |
|
679 | + <?php echo get_avatar($comment, 50, 'mystery'); ?> |
|
680 | 680 | |
681 | - <?php if ( !$comment->comment_type || 'comment' == $comment->comment_type ) : ?> |
|
681 | + <?php if ( ! $comment->comment_type || 'comment' == $comment->comment_type) : ?> |
|
682 | 682 | |
683 | 683 | <div class="dashboard-comment-wrap has-row-actions"> |
684 | 684 | <p class="comment-meta"> |
685 | 685 | <?php |
686 | 686 | // Comments might not have a post they relate to, e.g. programmatically created ones. |
687 | - if ( $comment_post_link ) { |
|
687 | + if ($comment_post_link) { |
|
688 | 688 | printf( |
689 | 689 | /* translators: 1: comment author, 2: post link, 3: notification if the comment is pending */ |
690 | - __( 'From %1$s on %2$s %3$s' ), |
|
691 | - '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>', |
|
690 | + __('From %1$s on %2$s %3$s'), |
|
691 | + '<cite class="comment-author">'.get_comment_author_link($comment).'</cite>', |
|
692 | 692 | $comment_post_link, |
693 | - '<span class="approve">' . __( '[Pending]' ) . '</span>' |
|
693 | + '<span class="approve">'.__('[Pending]').'</span>' |
|
694 | 694 | ); |
695 | 695 | } else { |
696 | 696 | printf( |
697 | 697 | /* translators: 1: comment author, 2: notification if the comment is pending */ |
698 | - __( 'From %1$s %2$s' ), |
|
699 | - '<cite class="comment-author">' . get_comment_author_link( $comment ) . '</cite>', |
|
700 | - '<span class="approve">' . __( '[Pending]' ) . '</span>' |
|
698 | + __('From %1$s %2$s'), |
|
699 | + '<cite class="comment-author">'.get_comment_author_link($comment).'</cite>', |
|
700 | + '<span class="approve">'.__('[Pending]').'</span>' |
|
701 | 701 | ); |
702 | 702 | } |
703 | 703 | ?> |
@@ -705,45 +705,45 @@ discard block |
||
705 | 705 | |
706 | 706 | <?php |
707 | 707 | else : |
708 | - switch ( $comment->comment_type ) { |
|
708 | + switch ($comment->comment_type) { |
|
709 | 709 | case 'pingback' : |
710 | - $type = __( 'Pingback' ); |
|
710 | + $type = __('Pingback'); |
|
711 | 711 | break; |
712 | 712 | case 'trackback' : |
713 | - $type = __( 'Trackback' ); |
|
713 | + $type = __('Trackback'); |
|
714 | 714 | break; |
715 | 715 | default : |
716 | - $type = ucwords( $comment->comment_type ); |
|
716 | + $type = ucwords($comment->comment_type); |
|
717 | 717 | } |
718 | - $type = esc_html( $type ); |
|
718 | + $type = esc_html($type); |
|
719 | 719 | ?> |
720 | 720 | <div class="dashboard-comment-wrap has-row-actions"> |
721 | 721 | <p class="comment-meta"> |
722 | 722 | <?php |
723 | 723 | // Pingbacks, Trackbacks or custom comment types might not have a post they relate to, e.g. programmatically created ones. |
724 | - if ( $comment_post_link ) { |
|
724 | + if ($comment_post_link) { |
|
725 | 725 | printf( |
726 | 726 | /* translators: 1: type of comment, 2: post link, 3: notification if the comment is pending */ |
727 | - _x( '%1$s on %2$s %3$s', 'dashboard' ), |
|
727 | + _x('%1$s on %2$s %3$s', 'dashboard'), |
|
728 | 728 | "<strong>$type</strong>", |
729 | 729 | $comment_post_link, |
730 | - '<span class="approve">' . __( '[Pending]' ) . '</span>' |
|
730 | + '<span class="approve">'.__('[Pending]').'</span>' |
|
731 | 731 | ); |
732 | 732 | } else { |
733 | 733 | printf( |
734 | 734 | /* translators: 1: type of comment, 2: notification if the comment is pending */ |
735 | - _x( '%1$s %2$s', 'dashboard' ), |
|
735 | + _x('%1$s %2$s', 'dashboard'), |
|
736 | 736 | "<strong>$type</strong>", |
737 | - '<span class="approve">' . __( '[Pending]' ) . '</span>' |
|
737 | + '<span class="approve">'.__('[Pending]').'</span>' |
|
738 | 738 | ); |
739 | 739 | } |
740 | 740 | ?> |
741 | 741 | </p> |
742 | - <p class="comment-author"><?php comment_author_link( $comment ); ?></p> |
|
742 | + <p class="comment-author"><?php comment_author_link($comment); ?></p> |
|
743 | 743 | |
744 | 744 | <?php endif; // comment_type ?> |
745 | - <blockquote><p><?php comment_excerpt( $comment ); ?></p></blockquote> |
|
746 | - <?php if ( $actions_string ) : ?> |
|
745 | + <blockquote><p><?php comment_excerpt($comment); ?></p></blockquote> |
|
746 | + <?php if ($actions_string) : ?> |
|
747 | 747 | <p class="row-actions"><?php echo $actions_string; ?></p> |
748 | 748 | <?php endif; ?> |
749 | 749 | </div> |
@@ -761,27 +761,27 @@ discard block |
||
761 | 761 | |
762 | 762 | echo '<div id="activity-widget">'; |
763 | 763 | |
764 | - $future_posts = wp_dashboard_recent_posts( array( |
|
764 | + $future_posts = wp_dashboard_recent_posts(array( |
|
765 | 765 | 'max' => 5, |
766 | 766 | 'status' => 'future', |
767 | 767 | 'order' => 'ASC', |
768 | - 'title' => __( 'Publishing Soon' ), |
|
768 | + 'title' => __('Publishing Soon'), |
|
769 | 769 | 'id' => 'future-posts', |
770 | - ) ); |
|
771 | - $recent_posts = wp_dashboard_recent_posts( array( |
|
770 | + )); |
|
771 | + $recent_posts = wp_dashboard_recent_posts(array( |
|
772 | 772 | 'max' => 5, |
773 | 773 | 'status' => 'publish', |
774 | 774 | 'order' => 'DESC', |
775 | - 'title' => __( 'Recently Published' ), |
|
775 | + 'title' => __('Recently Published'), |
|
776 | 776 | 'id' => 'published-posts', |
777 | - ) ); |
|
777 | + )); |
|
778 | 778 | |
779 | 779 | $recent_comments = wp_dashboard_recent_comments(); |
780 | 780 | |
781 | - if ( !$future_posts && !$recent_posts && !$recent_comments ) { |
|
781 | + if ( ! $future_posts && ! $recent_posts && ! $recent_comments) { |
|
782 | 782 | echo '<div class="no-activity">'; |
783 | 783 | echo '<p class="smiley" aria-hidden="true"></p>'; |
784 | - echo '<p>' . __( 'No activity yet!' ) . '</p>'; |
|
784 | + echo '<p>'.__('No activity yet!').'</p>'; |
|
785 | 785 | echo '</div>'; |
786 | 786 | } |
787 | 787 | |
@@ -804,16 +804,16 @@ discard block |
||
804 | 804 | * } |
805 | 805 | * @return bool False if no posts were found. True otherwise. |
806 | 806 | */ |
807 | -function wp_dashboard_recent_posts( $args ) { |
|
807 | +function wp_dashboard_recent_posts($args) { |
|
808 | 808 | $query_args = array( |
809 | 809 | 'post_type' => 'post', |
810 | 810 | 'post_status' => $args['status'], |
811 | 811 | 'orderby' => 'date', |
812 | 812 | 'order' => $args['order'], |
813 | - 'posts_per_page' => intval( $args['max'] ), |
|
813 | + 'posts_per_page' => intval($args['max']), |
|
814 | 814 | 'no_found_rows' => true, |
815 | 815 | 'cache_results' => false, |
816 | - 'perm' => ( 'future' === $args['status'] ) ? 'editable' : 'readable', |
|
816 | + 'perm' => ('future' === $args['status']) ? 'editable' : 'readable', |
|
817 | 817 | ); |
818 | 818 | |
819 | 819 | /** |
@@ -823,47 +823,47 @@ discard block |
||
823 | 823 | * |
824 | 824 | * @param array $query_args The arguments passed to WP_Query to produce the list of posts. |
825 | 825 | */ |
826 | - $query_args = apply_filters( 'dashboard_recent_posts_query_args', $query_args ); |
|
827 | - $posts = new WP_Query( $query_args ); |
|
826 | + $query_args = apply_filters('dashboard_recent_posts_query_args', $query_args); |
|
827 | + $posts = new WP_Query($query_args); |
|
828 | 828 | |
829 | - if ( $posts->have_posts() ) { |
|
829 | + if ($posts->have_posts()) { |
|
830 | 830 | |
831 | - echo '<div id="' . $args['id'] . '" class="activity-block">'; |
|
831 | + echo '<div id="'.$args['id'].'" class="activity-block">'; |
|
832 | 832 | |
833 | - echo '<h3>' . $args['title'] . '</h3>'; |
|
833 | + echo '<h3>'.$args['title'].'</h3>'; |
|
834 | 834 | |
835 | 835 | echo '<ul>'; |
836 | 836 | |
837 | - $today = date( 'Y-m-d', current_time( 'timestamp' ) ); |
|
838 | - $tomorrow = date( 'Y-m-d', strtotime( '+1 day', current_time( 'timestamp' ) ) ); |
|
837 | + $today = date('Y-m-d', current_time('timestamp')); |
|
838 | + $tomorrow = date('Y-m-d', strtotime('+1 day', current_time('timestamp'))); |
|
839 | 839 | |
840 | - while ( $posts->have_posts() ) { |
|
840 | + while ($posts->have_posts()) { |
|
841 | 841 | $posts->the_post(); |
842 | 842 | |
843 | - $time = get_the_time( 'U' ); |
|
844 | - if ( date( 'Y-m-d', $time ) == $today ) { |
|
845 | - $relative = __( 'Today' ); |
|
846 | - } elseif ( date( 'Y-m-d', $time ) == $tomorrow ) { |
|
847 | - $relative = __( 'Tomorrow' ); |
|
848 | - } elseif ( date( 'Y', $time ) !== date( 'Y', current_time( 'timestamp' ) ) ) { |
|
843 | + $time = get_the_time('U'); |
|
844 | + if (date('Y-m-d', $time) == $today) { |
|
845 | + $relative = __('Today'); |
|
846 | + } elseif (date('Y-m-d', $time) == $tomorrow) { |
|
847 | + $relative = __('Tomorrow'); |
|
848 | + } elseif (date('Y', $time) !== date('Y', current_time('timestamp'))) { |
|
849 | 849 | /* translators: date and time format for recent posts on the dashboard, from a different calendar year, see https://secure.php.net/date */ |
850 | - $relative = date_i18n( __( 'M jS Y' ), $time ); |
|
850 | + $relative = date_i18n(__('M jS Y'), $time); |
|
851 | 851 | } else { |
852 | 852 | /* translators: date and time format for recent posts on the dashboard, see https://secure.php.net/date */ |
853 | - $relative = date_i18n( __( 'M jS' ), $time ); |
|
853 | + $relative = date_i18n(__('M jS'), $time); |
|
854 | 854 | } |
855 | 855 | |
856 | 856 | // Use the post edit link for those who can edit, the permalink otherwise. |
857 | - $recent_post_link = current_user_can( 'edit_post', get_the_ID() ) ? get_edit_post_link() : get_permalink(); |
|
857 | + $recent_post_link = current_user_can('edit_post', get_the_ID()) ? get_edit_post_link() : get_permalink(); |
|
858 | 858 | |
859 | 859 | $draft_or_post_title = _draft_or_post_title(); |
860 | 860 | printf( |
861 | 861 | '<li><span>%1$s</span> <a href="%2$s" aria-label="%3$s">%4$s</a></li>', |
862 | 862 | /* translators: 1: relative date, 2: time */ |
863 | - sprintf( _x( '%1$s, %2$s', 'dashboard' ), $relative, get_the_time() ), |
|
863 | + sprintf(_x('%1$s, %2$s', 'dashboard'), $relative, get_the_time()), |
|
864 | 864 | $recent_post_link, |
865 | 865 | /* translators: %s: post title */ |
866 | - esc_attr( sprintf( __( 'Edit “%s”' ), $draft_or_post_title ) ), |
|
866 | + esc_attr(sprintf(__('Edit “%s”'), $draft_or_post_title)), |
|
867 | 867 | $draft_or_post_title |
868 | 868 | ); |
869 | 869 | } |
@@ -888,7 +888,7 @@ discard block |
||
888 | 888 | * @param int $total_items Optional. Number of comments to query. Default 5. |
889 | 889 | * @return bool False if no comments were found. True otherwise. |
890 | 890 | */ |
891 | -function wp_dashboard_recent_comments( $total_items = 5 ) { |
|
891 | +function wp_dashboard_recent_comments($total_items = 5) { |
|
892 | 892 | // Select all comment types and filter out spam later for better query performance. |
893 | 893 | $comments = array(); |
894 | 894 | |
@@ -896,36 +896,36 @@ discard block |
||
896 | 896 | 'number' => $total_items * 5, |
897 | 897 | 'offset' => 0 |
898 | 898 | ); |
899 | - if ( ! current_user_can( 'edit_posts' ) ) |
|
899 | + if ( ! current_user_can('edit_posts')) |
|
900 | 900 | $comments_query['status'] = 'approve'; |
901 | 901 | |
902 | - while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { |
|
903 | - if ( ! is_array( $possible ) ) { |
|
902 | + while (count($comments) < $total_items && $possible = get_comments($comments_query)) { |
|
903 | + if ( ! is_array($possible)) { |
|
904 | 904 | break; |
905 | 905 | } |
906 | - foreach ( $possible as $comment ) { |
|
907 | - if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) |
|
906 | + foreach ($possible as $comment) { |
|
907 | + if ( ! current_user_can('read_post', $comment->comment_post_ID)) |
|
908 | 908 | continue; |
909 | 909 | $comments[] = $comment; |
910 | - if ( count( $comments ) == $total_items ) |
|
910 | + if (count($comments) == $total_items) |
|
911 | 911 | break 2; |
912 | 912 | } |
913 | 913 | $comments_query['offset'] += $comments_query['number']; |
914 | 914 | $comments_query['number'] = $total_items * 10; |
915 | 915 | } |
916 | 916 | |
917 | - if ( $comments ) { |
|
917 | + if ($comments) { |
|
918 | 918 | echo '<div id="latest-comments" class="activity-block">'; |
919 | - echo '<h3>' . __( 'Recent Comments' ) . '</h3>'; |
|
919 | + echo '<h3>'.__('Recent Comments').'</h3>'; |
|
920 | 920 | |
921 | 921 | echo '<ul id="the-comment-list" data-wp-lists="list:comment">'; |
922 | - foreach ( $comments as $comment ) |
|
923 | - _wp_dashboard_recent_comments_row( $comment ); |
|
922 | + foreach ($comments as $comment) |
|
923 | + _wp_dashboard_recent_comments_row($comment); |
|
924 | 924 | echo '</ul>'; |
925 | 925 | |
926 | - if ( current_user_can( 'edit_posts' ) ) { |
|
927 | - echo '<h3 class="screen-reader-text">' . __( 'View more comments' ) . '</h3>'; |
|
928 | - _get_list_table( 'WP_Comments_List_Table' )->views(); |
|
926 | + if (current_user_can('edit_posts')) { |
|
927 | + echo '<h3 class="screen-reader-text">'.__('View more comments').'</h3>'; |
|
928 | + _get_list_table('WP_Comments_List_Table')->views(); |
|
929 | 929 | } |
930 | 930 | |
931 | 931 | wp_comment_reply( -1, false, 'dashboard', false ); |
@@ -945,10 +945,10 @@ discard block |
||
945 | 945 | * |
946 | 946 | * @param string $widget_id |
947 | 947 | */ |
948 | -function wp_dashboard_rss_output( $widget_id ) { |
|
949 | - $widgets = get_option( 'dashboard_widget_options' ); |
|
948 | +function wp_dashboard_rss_output($widget_id) { |
|
949 | + $widgets = get_option('dashboard_widget_options'); |
|
950 | 950 | echo '<div class="rss-widget">'; |
951 | - wp_widget_rss_output( $widgets[ $widget_id ] ); |
|
951 | + wp_widget_rss_output($widgets[$widget_id]); |
|
952 | 952 | echo "</div>"; |
953 | 953 | } |
954 | 954 | |
@@ -967,37 +967,37 @@ discard block |
||
967 | 967 | * @param array $check_urls RSS feeds |
968 | 968 | * @return bool False on failure. True on success. |
969 | 969 | */ |
970 | -function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { |
|
971 | - $loading = '<p class="widget-loading hide-if-no-js">' . __( 'Loading…' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>'; |
|
970 | +function wp_dashboard_cached_rss_widget($widget_id, $callback, $check_urls = array()) { |
|
971 | + $loading = '<p class="widget-loading hide-if-no-js">'.__('Loading…').'</p><div class="hide-if-js notice notice-error inline"><p>'.__('This widget requires JavaScript.').'</p></div>'; |
|
972 | 972 | $doing_ajax = wp_doing_ajax(); |
973 | 973 | |
974 | - if ( empty($check_urls) ) { |
|
975 | - $widgets = get_option( 'dashboard_widget_options' ); |
|
976 | - if ( empty($widgets[$widget_id]['url']) && ! $doing_ajax ) { |
|
974 | + if (empty($check_urls)) { |
|
975 | + $widgets = get_option('dashboard_widget_options'); |
|
976 | + if (empty($widgets[$widget_id]['url']) && ! $doing_ajax) { |
|
977 | 977 | echo $loading; |
978 | 978 | return false; |
979 | 979 | } |
980 | - $check_urls = array( $widgets[$widget_id]['url'] ); |
|
980 | + $check_urls = array($widgets[$widget_id]['url']); |
|
981 | 981 | } |
982 | 982 | |
983 | 983 | $locale = get_user_locale(); |
984 | - $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
|
985 | - if ( false !== ( $output = get_transient( $cache_key ) ) ) { |
|
984 | + $cache_key = 'dash_v2_'.md5($widget_id.'_'.$locale); |
|
985 | + if (false !== ($output = get_transient($cache_key))) { |
|
986 | 986 | echo $output; |
987 | 987 | return true; |
988 | 988 | } |
989 | 989 | |
990 | - if ( ! $doing_ajax ) { |
|
990 | + if ( ! $doing_ajax) { |
|
991 | 991 | echo $loading; |
992 | 992 | return false; |
993 | 993 | } |
994 | 994 | |
995 | - if ( $callback && is_callable( $callback ) ) { |
|
996 | - $args = array_slice( func_get_args(), 3 ); |
|
997 | - array_unshift( $args, $widget_id, $check_urls ); |
|
995 | + if ($callback && is_callable($callback)) { |
|
996 | + $args = array_slice(func_get_args(), 3); |
|
997 | + array_unshift($args, $widget_id, $check_urls); |
|
998 | 998 | ob_start(); |
999 | - call_user_func_array( $callback, $args ); |
|
1000 | - set_transient( $cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS ); // Default lifetime in cache of 12 hours (same as the feeds) |
|
999 | + call_user_func_array($callback, $args); |
|
1000 | + set_transient($cache_key, ob_get_flush(), 12 * HOUR_IN_SECONDS); // Default lifetime in cache of 12 hours (same as the feeds) |
|
1001 | 1001 | } |
1002 | 1002 | |
1003 | 1003 | return true; |
@@ -1016,11 +1016,11 @@ discard block |
||
1016 | 1016 | * |
1017 | 1017 | * @param int $widget_control_id Registered Widget ID. |
1018 | 1018 | */ |
1019 | -function wp_dashboard_trigger_widget_control( $widget_control_id = false ) { |
|
1019 | +function wp_dashboard_trigger_widget_control($widget_control_id = false) { |
|
1020 | 1020 | global $wp_dashboard_control_callbacks; |
1021 | 1021 | |
1022 | - if ( is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id]) ) { |
|
1023 | - call_user_func( $wp_dashboard_control_callbacks[$widget_control_id], '', array( 'id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id] ) ); |
|
1022 | + if (is_scalar($widget_control_id) && $widget_control_id && isset($wp_dashboard_control_callbacks[$widget_control_id]) && is_callable($wp_dashboard_control_callbacks[$widget_control_id])) { |
|
1023 | + call_user_func($wp_dashboard_control_callbacks[$widget_control_id], '', array('id' => $widget_control_id, 'callback' => $wp_dashboard_control_callbacks[$widget_control_id])); |
|
1024 | 1024 | } |
1025 | 1025 | } |
1026 | 1026 | |
@@ -1035,25 +1035,25 @@ discard block |
||
1035 | 1035 | * @param string $widget_id |
1036 | 1036 | * @param array $form_inputs |
1037 | 1037 | */ |
1038 | -function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { |
|
1039 | - if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) |
|
1038 | +function wp_dashboard_rss_control($widget_id, $form_inputs = array()) { |
|
1039 | + if ( ! $widget_options = get_option('dashboard_widget_options')) |
|
1040 | 1040 | $widget_options = array(); |
1041 | 1041 | |
1042 | - if ( !isset($widget_options[$widget_id]) ) |
|
1042 | + if ( ! isset($widget_options[$widget_id])) |
|
1043 | 1043 | $widget_options[$widget_id] = array(); |
1044 | 1044 | |
1045 | 1045 | $number = 1; // Hack to use wp_widget_rss_form() |
1046 | 1046 | $widget_options[$widget_id]['number'] = $number; |
1047 | 1047 | |
1048 | - if ( 'POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number]) ) { |
|
1049 | - $_POST['widget-rss'][$number] = wp_unslash( $_POST['widget-rss'][$number] ); |
|
1050 | - $widget_options[$widget_id] = wp_widget_rss_process( $_POST['widget-rss'][$number] ); |
|
1048 | + if ('POST' == $_SERVER['REQUEST_METHOD'] && isset($_POST['widget-rss'][$number])) { |
|
1049 | + $_POST['widget-rss'][$number] = wp_unslash($_POST['widget-rss'][$number]); |
|
1050 | + $widget_options[$widget_id] = wp_widget_rss_process($_POST['widget-rss'][$number]); |
|
1051 | 1051 | $widget_options[$widget_id]['number'] = $number; |
1052 | 1052 | |
1053 | 1053 | // Title is optional. If black, fill it if possible. |
1054 | - if ( !$widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title']) ) { |
|
1054 | + if ( ! $widget_options[$widget_id]['title'] && isset($_POST['widget-rss'][$number]['title'])) { |
|
1055 | 1055 | $rss = fetch_feed($widget_options[$widget_id]['url']); |
1056 | - if ( is_wp_error($rss) ) { |
|
1056 | + if (is_wp_error($rss)) { |
|
1057 | 1057 | $widget_options[$widget_id]['title'] = htmlentities(__('Unknown Feed')); |
1058 | 1058 | } else { |
1059 | 1059 | $widget_options[$widget_id]['title'] = htmlentities(strip_tags($rss->get_title())); |
@@ -1061,13 +1061,13 @@ discard block |
||
1061 | 1061 | unset($rss); |
1062 | 1062 | } |
1063 | 1063 | } |
1064 | - update_option( 'dashboard_widget_options', $widget_options ); |
|
1064 | + update_option('dashboard_widget_options', $widget_options); |
|
1065 | 1065 | $locale = get_user_locale(); |
1066 | - $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); |
|
1067 | - delete_transient( $cache_key ); |
|
1066 | + $cache_key = 'dash_v2_'.md5($widget_id.'_'.$locale); |
|
1067 | + delete_transient($cache_key); |
|
1068 | 1068 | } |
1069 | 1069 | |
1070 | - wp_widget_rss_form( $widget_options[$widget_id], $form_inputs ); |
|
1070 | + wp_widget_rss_form($widget_options[$widget_id], $form_inputs); |
|
1071 | 1071 | } |
1072 | 1072 | |
1073 | 1073 | |
@@ -1090,9 +1090,9 @@ discard block |
||
1090 | 1090 | printf( |
1091 | 1091 | '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>', |
1092 | 1092 | 'https://make.wordpress.org/community/meetups-landing-page', |
1093 | - __( 'Meetups' ), |
|
1093 | + __('Meetups'), |
|
1094 | 1094 | /* translators: accessibility text */ |
1095 | - __( '(opens in a new window)' ) |
|
1095 | + __('(opens in a new window)') |
|
1096 | 1096 | ); |
1097 | 1097 | ?> |
1098 | 1098 | |
@@ -1102,9 +1102,9 @@ discard block |
||
1102 | 1102 | printf( |
1103 | 1103 | '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>', |
1104 | 1104 | 'https://central.wordcamp.org/schedule/', |
1105 | - __( 'WordCamps' ), |
|
1105 | + __('WordCamps'), |
|
1106 | 1106 | /* translators: accessibility text */ |
1107 | - __( '(opens in a new window)' ) |
|
1107 | + __('(opens in a new window)') |
|
1108 | 1108 | ); |
1109 | 1109 | ?> |
1110 | 1110 | |
@@ -1114,10 +1114,10 @@ discard block |
||
1114 | 1114 | printf( |
1115 | 1115 | '<a href="%1$s" target="_blank">%2$s <span class="screen-reader-text">%3$s</span><span aria-hidden="true" class="dashicons dashicons-external"></span></a>', |
1116 | 1116 | /* translators: If a Rosetta site exists (e.g. https://es.wordpress.org/news/), then use that. Otherwise, leave untranslated. */ |
1117 | - esc_url( _x( 'https://wordpress.org/news/', 'Events and News dashboard widget' ) ), |
|
1118 | - __( 'News' ), |
|
1117 | + esc_url(_x('https://wordpress.org/news/', 'Events and News dashboard widget')), |
|
1118 | + __('News'), |
|
1119 | 1119 | /* translators: accessibility text */ |
1120 | - __( '(opens in a new window)' ) |
|
1120 | + __('(opens in a new window)') |
|
1121 | 1121 | ); |
1122 | 1122 | ?> |
1123 | 1123 | </p> |
@@ -1135,18 +1135,18 @@ discard block |
||
1135 | 1135 | |
1136 | 1136 | <div class="community-events-errors notice notice-error inline hide-if-js"> |
1137 | 1137 | <p class="hide-if-js"> |
1138 | - <?php _e( 'This widget requires JavaScript.' ); ?> |
|
1138 | + <?php _e('This widget requires JavaScript.'); ?> |
|
1139 | 1139 | </p> |
1140 | 1140 | |
1141 | 1141 | <p class="community-events-error-occurred" aria-hidden="true"> |
1142 | - <?php _e( 'An error occurred. Please try again.' ); ?> |
|
1142 | + <?php _e('An error occurred. Please try again.'); ?> |
|
1143 | 1143 | </p> |
1144 | 1144 | |
1145 | 1145 | <p class="community-events-could-not-locate" aria-hidden="true"></p> |
1146 | 1146 | </div> |
1147 | 1147 | |
1148 | 1148 | <div class="community-events-loading hide-if-no-js"> |
1149 | - <?php _e( 'Loading…' ); ?> |
|
1149 | + <?php _e('Loading…'); ?> |
|
1150 | 1150 | </div> |
1151 | 1151 | |
1152 | 1152 | <?php |
@@ -1160,14 +1160,14 @@ discard block |
||
1160 | 1160 | <p> |
1161 | 1161 | <span id="community-events-location-message"></span> |
1162 | 1162 | |
1163 | - <button class="button-link community-events-toggle-location" aria-label="<?php esc_attr_e( 'Edit city' ); ?>" aria-expanded="false"> |
|
1163 | + <button class="button-link community-events-toggle-location" aria-label="<?php esc_attr_e('Edit city'); ?>" aria-expanded="false"> |
|
1164 | 1164 | <span class="dashicons dashicons-edit"></span> |
1165 | 1165 | </button> |
1166 | 1166 | </p> |
1167 | 1167 | |
1168 | - <form class="community-events-form" aria-hidden="true" action="<?php echo esc_url( admin_url( 'admin-ajax.php' ) ); ?>" method="post"> |
|
1168 | + <form class="community-events-form" aria-hidden="true" action="<?php echo esc_url(admin_url('admin-ajax.php')); ?>" method="post"> |
|
1169 | 1169 | <label for="community-events-location"> |
1170 | - <?php _e( 'City:' ); ?> |
|
1170 | + <?php _e('City:'); ?> |
|
1171 | 1171 | </label> |
1172 | 1172 | <?php |
1173 | 1173 | /* translators: Replace with a city related to your locale. |
@@ -1179,12 +1179,12 @@ discard block |
||
1179 | 1179 | * (native locale name) instead of the English name if possible. |
1180 | 1180 | */ |
1181 | 1181 | ?> |
1182 | - <input id="community-events-location" class="regular-text" type="text" name="community-events-location" placeholder="<?php esc_attr_e( 'Cincinnati' ); ?>" /> |
|
1182 | + <input id="community-events-location" class="regular-text" type="text" name="community-events-location" placeholder="<?php esc_attr_e('Cincinnati'); ?>" /> |
|
1183 | 1183 | |
1184 | - <?php submit_button( __( 'Submit' ), 'secondary', 'community-events-submit', false ); ?> |
|
1184 | + <?php submit_button(__('Submit'), 'secondary', 'community-events-submit', false); ?> |
|
1185 | 1185 | |
1186 | 1186 | <button class="community-events-cancel button-link" type="button" aria-expanded="false"> |
1187 | - <?php _e( 'Cancel' ); ?> |
|
1187 | + <?php _e('Cancel'); ?> |
|
1188 | 1188 | </button> |
1189 | 1189 | |
1190 | 1190 | <span class="spinner"></span> |
@@ -1208,7 +1208,7 @@ discard block |
||
1208 | 1208 | <script id="tmpl-community-events-attend-event-near" type="text/template"> |
1209 | 1209 | <?php printf( |
1210 | 1210 | /* translators: %s is a placeholder for the name of a city. */ |
1211 | - __( 'Attend an upcoming event near %s.' ), |
|
1211 | + __('Attend an upcoming event near %s.'), |
|
1212 | 1212 | '<strong>{{ data.location.description }}</strong>' |
1213 | 1213 | ); ?> |
1214 | 1214 | </script> |
@@ -1220,7 +1220,7 @@ discard block |
||
1220 | 1220 | * that they match the expected location before including them. |
1221 | 1221 | * Use endonyms (native locale names) whenever possible. |
1222 | 1222 | */ |
1223 | - __( 'We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.' ), |
|
1223 | + __('We couldn’t locate %s. Please try another nearby city. For example: Kansas City; Springfield; Portland.'), |
|
1224 | 1224 | '<em>{{data.unknownCity}}</em>' |
1225 | 1225 | ); ?> |
1226 | 1226 | </script> |
@@ -1251,16 +1251,16 @@ discard block |
||
1251 | 1251 | <# if ( data.location.description ) { #> |
1252 | 1252 | <?php printf( |
1253 | 1253 | /* translators: 1: the city the user searched for, 2: meetup organization documentation URL */ |
1254 | - __( 'There aren’t any events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize one</a>?' ), |
|
1254 | + __('There aren’t any events scheduled near %1$s at the moment. Would you like to <a href="%2$s">organize one</a>?'), |
|
1255 | 1255 | '{{ data.location.description }}', |
1256 | - __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' ) |
|
1256 | + __('https://make.wordpress.org/community/handbook/meetup-organizer/welcome/') |
|
1257 | 1257 | ); ?> |
1258 | 1258 | |
1259 | 1259 | <# } else { #> |
1260 | 1260 | <?php printf( |
1261 | 1261 | /* translators: meetup organization documentation URL. */ |
1262 | - __( 'There aren’t any events scheduled near you at the moment. Would you like to <a href="%s">organize one</a>?' ), |
|
1263 | - __( 'https://make.wordpress.org/community/handbook/meetup-organizer/welcome/' ) |
|
1262 | + __('There aren’t any events scheduled near you at the moment. Would you like to <a href="%s">organize one</a>?'), |
|
1263 | + __('https://make.wordpress.org/community/handbook/meetup-organizer/welcome/') |
|
1264 | 1264 | ); ?> |
1265 | 1265 | <# } #> |
1266 | 1266 | </li> |
@@ -1285,7 +1285,7 @@ discard block |
||
1285 | 1285 | * |
1286 | 1286 | * @param string $link The widget's primary link URL. |
1287 | 1287 | */ |
1288 | - 'link' => apply_filters( 'dashboard_primary_link', __( 'https://wordpress.org/news/' ) ), |
|
1288 | + 'link' => apply_filters('dashboard_primary_link', __('https://wordpress.org/news/')), |
|
1289 | 1289 | |
1290 | 1290 | /** |
1291 | 1291 | * Filters the primary feed URL for the 'WordPress News' dashboard widget. |
@@ -1294,7 +1294,7 @@ discard block |
||
1294 | 1294 | * |
1295 | 1295 | * @param string $url The widget's primary feed URL. |
1296 | 1296 | */ |
1297 | - 'url' => apply_filters( 'dashboard_primary_feed', __( 'http://wordpress.org/news/feed/' ) ), |
|
1297 | + 'url' => apply_filters('dashboard_primary_feed', __('http://wordpress.org/news/feed/')), |
|
1298 | 1298 | |
1299 | 1299 | /** |
1300 | 1300 | * Filters the primary link title for the 'WordPress News' dashboard widget. |
@@ -1303,7 +1303,7 @@ discard block |
||
1303 | 1303 | * |
1304 | 1304 | * @param string $title Title attribute for the widget's primary link. |
1305 | 1305 | */ |
1306 | - 'title' => apply_filters( 'dashboard_primary_title', __( 'WordPress Blog' ) ), |
|
1306 | + 'title' => apply_filters('dashboard_primary_title', __('WordPress Blog')), |
|
1307 | 1307 | 'items' => 1, |
1308 | 1308 | 'show_summary' => 0, |
1309 | 1309 | 'show_author' => 0, |
@@ -1318,7 +1318,7 @@ discard block |
||
1318 | 1318 | * |
1319 | 1319 | * @param string $link The widget's secondary link URL. |
1320 | 1320 | */ |
1321 | - 'link' => apply_filters( 'dashboard_secondary_link', __( 'https://planet.wordpress.org/' ) ), |
|
1321 | + 'link' => apply_filters('dashboard_secondary_link', __('https://planet.wordpress.org/')), |
|
1322 | 1322 | |
1323 | 1323 | /** |
1324 | 1324 | * Filters the secondary feed URL for the 'WordPress News' dashboard widget. |
@@ -1327,7 +1327,7 @@ discard block |
||
1327 | 1327 | * |
1328 | 1328 | * @param string $url The widget's secondary feed URL. |
1329 | 1329 | */ |
1330 | - 'url' => apply_filters( 'dashboard_secondary_feed', __( 'https://planet.wordpress.org/feed/' ) ), |
|
1330 | + 'url' => apply_filters('dashboard_secondary_feed', __('https://planet.wordpress.org/feed/')), |
|
1331 | 1331 | |
1332 | 1332 | /** |
1333 | 1333 | * Filters the secondary link title for the 'WordPress News' dashboard widget. |
@@ -1336,7 +1336,7 @@ discard block |
||
1336 | 1336 | * |
1337 | 1337 | * @param string $title Title attribute for the widget's secondary link. |
1338 | 1338 | */ |
1339 | - 'title' => apply_filters( 'dashboard_secondary_title', __( 'Other WordPress News' ) ), |
|
1339 | + 'title' => apply_filters('dashboard_secondary_title', __('Other WordPress News')), |
|
1340 | 1340 | |
1341 | 1341 | /** |
1342 | 1342 | * Filters the number of secondary link items for the 'WordPress News' dashboard widget. |
@@ -1345,14 +1345,14 @@ discard block |
||
1345 | 1345 | * |
1346 | 1346 | * @param string $items How many items to show in the secondary feed. |
1347 | 1347 | */ |
1348 | - 'items' => apply_filters( 'dashboard_secondary_items', 3 ), |
|
1348 | + 'items' => apply_filters('dashboard_secondary_items', 3), |
|
1349 | 1349 | 'show_summary' => 0, |
1350 | 1350 | 'show_author' => 0, |
1351 | 1351 | 'show_date' => 0, |
1352 | 1352 | ) |
1353 | 1353 | ); |
1354 | 1354 | |
1355 | - wp_dashboard_cached_rss_widget( 'dashboard_primary', 'wp_dashboard_primary_output', $feeds ); |
|
1355 | + wp_dashboard_cached_rss_widget('dashboard_primary', 'wp_dashboard_primary_output', $feeds); |
|
1356 | 1356 | } |
1357 | 1357 | |
1358 | 1358 | /** |
@@ -1364,11 +1364,11 @@ discard block |
||
1364 | 1364 | * @param string $widget_id Widget ID. |
1365 | 1365 | * @param array $feeds Array of RSS feeds. |
1366 | 1366 | */ |
1367 | -function wp_dashboard_primary_output( $widget_id, $feeds ) { |
|
1368 | - foreach ( $feeds as $type => $args ) { |
|
1367 | +function wp_dashboard_primary_output($widget_id, $feeds) { |
|
1368 | + foreach ($feeds as $type => $args) { |
|
1369 | 1369 | $args['type'] = $type; |
1370 | 1370 | echo '<div class="rss-widget">'; |
1371 | - wp_widget_rss_output( $args['url'], $args ); |
|
1371 | + wp_widget_rss_output($args['url'], $args); |
|
1372 | 1372 | echo "</div>"; |
1373 | 1373 | } |
1374 | 1374 | } |
@@ -1383,48 +1383,48 @@ discard block |
||
1383 | 1383 | * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled. |
1384 | 1384 | */ |
1385 | 1385 | function wp_dashboard_quota() { |
1386 | - if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) |
|
1386 | + if ( ! is_multisite() || ! current_user_can('upload_files') || get_site_option('upload_space_check_disabled')) |
|
1387 | 1387 | return true; |
1388 | 1388 | |
1389 | 1389 | $quota = get_space_allowed(); |
1390 | 1390 | $used = get_space_used(); |
1391 | 1391 | |
1392 | - if ( $used > $quota ) |
|
1392 | + if ($used > $quota) |
|
1393 | 1393 | $percentused = '100'; |
1394 | 1394 | else |
1395 | - $percentused = ( $used / $quota ) * 100; |
|
1396 | - $used_class = ( $percentused >= 70 ) ? ' warning' : ''; |
|
1397 | - $used = round( $used, 2 ); |
|
1398 | - $percentused = number_format( $percentused ); |
|
1395 | + $percentused = ($used / $quota) * 100; |
|
1396 | + $used_class = ($percentused >= 70) ? ' warning' : ''; |
|
1397 | + $used = round($used, 2); |
|
1398 | + $percentused = number_format($percentused); |
|
1399 | 1399 | |
1400 | 1400 | ?> |
1401 | - <h3 class="mu-storage"><?php _e( 'Storage Space' ); ?></h3> |
|
1401 | + <h3 class="mu-storage"><?php _e('Storage Space'); ?></h3> |
|
1402 | 1402 | <div class="mu-storage"> |
1403 | 1403 | <ul> |
1404 | 1404 | <li class="storage-count"> |
1405 | 1405 | <?php $text = sprintf( |
1406 | 1406 | /* translators: number of megabytes */ |
1407 | - __( '%s MB Space Allowed' ), |
|
1408 | - number_format_i18n( $quota ) |
|
1407 | + __('%s MB Space Allowed'), |
|
1408 | + number_format_i18n($quota) |
|
1409 | 1409 | ); |
1410 | 1410 | printf( |
1411 | 1411 | '<a href="%1$s">%2$s <span class="screen-reader-text">(%3$s)</span></a>', |
1412 | - esc_url( admin_url( 'upload.php' ) ), |
|
1412 | + esc_url(admin_url('upload.php')), |
|
1413 | 1413 | $text, |
1414 | - __( 'Manage Uploads' ) |
|
1414 | + __('Manage Uploads') |
|
1415 | 1415 | ); ?> |
1416 | 1416 | </li><li class="storage-count <?php echo $used_class; ?>"> |
1417 | 1417 | <?php $text = sprintf( |
1418 | 1418 | /* translators: 1: number of megabytes, 2: percentage */ |
1419 | - __( '%1$s MB (%2$s%%) Space Used' ), |
|
1420 | - number_format_i18n( $used, 2 ), |
|
1419 | + __('%1$s MB (%2$s%%) Space Used'), |
|
1420 | + number_format_i18n($used, 2), |
|
1421 | 1421 | $percentused |
1422 | 1422 | ); |
1423 | 1423 | printf( |
1424 | 1424 | '<a href="%1$s" class="musublink">%2$s <span class="screen-reader-text">(%3$s)</span></a>', |
1425 | - esc_url( admin_url( 'upload.php' ) ), |
|
1425 | + esc_url(admin_url('upload.php')), |
|
1426 | 1426 | $text, |
1427 | - __( 'Manage Uploads' ) |
|
1427 | + __('Manage Uploads') |
|
1428 | 1428 | ); ?> |
1429 | 1429 | </li> |
1430 | 1430 | </ul> |
@@ -1437,35 +1437,35 @@ discard block |
||
1437 | 1437 | $notice = ''; |
1438 | 1438 | $response = wp_check_browser_version(); |
1439 | 1439 | |
1440 | - if ( $response ) { |
|
1441 | - if ( $response['insecure'] ) { |
|
1440 | + if ($response) { |
|
1441 | + if ($response['insecure']) { |
|
1442 | 1442 | /* translators: %s: browser name and link */ |
1443 | - $msg = sprintf( __( "It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser." ), |
|
1444 | - sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) |
|
1443 | + $msg = sprintf(__("It looks like you're using an insecure version of %s. Using an outdated browser makes your computer unsafe. For the best WordPress experience, please update your browser."), |
|
1444 | + sprintf('<a href="%s">%s</a>', esc_url($response['update_url']), esc_html($response['name'])) |
|
1445 | 1445 | ); |
1446 | 1446 | } else { |
1447 | 1447 | /* translators: %s: browser name and link */ |
1448 | - $msg = sprintf( __( "It looks like you're using an old version of %s. For the best WordPress experience, please update your browser." ), |
|
1449 | - sprintf( '<a href="%s">%s</a>', esc_url( $response['update_url'] ), esc_html( $response['name'] ) ) |
|
1448 | + $msg = sprintf(__("It looks like you're using an old version of %s. For the best WordPress experience, please update your browser."), |
|
1449 | + sprintf('<a href="%s">%s</a>', esc_url($response['update_url']), esc_html($response['name'])) |
|
1450 | 1450 | ); |
1451 | 1451 | } |
1452 | 1452 | |
1453 | 1453 | $browser_nag_class = ''; |
1454 | - if ( !empty( $response['img_src'] ) ) { |
|
1455 | - $img_src = ( is_ssl() && ! empty( $response['img_src_ssl'] ) )? $response['img_src_ssl'] : $response['img_src']; |
|
1454 | + if ( ! empty($response['img_src'])) { |
|
1455 | + $img_src = (is_ssl() && ! empty($response['img_src_ssl'])) ? $response['img_src_ssl'] : $response['img_src']; |
|
1456 | 1456 | |
1457 | - $notice .= '<div class="alignright browser-icon"><a href="' . esc_attr($response['update_url']) . '"><img src="' . esc_attr( $img_src ) . '" alt="" /></a></div>'; |
|
1457 | + $notice .= '<div class="alignright browser-icon"><a href="'.esc_attr($response['update_url']).'"><img src="'.esc_attr($img_src).'" alt="" /></a></div>'; |
|
1458 | 1458 | $browser_nag_class = ' has-browser-icon'; |
1459 | 1459 | } |
1460 | 1460 | $notice .= "<p class='browser-update-nag{$browser_nag_class}'>{$msg}</p>"; |
1461 | 1461 | |
1462 | 1462 | $browsehappy = 'http://browsehappy.com/'; |
1463 | 1463 | $locale = get_user_locale(); |
1464 | - if ( 'en_US' !== $locale ) |
|
1465 | - $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); |
|
1464 | + if ('en_US' !== $locale) |
|
1465 | + $browsehappy = add_query_arg('locale', $locale, $browsehappy); |
|
1466 | 1466 | |
1467 | - $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>'; |
|
1468 | - $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>'; |
|
1467 | + $notice .= '<p>'.sprintf(__('<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>'), esc_attr($response['update_url']), esc_html($response['name']), esc_url($browsehappy)).'</p>'; |
|
1468 | + $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="'.esc_attr__('Dismiss the browser warning panel').'">'.__('Dismiss').'</a></p>'; |
|
1469 | 1469 | $notice .= '<div class="clear"></div>'; |
1470 | 1470 | } |
1471 | 1471 | |
@@ -1477,7 +1477,7 @@ discard block |
||
1477 | 1477 | * @param string $notice The notice content. |
1478 | 1478 | * @param array $response An array containing web browser information. |
1479 | 1479 | */ |
1480 | - echo apply_filters( 'browse-happy-notice', $notice, $response ); |
|
1480 | + echo apply_filters('browse-happy-notice', $notice, $response); |
|
1481 | 1481 | } |
1482 | 1482 | |
1483 | 1483 | /** |
@@ -1486,10 +1486,10 @@ discard block |
||
1486 | 1486 | * @param array $classes |
1487 | 1487 | * @return array |
1488 | 1488 | */ |
1489 | -function dashboard_browser_nag_class( $classes ) { |
|
1489 | +function dashboard_browser_nag_class($classes) { |
|
1490 | 1490 | $response = wp_check_browser_version(); |
1491 | 1491 | |
1492 | - if ( $response && $response['insecure'] ) |
|
1492 | + if ($response && $response['insecure']) |
|
1493 | 1493 | $classes[] = 'browser-insecure'; |
1494 | 1494 | |
1495 | 1495 | return $classes; |
@@ -1503,20 +1503,20 @@ discard block |
||
1503 | 1503 | * @return array|bool False on failure, array of browser data on success. |
1504 | 1504 | */ |
1505 | 1505 | function wp_check_browser_version() { |
1506 | - if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) |
|
1506 | + if (empty($_SERVER['HTTP_USER_AGENT'])) |
|
1507 | 1507 | return false; |
1508 | 1508 | |
1509 | - $key = md5( $_SERVER['HTTP_USER_AGENT'] ); |
|
1509 | + $key = md5($_SERVER['HTTP_USER_AGENT']); |
|
1510 | 1510 | |
1511 | - if ( false === ($response = get_site_transient('browser_' . $key) ) ) { |
|
1511 | + if (false === ($response = get_site_transient('browser_'.$key))) { |
|
1512 | 1512 | $options = array( |
1513 | - 'body' => array( 'useragent' => $_SERVER['HTTP_USER_AGENT'] ), |
|
1514 | - 'user-agent' => 'WordPress/' . get_bloginfo( 'version' ) . '; ' . home_url() |
|
1513 | + 'body' => array('useragent' => $_SERVER['HTTP_USER_AGENT']), |
|
1514 | + 'user-agent' => 'WordPress/'.get_bloginfo('version').'; '.home_url() |
|
1515 | 1515 | ); |
1516 | 1516 | |
1517 | - $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options ); |
|
1517 | + $response = wp_remote_post('http://api.wordpress.org/core/browse-happy/1.1/', $options); |
|
1518 | 1518 | |
1519 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) |
|
1519 | + if (is_wp_error($response) || 200 != wp_remote_retrieve_response_code($response)) |
|
1520 | 1520 | return false; |
1521 | 1521 | |
1522 | 1522 | /** |
@@ -1531,12 +1531,12 @@ discard block |
||
1531 | 1531 | * 'img_src' - string - An image representing the browser |
1532 | 1532 | * 'img_src_ssl' - string - An image (over SSL) representing the browser |
1533 | 1533 | */ |
1534 | - $response = json_decode( wp_remote_retrieve_body( $response ), true ); |
|
1534 | + $response = json_decode(wp_remote_retrieve_body($response), true); |
|
1535 | 1535 | |
1536 | - if ( ! is_array( $response ) ) |
|
1536 | + if ( ! is_array($response)) |
|
1537 | 1537 | return false; |
1538 | 1538 | |
1539 | - set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); |
|
1539 | + set_site_transient('browser_'.$key, $response, WEEK_IN_SECONDS); |
|
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | return $response; |
@@ -1555,55 +1555,55 @@ discard block |
||
1555 | 1555 | function wp_welcome_panel() { |
1556 | 1556 | ?> |
1557 | 1557 | <div class="welcome-panel-content"> |
1558 | - <h2><?php _e( 'Welcome to WordPress!' ); ?></h2> |
|
1559 | - <p class="about-description"><?php _e( 'We’ve assembled some links to get you started:' ); ?></p> |
|
1558 | + <h2><?php _e('Welcome to WordPress!'); ?></h2> |
|
1559 | + <p class="about-description"><?php _e('We’ve assembled some links to get you started:'); ?></p> |
|
1560 | 1560 | <div class="welcome-panel-column-container"> |
1561 | 1561 | <div class="welcome-panel-column"> |
1562 | - <?php if ( current_user_can( 'customize' ) ): ?> |
|
1563 | - <h3><?php _e( 'Get Started' ); ?></h3> |
|
1564 | - <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Customize Your Site' ); ?></a> |
|
1562 | + <?php if (current_user_can('customize')): ?> |
|
1563 | + <h3><?php _e('Get Started'); ?></h3> |
|
1564 | + <a class="button button-primary button-hero load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e('Customize Your Site'); ?></a> |
|
1565 | 1565 | <?php endif; ?> |
1566 | - <a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url( 'themes.php' ); ?>"><?php _e( 'Customize Your Site' ); ?></a> |
|
1567 | - <?php if ( current_user_can( 'install_themes' ) || ( current_user_can( 'switch_themes' ) && count( wp_get_themes( array( 'allowed' => true ) ) ) > 1 ) ) : ?> |
|
1568 | - <p class="hide-if-no-customize"><?php printf( __( 'or, <a href="%s">change your theme completely</a>' ), admin_url( 'themes.php' ) ); ?></p> |
|
1566 | + <a class="button button-primary button-hero hide-if-customize" href="<?php echo admin_url('themes.php'); ?>"><?php _e('Customize Your Site'); ?></a> |
|
1567 | + <?php if (current_user_can('install_themes') || (current_user_can('switch_themes') && count(wp_get_themes(array('allowed' => true))) > 1)) : ?> |
|
1568 | + <p class="hide-if-no-customize"><?php printf(__('or, <a href="%s">change your theme completely</a>'), admin_url('themes.php')); ?></p> |
|
1569 | 1569 | <?php endif; ?> |
1570 | 1570 | </div> |
1571 | 1571 | <div class="welcome-panel-column"> |
1572 | - <h3><?php _e( 'Next Steps' ); ?></h3> |
|
1572 | + <h3><?php _e('Next Steps'); ?></h3> |
|
1573 | 1573 | <ul> |
1574 | - <?php if ( 'page' == get_option( 'show_on_front' ) && ! get_option( 'page_for_posts' ) ) : ?> |
|
1575 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li> |
|
1576 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
|
1577 | - <?php elseif ( 'page' == get_option( 'show_on_front' ) ) : ?> |
|
1578 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li> |
|
1579 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
|
1580 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
|
1574 | + <?php if ('page' == get_option('show_on_front') && ! get_option('page_for_posts')) : ?> |
|
1575 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-edit-page">'.__('Edit your front page').'</a>', get_edit_post_link(get_option('page_on_front'))); ?></li> |
|
1576 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-add-page">'.__('Add additional pages').'</a>', admin_url('post-new.php?post_type=page')); ?></li> |
|
1577 | + <?php elseif ('page' == get_option('show_on_front')) : ?> |
|
1578 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-edit-page">'.__('Edit your front page').'</a>', get_edit_post_link(get_option('page_on_front'))); ?></li> |
|
1579 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-add-page">'.__('Add additional pages').'</a>', admin_url('post-new.php?post_type=page')); ?></li> |
|
1580 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-write-blog">'.__('Add a blog post').'</a>', admin_url('post-new.php')); ?></li> |
|
1581 | 1581 | <?php else : ?> |
1582 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
|
1583 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
|
1582 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-write-blog">'.__('Write your first blog post').'</a>', admin_url('post-new.php')); ?></li> |
|
1583 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-add-page">'.__('Add an About page').'</a>', admin_url('post-new.php?post_type=page')); ?></li> |
|
1584 | 1584 | <?php endif; ?> |
1585 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li> |
|
1585 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-view-site">'.__('View your site').'</a>', home_url('/')); ?></li> |
|
1586 | 1586 | </ul> |
1587 | 1587 | </div> |
1588 | 1588 | <div class="welcome-panel-column welcome-panel-last"> |
1589 | - <h3><?php _e( 'More Actions' ); ?></h3> |
|
1589 | + <h3><?php _e('More Actions'); ?></h3> |
|
1590 | 1590 | <ul> |
1591 | - <?php if ( current_theme_supports( 'widgets' ) || current_theme_supports( 'menus' ) ) : ?> |
|
1591 | + <?php if (current_theme_supports('widgets') || current_theme_supports('menus')) : ?> |
|
1592 | 1592 | <li><div class="welcome-icon welcome-widgets-menus"><?php |
1593 | - if ( current_theme_supports( 'widgets' ) && current_theme_supports( 'menus' ) ) { |
|
1594 | - printf( __( 'Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>' ), |
|
1595 | - admin_url( 'widgets.php' ), admin_url( 'nav-menus.php' ) ); |
|
1596 | - } elseif ( current_theme_supports( 'widgets' ) ) { |
|
1597 | - echo '<a href="' . admin_url( 'widgets.php' ) . '">' . __( 'Manage widgets' ) . '</a>'; |
|
1593 | + if (current_theme_supports('widgets') && current_theme_supports('menus')) { |
|
1594 | + printf(__('Manage <a href="%1$s">widgets</a> or <a href="%2$s">menus</a>'), |
|
1595 | + admin_url('widgets.php'), admin_url('nav-menus.php')); |
|
1596 | + } elseif (current_theme_supports('widgets')) { |
|
1597 | + echo '<a href="'.admin_url('widgets.php').'">'.__('Manage widgets').'</a>'; |
|
1598 | 1598 | } else { |
1599 | - echo '<a href="' . admin_url( 'nav-menus.php' ) . '">' . __( 'Manage menus' ) . '</a>'; |
|
1599 | + echo '<a href="'.admin_url('nav-menus.php').'">'.__('Manage menus').'</a>'; |
|
1600 | 1600 | } |
1601 | 1601 | ?></div></li> |
1602 | 1602 | <?php endif; ?> |
1603 | - <?php if ( current_user_can( 'manage_options' ) ) : ?> |
|
1604 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-comments">' . __( 'Turn comments on or off' ) . '</a>', admin_url( 'options-discussion.php' ) ); ?></li> |
|
1603 | + <?php if (current_user_can('manage_options')) : ?> |
|
1604 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-comments">'.__('Turn comments on or off').'</a>', admin_url('options-discussion.php')); ?></li> |
|
1605 | 1605 | <?php endif; ?> |
1606 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-learn-more">' . __( 'Learn more about getting started' ) . '</a>', __( 'https://codex.wordpress.org/First_Steps_With_WordPress' ) ); ?></li> |
|
1606 | + <li><?php printf('<a href="%s" class="welcome-icon welcome-learn-more">'.__('Learn more about getting started').'</a>', __('https://codex.wordpress.org/First_Steps_With_WordPress')); ?></li> |
|
1607 | 1607 | </ul> |
1608 | 1608 | </div> |
1609 | 1609 | </div> |
@@ -28,18 +28,21 @@ discard block |
||
28 | 28 | |
29 | 29 | if ( $response && $response['upgrade'] ) { |
30 | 30 | add_filter( 'postbox_classes_dashboard_dashboard_browser_nag', 'dashboard_browser_nag_class' ); |
31 | - if ( $response['insecure'] ) |
|
32 | - wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' ); |
|
33 | - else |
|
34 | - wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' ); |
|
31 | + if ( $response['insecure'] ) { |
|
32 | + wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'You are using an insecure browser!' ), 'wp_dashboard_browser_nag' ); |
|
33 | + } else { |
|
34 | + wp_add_dashboard_widget( 'dashboard_browser_nag', __( 'Your browser is out of date!' ), 'wp_dashboard_browser_nag' ); |
|
35 | + } |
|
35 | 36 | } |
36 | 37 | |
37 | 38 | // Right Now |
38 | - if ( is_blog_admin() && current_user_can('edit_posts') ) |
|
39 | - wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); |
|
39 | + if ( is_blog_admin() && current_user_can('edit_posts') ) { |
|
40 | + wp_add_dashboard_widget( 'dashboard_right_now', __( 'At a Glance' ), 'wp_dashboard_right_now' ); |
|
41 | + } |
|
40 | 42 | |
41 | - if ( is_network_admin() ) |
|
42 | - wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); |
|
43 | + if ( is_network_admin() ) { |
|
44 | + wp_add_dashboard_widget( 'network_dashboard_right_now', __( 'Right Now' ), 'wp_network_dashboard_right_now' ); |
|
45 | + } |
|
43 | 46 | |
44 | 47 | // Activity Widget |
45 | 48 | if ( is_blog_admin() ) { |
@@ -171,12 +174,14 @@ discard block |
||
171 | 174 | $side_widgets = array( 'dashboard_quick_press', 'dashboard_primary' ); |
172 | 175 | |
173 | 176 | $location = 'normal'; |
174 | - if ( in_array($widget_id, $side_widgets) ) |
|
175 | - $location = 'side'; |
|
177 | + if ( in_array($widget_id, $side_widgets) ) { |
|
178 | + $location = 'side'; |
|
179 | + } |
|
176 | 180 | |
177 | 181 | $priority = 'core'; |
178 | - if ( 'dashboard_browser_nag' === $widget_id ) |
|
179 | - $priority = 'high'; |
|
182 | + if ( 'dashboard_browser_nag' === $widget_id ) { |
|
183 | + $priority = 'high'; |
|
184 | + } |
|
180 | 185 | |
181 | 186 | add_meta_box( $widget_id, $widget_name, $callback, $screen, $location, $priority, $callback_args ); |
182 | 187 | } |
@@ -384,10 +389,12 @@ discard block |
||
384 | 389 | */ |
385 | 390 | function wp_network_dashboard_right_now() { |
386 | 391 | $actions = array(); |
387 | - if ( current_user_can('create_sites') ) |
|
388 | - $actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>'; |
|
389 | - if ( current_user_can('create_users') ) |
|
390 | - $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>'; |
|
392 | + if ( current_user_can('create_sites') ) { |
|
393 | + $actions['create-site'] = '<a href="' . network_admin_url('site-new.php') . '">' . __( 'Create a New Site' ) . '</a>'; |
|
394 | + } |
|
395 | + if ( current_user_can('create_users') ) { |
|
396 | + $actions['create-user'] = '<a href="' . network_admin_url('user-new.php') . '">' . __( 'Create a New User' ) . '</a>'; |
|
397 | + } |
|
391 | 398 | |
392 | 399 | $c_users = get_user_count(); |
393 | 400 | $c_blogs = get_blog_count(); |
@@ -487,8 +494,10 @@ discard block |
||
487 | 494 | $post = get_default_post_to_edit( 'post' , true); |
488 | 495 | $user_id = get_current_user_id(); |
489 | 496 | // Don't create an option if this is a super admin who does not belong to this site. |
490 | - if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) |
|
491 | - update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID |
|
497 | + if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ) ) ) { |
|
498 | + update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); |
|
499 | + } |
|
500 | + // Save post_ID |
|
492 | 501 | } |
493 | 502 | |
494 | 503 | $post_ID = (int) $post->ID; |
@@ -704,10 +713,12 @@ discard block |
||
704 | 713 | </p> |
705 | 714 | |
706 | 715 | <?php |
707 | - else : |
|
716 | + else { |
|
717 | + : |
|
708 | 718 | switch ( $comment->comment_type ) { |
709 | 719 | case 'pingback' : |
710 | 720 | $type = __( 'Pingback' ); |
721 | + } |
|
711 | 722 | break; |
712 | 723 | case 'trackback' : |
713 | 724 | $type = __( 'Trackback' ); |
@@ -896,19 +907,22 @@ discard block |
||
896 | 907 | 'number' => $total_items * 5, |
897 | 908 | 'offset' => 0 |
898 | 909 | ); |
899 | - if ( ! current_user_can( 'edit_posts' ) ) |
|
900 | - $comments_query['status'] = 'approve'; |
|
910 | + if ( ! current_user_can( 'edit_posts' ) ) { |
|
911 | + $comments_query['status'] = 'approve'; |
|
912 | + } |
|
901 | 913 | |
902 | 914 | while ( count( $comments ) < $total_items && $possible = get_comments( $comments_query ) ) { |
903 | 915 | if ( ! is_array( $possible ) ) { |
904 | 916 | break; |
905 | 917 | } |
906 | 918 | foreach ( $possible as $comment ) { |
907 | - if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) |
|
908 | - continue; |
|
919 | + if ( ! current_user_can( 'read_post', $comment->comment_post_ID ) ) { |
|
920 | + continue; |
|
921 | + } |
|
909 | 922 | $comments[] = $comment; |
910 | - if ( count( $comments ) == $total_items ) |
|
911 | - break 2; |
|
923 | + if ( count( $comments ) == $total_items ) { |
|
924 | + break 2; |
|
925 | + } |
|
912 | 926 | } |
913 | 927 | $comments_query['offset'] += $comments_query['number']; |
914 | 928 | $comments_query['number'] = $total_items * 10; |
@@ -919,8 +933,9 @@ discard block |
||
919 | 933 | echo '<h3>' . __( 'Recent Comments' ) . '</h3>'; |
920 | 934 | |
921 | 935 | echo '<ul id="the-comment-list" data-wp-lists="list:comment">'; |
922 | - foreach ( $comments as $comment ) |
|
923 | - _wp_dashboard_recent_comments_row( $comment ); |
|
936 | + foreach ( $comments as $comment ) { |
|
937 | + _wp_dashboard_recent_comments_row( $comment ); |
|
938 | + } |
|
924 | 939 | echo '</ul>'; |
925 | 940 | |
926 | 941 | if ( current_user_can( 'edit_posts' ) ) { |
@@ -1036,11 +1051,13 @@ discard block |
||
1036 | 1051 | * @param array $form_inputs |
1037 | 1052 | */ |
1038 | 1053 | function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { |
1039 | - if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) |
|
1040 | - $widget_options = array(); |
|
1054 | + if ( !$widget_options = get_option( 'dashboard_widget_options' ) ) { |
|
1055 | + $widget_options = array(); |
|
1056 | + } |
|
1041 | 1057 | |
1042 | - if ( !isset($widget_options[$widget_id]) ) |
|
1043 | - $widget_options[$widget_id] = array(); |
|
1058 | + if ( !isset($widget_options[$widget_id]) ) { |
|
1059 | + $widget_options[$widget_id] = array(); |
|
1060 | + } |
|
1044 | 1061 | |
1045 | 1062 | $number = 1; // Hack to use wp_widget_rss_form() |
1046 | 1063 | $widget_options[$widget_id]['number'] = $number; |
@@ -1383,16 +1400,18 @@ discard block |
||
1383 | 1400 | * @return bool|null True if not multisite, user can't upload files, or the space check option is disabled. |
1384 | 1401 | */ |
1385 | 1402 | function wp_dashboard_quota() { |
1386 | - if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) |
|
1387 | - return true; |
|
1403 | + if ( !is_multisite() || !current_user_can( 'upload_files' ) || get_site_option( 'upload_space_check_disabled' ) ) { |
|
1404 | + return true; |
|
1405 | + } |
|
1388 | 1406 | |
1389 | 1407 | $quota = get_space_allowed(); |
1390 | 1408 | $used = get_space_used(); |
1391 | 1409 | |
1392 | - if ( $used > $quota ) |
|
1393 | - $percentused = '100'; |
|
1394 | - else |
|
1395 | - $percentused = ( $used / $quota ) * 100; |
|
1410 | + if ( $used > $quota ) { |
|
1411 | + $percentused = '100'; |
|
1412 | + } else { |
|
1413 | + $percentused = ( $used / $quota ) * 100; |
|
1414 | + } |
|
1396 | 1415 | $used_class = ( $percentused >= 70 ) ? ' warning' : ''; |
1397 | 1416 | $used = round( $used, 2 ); |
1398 | 1417 | $percentused = number_format( $percentused ); |
@@ -1461,8 +1480,9 @@ discard block |
||
1461 | 1480 | |
1462 | 1481 | $browsehappy = 'http://browsehappy.com/'; |
1463 | 1482 | $locale = get_user_locale(); |
1464 | - if ( 'en_US' !== $locale ) |
|
1465 | - $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); |
|
1483 | + if ( 'en_US' !== $locale ) { |
|
1484 | + $browsehappy = add_query_arg( 'locale', $locale, $browsehappy ); |
|
1485 | + } |
|
1466 | 1486 | |
1467 | 1487 | $notice .= '<p>' . sprintf( __( '<a href="%1$s" class="update-browser-link">Update %2$s</a> or learn how to <a href="%3$s" class="browse-happy-link">browse happy</a>' ), esc_attr( $response['update_url'] ), esc_html( $response['name'] ), esc_url( $browsehappy ) ) . '</p>'; |
1468 | 1488 | $notice .= '<p class="hide-if-no-js"><a href="" class="dismiss" aria-label="' . esc_attr__( 'Dismiss the browser warning panel' ) . '">' . __( 'Dismiss' ) . '</a></p>'; |
@@ -1489,8 +1509,9 @@ discard block |
||
1489 | 1509 | function dashboard_browser_nag_class( $classes ) { |
1490 | 1510 | $response = wp_check_browser_version(); |
1491 | 1511 | |
1492 | - if ( $response && $response['insecure'] ) |
|
1493 | - $classes[] = 'browser-insecure'; |
|
1512 | + if ( $response && $response['insecure'] ) { |
|
1513 | + $classes[] = 'browser-insecure'; |
|
1514 | + } |
|
1494 | 1515 | |
1495 | 1516 | return $classes; |
1496 | 1517 | } |
@@ -1503,8 +1524,9 @@ discard block |
||
1503 | 1524 | * @return array|bool False on failure, array of browser data on success. |
1504 | 1525 | */ |
1505 | 1526 | function wp_check_browser_version() { |
1506 | - if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) |
|
1507 | - return false; |
|
1527 | + if ( empty( $_SERVER['HTTP_USER_AGENT'] ) ) { |
|
1528 | + return false; |
|
1529 | + } |
|
1508 | 1530 | |
1509 | 1531 | $key = md5( $_SERVER['HTTP_USER_AGENT'] ); |
1510 | 1532 | |
@@ -1516,8 +1538,9 @@ discard block |
||
1516 | 1538 | |
1517 | 1539 | $response = wp_remote_post( 'http://api.wordpress.org/core/browse-happy/1.1/', $options ); |
1518 | 1540 | |
1519 | - if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) |
|
1520 | - return false; |
|
1541 | + if ( is_wp_error( $response ) || 200 != wp_remote_retrieve_response_code( $response ) ) { |
|
1542 | + return false; |
|
1543 | + } |
|
1521 | 1544 | |
1522 | 1545 | /** |
1523 | 1546 | * Response should be an array with: |
@@ -1533,8 +1556,9 @@ discard block |
||
1533 | 1556 | */ |
1534 | 1557 | $response = json_decode( wp_remote_retrieve_body( $response ), true ); |
1535 | 1558 | |
1536 | - if ( ! is_array( $response ) ) |
|
1537 | - return false; |
|
1559 | + if ( ! is_array( $response ) ) { |
|
1560 | + return false; |
|
1561 | + } |
|
1538 | 1562 | |
1539 | 1563 | set_site_transient( 'browser_' . $key, $response, WEEK_IN_SECONDS ); |
1540 | 1564 | } |
@@ -1578,8 +1602,11 @@ discard block |
||
1578 | 1602 | <li><?php printf( '<a href="%s" class="welcome-icon welcome-edit-page">' . __( 'Edit your front page' ) . '</a>', get_edit_post_link( get_option( 'page_on_front' ) ) ); ?></li> |
1579 | 1603 | <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add additional pages' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
1580 | 1604 | <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Add a blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
1581 | - <?php else : ?> |
|
1582 | - <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); ?></li> |
|
1605 | + <?php else { |
|
1606 | + : ?> |
|
1607 | + <li><?php printf( '<a href="%s" class="welcome-icon welcome-write-blog">' . __( 'Write your first blog post' ) . '</a>', admin_url( 'post-new.php' ) ); |
|
1608 | +} |
|
1609 | +?></li> |
|
1583 | 1610 | <li><?php printf( '<a href="%s" class="welcome-icon welcome-add-page">' . __( 'Add an About page' ) . '</a>', admin_url( 'post-new.php?post_type=page' ) ); ?></li> |
1584 | 1611 | <?php endif; ?> |
1585 | 1612 | <li><?php printf( '<a href="%s" class="welcome-icon welcome-view-site">' . __( 'View your site' ) . '</a>', home_url( '/' ) ); ?></li> |
@@ -39,8 +39,9 @@ discard block |
||
39 | 39 | * @param WP_Upgrader $upgrader |
40 | 40 | */ |
41 | 41 | public function set_upgrader(&$upgrader) { |
42 | - if ( is_object($upgrader) ) |
|
43 | - $this->upgrader =& $upgrader; |
|
42 | + if ( is_object($upgrader) ) { |
|
43 | + $this->upgrader =& $upgrader; |
|
44 | + } |
|
44 | 45 | $this->add_strings(); |
45 | 46 | } |
46 | 47 | |
@@ -107,16 +108,18 @@ discard block |
||
107 | 108 | * @param string|WP_Error $errors |
108 | 109 | */ |
109 | 110 | public function error($errors) { |
110 | - if ( ! $this->done_header ) |
|
111 | - $this->header(); |
|
111 | + if ( ! $this->done_header ) { |
|
112 | + $this->header(); |
|
113 | + } |
|
112 | 114 | if ( is_string($errors) ) { |
113 | 115 | $this->feedback($errors); |
114 | 116 | } elseif ( is_wp_error($errors) && $errors->get_error_code() ) { |
115 | 117 | foreach ( $errors->get_error_messages() as $message ) { |
116 | - if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) |
|
117 | - $this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) ); |
|
118 | - else |
|
119 | - $this->feedback($message); |
|
118 | + if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) { |
|
119 | + $this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) ); |
|
120 | + } else { |
|
121 | + $this->feedback($message); |
|
122 | + } |
|
120 | 123 | } |
121 | 124 | } |
122 | 125 | } |
@@ -126,8 +129,9 @@ discard block |
||
126 | 129 | * @param string $string |
127 | 130 | */ |
128 | 131 | public function feedback($string) { |
129 | - if ( isset( $this->upgrader->strings[$string] ) ) |
|
130 | - $string = $this->upgrader->strings[$string]; |
|
132 | + if ( isset( $this->upgrader->strings[$string] ) ) { |
|
133 | + $string = $this->upgrader->strings[$string]; |
|
134 | + } |
|
131 | 135 | |
132 | 136 | if ( strpos($string, '%') !== false ) { |
133 | 137 | $args = func_get_args(); |
@@ -138,8 +142,9 @@ discard block |
||
138 | 142 | $string = vsprintf($string, $args); |
139 | 143 | } |
140 | 144 | } |
141 | - if ( empty($string) ) |
|
142 | - return; |
|
145 | + if ( empty($string) ) { |
|
146 | + return; |
|
147 | + } |
|
143 | 148 | show_message($string); |
144 | 149 | } |
145 | 150 |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * @param array $args |
35 | 35 | */ |
36 | 36 | public function __construct($args = array()) { |
37 | - $defaults = array( 'url' => '', 'nonce' => '', 'title' => '', 'context' => false ); |
|
37 | + $defaults = array('url' => '', 'nonce' => '', 'title' => '', 'context' => false); |
|
38 | 38 | $this->options = wp_parse_args($args, $defaults); |
39 | 39 | } |
40 | 40 | |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @param WP_Upgrader $upgrader |
43 | 43 | */ |
44 | 44 | public function set_upgrader(&$upgrader) { |
45 | - if ( is_object($upgrader) ) |
|
46 | - $this->upgrader =& $upgrader; |
|
45 | + if (is_object($upgrader)) |
|
46 | + $this->upgrader = & $upgrader; |
|
47 | 47 | $this->add_strings(); |
48 | 48 | } |
49 | 49 | |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | * |
62 | 62 | * @param string|bool|WP_Error $result The result of an upgrade. |
63 | 63 | */ |
64 | - public function set_result( $result ) { |
|
64 | + public function set_result($result) { |
|
65 | 65 | $this->result = $result; |
66 | 66 | } |
67 | 67 | |
@@ -81,37 +81,37 @@ discard block |
||
81 | 81 | * @param bool $allow_relaxed_file_ownership Optional. Whether to allow Group/World writable. Default false. |
82 | 82 | * @return bool False on failure, true on success. |
83 | 83 | */ |
84 | - public function request_filesystem_credentials( $error = false, $context = '', $allow_relaxed_file_ownership = false ) { |
|
84 | + public function request_filesystem_credentials($error = false, $context = '', $allow_relaxed_file_ownership = false) { |
|
85 | 85 | $url = $this->options['url']; |
86 | - if ( ! $context ) { |
|
86 | + if ( ! $context) { |
|
87 | 87 | $context = $this->options['context']; |
88 | 88 | } |
89 | - if ( !empty($this->options['nonce']) ) { |
|
89 | + if ( ! empty($this->options['nonce'])) { |
|
90 | 90 | $url = wp_nonce_url($url, $this->options['nonce']); |
91 | 91 | } |
92 | 92 | |
93 | 93 | $extra_fields = array(); |
94 | 94 | |
95 | - return request_filesystem_credentials( $url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership ); |
|
95 | + return request_filesystem_credentials($url, '', $error, $context, $extra_fields, $allow_relaxed_file_ownership); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | /** |
99 | 99 | * @access public |
100 | 100 | */ |
101 | 101 | public function header() { |
102 | - if ( $this->done_header ) { |
|
102 | + if ($this->done_header) { |
|
103 | 103 | return; |
104 | 104 | } |
105 | 105 | $this->done_header = true; |
106 | 106 | echo '<div class="wrap">'; |
107 | - echo '<h1>' . $this->options['title'] . '</h1>'; |
|
107 | + echo '<h1>'.$this->options['title'].'</h1>'; |
|
108 | 108 | } |
109 | 109 | |
110 | 110 | /** |
111 | 111 | * @access public |
112 | 112 | */ |
113 | 113 | public function footer() { |
114 | - if ( $this->done_footer ) { |
|
114 | + if ($this->done_footer) { |
|
115 | 115 | return; |
116 | 116 | } |
117 | 117 | $this->done_footer = true; |
@@ -123,14 +123,14 @@ discard block |
||
123 | 123 | * @param string|WP_Error $errors |
124 | 124 | */ |
125 | 125 | public function error($errors) { |
126 | - if ( ! $this->done_header ) |
|
126 | + if ( ! $this->done_header) |
|
127 | 127 | $this->header(); |
128 | - if ( is_string($errors) ) { |
|
128 | + if (is_string($errors)) { |
|
129 | 129 | $this->feedback($errors); |
130 | - } elseif ( is_wp_error($errors) && $errors->get_error_code() ) { |
|
131 | - foreach ( $errors->get_error_messages() as $message ) { |
|
132 | - if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) |
|
133 | - $this->feedback($message . ' ' . esc_html( strip_tags( $errors->get_error_data() ) ) ); |
|
130 | + } elseif (is_wp_error($errors) && $errors->get_error_code()) { |
|
131 | + foreach ($errors->get_error_messages() as $message) { |
|
132 | + if ($errors->get_error_data() && is_string($errors->get_error_data())) |
|
133 | + $this->feedback($message.' '.esc_html(strip_tags($errors->get_error_data()))); |
|
134 | 134 | else |
135 | 135 | $this->feedback($message); |
136 | 136 | } |
@@ -142,19 +142,19 @@ discard block |
||
142 | 142 | * @param string $string |
143 | 143 | */ |
144 | 144 | public function feedback($string) { |
145 | - if ( isset( $this->upgrader->strings[$string] ) ) |
|
145 | + if (isset($this->upgrader->strings[$string])) |
|
146 | 146 | $string = $this->upgrader->strings[$string]; |
147 | 147 | |
148 | - if ( strpos($string, '%') !== false ) { |
|
148 | + if (strpos($string, '%') !== false) { |
|
149 | 149 | $args = func_get_args(); |
150 | 150 | $args = array_splice($args, 1); |
151 | - if ( $args ) { |
|
152 | - $args = array_map( 'strip_tags', $args ); |
|
153 | - $args = array_map( 'esc_html', $args ); |
|
151 | + if ($args) { |
|
152 | + $args = array_map('strip_tags', $args); |
|
153 | + $args = array_map('esc_html', $args); |
|
154 | 154 | $string = vsprintf($string, $args); |
155 | 155 | } |
156 | 156 | } |
157 | - if ( empty($string) ) |
|
157 | + if (empty($string)) |
|
158 | 158 | return; |
159 | 159 | show_message($string); |
160 | 160 | } |
@@ -177,22 +177,22 @@ discard block |
||
177 | 177 | * @param string $type Type of update count to decrement. Likely values include 'plugin', |
178 | 178 | * 'theme', 'translation', etc. |
179 | 179 | */ |
180 | - protected function decrement_update_count( $type ) { |
|
181 | - if ( ! $this->result || is_wp_error( $this->result ) || 'up_to_date' === $this->result ) { |
|
180 | + protected function decrement_update_count($type) { |
|
181 | + if ( ! $this->result || is_wp_error($this->result) || 'up_to_date' === $this->result) { |
|
182 | 182 | return; |
183 | 183 | } |
184 | 184 | |
185 | - if ( defined( 'IFRAME_REQUEST' ) ) { |
|
185 | + if (defined('IFRAME_REQUEST')) { |
|
186 | 186 | echo '<script type="text/javascript"> |
187 | 187 | if ( window.postMessage && JSON ) { |
188 | - window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type . '" } ), window.location.protocol + "//" + window.location.hostname ); |
|
188 | + window.parent.postMessage( JSON.stringify( { action: "decrementUpdateCount", upgradeType: "' . $type.'" } ), window.location.protocol + "//" + window.location.hostname ); |
|
189 | 189 | } |
190 | 190 | </script>'; |
191 | 191 | } else { |
192 | 192 | echo '<script type="text/javascript"> |
193 | 193 | (function( wp ) { |
194 | 194 | if ( wp && wp.updates.decrementCount ) { |
195 | - wp.updates.decrementCount( "' . $type . '" ); |
|
195 | + wp.updates.decrementCount( "' . $type.'" ); |
|
196 | 196 | } |
197 | 197 | })( window.wp ); |
198 | 198 | </script>'; |
@@ -94,10 +94,12 @@ discard block |
||
94 | 94 | * the latest sites with no paging in order to avoid expensive count queries. |
95 | 95 | */ |
96 | 96 | if ( !$s && wp_is_large_network() ) { |
97 | - if ( !isset($_REQUEST['orderby']) ) |
|
98 | - $_GET['orderby'] = $_REQUEST['orderby'] = ''; |
|
99 | - if ( !isset($_REQUEST['order']) ) |
|
100 | - $_GET['order'] = $_REQUEST['order'] = 'DESC'; |
|
97 | + if ( !isset($_REQUEST['orderby']) ) { |
|
98 | + $_GET['orderby'] = $_REQUEST['orderby'] = ''; |
|
99 | + } |
|
100 | + if ( !isset($_REQUEST['order']) ) { |
|
101 | + $_GET['order'] = $_REQUEST['order'] = 'DESC'; |
|
102 | + } |
|
101 | 103 | } |
102 | 104 | |
103 | 105 | $args = array( |
@@ -199,8 +201,9 @@ discard block |
||
199 | 201 | */ |
200 | 202 | protected function get_bulk_actions() { |
201 | 203 | $actions = array(); |
202 | - if ( current_user_can( 'delete_sites' ) ) |
|
203 | - $actions['delete'] = __( 'Delete' ); |
|
204 | + if ( current_user_can( 'delete_sites' ) ) { |
|
205 | + $actions['delete'] = __( 'Delete' ); |
|
206 | + } |
|
204 | 207 | $actions['spam'] = _x( 'Mark as Spam', 'site' ); |
205 | 208 | $actions['notspam'] = _x( 'Not Spam', 'site' ); |
206 | 209 | |
@@ -217,8 +220,9 @@ discard block |
||
217 | 220 | |
218 | 221 | parent::pagination( $which ); |
219 | 222 | |
220 | - if ( 'top' === $which ) |
|
221 | - $this->view_switcher( $mode ); |
|
223 | + if ( 'top' === $which ) { |
|
224 | + $this->view_switcher( $mode ); |
|
225 | + } |
|
222 | 226 | } |
223 | 227 | |
224 | 228 | /** |
@@ -36,18 +36,18 @@ discard block |
||
36 | 36 | * |
37 | 37 | * @param array $args An associative array of arguments. |
38 | 38 | */ |
39 | - public function __construct( $args = array() ) { |
|
39 | + public function __construct($args = array()) { |
|
40 | 40 | $this->status_list = array( |
41 | - 'archived' => array( 'site-archived', __( 'Archived' ) ), |
|
42 | - 'spam' => array( 'site-spammed', _x( 'Spam', 'site' ) ), |
|
43 | - 'deleted' => array( 'site-deleted', __( 'Deleted' ) ), |
|
44 | - 'mature' => array( 'site-mature', __( 'Mature' ) ) |
|
41 | + 'archived' => array('site-archived', __('Archived')), |
|
42 | + 'spam' => array('site-spammed', _x('Spam', 'site')), |
|
43 | + 'deleted' => array('site-deleted', __('Deleted')), |
|
44 | + 'mature' => array('site-mature', __('Mature')) |
|
45 | 45 | ); |
46 | 46 | |
47 | - parent::__construct( array( |
|
47 | + parent::__construct(array( |
|
48 | 48 | 'plural' => 'sites', |
49 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
50 | - ) ); |
|
49 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
50 | + )); |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | /** |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | * @return bool |
56 | 56 | */ |
57 | 57 | public function ajax_user_can() { |
58 | - return current_user_can( 'manage_sites' ); |
|
58 | + return current_user_can('manage_sites'); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -70,20 +70,20 @@ discard block |
||
70 | 70 | public function prepare_items() { |
71 | 71 | global $s, $mode, $wpdb; |
72 | 72 | |
73 | - if ( ! empty( $_REQUEST['mode'] ) ) { |
|
73 | + if ( ! empty($_REQUEST['mode'])) { |
|
74 | 74 | $mode = $_REQUEST['mode'] === 'excerpt' ? 'excerpt' : 'list'; |
75 | - set_user_setting( 'sites_list_mode', $mode ); |
|
75 | + set_user_setting('sites_list_mode', $mode); |
|
76 | 76 | } else { |
77 | - $mode = get_user_setting( 'sites_list_mode', 'list' ); |
|
77 | + $mode = get_user_setting('sites_list_mode', 'list'); |
|
78 | 78 | } |
79 | 79 | |
80 | - $per_page = $this->get_items_per_page( 'sites_network_per_page' ); |
|
80 | + $per_page = $this->get_items_per_page('sites_network_per_page'); |
|
81 | 81 | |
82 | 82 | $pagenum = $this->get_pagenum(); |
83 | 83 | |
84 | - $s = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST[ 's' ] ) ) : ''; |
|
84 | + $s = isset($_REQUEST['s']) ? wp_unslash(trim($_REQUEST['s'])) : ''; |
|
85 | 85 | $wild = ''; |
86 | - if ( false !== strpos($s, '*') ) { |
|
86 | + if (false !== strpos($s, '*')) { |
|
87 | 87 | $wild = '*'; |
88 | 88 | $s = trim($s, '*'); |
89 | 89 | } |
@@ -92,66 +92,66 @@ discard block |
||
92 | 92 | * If the network is large and a search is not being performed, show only |
93 | 93 | * the latest sites with no paging in order to avoid expensive count queries. |
94 | 94 | */ |
95 | - if ( !$s && wp_is_large_network() ) { |
|
96 | - if ( !isset($_REQUEST['orderby']) ) |
|
95 | + if ( ! $s && wp_is_large_network()) { |
|
96 | + if ( ! isset($_REQUEST['orderby'])) |
|
97 | 97 | $_GET['orderby'] = $_REQUEST['orderby'] = ''; |
98 | - if ( !isset($_REQUEST['order']) ) |
|
98 | + if ( ! isset($_REQUEST['order'])) |
|
99 | 99 | $_GET['order'] = $_REQUEST['order'] = 'DESC'; |
100 | 100 | } |
101 | 101 | |
102 | 102 | $args = array( |
103 | - 'number' => intval( $per_page ), |
|
104 | - 'offset' => intval( ( $pagenum - 1 ) * $per_page ), |
|
103 | + 'number' => intval($per_page), |
|
104 | + 'offset' => intval(($pagenum - 1) * $per_page), |
|
105 | 105 | 'network_id' => get_current_network_id(), |
106 | 106 | ); |
107 | 107 | |
108 | - if ( empty($s) ) { |
|
108 | + if (empty($s)) { |
|
109 | 109 | // Nothing to do. |
110 | - } elseif ( preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s ) || |
|
111 | - preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || |
|
112 | - preg_match( '/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s ) || |
|
113 | - preg_match( '/^[0-9]{1,3}\.$/', $s ) ) { |
|
110 | + } elseif (preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$/', $s) || |
|
111 | + preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s) || |
|
112 | + preg_match('/^[0-9]{1,3}\.[0-9]{1,3}\.?$/', $s) || |
|
113 | + preg_match('/^[0-9]{1,3}\.$/', $s)) { |
|
114 | 114 | // IPv4 address |
115 | - $sql = $wpdb->prepare( "SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like( $s ) . ( ! empty( $wild ) ? '%' : '' ) ); |
|
116 | - $reg_blog_ids = $wpdb->get_col( $sql ); |
|
115 | + $sql = $wpdb->prepare("SELECT blog_id FROM {$wpdb->registration_log} WHERE {$wpdb->registration_log}.IP LIKE %s", $wpdb->esc_like($s).( ! empty($wild) ? '%' : '')); |
|
116 | + $reg_blog_ids = $wpdb->get_col($sql); |
|
117 | 117 | |
118 | - if ( $reg_blog_ids ) { |
|
118 | + if ($reg_blog_ids) { |
|
119 | 119 | $args['site__in'] = $reg_blog_ids; |
120 | 120 | } |
121 | - } elseif ( is_numeric( $s ) && empty( $wild ) ) { |
|
121 | + } elseif (is_numeric($s) && empty($wild)) { |
|
122 | 122 | $args['ID'] = $s; |
123 | 123 | } else { |
124 | 124 | $args['search'] = $s; |
125 | 125 | |
126 | - if ( ! is_subdomain_install() ) { |
|
127 | - $args['search_columns'] = array( 'path' ); |
|
126 | + if ( ! is_subdomain_install()) { |
|
127 | + $args['search_columns'] = array('path'); |
|
128 | 128 | } |
129 | 129 | } |
130 | 130 | |
131 | - $order_by = isset( $_REQUEST['orderby'] ) ? $_REQUEST['orderby'] : ''; |
|
132 | - if ( 'registered' === $order_by ) { |
|
131 | + $order_by = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : ''; |
|
132 | + if ('registered' === $order_by) { |
|
133 | 133 | // registered is a valid field name. |
134 | - } elseif ( 'lastupdated' === $order_by ) { |
|
134 | + } elseif ('lastupdated' === $order_by) { |
|
135 | 135 | $order_by = 'last_updated'; |
136 | - } elseif ( 'blogname' === $order_by ) { |
|
137 | - if ( is_subdomain_install() ) { |
|
136 | + } elseif ('blogname' === $order_by) { |
|
137 | + if (is_subdomain_install()) { |
|
138 | 138 | $order_by = 'domain'; |
139 | 139 | } else { |
140 | 140 | $order_by = 'path'; |
141 | 141 | } |
142 | - } elseif ( 'blog_id' === $order_by ) { |
|
142 | + } elseif ('blog_id' === $order_by) { |
|
143 | 143 | $order_by = 'id'; |
144 | - } elseif ( ! $order_by ) { |
|
144 | + } elseif ( ! $order_by) { |
|
145 | 145 | $order_by = false; |
146 | 146 | } |
147 | 147 | |
148 | 148 | $args['orderby'] = $order_by; |
149 | 149 | |
150 | - if ( $order_by ) { |
|
151 | - $args['order'] = ( isset( $_REQUEST['order'] ) && 'DESC' === strtoupper( $_REQUEST['order'] ) ) ? "DESC" : "ASC"; |
|
150 | + if ($order_by) { |
|
151 | + $args['order'] = (isset($_REQUEST['order']) && 'DESC' === strtoupper($_REQUEST['order'])) ? "DESC" : "ASC"; |
|
152 | 152 | } |
153 | 153 | |
154 | - if ( wp_is_large_network() ) { |
|
154 | + if (wp_is_large_network()) { |
|
155 | 155 | $args['no_found_rows'] = true; |
156 | 156 | } else { |
157 | 157 | $args['no_found_rows'] = false; |
@@ -164,32 +164,32 @@ discard block |
||
164 | 164 | * |
165 | 165 | * @param array $args An array of get_sites() arguments. |
166 | 166 | */ |
167 | - $args = apply_filters( 'ms_sites_list_table_query_args', $args ); |
|
167 | + $args = apply_filters('ms_sites_list_table_query_args', $args); |
|
168 | 168 | |
169 | - $_sites = get_sites( $args ); |
|
170 | - if ( is_array( $_sites ) ) { |
|
171 | - update_site_cache( $_sites ); |
|
169 | + $_sites = get_sites($args); |
|
170 | + if (is_array($_sites)) { |
|
171 | + update_site_cache($_sites); |
|
172 | 172 | |
173 | - $this->items = array_slice( $_sites, 0, $per_page ); |
|
173 | + $this->items = array_slice($_sites, 0, $per_page); |
|
174 | 174 | } |
175 | 175 | |
176 | - $total_sites = get_sites( array_merge( $args, array( |
|
176 | + $total_sites = get_sites(array_merge($args, array( |
|
177 | 177 | 'count' => true, |
178 | 178 | 'offset' => 0, |
179 | 179 | 'number' => 0, |
180 | - ) ) ); |
|
180 | + ))); |
|
181 | 181 | |
182 | - $this->set_pagination_args( array( |
|
182 | + $this->set_pagination_args(array( |
|
183 | 183 | 'total_items' => $total_sites, |
184 | 184 | 'per_page' => $per_page, |
185 | - ) ); |
|
185 | + )); |
|
186 | 186 | } |
187 | 187 | |
188 | 188 | /** |
189 | 189 | * @access public |
190 | 190 | */ |
191 | 191 | public function no_items() { |
192 | - _e( 'No sites found.' ); |
|
192 | + _e('No sites found.'); |
|
193 | 193 | } |
194 | 194 | |
195 | 195 | /** |
@@ -198,10 +198,10 @@ discard block |
||
198 | 198 | */ |
199 | 199 | protected function get_bulk_actions() { |
200 | 200 | $actions = array(); |
201 | - if ( current_user_can( 'delete_sites' ) ) |
|
202 | - $actions['delete'] = __( 'Delete' ); |
|
203 | - $actions['spam'] = _x( 'Mark as Spam', 'site' ); |
|
204 | - $actions['notspam'] = _x( 'Not Spam', 'site' ); |
|
201 | + if (current_user_can('delete_sites')) |
|
202 | + $actions['delete'] = __('Delete'); |
|
203 | + $actions['spam'] = _x('Mark as Spam', 'site'); |
|
204 | + $actions['notspam'] = _x('Not Spam', 'site'); |
|
205 | 205 | |
206 | 206 | return $actions; |
207 | 207 | } |
@@ -211,13 +211,13 @@ discard block |
||
211 | 211 | * |
212 | 212 | * @param string $which |
213 | 213 | */ |
214 | - protected function pagination( $which ) { |
|
214 | + protected function pagination($which) { |
|
215 | 215 | global $mode; |
216 | 216 | |
217 | - parent::pagination( $which ); |
|
217 | + parent::pagination($which); |
|
218 | 218 | |
219 | - if ( 'top' === $which ) |
|
220 | - $this->view_switcher( $mode ); |
|
219 | + if ('top' === $which) |
|
220 | + $this->view_switcher($mode); |
|
221 | 221 | } |
222 | 222 | |
223 | 223 | /** |
@@ -226,14 +226,14 @@ discard block |
||
226 | 226 | public function get_columns() { |
227 | 227 | $sites_columns = array( |
228 | 228 | 'cb' => '<input type="checkbox" />', |
229 | - 'blogname' => __( 'URL' ), |
|
230 | - 'lastupdated' => __( 'Last Updated' ), |
|
231 | - 'registered' => _x( 'Registered', 'site' ), |
|
232 | - 'users' => __( 'Users' ), |
|
229 | + 'blogname' => __('URL'), |
|
230 | + 'lastupdated' => __('Last Updated'), |
|
231 | + 'registered' => _x('Registered', 'site'), |
|
232 | + 'users' => __('Users'), |
|
233 | 233 | ); |
234 | 234 | |
235 | - if ( has_filter( 'wpmublogsaction' ) ) { |
|
236 | - $sites_columns['plugins'] = __( 'Actions' ); |
|
235 | + if (has_filter('wpmublogsaction')) { |
|
236 | + $sites_columns['plugins'] = __('Actions'); |
|
237 | 237 | } |
238 | 238 | |
239 | 239 | /** |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | * @param array $sites_columns An array of displayed site columns. Default 'cb', |
245 | 245 | * 'blogname', 'lastupdated', 'registered', 'users'. |
246 | 246 | */ |
247 | - return apply_filters( 'wpmu_blogs_columns', $sites_columns ); |
|
247 | + return apply_filters('wpmu_blogs_columns', $sites_columns); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -266,14 +266,14 @@ discard block |
||
266 | 266 | * |
267 | 267 | * @param array $blog Current site. |
268 | 268 | */ |
269 | - public function column_cb( $blog ) { |
|
270 | - if ( ! is_main_site( $blog['blog_id'] ) ) : |
|
271 | - $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); |
|
269 | + public function column_cb($blog) { |
|
270 | + if ( ! is_main_site($blog['blog_id'])) : |
|
271 | + $blogname = untrailingslashit($blog['domain'].$blog['path']); |
|
272 | 272 | ?> |
273 | 273 | <label class="screen-reader-text" for="blog_<?php echo $blog['blog_id']; ?>"><?php |
274 | - printf( __( 'Select %s' ), $blogname ); |
|
274 | + printf(__('Select %s'), $blogname); |
|
275 | 275 | ?></label> |
276 | - <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr( $blog['blog_id'] ) ?>" /> |
|
276 | + <input type="checkbox" id="blog_<?php echo $blog['blog_id'] ?>" name="allblogs[]" value="<?php echo esc_attr($blog['blog_id']) ?>" /> |
|
277 | 277 | <?php endif; |
278 | 278 | } |
279 | 279 | |
@@ -285,7 +285,7 @@ discard block |
||
285 | 285 | * |
286 | 286 | * @param array $blog Current site. |
287 | 287 | */ |
288 | - public function column_id( $blog ) { |
|
288 | + public function column_id($blog) { |
|
289 | 289 | echo $blog['blog_id']; |
290 | 290 | } |
291 | 291 | |
@@ -299,44 +299,44 @@ discard block |
||
299 | 299 | * |
300 | 300 | * @param array $blog Current site. |
301 | 301 | */ |
302 | - public function column_blogname( $blog ) { |
|
302 | + public function column_blogname($blog) { |
|
303 | 303 | global $mode; |
304 | 304 | |
305 | - $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); |
|
305 | + $blogname = untrailingslashit($blog['domain'].$blog['path']); |
|
306 | 306 | $blog_states = array(); |
307 | - reset( $this->status_list ); |
|
307 | + reset($this->status_list); |
|
308 | 308 | |
309 | - foreach ( $this->status_list as $status => $col ) { |
|
310 | - if ( $blog[ $status ] == 1 ) { |
|
309 | + foreach ($this->status_list as $status => $col) { |
|
310 | + if ($blog[$status] == 1) { |
|
311 | 311 | $blog_states[] = $col[1]; |
312 | 312 | } |
313 | 313 | } |
314 | 314 | $blog_state = ''; |
315 | - if ( ! empty( $blog_states ) ) { |
|
316 | - $state_count = count( $blog_states ); |
|
315 | + if ( ! empty($blog_states)) { |
|
316 | + $state_count = count($blog_states); |
|
317 | 317 | $i = 0; |
318 | 318 | $blog_state .= ' — '; |
319 | - foreach ( $blog_states as $state ) { |
|
319 | + foreach ($blog_states as $state) { |
|
320 | 320 | ++$i; |
321 | - $sep = ( $i == $state_count ) ? '' : ', '; |
|
321 | + $sep = ($i == $state_count) ? '' : ', '; |
|
322 | 322 | $blog_state .= "<span class='post-state'>$state$sep</span>"; |
323 | 323 | } |
324 | 324 | } |
325 | 325 | |
326 | 326 | ?> |
327 | 327 | <strong> |
328 | - <a href="<?php echo esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ); ?>" class="edit"><?php echo $blogname; ?></a> |
|
328 | + <a href="<?php echo esc_url(network_admin_url('site-info.php?id='.$blog['blog_id'])); ?>" class="edit"><?php echo $blogname; ?></a> |
|
329 | 329 | <?php echo $blog_state; ?> |
330 | 330 | </strong> |
331 | 331 | <?php |
332 | - if ( 'list' !== $mode ) { |
|
333 | - switch_to_blog( $blog['blog_id'] ); |
|
332 | + if ('list' !== $mode) { |
|
333 | + switch_to_blog($blog['blog_id']); |
|
334 | 334 | echo '<p>'; |
335 | 335 | printf( |
336 | 336 | /* translators: 1: site name, 2: site tagline. */ |
337 | - __( '%1$s – %2$s' ), |
|
338 | - get_option( 'blogname' ), |
|
339 | - '<em>' . get_option( 'blogdescription ' ) . '</em>' |
|
337 | + __('%1$s – %2$s'), |
|
338 | + get_option('blogname'), |
|
339 | + '<em>'.get_option('blogdescription ').'</em>' |
|
340 | 340 | ); |
341 | 341 | echo '</p>'; |
342 | 342 | restore_current_blog(); |
@@ -353,16 +353,16 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @param array $blog Current site. |
355 | 355 | */ |
356 | - public function column_lastupdated( $blog ) { |
|
356 | + public function column_lastupdated($blog) { |
|
357 | 357 | global $mode; |
358 | 358 | |
359 | - if ( 'list' === $mode ) { |
|
360 | - $date = __( 'Y/m/d' ); |
|
359 | + if ('list' === $mode) { |
|
360 | + $date = __('Y/m/d'); |
|
361 | 361 | } else { |
362 | - $date = __( 'Y/m/d g:i:s a' ); |
|
362 | + $date = __('Y/m/d g:i:s a'); |
|
363 | 363 | } |
364 | 364 | |
365 | - echo ( $blog['last_updated'] === '0000-00-00 00:00:00' ) ? __( 'Never' ) : mysql2date( $date, $blog['last_updated'] ); |
|
365 | + echo ($blog['last_updated'] === '0000-00-00 00:00:00') ? __('Never') : mysql2date($date, $blog['last_updated']); |
|
366 | 366 | } |
367 | 367 | |
368 | 368 | /** |
@@ -375,19 +375,19 @@ discard block |
||
375 | 375 | * |
376 | 376 | * @param array $blog Current site. |
377 | 377 | */ |
378 | - public function column_registered( $blog ) { |
|
378 | + public function column_registered($blog) { |
|
379 | 379 | global $mode; |
380 | 380 | |
381 | - if ( 'list' === $mode ) { |
|
382 | - $date = __( 'Y/m/d' ); |
|
381 | + if ('list' === $mode) { |
|
382 | + $date = __('Y/m/d'); |
|
383 | 383 | } else { |
384 | - $date = __( 'Y/m/d g:i:s a' ); |
|
384 | + $date = __('Y/m/d g:i:s a'); |
|
385 | 385 | } |
386 | 386 | |
387 | - if ( $blog['registered'] === '0000-00-00 00:00:00' ) { |
|
387 | + if ($blog['registered'] === '0000-00-00 00:00:00') { |
|
388 | 388 | echo '—'; |
389 | 389 | } else { |
390 | - echo mysql2date( $date, $blog['registered'] ); |
|
390 | + echo mysql2date($date, $blog['registered']); |
|
391 | 391 | } |
392 | 392 | } |
393 | 393 | |
@@ -399,19 +399,19 @@ discard block |
||
399 | 399 | * |
400 | 400 | * @param array $blog Current site. |
401 | 401 | */ |
402 | - public function column_users( $blog ) { |
|
403 | - $user_count = wp_cache_get( $blog['blog_id'] . '_user_count', 'blog-details' ); |
|
404 | - if ( ! $user_count ) { |
|
405 | - $blog_users = get_users( array( 'blog_id' => $blog['blog_id'], 'fields' => 'ID' ) ); |
|
406 | - $user_count = count( $blog_users ); |
|
407 | - unset( $blog_users ); |
|
408 | - wp_cache_set( $blog['blog_id'] . '_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS ); |
|
402 | + public function column_users($blog) { |
|
403 | + $user_count = wp_cache_get($blog['blog_id'].'_user_count', 'blog-details'); |
|
404 | + if ( ! $user_count) { |
|
405 | + $blog_users = get_users(array('blog_id' => $blog['blog_id'], 'fields' => 'ID')); |
|
406 | + $user_count = count($blog_users); |
|
407 | + unset($blog_users); |
|
408 | + wp_cache_set($blog['blog_id'].'_user_count', $user_count, 'blog-details', 12 * HOUR_IN_SECONDS); |
|
409 | 409 | } |
410 | 410 | |
411 | 411 | printf( |
412 | 412 | '<a href="%s">%s</a>', |
413 | - esc_url( network_admin_url( 'site-users.php?id=' . $blog['blog_id'] ) ), |
|
414 | - number_format_i18n( $user_count ) |
|
413 | + esc_url(network_admin_url('site-users.php?id='.$blog['blog_id'])), |
|
414 | + number_format_i18n($user_count) |
|
415 | 415 | ); |
416 | 416 | } |
417 | 417 | |
@@ -423,8 +423,8 @@ discard block |
||
423 | 423 | * |
424 | 424 | * @param array $blog Current site. |
425 | 425 | */ |
426 | - public function column_plugins( $blog ) { |
|
427 | - if ( has_filter( 'wpmublogsaction' ) ) { |
|
426 | + public function column_plugins($blog) { |
|
427 | + if (has_filter('wpmublogsaction')) { |
|
428 | 428 | /** |
429 | 429 | * Fires inside the auxiliary 'Actions' column of the Sites list table. |
430 | 430 | * |
@@ -434,7 +434,7 @@ discard block |
||
434 | 434 | * |
435 | 435 | * @param int $blog_id The site ID. |
436 | 436 | */ |
437 | - do_action( 'wpmublogsaction', $blog['blog_id'] ); |
|
437 | + do_action('wpmublogsaction', $blog['blog_id']); |
|
438 | 438 | } |
439 | 439 | } |
440 | 440 | |
@@ -447,7 +447,7 @@ discard block |
||
447 | 447 | * @param array $blog Current site. |
448 | 448 | * @param string $column_name Current column name. |
449 | 449 | */ |
450 | - public function column_default( $blog, $column_name ) { |
|
450 | + public function column_default($blog, $column_name) { |
|
451 | 451 | /** |
452 | 452 | * Fires for each registered custom column in the Sites list table. |
453 | 453 | * |
@@ -456,7 +456,7 @@ discard block |
||
456 | 456 | * @param string $column_name The name of the column to display. |
457 | 457 | * @param int $blog_id The site ID. |
458 | 458 | */ |
459 | - do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] ); |
|
459 | + do_action('manage_sites_custom_column', $column_name, $blog['blog_id']); |
|
460 | 460 | } |
461 | 461 | |
462 | 462 | /** |
@@ -464,20 +464,20 @@ discard block |
||
464 | 464 | * @global string $mode |
465 | 465 | */ |
466 | 466 | public function display_rows() { |
467 | - foreach ( $this->items as $blog ) { |
|
467 | + foreach ($this->items as $blog) { |
|
468 | 468 | $blog = $blog->to_array(); |
469 | 469 | $class = ''; |
470 | - reset( $this->status_list ); |
|
470 | + reset($this->status_list); |
|
471 | 471 | |
472 | - foreach ( $this->status_list as $status => $col ) { |
|
473 | - if ( $blog[ $status ] == 1 ) { |
|
472 | + foreach ($this->status_list as $status => $col) { |
|
473 | + if ($blog[$status] == 1) { |
|
474 | 474 | $class = " class='{$col[0]}'"; |
475 | 475 | } |
476 | 476 | } |
477 | 477 | |
478 | 478 | echo "<tr{$class}>"; |
479 | 479 | |
480 | - $this->single_row_columns( $blog ); |
|
480 | + $this->single_row_columns($blog); |
|
481 | 481 | |
482 | 482 | echo '</tr>'; |
483 | 483 | } |
@@ -506,12 +506,12 @@ discard block |
||
506 | 506 | * @param string $primary Primary column name. |
507 | 507 | * @return string Row actions output. |
508 | 508 | */ |
509 | - protected function handle_row_actions( $blog, $column_name, $primary ) { |
|
510 | - if ( $primary !== $column_name ) { |
|
509 | + protected function handle_row_actions($blog, $column_name, $primary) { |
|
510 | + if ($primary !== $column_name) { |
|
511 | 511 | return; |
512 | 512 | } |
513 | 513 | |
514 | - $blogname = untrailingslashit( $blog['domain'] . $blog['path'] ); |
|
514 | + $blogname = untrailingslashit($blog['domain'].$blog['path']); |
|
515 | 515 | |
516 | 516 | // Preordered. |
517 | 517 | $actions = array( |
@@ -523,33 +523,33 @@ discard block |
||
523 | 523 | 'visit' => '', |
524 | 524 | ); |
525 | 525 | |
526 | - $actions['edit'] = '<a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a>'; |
|
527 | - $actions['backend'] = "<a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a>'; |
|
528 | - if ( get_network()->site_id != $blog['blog_id'] ) { |
|
529 | - if ( $blog['deleted'] == '1' ) { |
|
530 | - $actions['activate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] ), 'activateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Activate' ) . '</a>'; |
|
526 | + $actions['edit'] = '<a href="'.esc_url(network_admin_url('site-info.php?id='.$blog['blog_id'])).'">'.__('Edit').'</a>'; |
|
527 | + $actions['backend'] = "<a href='".esc_url(get_admin_url($blog['blog_id']))."' class='edit'>".__('Dashboard').'</a>'; |
|
528 | + if (get_network()->site_id != $blog['blog_id']) { |
|
529 | + if ($blog['deleted'] == '1') { |
|
530 | + $actions['activate'] = '<a href="'.esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=activateblog&id='.$blog['blog_id']), 'activateblog_'.$blog['blog_id'])).'">'.__('Activate').'</a>'; |
|
531 | 531 | } else { |
532 | - $actions['deactivate'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] ), 'deactivateblog_' . $blog['blog_id'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; |
|
532 | + $actions['deactivate'] = '<a href="'.esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=deactivateblog&id='.$blog['blog_id']), 'deactivateblog_'.$blog['blog_id'])).'">'.__('Deactivate').'</a>'; |
|
533 | 533 | } |
534 | 534 | |
535 | - if ( $blog['archived'] == '1' ) { |
|
536 | - $actions['unarchive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] ), 'unarchiveblog_' . $blog['blog_id'] ) ) . '">' . __( 'Unarchive' ) . '</a>'; |
|
535 | + if ($blog['archived'] == '1') { |
|
536 | + $actions['unarchive'] = '<a href="'.esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=unarchiveblog&id='.$blog['blog_id']), 'unarchiveblog_'.$blog['blog_id'])).'">'.__('Unarchive').'</a>'; |
|
537 | 537 | } else { |
538 | - $actions['archive'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] ), 'archiveblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Archive', 'verb; site' ) . '</a>'; |
|
538 | + $actions['archive'] = '<a href="'.esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=archiveblog&id='.$blog['blog_id']), 'archiveblog_'.$blog['blog_id'])).'">'._x('Archive', 'verb; site').'</a>'; |
|
539 | 539 | } |
540 | 540 | |
541 | - if ( $blog['spam'] == '1' ) { |
|
542 | - $actions['unspam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] ), 'unspamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Not Spam', 'site' ) . '</a>'; |
|
541 | + if ($blog['spam'] == '1') { |
|
542 | + $actions['unspam'] = '<a href="'.esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=unspamblog&id='.$blog['blog_id']), 'unspamblog_'.$blog['blog_id'])).'">'._x('Not Spam', 'site').'</a>'; |
|
543 | 543 | } else { |
544 | - $actions['spam'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] ), 'spamblog_' . $blog['blog_id'] ) ) . '">' . _x( 'Spam', 'site' ) . '</a>'; |
|
544 | + $actions['spam'] = '<a href="'.esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=spamblog&id='.$blog['blog_id']), 'spamblog_'.$blog['blog_id'])).'">'._x('Spam', 'site').'</a>'; |
|
545 | 545 | } |
546 | 546 | |
547 | - if ( current_user_can( 'delete_site', $blog['blog_id'] ) ) { |
|
548 | - $actions['delete'] = '<a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deleteblog&id=' . $blog['blog_id'] ), 'deleteblog_' . $blog['blog_id'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
547 | + if (current_user_can('delete_site', $blog['blog_id'])) { |
|
548 | + $actions['delete'] = '<a href="'.esc_url(wp_nonce_url(network_admin_url('sites.php?action=confirm&action2=deleteblog&id='.$blog['blog_id']), 'deleteblog_'.$blog['blog_id'])).'">'.__('Delete').'</a>'; |
|
549 | 549 | } |
550 | 550 | } |
551 | 551 | |
552 | - $actions['visit'] = "<a href='" . esc_url( get_home_url( $blog['blog_id'], '/' ) ) . "' rel='bookmark'>" . __( 'Visit' ) . '</a>'; |
|
552 | + $actions['visit'] = "<a href='".esc_url(get_home_url($blog['blog_id'], '/'))."' rel='bookmark'>".__('Visit').'</a>'; |
|
553 | 553 | |
554 | 554 | /** |
555 | 555 | * Filters the action links displayed for each site in the Sites list table. |
@@ -566,7 +566,7 @@ discard block |
||
566 | 566 | * @param string $blogname Site path, formatted depending on whether it is a sub-domain |
567 | 567 | * or subdirectory multisite install. |
568 | 568 | */ |
569 | - $actions = apply_filters( 'manage_sites_action_links', array_filter( $actions ), $blog['blog_id'], $blogname ); |
|
570 | - return $this->row_actions( $actions ); |
|
569 | + $actions = apply_filters('manage_sites_action_links', array_filter($actions), $blog['blog_id'], $blogname); |
|
570 | + return $this->row_actions($actions); |
|
571 | 571 | } |
572 | 572 | } |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | * @param array $args |
23 | 23 | */ |
24 | 24 | public function __construct($args = array()) { |
25 | - $defaults = array( 'type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => '' ); |
|
25 | + $defaults = array('type' => 'web', 'url' => '', 'theme' => '', 'nonce' => '', 'title' => ''); |
|
26 | 26 | $args = wp_parse_args($args, $defaults); |
27 | 27 | |
28 | 28 | $this->type = $args['type']; |
@@ -35,49 +35,49 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function before() { |
38 | - if ( !empty($this->api) ) |
|
39 | - $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version); |
|
38 | + if ( ! empty($this->api)) |
|
39 | + $this->upgrader->strings['process_success'] = sprintf($this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | /** |
43 | 43 | * @access public |
44 | 44 | */ |
45 | 45 | public function after() { |
46 | - if ( empty($this->upgrader->result['destination_name']) ) |
|
46 | + if (empty($this->upgrader->result['destination_name'])) |
|
47 | 47 | return; |
48 | 48 | |
49 | 49 | $theme_info = $this->upgrader->theme_info(); |
50 | - if ( empty( $theme_info ) ) |
|
50 | + if (empty($theme_info)) |
|
51 | 51 | return; |
52 | 52 | |
53 | 53 | $name = $theme_info->display('Name'); |
54 | 54 | $stylesheet = $this->upgrader->result['destination_name']; |
55 | 55 | $template = $theme_info->get_template(); |
56 | 56 | |
57 | - $activate_link = add_query_arg( array( |
|
57 | + $activate_link = add_query_arg(array( |
|
58 | 58 | 'action' => 'activate', |
59 | - 'template' => urlencode( $template ), |
|
60 | - 'stylesheet' => urlencode( $stylesheet ), |
|
61 | - ), admin_url('themes.php') ); |
|
62 | - $activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); |
|
59 | + 'template' => urlencode($template), |
|
60 | + 'stylesheet' => urlencode($stylesheet), |
|
61 | + ), admin_url('themes.php')); |
|
62 | + $activate_link = wp_nonce_url($activate_link, 'switch-theme_'.$stylesheet); |
|
63 | 63 | |
64 | 64 | $install_actions = array(); |
65 | 65 | |
66 | - if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) { |
|
67 | - $install_actions['preview'] = '<a href="' . wp_customize_url( $stylesheet ) . '" class="hide-if-no-customize load-customize"><span aria-hidden="true">' . __( 'Live Preview' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Live Preview “%s”' ), $name ) . '</span></a>'; |
|
66 | + if (current_user_can('edit_theme_options') && current_user_can('customize')) { |
|
67 | + $install_actions['preview'] = '<a href="'.wp_customize_url($stylesheet).'" class="hide-if-no-customize load-customize"><span aria-hidden="true">'.__('Live Preview').'</span><span class="screen-reader-text">'.sprintf(__('Live Preview “%s”'), $name).'</span></a>'; |
|
68 | 68 | } |
69 | - $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate “%s”' ), $name ) . '</span></a>'; |
|
69 | + $install_actions['activate'] = '<a href="'.esc_url($activate_link).'" class="activatelink"><span aria-hidden="true">'.__('Activate').'</span><span class="screen-reader-text">'.sprintf(__('Activate “%s”'), $name).'</span></a>'; |
|
70 | 70 | |
71 | - if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) |
|
72 | - $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>'; |
|
71 | + if (is_network_admin() && current_user_can('manage_network_themes')) |
|
72 | + $install_actions['network_enable'] = '<a href="'.esc_url(wp_nonce_url('themes.php?action=enable&theme='.urlencode($stylesheet), 'enable-theme_'.$stylesheet)).'" target="_parent">'.__('Network Enable').'</a>'; |
|
73 | 73 | |
74 | - if ( $this->type == 'web' ) |
|
75 | - $install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>'; |
|
76 | - elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) |
|
77 | - $install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>'; |
|
74 | + if ($this->type == 'web') |
|
75 | + $install_actions['themes_page'] = '<a href="'.self_admin_url('theme-install.php').'" target="_parent">'.__('Return to Theme Installer').'</a>'; |
|
76 | + elseif (current_user_can('switch_themes') || current_user_can('edit_theme_options')) |
|
77 | + $install_actions['themes_page'] = '<a href="'.self_admin_url('themes.php').'" target="_parent">'.__('Return to Themes page').'</a>'; |
|
78 | 78 | |
79 | - if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) ) |
|
80 | - unset( $install_actions['activate'], $install_actions['preview'] ); |
|
79 | + if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can('switch_themes')) |
|
80 | + unset($install_actions['activate'], $install_actions['preview']); |
|
81 | 81 | |
82 | 82 | /** |
83 | 83 | * Filters the list of action links available following a single theme installation. |
@@ -89,8 +89,8 @@ discard block |
||
89 | 89 | * @param string $stylesheet Theme directory name. |
90 | 90 | * @param WP_Theme $theme_info Theme object. |
91 | 91 | */ |
92 | - $install_actions = apply_filters( 'install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info ); |
|
93 | - if ( ! empty($install_actions) ) |
|
94 | - $this->feedback(implode(' | ', (array)$install_actions)); |
|
92 | + $install_actions = apply_filters('install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info); |
|
93 | + if ( ! empty($install_actions)) |
|
94 | + $this->feedback(implode(' | ', (array) $install_actions)); |
|
95 | 95 | } |
96 | 96 | } |
@@ -35,20 +35,23 @@ discard block |
||
35 | 35 | * @access public |
36 | 36 | */ |
37 | 37 | public function before() { |
38 | - if ( !empty($this->api) ) |
|
39 | - $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version); |
|
38 | + if ( !empty($this->api) ) { |
|
39 | + $this->upgrader->strings['process_success'] = sprintf( $this->upgrader->strings['process_success_specific'], $this->api->name, $this->api->version); |
|
40 | + } |
|
40 | 41 | } |
41 | 42 | |
42 | 43 | /** |
43 | 44 | * @access public |
44 | 45 | */ |
45 | 46 | public function after() { |
46 | - if ( empty($this->upgrader->result['destination_name']) ) |
|
47 | - return; |
|
47 | + if ( empty($this->upgrader->result['destination_name']) ) { |
|
48 | + return; |
|
49 | + } |
|
48 | 50 | |
49 | 51 | $theme_info = $this->upgrader->theme_info(); |
50 | - if ( empty( $theme_info ) ) |
|
51 | - return; |
|
52 | + if ( empty( $theme_info ) ) { |
|
53 | + return; |
|
54 | + } |
|
52 | 55 | |
53 | 56 | $name = $theme_info->display('Name'); |
54 | 57 | $stylesheet = $this->upgrader->result['destination_name']; |
@@ -68,16 +71,19 @@ discard block |
||
68 | 71 | } |
69 | 72 | $install_actions['activate'] = '<a href="' . esc_url( $activate_link ) . '" class="activatelink"><span aria-hidden="true">' . __( 'Activate' ) . '</span><span class="screen-reader-text">' . sprintf( __( 'Activate “%s”' ), $name ) . '</span></a>'; |
70 | 73 | |
71 | - if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) |
|
72 | - $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>'; |
|
74 | + if ( is_network_admin() && current_user_can( 'manage_network_themes' ) ) { |
|
75 | + $install_actions['network_enable'] = '<a href="' . esc_url( wp_nonce_url( 'themes.php?action=enable&theme=' . urlencode( $stylesheet ), 'enable-theme_' . $stylesheet ) ) . '" target="_parent">' . __( 'Network Enable' ) . '</a>'; |
|
76 | + } |
|
73 | 77 | |
74 | - if ( $this->type == 'web' ) |
|
75 | - $install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>'; |
|
76 | - elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) |
|
77 | - $install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>'; |
|
78 | + if ( $this->type == 'web' ) { |
|
79 | + $install_actions['themes_page'] = '<a href="' . self_admin_url( 'theme-install.php' ) . '" target="_parent">' . __( 'Return to Theme Installer' ) . '</a>'; |
|
80 | + } elseif ( current_user_can( 'switch_themes' ) || current_user_can( 'edit_theme_options' ) ) { |
|
81 | + $install_actions['themes_page'] = '<a href="' . self_admin_url( 'themes.php' ) . '" target="_parent">' . __( 'Return to Themes page' ) . '</a>'; |
|
82 | + } |
|
78 | 83 | |
79 | - if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) ) |
|
80 | - unset( $install_actions['activate'], $install_actions['preview'] ); |
|
84 | + if ( ! $this->result || is_wp_error($this->result) || is_network_admin() || ! current_user_can( 'switch_themes' ) ) { |
|
85 | + unset( $install_actions['activate'], $install_actions['preview'] ); |
|
86 | + } |
|
81 | 87 | |
82 | 88 | /** |
83 | 89 | * Filters the list of action links available following a single theme installation. |
@@ -90,7 +96,8 @@ discard block |
||
90 | 96 | * @param WP_Theme $theme_info Theme object. |
91 | 97 | */ |
92 | 98 | $install_actions = apply_filters( 'install_theme_complete_actions', $install_actions, $this->api, $stylesheet, $theme_info ); |
93 | - if ( ! empty($install_actions) ) |
|
94 | - $this->feedback(implode(' | ', (array)$install_actions)); |
|
99 | + if ( ! empty($install_actions) ) { |
|
100 | + $this->feedback(implode(' | ', (array)$install_actions)); |
|
101 | + } |
|
95 | 102 | } |
96 | 103 | } |
@@ -185,14 +185,14 @@ |
||
185 | 185 | $notify = isset( $_POST['send_user_notification'] ) ? 'both' : 'admin'; |
186 | 186 | |
187 | 187 | /** |
188 | - * Fires after a new user has been created. |
|
189 | - * |
|
190 | - * @since 4.4.0 |
|
191 | - * |
|
192 | - * @param int $user_id ID of the newly created user. |
|
193 | - * @param string $notify Type of notification that should happen. See wp_send_new_user_notifications() |
|
194 | - * for more information on possible values. |
|
195 | - */ |
|
188 | + * Fires after a new user has been created. |
|
189 | + * |
|
190 | + * @since 4.4.0 |
|
191 | + * |
|
192 | + * @param int $user_id ID of the newly created user. |
|
193 | + * @param string $notify Type of notification that should happen. See wp_send_new_user_notifications() |
|
194 | + * for more information on possible values. |
|
195 | + */ |
|
196 | 196 | do_action( 'edit_user_created_user', $user_id, $notify ); |
197 | 197 | } |
198 | 198 | return $user_id; |
@@ -39,31 +39,37 @@ discard block |
||
39 | 39 | $update = false; |
40 | 40 | } |
41 | 41 | |
42 | - if ( !$update && isset( $_POST['user_login'] ) ) |
|
43 | - $user->user_login = sanitize_user($_POST['user_login'], true); |
|
42 | + if ( !$update && isset( $_POST['user_login'] ) ) { |
|
43 | + $user->user_login = sanitize_user($_POST['user_login'], true); |
|
44 | + } |
|
44 | 45 | |
45 | 46 | $pass1 = $pass2 = ''; |
46 | - if ( isset( $_POST['pass1'] ) ) |
|
47 | - $pass1 = $_POST['pass1']; |
|
48 | - if ( isset( $_POST['pass2'] ) ) |
|
49 | - $pass2 = $_POST['pass2']; |
|
47 | + if ( isset( $_POST['pass1'] ) ) { |
|
48 | + $pass1 = $_POST['pass1']; |
|
49 | + } |
|
50 | + if ( isset( $_POST['pass2'] ) ) { |
|
51 | + $pass2 = $_POST['pass2']; |
|
52 | + } |
|
50 | 53 | |
51 | 54 | if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) { |
52 | 55 | $new_role = sanitize_text_field( $_POST['role'] ); |
53 | 56 | $potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false; |
54 | 57 | // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. |
55 | 58 | // Multisite super admins can freely edit their blog roles -- they possess all caps. |
56 | - if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) ) |
|
57 | - $user->role = $new_role; |
|
59 | + if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) ) { |
|
60 | + $user->role = $new_role; |
|
61 | + } |
|
58 | 62 | |
59 | 63 | // If the new role isn't editable by the logged-in user die with error |
60 | 64 | $editable_roles = get_editable_roles(); |
61 | - if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) ) |
|
62 | - wp_die(__('You can’t give users that role.')); |
|
65 | + if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) ) { |
|
66 | + wp_die(__('You can’t give users that role.')); |
|
67 | + } |
|
63 | 68 | } |
64 | 69 | |
65 | - if ( isset( $_POST['email'] )) |
|
66 | - $user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) ); |
|
70 | + if ( isset( $_POST['email'] )) { |
|
71 | + $user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) ); |
|
72 | + } |
|
67 | 73 | if ( isset( $_POST['url'] ) ) { |
68 | 74 | if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) { |
69 | 75 | $user->user_url = ''; |
@@ -73,21 +79,27 @@ discard block |
||
73 | 79 | $user->user_url = preg_match('/^(' . $protocols . '):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; |
74 | 80 | } |
75 | 81 | } |
76 | - if ( isset( $_POST['first_name'] ) ) |
|
77 | - $user->first_name = sanitize_text_field( $_POST['first_name'] ); |
|
78 | - if ( isset( $_POST['last_name'] ) ) |
|
79 | - $user->last_name = sanitize_text_field( $_POST['last_name'] ); |
|
80 | - if ( isset( $_POST['nickname'] ) ) |
|
81 | - $user->nickname = sanitize_text_field( $_POST['nickname'] ); |
|
82 | - if ( isset( $_POST['display_name'] ) ) |
|
83 | - $user->display_name = sanitize_text_field( $_POST['display_name'] ); |
|
82 | + if ( isset( $_POST['first_name'] ) ) { |
|
83 | + $user->first_name = sanitize_text_field( $_POST['first_name'] ); |
|
84 | + } |
|
85 | + if ( isset( $_POST['last_name'] ) ) { |
|
86 | + $user->last_name = sanitize_text_field( $_POST['last_name'] ); |
|
87 | + } |
|
88 | + if ( isset( $_POST['nickname'] ) ) { |
|
89 | + $user->nickname = sanitize_text_field( $_POST['nickname'] ); |
|
90 | + } |
|
91 | + if ( isset( $_POST['display_name'] ) ) { |
|
92 | + $user->display_name = sanitize_text_field( $_POST['display_name'] ); |
|
93 | + } |
|
84 | 94 | |
85 | - if ( isset( $_POST['description'] ) ) |
|
86 | - $user->description = trim( $_POST['description'] ); |
|
95 | + if ( isset( $_POST['description'] ) ) { |
|
96 | + $user->description = trim( $_POST['description'] ); |
|
97 | + } |
|
87 | 98 | |
88 | 99 | foreach ( wp_get_user_contact_methods( $user ) as $method => $name ) { |
89 | - if ( isset( $_POST[$method] )) |
|
90 | - $user->$method = sanitize_text_field( $_POST[$method] ); |
|
100 | + if ( isset( $_POST[$method] )) { |
|
101 | + $user->$method = sanitize_text_field( $_POST[$method] ); |
|
102 | + } |
|
91 | 103 | } |
92 | 104 | |
93 | 105 | if ( $update ) { |
@@ -99,14 +111,16 @@ discard block |
||
99 | 111 | $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; |
100 | 112 | |
101 | 113 | $user->use_ssl = 0; |
102 | - if ( !empty($_POST['use_ssl']) ) |
|
103 | - $user->use_ssl = 1; |
|
114 | + if ( !empty($_POST['use_ssl']) ) { |
|
115 | + $user->use_ssl = 1; |
|
116 | + } |
|
104 | 117 | |
105 | 118 | $errors = new WP_Error(); |
106 | 119 | |
107 | 120 | /* checking that username has been typed */ |
108 | - if ( $user->user_login == '' ) |
|
109 | - $errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ) ); |
|
121 | + if ( $user->user_login == '' ) { |
|
122 | + $errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ) ); |
|
123 | + } |
|
110 | 124 | |
111 | 125 | /* checking that nickname has been typed */ |
112 | 126 | if ( $update && empty( $user->nickname ) ) { |
@@ -139,14 +153,17 @@ discard block |
||
139 | 153 | $errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) ); |
140 | 154 | } |
141 | 155 | |
142 | - if ( !empty( $pass1 ) ) |
|
143 | - $user->user_pass = $pass1; |
|
156 | + if ( !empty( $pass1 ) ) { |
|
157 | + $user->user_pass = $pass1; |
|
158 | + } |
|
144 | 159 | |
145 | - if ( !$update && isset( $_POST['user_login'] ) && !validate_username( $_POST['user_login'] ) ) |
|
146 | - $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' )); |
|
160 | + if ( !$update && isset( $_POST['user_login'] ) && !validate_username( $_POST['user_login'] ) ) { |
|
161 | + $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' )); |
|
162 | + } |
|
147 | 163 | |
148 | - if ( !$update && username_exists( $user->user_login ) ) |
|
149 | - $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' )); |
|
164 | + if ( !$update && username_exists( $user->user_login ) ) { |
|
165 | + $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' )); |
|
166 | + } |
|
150 | 167 | |
151 | 168 | /** This filter is documented in wp-includes/user.php */ |
152 | 169 | $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
@@ -175,8 +192,9 @@ discard block |
||
175 | 192 | */ |
176 | 193 | do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); |
177 | 194 | |
178 | - if ( $errors->get_error_codes() ) |
|
179 | - return $errors; |
|
195 | + if ( $errors->get_error_codes() ) { |
|
196 | + return $errors; |
|
197 | + } |
|
180 | 198 | |
181 | 199 | if ( $update ) { |
182 | 200 | $user_id = wp_update_user( $user ); |
@@ -240,8 +258,9 @@ discard block |
||
240 | 258 | function get_user_to_edit( $user_id ) { |
241 | 259 | $user = get_userdata( $user_id ); |
242 | 260 | |
243 | - if ( $user ) |
|
244 | - $user->filter = 'edit'; |
|
261 | + if ( $user ) { |
|
262 | + $user->filter = 'edit'; |
|
263 | + } |
|
245 | 264 | |
246 | 265 | return $user; |
247 | 266 | } |
@@ -297,8 +316,9 @@ discard block |
||
297 | 316 | $id = (int) $id; |
298 | 317 | $user = new WP_User( $id ); |
299 | 318 | |
300 | - if ( !$user->exists() ) |
|
301 | - return false; |
|
319 | + if ( !$user->exists() ) { |
|
320 | + return false; |
|
321 | + } |
|
302 | 322 | |
303 | 323 | // Normalize $reassign to null or a user ID. 'novalue' was an older default. |
304 | 324 | if ( 'novalue' === $reassign ) { |
@@ -340,29 +360,33 @@ discard block |
||
340 | 360 | $post_types_to_delete = implode( "', '", $post_types_to_delete ); |
341 | 361 | $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id ) ); |
342 | 362 | if ( $post_ids ) { |
343 | - foreach ( $post_ids as $post_id ) |
|
344 | - wp_delete_post( $post_id ); |
|
363 | + foreach ( $post_ids as $post_id ) { |
|
364 | + wp_delete_post( $post_id ); |
|
365 | + } |
|
345 | 366 | } |
346 | 367 | |
347 | 368 | // Clean links |
348 | 369 | $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) ); |
349 | 370 | |
350 | 371 | if ( $link_ids ) { |
351 | - foreach ( $link_ids as $link_id ) |
|
352 | - wp_delete_link($link_id); |
|
372 | + foreach ( $link_ids as $link_id ) { |
|
373 | + wp_delete_link($link_id); |
|
374 | + } |
|
353 | 375 | } |
354 | 376 | } else { |
355 | 377 | $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); |
356 | 378 | $wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) ); |
357 | 379 | if ( ! empty( $post_ids ) ) { |
358 | - foreach ( $post_ids as $post_id ) |
|
359 | - clean_post_cache( $post_id ); |
|
380 | + foreach ( $post_ids as $post_id ) { |
|
381 | + clean_post_cache( $post_id ); |
|
382 | + } |
|
360 | 383 | } |
361 | 384 | $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) ); |
362 | 385 | $wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) ); |
363 | 386 | if ( ! empty( $link_ids ) ) { |
364 | - foreach ( $link_ids as $link_id ) |
|
365 | - clean_bookmark_cache( $link_id ); |
|
387 | + foreach ( $link_ids as $link_id ) { |
|
388 | + clean_bookmark_cache( $link_id ); |
|
389 | + } |
|
366 | 390 | } |
367 | 391 | } |
368 | 392 | |
@@ -371,8 +395,9 @@ discard block |
||
371 | 395 | remove_user_from_blog( $id, get_current_blog_id() ); |
372 | 396 | } else { |
373 | 397 | $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); |
374 | - foreach ( $meta as $mid ) |
|
375 | - delete_metadata_by_mid( 'user', $mid ); |
|
398 | + foreach ( $meta as $mid ) { |
|
399 | + delete_metadata_by_mid( 'user', $mid ); |
|
400 | + } |
|
376 | 401 | |
377 | 402 | $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); |
378 | 403 | } |
@@ -417,8 +442,9 @@ discard block |
||
417 | 442 | function default_password_nag_handler($errors = false) { |
418 | 443 | global $user_ID; |
419 | 444 | // Short-circuit it. |
420 | - if ( ! get_user_option('default_password_nag') ) |
|
421 | - return; |
|
445 | + if ( ! get_user_option('default_password_nag') ) { |
|
446 | + return; |
|
447 | + } |
|
422 | 448 | |
423 | 449 | // get_user_setting = JS saved UI setting. else no-js-fallback code. |
424 | 450 | if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) { |
@@ -435,8 +461,9 @@ discard block |
||
435 | 461 | */ |
436 | 462 | function default_password_nag_edit_user($user_ID, $old_data) { |
437 | 463 | // Short-circuit it. |
438 | - if ( ! get_user_option('default_password_nag', $user_ID) ) |
|
439 | - return; |
|
464 | + if ( ! get_user_option('default_password_nag', $user_ID) ) { |
|
465 | + return; |
|
466 | + } |
|
440 | 467 | |
441 | 468 | $new_data = get_userdata($user_ID); |
442 | 469 | |
@@ -455,8 +482,9 @@ discard block |
||
455 | 482 | function default_password_nag() { |
456 | 483 | global $pagenow; |
457 | 484 | // Short-circuit it. |
458 | - if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) |
|
459 | - return; |
|
485 | + if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) { |
|
486 | + return; |
|
487 | + } |
|
460 | 488 | |
461 | 489 | echo '<div class="error default-password-nag">'; |
462 | 490 | echo '<p>'; |
@@ -27,82 +27,82 @@ discard block |
||
27 | 27 | * @param int $user_id Optional. User ID. |
28 | 28 | * @return int|WP_Error user id of the updated user |
29 | 29 | */ |
30 | -function edit_user( $user_id = 0 ) { |
|
30 | +function edit_user($user_id = 0) { |
|
31 | 31 | $wp_roles = wp_roles(); |
32 | 32 | $user = new stdClass; |
33 | - if ( $user_id ) { |
|
33 | + if ($user_id) { |
|
34 | 34 | $update = true; |
35 | 35 | $user->ID = (int) $user_id; |
36 | - $userdata = get_userdata( $user_id ); |
|
37 | - $user->user_login = wp_slash( $userdata->user_login ); |
|
36 | + $userdata = get_userdata($user_id); |
|
37 | + $user->user_login = wp_slash($userdata->user_login); |
|
38 | 38 | } else { |
39 | 39 | $update = false; |
40 | 40 | } |
41 | 41 | |
42 | - if ( !$update && isset( $_POST['user_login'] ) ) |
|
42 | + if ( ! $update && isset($_POST['user_login'])) |
|
43 | 43 | $user->user_login = sanitize_user($_POST['user_login'], true); |
44 | 44 | |
45 | 45 | $pass1 = $pass2 = ''; |
46 | - if ( isset( $_POST['pass1'] ) ) |
|
46 | + if (isset($_POST['pass1'])) |
|
47 | 47 | $pass1 = $_POST['pass1']; |
48 | - if ( isset( $_POST['pass2'] ) ) |
|
48 | + if (isset($_POST['pass2'])) |
|
49 | 49 | $pass2 = $_POST['pass2']; |
50 | 50 | |
51 | - if ( isset( $_POST['role'] ) && current_user_can( 'edit_users' ) ) { |
|
52 | - $new_role = sanitize_text_field( $_POST['role'] ); |
|
51 | + if (isset($_POST['role']) && current_user_can('edit_users')) { |
|
52 | + $new_role = sanitize_text_field($_POST['role']); |
|
53 | 53 | $potential_role = isset($wp_roles->role_objects[$new_role]) ? $wp_roles->role_objects[$new_role] : false; |
54 | 54 | // Don't let anyone with 'edit_users' (admins) edit their own role to something without it. |
55 | 55 | // Multisite super admins can freely edit their blog roles -- they possess all caps. |
56 | - if ( ( is_multisite() && current_user_can( 'manage_sites' ) ) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap( 'edit_users' ) ) ) |
|
56 | + if ((is_multisite() && current_user_can('manage_sites')) || $user_id != get_current_user_id() || ($potential_role && $potential_role->has_cap('edit_users'))) |
|
57 | 57 | $user->role = $new_role; |
58 | 58 | |
59 | 59 | // If the new role isn't editable by the logged-in user die with error |
60 | 60 | $editable_roles = get_editable_roles(); |
61 | - if ( ! empty( $new_role ) && empty( $editable_roles[$new_role] ) ) |
|
61 | + if ( ! empty($new_role) && empty($editable_roles[$new_role])) |
|
62 | 62 | wp_die(__('You can’t give users that role.')); |
63 | 63 | } |
64 | 64 | |
65 | - if ( isset( $_POST['email'] )) |
|
66 | - $user->user_email = sanitize_text_field( wp_unslash( $_POST['email'] ) ); |
|
67 | - if ( isset( $_POST['url'] ) ) { |
|
68 | - if ( empty ( $_POST['url'] ) || $_POST['url'] == 'http://' ) { |
|
65 | + if (isset($_POST['email'])) |
|
66 | + $user->user_email = sanitize_text_field(wp_unslash($_POST['email'])); |
|
67 | + if (isset($_POST['url'])) { |
|
68 | + if (empty ($_POST['url']) || $_POST['url'] == 'http://') { |
|
69 | 69 | $user->user_url = ''; |
70 | 70 | } else { |
71 | - $user->user_url = esc_url_raw( $_POST['url'] ); |
|
72 | - $protocols = implode( '|', array_map( 'preg_quote', wp_allowed_protocols() ) ); |
|
73 | - $user->user_url = preg_match('/^(' . $protocols . '):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; |
|
71 | + $user->user_url = esc_url_raw($_POST['url']); |
|
72 | + $protocols = implode('|', array_map('preg_quote', wp_allowed_protocols())); |
|
73 | + $user->user_url = preg_match('/^('.$protocols.'):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; |
|
74 | 74 | } |
75 | 75 | } |
76 | - if ( isset( $_POST['first_name'] ) ) |
|
77 | - $user->first_name = sanitize_text_field( $_POST['first_name'] ); |
|
78 | - if ( isset( $_POST['last_name'] ) ) |
|
79 | - $user->last_name = sanitize_text_field( $_POST['last_name'] ); |
|
80 | - if ( isset( $_POST['nickname'] ) ) |
|
81 | - $user->nickname = sanitize_text_field( $_POST['nickname'] ); |
|
82 | - if ( isset( $_POST['display_name'] ) ) |
|
83 | - $user->display_name = sanitize_text_field( $_POST['display_name'] ); |
|
84 | - |
|
85 | - if ( isset( $_POST['description'] ) ) |
|
86 | - $user->description = trim( $_POST['description'] ); |
|
87 | - |
|
88 | - foreach ( wp_get_user_contact_methods( $user ) as $method => $name ) { |
|
89 | - if ( isset( $_POST[$method] )) |
|
90 | - $user->$method = sanitize_text_field( $_POST[$method] ); |
|
76 | + if (isset($_POST['first_name'])) |
|
77 | + $user->first_name = sanitize_text_field($_POST['first_name']); |
|
78 | + if (isset($_POST['last_name'])) |
|
79 | + $user->last_name = sanitize_text_field($_POST['last_name']); |
|
80 | + if (isset($_POST['nickname'])) |
|
81 | + $user->nickname = sanitize_text_field($_POST['nickname']); |
|
82 | + if (isset($_POST['display_name'])) |
|
83 | + $user->display_name = sanitize_text_field($_POST['display_name']); |
|
84 | + |
|
85 | + if (isset($_POST['description'])) |
|
86 | + $user->description = trim($_POST['description']); |
|
87 | + |
|
88 | + foreach (wp_get_user_contact_methods($user) as $method => $name) { |
|
89 | + if (isset($_POST[$method])) |
|
90 | + $user->$method = sanitize_text_field($_POST[$method]); |
|
91 | 91 | } |
92 | 92 | |
93 | - if ( $update ) { |
|
94 | - $user->rich_editing = isset( $_POST['rich_editing'] ) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; |
|
95 | - $user->admin_color = isset( $_POST['admin_color'] ) ? sanitize_text_field( $_POST['admin_color'] ) : 'fresh'; |
|
96 | - $user->show_admin_bar_front = isset( $_POST['admin_bar_front'] ) ? 'true' : 'false'; |
|
93 | + if ($update) { |
|
94 | + $user->rich_editing = isset($_POST['rich_editing']) && 'false' == $_POST['rich_editing'] ? 'false' : 'true'; |
|
95 | + $user->admin_color = isset($_POST['admin_color']) ? sanitize_text_field($_POST['admin_color']) : 'fresh'; |
|
96 | + $user->show_admin_bar_front = isset($_POST['admin_bar_front']) ? 'true' : 'false'; |
|
97 | 97 | $user->locale = ''; |
98 | 98 | |
99 | - if ( isset( $_POST['locale'] ) ) { |
|
100 | - $locale = sanitize_text_field( $_POST['locale'] ); |
|
101 | - if ( 'site-default' === $locale ) { |
|
99 | + if (isset($_POST['locale'])) { |
|
100 | + $locale = sanitize_text_field($_POST['locale']); |
|
101 | + if ('site-default' === $locale) { |
|
102 | 102 | $locale = ''; |
103 | - } elseif ( '' === $locale ) { |
|
103 | + } elseif ('' === $locale) { |
|
104 | 104 | $locale = 'en_US'; |
105 | - } elseif ( ! in_array( $locale, get_available_languages(), true ) ) { |
|
105 | + } elseif ( ! in_array($locale, get_available_languages(), true)) { |
|
106 | 106 | $locale = ''; |
107 | 107 | } |
108 | 108 | |
@@ -110,21 +110,21 @@ discard block |
||
110 | 110 | } |
111 | 111 | } |
112 | 112 | |
113 | - $user->comment_shortcuts = isset( $_POST['comment_shortcuts'] ) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; |
|
113 | + $user->comment_shortcuts = isset($_POST['comment_shortcuts']) && 'true' == $_POST['comment_shortcuts'] ? 'true' : ''; |
|
114 | 114 | |
115 | 115 | $user->use_ssl = 0; |
116 | - if ( !empty($_POST['use_ssl']) ) |
|
116 | + if ( ! empty($_POST['use_ssl'])) |
|
117 | 117 | $user->use_ssl = 1; |
118 | 118 | |
119 | 119 | $errors = new WP_Error(); |
120 | 120 | |
121 | 121 | /* checking that username has been typed */ |
122 | - if ( $user->user_login == '' ) |
|
123 | - $errors->add( 'user_login', __( '<strong>ERROR</strong>: Please enter a username.' ) ); |
|
122 | + if ($user->user_login == '') |
|
123 | + $errors->add('user_login', __('<strong>ERROR</strong>: Please enter a username.')); |
|
124 | 124 | |
125 | 125 | /* checking that nickname has been typed */ |
126 | - if ( $update && empty( $user->nickname ) ) { |
|
127 | - $errors->add( 'nickname', __( '<strong>ERROR</strong>: Please enter a nickname.' ) ); |
|
126 | + if ($update && empty($user->nickname)) { |
|
127 | + $errors->add('nickname', __('<strong>ERROR</strong>: Please enter a nickname.')); |
|
128 | 128 | } |
129 | 129 | |
130 | 130 | /** |
@@ -136,46 +136,46 @@ discard block |
||
136 | 136 | * @param string &$pass1 The password, passed by reference. |
137 | 137 | * @param string &$pass2 The confirmed password, passed by reference. |
138 | 138 | */ |
139 | - do_action_ref_array( 'check_passwords', array( $user->user_login, &$pass1, &$pass2 ) ); |
|
139 | + do_action_ref_array('check_passwords', array($user->user_login, &$pass1, &$pass2)); |
|
140 | 140 | |
141 | 141 | // Check for blank password when adding a user. |
142 | - if ( ! $update && empty( $pass1 ) ) { |
|
143 | - $errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter a password.' ), array( 'form-field' => 'pass1' ) ); |
|
142 | + if ( ! $update && empty($pass1)) { |
|
143 | + $errors->add('pass', __('<strong>ERROR</strong>: Please enter a password.'), array('form-field' => 'pass1')); |
|
144 | 144 | } |
145 | 145 | |
146 | 146 | // Check for "\" in password. |
147 | - if ( false !== strpos( wp_unslash( $pass1 ), "\\" ) ) { |
|
148 | - $errors->add( 'pass', __( '<strong>ERROR</strong>: Passwords may not contain the character "\\".' ), array( 'form-field' => 'pass1' ) ); |
|
147 | + if (false !== strpos(wp_unslash($pass1), "\\")) { |
|
148 | + $errors->add('pass', __('<strong>ERROR</strong>: Passwords may not contain the character "\\".'), array('form-field' => 'pass1')); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Checking the password has been typed twice the same. |
152 | - if ( ( $update || ! empty( $pass1 ) ) && $pass1 != $pass2 ) { |
|
153 | - $errors->add( 'pass', __( '<strong>ERROR</strong>: Please enter the same password in both password fields.' ), array( 'form-field' => 'pass1' ) ); |
|
152 | + if (($update || ! empty($pass1)) && $pass1 != $pass2) { |
|
153 | + $errors->add('pass', __('<strong>ERROR</strong>: Please enter the same password in both password fields.'), array('form-field' => 'pass1')); |
|
154 | 154 | } |
155 | 155 | |
156 | - if ( !empty( $pass1 ) ) |
|
156 | + if ( ! empty($pass1)) |
|
157 | 157 | $user->user_pass = $pass1; |
158 | 158 | |
159 | - if ( !$update && isset( $_POST['user_login'] ) && !validate_username( $_POST['user_login'] ) ) |
|
160 | - $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.' )); |
|
159 | + if ( ! $update && isset($_POST['user_login']) && ! validate_username($_POST['user_login'])) |
|
160 | + $errors->add('user_login', __('<strong>ERROR</strong>: This username is invalid because it uses illegal characters. Please enter a valid username.')); |
|
161 | 161 | |
162 | - if ( !$update && username_exists( $user->user_login ) ) |
|
163 | - $errors->add( 'user_login', __( '<strong>ERROR</strong>: This username is already registered. Please choose another one.' )); |
|
162 | + if ( ! $update && username_exists($user->user_login)) |
|
163 | + $errors->add('user_login', __('<strong>ERROR</strong>: This username is already registered. Please choose another one.')); |
|
164 | 164 | |
165 | 165 | /** This filter is documented in wp-includes/user.php */ |
166 | - $illegal_logins = (array) apply_filters( 'illegal_user_logins', array() ); |
|
166 | + $illegal_logins = (array) apply_filters('illegal_user_logins', array()); |
|
167 | 167 | |
168 | - if ( in_array( strtolower( $user->user_login ), array_map( 'strtolower', $illegal_logins ) ) ) { |
|
169 | - $errors->add( 'invalid_username', __( '<strong>ERROR</strong>: Sorry, that username is not allowed.' ) ); |
|
168 | + if (in_array(strtolower($user->user_login), array_map('strtolower', $illegal_logins))) { |
|
169 | + $errors->add('invalid_username', __('<strong>ERROR</strong>: Sorry, that username is not allowed.')); |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | /* checking email address */ |
173 | - if ( empty( $user->user_email ) ) { |
|
174 | - $errors->add( 'empty_email', __( '<strong>ERROR</strong>: Please enter an email address.' ), array( 'form-field' => 'email' ) ); |
|
175 | - } elseif ( !is_email( $user->user_email ) ) { |
|
176 | - $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn’t correct.' ), array( 'form-field' => 'email' ) ); |
|
177 | - } elseif ( ( $owner_id = email_exists($user->user_email) ) && ( !$update || ( $owner_id != $user->ID ) ) ) { |
|
178 | - $errors->add( 'email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array( 'form-field' => 'email' ) ); |
|
173 | + if (empty($user->user_email)) { |
|
174 | + $errors->add('empty_email', __('<strong>ERROR</strong>: Please enter an email address.'), array('form-field' => 'email')); |
|
175 | + } elseif ( ! is_email($user->user_email)) { |
|
176 | + $errors->add('invalid_email', __('<strong>ERROR</strong>: The email address isn’t correct.'), array('form-field' => 'email')); |
|
177 | + } elseif (($owner_id = email_exists($user->user_email)) && ( ! $update || ($owner_id != $user->ID))) { |
|
178 | + $errors->add('email_exists', __('<strong>ERROR</strong>: This email is already registered, please choose another one.'), array('form-field' => 'email')); |
|
179 | 179 | } |
180 | 180 | |
181 | 181 | /** |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | * @param bool $update Whether this is a user update. |
188 | 188 | * @param stdClass &$user User object, passed by reference. |
189 | 189 | */ |
190 | - do_action_ref_array( 'user_profile_update_errors', array( &$errors, $update, &$user ) ); |
|
190 | + do_action_ref_array('user_profile_update_errors', array(&$errors, $update, &$user)); |
|
191 | 191 | |
192 | - if ( $errors->get_error_codes() ) |
|
192 | + if ($errors->get_error_codes()) |
|
193 | 193 | return $errors; |
194 | 194 | |
195 | - if ( $update ) { |
|
196 | - $user_id = wp_update_user( $user ); |
|
195 | + if ($update) { |
|
196 | + $user_id = wp_update_user($user); |
|
197 | 197 | } else { |
198 | - $user_id = wp_insert_user( $user ); |
|
199 | - $notify = isset( $_POST['send_user_notification'] ) ? 'both' : 'admin'; |
|
198 | + $user_id = wp_insert_user($user); |
|
199 | + $notify = isset($_POST['send_user_notification']) ? 'both' : 'admin'; |
|
200 | 200 | |
201 | 201 | /** |
202 | 202 | * Fires after a new user has been created. |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | * @param string $notify Type of notification that should happen. See wp_send_new_user_notifications() |
208 | 208 | * for more information on possible values. |
209 | 209 | */ |
210 | - do_action( 'edit_user_created_user', $user_id, $notify ); |
|
210 | + do_action('edit_user_created_user', $user_id, $notify); |
|
211 | 211 | } |
212 | 212 | return $user_id; |
213 | 213 | } |
@@ -238,7 +238,7 @@ discard block |
||
238 | 238 | * |
239 | 239 | * @param array $all_roles List of roles. |
240 | 240 | */ |
241 | - $editable_roles = apply_filters( 'editable_roles', $all_roles ); |
|
241 | + $editable_roles = apply_filters('editable_roles', $all_roles); |
|
242 | 242 | |
243 | 243 | return $editable_roles; |
244 | 244 | } |
@@ -251,10 +251,10 @@ discard block |
||
251 | 251 | * @param int $user_id User ID. |
252 | 252 | * @return WP_User|bool WP_User object on success, false on failure. |
253 | 253 | */ |
254 | -function get_user_to_edit( $user_id ) { |
|
255 | - $user = get_userdata( $user_id ); |
|
254 | +function get_user_to_edit($user_id) { |
|
255 | + $user = get_userdata($user_id); |
|
256 | 256 | |
257 | - if ( $user ) |
|
257 | + if ($user) |
|
258 | 258 | $user->filter = 'edit'; |
259 | 259 | |
260 | 260 | return $user; |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | * @param int $user_id User ID. |
271 | 271 | * @return array |
272 | 272 | */ |
273 | -function get_users_drafts( $user_id ) { |
|
273 | +function get_users_drafts($user_id) { |
|
274 | 274 | global $wpdb; |
275 | 275 | $query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id); |
276 | 276 | |
@@ -281,8 +281,8 @@ discard block |
||
281 | 281 | * |
282 | 282 | * @param string $query The user's drafts query string. |
283 | 283 | */ |
284 | - $query = apply_filters( 'get_users_drafts', $query ); |
|
285 | - return $wpdb->get_results( $query ); |
|
284 | + $query = apply_filters('get_users_drafts', $query); |
|
285 | + return $wpdb->get_results($query); |
|
286 | 286 | } |
287 | 287 | |
288 | 288 | /** |
@@ -301,23 +301,23 @@ discard block |
||
301 | 301 | * @param int $reassign Optional. Reassign posts and links to new User ID. |
302 | 302 | * @return bool True when finished. |
303 | 303 | */ |
304 | -function wp_delete_user( $id, $reassign = null ) { |
|
304 | +function wp_delete_user($id, $reassign = null) { |
|
305 | 305 | global $wpdb; |
306 | 306 | |
307 | - if ( ! is_numeric( $id ) ) { |
|
307 | + if ( ! is_numeric($id)) { |
|
308 | 308 | return false; |
309 | 309 | } |
310 | 310 | |
311 | 311 | $id = (int) $id; |
312 | - $user = new WP_User( $id ); |
|
312 | + $user = new WP_User($id); |
|
313 | 313 | |
314 | - if ( !$user->exists() ) |
|
314 | + if ( ! $user->exists()) |
|
315 | 315 | return false; |
316 | 316 | |
317 | 317 | // Normalize $reassign to null or a user ID. 'novalue' was an older default. |
318 | - if ( 'novalue' === $reassign ) { |
|
318 | + if ('novalue' === $reassign) { |
|
319 | 319 | $reassign = null; |
320 | - } elseif ( null !== $reassign ) { |
|
320 | + } elseif (null !== $reassign) { |
|
321 | 321 | $reassign = (int) $reassign; |
322 | 322 | } |
323 | 323 | |
@@ -330,14 +330,14 @@ discard block |
||
330 | 330 | * @param int|null $reassign ID of the user to reassign posts and links to. |
331 | 331 | * Default null, for no reassignment. |
332 | 332 | */ |
333 | - do_action( 'delete_user', $id, $reassign ); |
|
333 | + do_action('delete_user', $id, $reassign); |
|
334 | 334 | |
335 | - if ( null === $reassign ) { |
|
335 | + if (null === $reassign) { |
|
336 | 336 | $post_types_to_delete = array(); |
337 | - foreach ( get_post_types( array(), 'objects' ) as $post_type ) { |
|
338 | - if ( $post_type->delete_with_user ) { |
|
337 | + foreach (get_post_types(array(), 'objects') as $post_type) { |
|
338 | + if ($post_type->delete_with_user) { |
|
339 | 339 | $post_types_to_delete[] = $post_type->name; |
340 | - } elseif ( null === $post_type->delete_with_user && post_type_supports( $post_type->name, 'author' ) ) { |
|
340 | + } elseif (null === $post_type->delete_with_user && post_type_supports($post_type->name, 'author')) { |
|
341 | 341 | $post_types_to_delete[] = $post_type->name; |
342 | 342 | } |
343 | 343 | } |
@@ -350,48 +350,48 @@ discard block |
||
350 | 350 | * @param array $post_types_to_delete Post types to delete. |
351 | 351 | * @param int $id User ID. |
352 | 352 | */ |
353 | - $post_types_to_delete = apply_filters( 'post_types_to_delete_with_user', $post_types_to_delete, $id ); |
|
354 | - $post_types_to_delete = implode( "', '", $post_types_to_delete ); |
|
355 | - $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id ) ); |
|
356 | - if ( $post_ids ) { |
|
357 | - foreach ( $post_ids as $post_id ) |
|
358 | - wp_delete_post( $post_id ); |
|
353 | + $post_types_to_delete = apply_filters('post_types_to_delete_with_user', $post_types_to_delete, $id); |
|
354 | + $post_types_to_delete = implode("', '", $post_types_to_delete); |
|
355 | + $post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d AND post_type IN ('$post_types_to_delete')", $id)); |
|
356 | + if ($post_ids) { |
|
357 | + foreach ($post_ids as $post_id) |
|
358 | + wp_delete_post($post_id); |
|
359 | 359 | } |
360 | 360 | |
361 | 361 | // Clean links |
362 | - $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) ); |
|
362 | + $link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id)); |
|
363 | 363 | |
364 | - if ( $link_ids ) { |
|
365 | - foreach ( $link_ids as $link_id ) |
|
364 | + if ($link_ids) { |
|
365 | + foreach ($link_ids as $link_id) |
|
366 | 366 | wp_delete_link($link_id); |
367 | 367 | } |
368 | 368 | } else { |
369 | - $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id ) ); |
|
370 | - $wpdb->update( $wpdb->posts, array('post_author' => $reassign), array('post_author' => $id) ); |
|
371 | - if ( ! empty( $post_ids ) ) { |
|
372 | - foreach ( $post_ids as $post_id ) |
|
373 | - clean_post_cache( $post_id ); |
|
369 | + $post_ids = $wpdb->get_col($wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id)); |
|
370 | + $wpdb->update($wpdb->posts, array('post_author' => $reassign), array('post_author' => $id)); |
|
371 | + if ( ! empty($post_ids)) { |
|
372 | + foreach ($post_ids as $post_id) |
|
373 | + clean_post_cache($post_id); |
|
374 | 374 | } |
375 | - $link_ids = $wpdb->get_col( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id) ); |
|
376 | - $wpdb->update( $wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id) ); |
|
377 | - if ( ! empty( $link_ids ) ) { |
|
378 | - foreach ( $link_ids as $link_id ) |
|
379 | - clean_bookmark_cache( $link_id ); |
|
375 | + $link_ids = $wpdb->get_col($wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_owner = %d", $id)); |
|
376 | + $wpdb->update($wpdb->links, array('link_owner' => $reassign), array('link_owner' => $id)); |
|
377 | + if ( ! empty($link_ids)) { |
|
378 | + foreach ($link_ids as $link_id) |
|
379 | + clean_bookmark_cache($link_id); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
383 | 383 | // FINALLY, delete user |
384 | - if ( is_multisite() ) { |
|
385 | - remove_user_from_blog( $id, get_current_blog_id() ); |
|
384 | + if (is_multisite()) { |
|
385 | + remove_user_from_blog($id, get_current_blog_id()); |
|
386 | 386 | } else { |
387 | - $meta = $wpdb->get_col( $wpdb->prepare( "SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id ) ); |
|
388 | - foreach ( $meta as $mid ) |
|
389 | - delete_metadata_by_mid( 'user', $mid ); |
|
387 | + $meta = $wpdb->get_col($wpdb->prepare("SELECT umeta_id FROM $wpdb->usermeta WHERE user_id = %d", $id)); |
|
388 | + foreach ($meta as $mid) |
|
389 | + delete_metadata_by_mid('user', $mid); |
|
390 | 390 | |
391 | - $wpdb->delete( $wpdb->users, array( 'ID' => $id ) ); |
|
391 | + $wpdb->delete($wpdb->users, array('ID' => $id)); |
|
392 | 392 | } |
393 | 393 | |
394 | - clean_user_cache( $user ); |
|
394 | + clean_user_cache($user); |
|
395 | 395 | |
396 | 396 | /** |
397 | 397 | * Fires immediately after a user is deleted from the database. |
@@ -402,7 +402,7 @@ discard block |
||
402 | 402 | * @param int|null $reassign ID of the user to reassign posts and links to. |
403 | 403 | * Default null, for no reassignment. |
404 | 404 | */ |
405 | - do_action( 'deleted_user', $id, $reassign ); |
|
405 | + do_action('deleted_user', $id, $reassign); |
|
406 | 406 | |
407 | 407 | return true; |
408 | 408 | } |
@@ -431,11 +431,11 @@ discard block |
||
431 | 431 | function default_password_nag_handler($errors = false) { |
432 | 432 | global $user_ID; |
433 | 433 | // Short-circuit it. |
434 | - if ( ! get_user_option('default_password_nag') ) |
|
434 | + if ( ! get_user_option('default_password_nag')) |
|
435 | 435 | return; |
436 | 436 | |
437 | 437 | // get_user_setting = JS saved UI setting. else no-js-fallback code. |
438 | - if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) { |
|
438 | + if ('hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag']) { |
|
439 | 439 | delete_user_setting('default_password_nag'); |
440 | 440 | update_user_option($user_ID, 'default_password_nag', false, true); |
441 | 441 | } |
@@ -449,13 +449,13 @@ discard block |
||
449 | 449 | */ |
450 | 450 | function default_password_nag_edit_user($user_ID, $old_data) { |
451 | 451 | // Short-circuit it. |
452 | - if ( ! get_user_option('default_password_nag', $user_ID) ) |
|
452 | + if ( ! get_user_option('default_password_nag', $user_ID)) |
|
453 | 453 | return; |
454 | 454 | |
455 | 455 | $new_data = get_userdata($user_ID); |
456 | 456 | |
457 | 457 | // Remove the nag if the password has been changed. |
458 | - if ( $new_data->user_pass != $old_data->user_pass ) { |
|
458 | + if ($new_data->user_pass != $old_data->user_pass) { |
|
459 | 459 | delete_user_setting('default_password_nag'); |
460 | 460 | update_user_option($user_ID, 'default_password_nag', false, true); |
461 | 461 | } |
@@ -469,16 +469,16 @@ discard block |
||
469 | 469 | function default_password_nag() { |
470 | 470 | global $pagenow; |
471 | 471 | // Short-circuit it. |
472 | - if ( 'profile.php' == $pagenow || ! get_user_option('default_password_nag') ) |
|
472 | + if ('profile.php' == $pagenow || ! get_user_option('default_password_nag')) |
|
473 | 473 | return; |
474 | 474 | |
475 | 475 | echo '<div class="error default-password-nag">'; |
476 | 476 | echo '<p>'; |
477 | - echo '<strong>' . __('Notice:') . '</strong> '; |
|
477 | + echo '<strong>'.__('Notice:').'</strong> '; |
|
478 | 478 | _e('You’re using the auto-generated password for your account. Would you like to change it?'); |
479 | 479 | echo '</p><p>'; |
480 | - printf( '<a href="%s">' . __('Yes, take me to my profile page') . '</a> | ', get_edit_profile_url() . '#password' ); |
|
481 | - printf( '<a href="%s" id="default-password-nag-no">' . __('No thanks, do not remind me again') . '</a>', '?default_password_nag=0' ); |
|
480 | + printf('<a href="%s">'.__('Yes, take me to my profile page').'</a> | ', get_edit_profile_url().'#password'); |
|
481 | + printf('<a href="%s" id="default-password-nag-no">'.__('No thanks, do not remind me again').'</a>', '?default_password_nag=0'); |
|
482 | 482 | echo '</p></div>'; |
483 | 483 | } |
484 | 484 | |
@@ -524,16 +524,16 @@ discard block |
||
524 | 524 | * @param string $text |
525 | 525 | * @return string |
526 | 526 | */ |
527 | -function admin_created_user_email( $text ) { |
|
527 | +function admin_created_user_email($text) { |
|
528 | 528 | $roles = get_editable_roles(); |
529 | - $role = $roles[ $_REQUEST['role'] ]; |
|
529 | + $role = $roles[$_REQUEST['role']]; |
|
530 | 530 | /* translators: 1: Site name, 2: site URL, 3: role */ |
531 | - return sprintf( __( 'Hi, |
|
531 | + return sprintf(__('Hi, |
|
532 | 532 | You\'ve been invited to join \'%1$s\' at |
533 | 533 | %2$s with the role of %3$s. |
534 | 534 | If you do not want to join this site please ignore |
535 | 535 | this email. This invitation will expire in a few days. |
536 | 536 | |
537 | 537 | Please click the following link to activate your user account: |
538 | -%%s' ), wp_specialchars_decode( get_bloginfo( 'name' ), ENT_QUOTES ), home_url(), wp_specialchars_decode( translate_user_role( $role['name'] ) ) ); |
|
538 | +%%s' ), wp_specialchars_decode(get_bloginfo('name'), ENT_QUOTES), home_url(), wp_specialchars_decode(translate_user_role($role['name']))); |
|
539 | 539 | } |
@@ -203,15 +203,15 @@ |
||
203 | 203 | |
204 | 204 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
205 | 205 | _n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
206 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
206 | + '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
207 | 207 | |
208 | 208 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
209 | 209 | _n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
210 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
210 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
211 | 211 | |
212 | 212 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
213 | 213 | _n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
214 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
214 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
215 | 215 | |
216 | 216 | /* translators: %s: Codex URL */ |
217 | 217 | __( 'For more information, see <a href="%s">the release notes</a>.' ); |
@@ -7,53 +7,53 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
10 | +require_once(dirname(__FILE__).'/admin.php'); |
|
11 | 11 | |
12 | -if ( ! wp_is_mobile() ) { |
|
13 | - wp_enqueue_style( 'wp-mediaelement' ); |
|
14 | - wp_enqueue_script( 'wp-mediaelement' ); |
|
15 | - wp_localize_script( 'mediaelement', '_wpmejsSettings', array( |
|
16 | - 'pluginPath' => includes_url( 'js/mediaelement/', 'relative' ), |
|
12 | +if ( ! wp_is_mobile()) { |
|
13 | + wp_enqueue_style('wp-mediaelement'); |
|
14 | + wp_enqueue_script('wp-mediaelement'); |
|
15 | + wp_localize_script('mediaelement', '_wpmejsSettings', array( |
|
16 | + 'pluginPath' => includes_url('js/mediaelement/', 'relative'), |
|
17 | 17 | 'pauseOtherPlayers' => '', |
18 | - ) ); |
|
18 | + )); |
|
19 | 19 | } |
20 | 20 | |
21 | 21 | $video_url = 'https://videopress.com/embed/AHz0Ca46?hd=true'; |
22 | -$lang_code = str_replace( '_', '-', get_user_locale() ); |
|
23 | -list( $lang_code ) = explode( '-', $lang_code ); |
|
24 | -if ( 'en' !== $lang_code ) { |
|
25 | - $video_url = add_query_arg( 'defaultLangCode', $lang_code, $video_url ); |
|
22 | +$lang_code = str_replace('_', '-', get_user_locale()); |
|
23 | +list($lang_code) = explode('-', $lang_code); |
|
24 | +if ('en' !== $lang_code) { |
|
25 | + $video_url = add_query_arg('defaultLangCode', $lang_code, $video_url); |
|
26 | 26 | } |
27 | 27 | |
28 | -$title = __( 'About' ); |
|
28 | +$title = __('About'); |
|
29 | 29 | |
30 | -list( $display_version ) = explode( '-', get_bloginfo( 'version' ) ); |
|
30 | +list($display_version) = explode('-', get_bloginfo('version')); |
|
31 | 31 | |
32 | -include( ABSPATH . 'wp-admin/admin-header.php' ); |
|
32 | +include(ABSPATH.'wp-admin/admin-header.php'); |
|
33 | 33 | ?> |
34 | 34 | <div class="wrap about-wrap"> |
35 | - <h1><?php printf( __( 'Welcome to WordPress %s' ), $display_version ); ?></h1> |
|
35 | + <h1><?php printf(__('Welcome to WordPress %s'), $display_version); ?></h1> |
|
36 | 36 | |
37 | - <p class="about-text"><?php printf( __( 'Thank you for updating to the latest version! WordPress %s adds more ways for you to express yourself and represent your brand.' ), $display_version ); ?></p> |
|
38 | - <div class="wp-badge"><?php printf( __( 'Version %s' ), $display_version ); ?></div> |
|
37 | + <p class="about-text"><?php printf(__('Thank you for updating to the latest version! WordPress %s adds more ways for you to express yourself and represent your brand.'), $display_version); ?></p> |
|
38 | + <div class="wp-badge"><?php printf(__('Version %s'), $display_version); ?></div> |
|
39 | 39 | |
40 | 40 | <h2 class="nav-tab-wrapper wp-clearfix"> |
41 | - <a href="about.php" class="nav-tab nav-tab-active"><?php _e( 'What’s New' ); ?></a> |
|
42 | - <a href="credits.php" class="nav-tab"><?php _e( 'Credits' ); ?></a> |
|
43 | - <a href="freedoms.php" class="nav-tab"><?php _e( 'Freedoms' ); ?></a> |
|
41 | + <a href="about.php" class="nav-tab nav-tab-active"><?php _e('What’s New'); ?></a> |
|
42 | + <a href="credits.php" class="nav-tab"><?php _e('Credits'); ?></a> |
|
43 | + <a href="freedoms.php" class="nav-tab"><?php _e('Freedoms'); ?></a> |
|
44 | 44 | </h2> |
45 | 45 | |
46 | 46 | <div class="feature-section one-col"> |
47 | 47 | <div class="col"> |
48 | - <h2><?php _e( 'An Update with You in Mind' ); ?></h2> |
|
49 | - <p class="lead-description"><?php _e( 'WordPress 4.8 adds some great new features. Gear up for a more intuitive WordPress!' ); ?></p> |
|
50 | - <p><?php _e( 'Though some updates seem minor, they’ve been built by hundreds of contributors with <em>you</em> in mind. Get ready for new features you’ll welcome like an old friend: link improvements, <em>three</em> new media widgets covering images, audio, and video, an updated text widget that supports visual editing, and an upgraded news section in your dashboard which brings in nearby and upcoming WordPress events.' ); ?></p> |
|
48 | + <h2><?php _e('An Update with You in Mind'); ?></h2> |
|
49 | + <p class="lead-description"><?php _e('WordPress 4.8 adds some great new features. Gear up for a more intuitive WordPress!'); ?></p> |
|
50 | + <p><?php _e('Though some updates seem minor, they’ve been built by hundreds of contributors with <em>you</em> in mind. Get ready for new features you’ll welcome like an old friend: link improvements, <em>three</em> new media widgets covering images, audio, and video, an updated text widget that supports visual editing, and an upgraded news section in your dashboard which brings in nearby and upcoming WordPress events.'); ?></p> |
|
51 | 51 | </div> |
52 | 52 | </div> |
53 | 53 | |
54 | 54 | <hr /> |
55 | 55 | |
56 | - <h2><?php _e( 'Exciting Widget Updates' ); ?></h2> |
|
56 | + <h2><?php _e('Exciting Widget Updates'); ?></h2> |
|
57 | 57 | |
58 | 58 | <div class="headline-feature one-col"> |
59 | 59 | <div class="col"> |
@@ -101,20 +101,20 @@ discard block |
||
101 | 101 | |
102 | 102 | <div class="feature-section two-col"> |
103 | 103 | <div class="col"> |
104 | - <h3><?php _e( 'Image Widget' ); ?></h3> |
|
105 | - <p><?php _e( 'Adding an image to a widget is now a simple task that is achievable for any WordPress user without needing to know code. Simply insert your image right within the widget settings. Try adding something like a headshot or a photo of your latest weekend adventure — and see it appear automatically.' ); ?></p> |
|
104 | + <h3><?php _e('Image Widget'); ?></h3> |
|
105 | + <p><?php _e('Adding an image to a widget is now a simple task that is achievable for any WordPress user without needing to know code. Simply insert your image right within the widget settings. Try adding something like a headshot or a photo of your latest weekend adventure — and see it appear automatically.'); ?></p> |
|
106 | 106 | </div> |
107 | 107 | <div class="col"> |
108 | - <h3><?php _e( 'Video Widget' ); ?></h3> |
|
109 | - <p><?php _e( 'A welcome video is a great way to humanize the branding of your website. You can now add any video from the Media Library to a sidebar on your site with the new Video widget. Use this to showcase a welcome video to introduce visitors to your site or promote your latest and greatest content.' ); ?></p> |
|
108 | + <h3><?php _e('Video Widget'); ?></h3> |
|
109 | + <p><?php _e('A welcome video is a great way to humanize the branding of your website. You can now add any video from the Media Library to a sidebar on your site with the new Video widget. Use this to showcase a welcome video to introduce visitors to your site or promote your latest and greatest content.'); ?></p> |
|
110 | 110 | </div> |
111 | 111 | <div class="col"> |
112 | - <h3><?php _e( 'Audio Widget' ); ?></h3> |
|
113 | - <p><?php _e( 'Are you a podcaster, musician, or avid blogger? Adding a widget with your audio file has never been easier. Upload your audio file to the Media Library, go to the widget settings, select your file, and you’re ready for listeners. This would be a easy way to add a more personal welcome message, too!' );?></p> |
|
112 | + <h3><?php _e('Audio Widget'); ?></h3> |
|
113 | + <p><?php _e('Are you a podcaster, musician, or avid blogger? Adding a widget with your audio file has never been easier. Upload your audio file to the Media Library, go to the widget settings, select your file, and you’re ready for listeners. This would be a easy way to add a more personal welcome message, too!'); ?></p> |
|
114 | 114 | </div> |
115 | 115 | <div class="col"> |
116 | - <h3><?php _e( 'Rich Text Widget' ); ?></h3> |
|
117 | - <p><?php _e( 'This feature deserves a parade down the center of town! Rich-text editing capabilities are now native for Text widgets. Add a widget anywhere and format away. Create lists, add emphasis, and quickly and easily insert links. Have fun with your newfound formatting powers, and watch what you can accomplish in a short amount of time.' ); ?></p> |
|
116 | + <h3><?php _e('Rich Text Widget'); ?></h3> |
|
117 | + <p><?php _e('This feature deserves a parade down the center of town! Rich-text editing capabilities are now native for Text widgets. Add a widget anywhere and format away. Create lists, add emphasis, and quickly and easily insert links. Have fun with your newfound formatting powers, and watch what you can accomplish in a short amount of time.'); ?></p> |
|
118 | 118 | </div> |
119 | 119 | </div> |
120 | 120 | |
@@ -122,18 +122,18 @@ discard block |
||
122 | 122 | |
123 | 123 | <div class="feature-section two-col"> |
124 | 124 | <div class="col"> |
125 | - <h3><?php _e( 'Link Boundaries' ); ?></h3> |
|
126 | - <p><?php _e( 'Have you ever tried updating a link, or the text around a link, and found you can’t seem to edit it correctly? When you edit the text after the link, your new text also ends up linked. Or you edit the text in the link, but your text ends up outside of it. This can be frustrating! With link boundaries, a great new feature, the process is streamlined and your links will work well. You’ll be happier. We promise.' ); ?></p> |
|
125 | + <h3><?php _e('Link Boundaries'); ?></h3> |
|
126 | + <p><?php _e('Have you ever tried updating a link, or the text around a link, and found you can’t seem to edit it correctly? When you edit the text after the link, your new text also ends up linked. Or you edit the text in the link, but your text ends up outside of it. This can be frustrating! With link boundaries, a great new feature, the process is streamlined and your links will work well. You’ll be happier. We promise.'); ?></p> |
|
127 | 127 | </div> |
128 | 128 | <div class="col"> |
129 | 129 | <?php |
130 | - echo wp_video_shortcode( array( |
|
130 | + echo wp_video_shortcode(array( |
|
131 | 131 | 'mp4' => 'https://s.w.org/images/core/4.8/link-boundaries.mp4', |
132 | 132 | 'poster' => 'https://s.w.org/images/core/4.8/link-boundaries.png', |
133 | 133 | 'width' => 1140, |
134 | 134 | 'height' => 624, |
135 | 135 | // 'class' => 'wp-video-shortcode feature-video', |
136 | - ) ); |
|
136 | + )); |
|
137 | 137 | ?> |
138 | 138 | </div> |
139 | 139 | </div> |
@@ -142,13 +142,13 @@ discard block |
||
142 | 142 | |
143 | 143 | <div class="feature-section two-col"> |
144 | 144 | <div class="col"> |
145 | - <h3><?php _e( 'Nearby WordPress Events' ); ?></h3> |
|
145 | + <h3><?php _e('Nearby WordPress Events'); ?></h3> |
|
146 | 146 | |
147 | - <p><?php _e( 'Did you know that WordPress has a thriving offline community with groups meeting regularly in more than 400 cities around the world? WordPress now draws your attention to the events that help you continue improving your WordPress skills, meet friends, and, of course, publish!' ); ?></p> |
|
147 | + <p><?php _e('Did you know that WordPress has a thriving offline community with groups meeting regularly in more than 400 cities around the world? WordPress now draws your attention to the events that help you continue improving your WordPress skills, meet friends, and, of course, publish!'); ?></p> |
|
148 | 148 | |
149 | - <p><?php _e( 'This is quickly becoming one of our favorite features. While you are in the dashboard (because you’re running updates and writing posts, right?) all upcoming WordCamps and WordPress Meetups — local to you — will be displayed.' ); ?> |
|
149 | + <p><?php _e('This is quickly becoming one of our favorite features. While you are in the dashboard (because you’re running updates and writing posts, right?) all upcoming WordCamps and WordPress Meetups — local to you — will be displayed.'); ?> |
|
150 | 150 | |
151 | - <p><?php _e( 'Being part of the community can help you improve your WordPress skills and network with people you wouldn’t otherwise meet. Now you can easily find your local events just by logging in to your dashboard and looking at the new Events and News dashboard widget.' ); ?> |
|
151 | + <p><?php _e('Being part of the community can help you improve your WordPress skills and network with people you wouldn’t otherwise meet. Now you can easily find your local events just by logging in to your dashboard and looking at the new Events and News dashboard widget.'); ?> |
|
152 | 152 | </div> |
153 | 153 | <div class="col"> |
154 | 154 | <img |
@@ -177,35 +177,35 @@ discard block |
||
177 | 177 | <h2><?php |
178 | 178 | printf( |
179 | 179 | /* translators: %s: smiling face with smiling eyes emoji */ |
180 | - __( 'Even More Developer Happiness %s' ), |
|
180 | + __('Even More Developer Happiness %s'), |
|
181 | 181 | '😊' |
182 | 182 | ); |
183 | 183 | ?></h2> |
184 | 184 | |
185 | 185 | <div class="under-the-hood three-col"> |
186 | 186 | <div class="col"> |
187 | - <h3><a href="https://make.wordpress.org/core/2017/05/17/cleaner-headings-in-the-admin-screens/"><?php _e( 'More Accessible Admin Panel Headings' ); ?></a></h3> |
|
188 | - <p><?php _e( 'New CSS rules mean extraneous content (like “Add New” links) no longer need to be included in admin-area headings. These panel headings improve the experience for people using assistive technologies.' ); ?></p> |
|
187 | + <h3><a href="https://make.wordpress.org/core/2017/05/17/cleaner-headings-in-the-admin-screens/"><?php _e('More Accessible Admin Panel Headings'); ?></a></h3> |
|
188 | + <p><?php _e('New CSS rules mean extraneous content (like “Add New” links) no longer need to be included in admin-area headings. These panel headings improve the experience for people using assistive technologies.'); ?></p> |
|
189 | 189 | </div> |
190 | 190 | <div class="col"> |
191 | - <h3><a href="https://make.wordpress.org/core/2017/05/22/removal-of-core-embedding-support-for-wmv-and-wma-file-formats/"><?php _e( 'Removal of Core Support for WMV and WMA Files' ); ?></a></h3> |
|
192 | - <p><?php _e( 'As fewer and fewer browsers support Silverlight, file formats which require the presence of the Silverlight plugin are being removed from core support. Files will still display as a download link, but will no longer be embedded automatically.' ); ?></p> |
|
191 | + <h3><a href="https://make.wordpress.org/core/2017/05/22/removal-of-core-embedding-support-for-wmv-and-wma-file-formats/"><?php _e('Removal of Core Support for WMV and WMA Files'); ?></a></h3> |
|
192 | + <p><?php _e('As fewer and fewer browsers support Silverlight, file formats which require the presence of the Silverlight plugin are being removed from core support. Files will still display as a download link, but will no longer be embedded automatically.'); ?></p> |
|
193 | 193 | </div> |
194 | 194 | <div class="col"> |
195 | - <h3><a href="https://make.wordpress.org/core/2017/05/22/multisite-focused-changes-in-4-8/"><?php _e( 'Multisite Updates' ); ?></a></h3> |
|
196 | - <p><?php _e( 'New capabilities have been introduced to 4.8 with an eye towards removing calls to <code>is_super_admin()</code>. Additionally, new hooks and tweaks to more granularly control site and user counts per network have been added.' ); ?></p> |
|
195 | + <h3><a href="https://make.wordpress.org/core/2017/05/22/multisite-focused-changes-in-4-8/"><?php _e('Multisite Updates'); ?></a></h3> |
|
196 | + <p><?php _e('New capabilities have been introduced to 4.8 with an eye towards removing calls to <code>is_super_admin()</code>. Additionally, new hooks and tweaks to more granularly control site and user counts per network have been added.'); ?></p> |
|
197 | 197 | </div> |
198 | 198 | <div class="col"> |
199 | - <h3><a href="https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-text-widget/"><?php _e( 'Text-Editor JavaScript API' ); ?></a></h3> |
|
200 | - <p><?php _e( 'With the addition of TinyMCE to the text widget in 4.8 comes a new JavaScript API for instantiating the editor after page load. This can be used to add an editor instance to any text area, and customize it with buttons and functions. Great for plugin authors!' ); ?></p> |
|
199 | + <h3><a href="https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-text-widget/"><?php _e('Text-Editor JavaScript API'); ?></a></h3> |
|
200 | + <p><?php _e('With the addition of TinyMCE to the text widget in 4.8 comes a new JavaScript API for instantiating the editor after page load. This can be used to add an editor instance to any text area, and customize it with buttons and functions. Great for plugin authors!'); ?></p> |
|
201 | 201 | </div> |
202 | 202 | <div class="col"> |
203 | - <h3><a href="https://make.wordpress.org/core/2017/05/26/media-widgets-for-images-video-and-audio/"><?php _e( 'Media Widgets API' ); ?></a></h3> |
|
204 | - <p><?php _e( 'The introduction of a new base media widget REST API schema to 4.8 opens up possibilities for even more media widgets (like galleries or playlists) in the future. The three new media widgets are powered by a shared base class that covers most of the interactions with the media modal. That class also makes it easier to create new media widgets and paves the way for more to come.' ); ?></p> |
|
203 | + <h3><a href="https://make.wordpress.org/core/2017/05/26/media-widgets-for-images-video-and-audio/"><?php _e('Media Widgets API'); ?></a></h3> |
|
204 | + <p><?php _e('The introduction of a new base media widget REST API schema to 4.8 opens up possibilities for even more media widgets (like galleries or playlists) in the future. The three new media widgets are powered by a shared base class that covers most of the interactions with the media modal. That class also makes it easier to create new media widgets and paves the way for more to come.'); ?></p> |
|
205 | 205 | </div> |
206 | 206 | <div class="col"> |
207 | - <h3><a href="https://make.wordpress.org/core/2017/05/16/customizer-sidebar-width-is-now-variable/"><?php _e( 'Customizer Width Variable' ); ?></a></h3> |
|
208 | - <p><?php _e( 'Rejoice! New responsive breakpoints have been added to the customizer sidebar to make it wider on high-resolution screens. Customizer controls should use percentage-based widths instead of pixels.' ); ?></p> |
|
207 | + <h3><a href="https://make.wordpress.org/core/2017/05/16/customizer-sidebar-width-is-now-variable/"><?php _e('Customizer Width Variable'); ?></a></h3> |
|
208 | + <p><?php _e('Rejoice! New responsive breakpoints have been added to the customizer sidebar to make it wider on high-resolution screens. Customizer controls should use percentage-based widths instead of pixels.'); ?></p> |
|
209 | 209 | </div> |
210 | 210 | </div> |
211 | 211 | </div> |
@@ -213,47 +213,47 @@ discard block |
||
213 | 213 | <hr /> |
214 | 214 | |
215 | 215 | <div class="return-to-dashboard"> |
216 | - <?php if ( current_user_can( 'update_core' ) && isset( $_GET['updated'] ) ) : ?> |
|
217 | - <a href="<?php echo esc_url( self_admin_url( 'update-core.php' ) ); ?>"> |
|
218 | - <?php is_multisite() ? _e( 'Return to Updates' ) : _e( 'Return to Dashboard → Updates' ); ?> |
|
216 | + <?php if (current_user_can('update_core') && isset($_GET['updated'])) : ?> |
|
217 | + <a href="<?php echo esc_url(self_admin_url('update-core.php')); ?>"> |
|
218 | + <?php is_multisite() ? _e('Return to Updates') : _e('Return to Dashboard → Updates'); ?> |
|
219 | 219 | </a> | |
220 | 220 | <?php endif; ?> |
221 | - <a href="<?php echo esc_url( self_admin_url() ); ?>"><?php is_blog_admin() ? _e( 'Go to Dashboard → Home' ) : _e( 'Go to Dashboard' ); ?></a> |
|
221 | + <a href="<?php echo esc_url(self_admin_url()); ?>"><?php is_blog_admin() ? _e('Go to Dashboard → Home') : _e('Go to Dashboard'); ?></a> |
|
222 | 222 | </div> |
223 | 223 | |
224 | 224 | </div> |
225 | 225 | <?php |
226 | 226 | |
227 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
227 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
|
228 | 228 | |
229 | 229 | // These are strings we may use to describe maintenance/security releases, where we aim for no new strings. |
230 | 230 | return; |
231 | 231 | |
232 | -__( 'Maintenance Release' ); |
|
233 | -__( 'Maintenance Releases' ); |
|
232 | +__('Maintenance Release'); |
|
233 | +__('Maintenance Releases'); |
|
234 | 234 | |
235 | -__( 'Security Release' ); |
|
236 | -__( 'Security Releases' ); |
|
235 | +__('Security Release'); |
|
236 | +__('Security Releases'); |
|
237 | 237 | |
238 | -__( 'Maintenance and Security Release' ); |
|
239 | -__( 'Maintenance and Security Releases' ); |
|
238 | +__('Maintenance and Security Release'); |
|
239 | +__('Maintenance and Security Releases'); |
|
240 | 240 | |
241 | 241 | /* translators: %s: WordPress version number */ |
242 | -__( '<strong>Version %s</strong> addressed one security issue.' ); |
|
242 | +__('<strong>Version %s</strong> addressed one security issue.'); |
|
243 | 243 | /* translators: %s: WordPress version number */ |
244 | -__( '<strong>Version %s</strong> addressed some security issues.' ); |
|
244 | +__('<strong>Version %s</strong> addressed some security issues.'); |
|
245 | 245 | |
246 | 246 | /* translators: 1: WordPress version number, 2: plural number of bugs. */ |
247 | -_n_noop( '<strong>Version %1$s</strong> addressed %2$s bug.', |
|
248 | - '<strong>Version %1$s</strong> addressed %2$s bugs.' ); |
|
247 | +_n_noop('<strong>Version %1$s</strong> addressed %2$s bug.', |
|
248 | + '<strong>Version %1$s</strong> addressed %2$s bugs.'); |
|
249 | 249 | |
250 | 250 | /* translators: 1: WordPress version number, 2: plural number of bugs. Singular security issue. */ |
251 | -_n_noop( '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
252 | - '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.' ); |
|
251 | +_n_noop('<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bug.', |
|
252 | + '<strong>Version %1$s</strong> addressed a security issue and fixed %2$s bugs.'); |
|
253 | 253 | |
254 | 254 | /* translators: 1: WordPress version number, 2: plural number of bugs. More than one security issue. */ |
255 | -_n_noop( '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
256 | - '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.' ); |
|
255 | +_n_noop('<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bug.', |
|
256 | + '<strong>Version %1$s</strong> addressed some security issues and fixed %2$s bugs.'); |
|
257 | 257 | |
258 | 258 | /* translators: %s: Codex URL */ |
259 | -__( 'For more information, see <a href="%s">the release notes</a>.' ); |
|
259 | +__('For more information, see <a href="%s">the release notes</a>.'); |
@@ -348,7 +348,7 @@ |
||
348 | 348 | if ( current_user_can($tax->cap->edit_terms) ) { |
349 | 349 | if ( 'category' == $taxonomy ) { |
350 | 350 | /** |
351 | - * Fires before the Add Category form. |
|
351 | + * Fires before the Add Category form. |
|
352 | 352 | * |
353 | 353 | * @since 2.1.0 |
354 | 354 | * @deprecated 3.0.0 Use {$taxonomy}_pre_add_form instead. |
@@ -67,118 +67,118 @@ |
||
67 | 67 | $referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' ), $referer ); |
68 | 68 | switch ( $wp_list_table->current_action() ) { |
69 | 69 | |
70 | -case 'add-tag': |
|
71 | - check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
72 | - |
|
73 | - if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
74 | - wp_die( |
|
75 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
76 | - '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>', |
|
77 | - 403 |
|
78 | - ); |
|
79 | - } |
|
80 | - |
|
81 | - $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
82 | - if ( $ret && !is_wp_error( $ret ) ) |
|
83 | - $location = add_query_arg( 'message', 1, $referer ); |
|
84 | - else |
|
85 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $referer ); |
|
86 | - |
|
87 | - break; |
|
70 | + case 'add-tag': |
|
71 | + check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
72 | + |
|
73 | + if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
74 | + wp_die( |
|
75 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
76 | + '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>', |
|
77 | + 403 |
|
78 | + ); |
|
79 | + } |
|
80 | + |
|
81 | + $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
82 | + if ( $ret && !is_wp_error( $ret ) ) |
|
83 | + $location = add_query_arg( 'message', 1, $referer ); |
|
84 | + else |
|
85 | + $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $referer ); |
|
88 | 86 | |
89 | -case 'delete': |
|
90 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
91 | 87 | break; |
92 | - } |
|
93 | 88 | |
94 | - $tag_ID = (int) $_REQUEST['tag_ID']; |
|
95 | - check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
89 | + case 'delete': |
|
90 | + if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
91 | + break; |
|
92 | + } |
|
96 | 93 | |
97 | - if ( ! current_user_can( 'delete_term', $tag_ID ) ) { |
|
98 | - wp_die( |
|
99 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
100 | - '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
|
101 | - 403 |
|
102 | - ); |
|
103 | - } |
|
94 | + $tag_ID = (int) $_REQUEST['tag_ID']; |
|
95 | + check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
104 | 96 | |
105 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
97 | + if ( ! current_user_can( 'delete_term', $tag_ID ) ) { |
|
98 | + wp_die( |
|
99 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
100 | + '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
|
101 | + 403 |
|
102 | + ); |
|
103 | + } |
|
106 | 104 | |
107 | - $location = add_query_arg( 'message', 2, $referer ); |
|
105 | + wp_delete_term( $tag_ID, $taxonomy ); |
|
108 | 106 | |
109 | - // When deleting a term, prevent the action from redirecting back to a term that no longer exists. |
|
110 | - $location = remove_query_arg( array( 'tag_ID', 'action' ), $location ); |
|
107 | + $location = add_query_arg( 'message', 2, $referer ); |
|
111 | 108 | |
112 | - break; |
|
109 | + // When deleting a term, prevent the action from redirecting back to a term that no longer exists. |
|
110 | + $location = remove_query_arg( array( 'tag_ID', 'action' ), $location ); |
|
113 | 111 | |
114 | -case 'bulk-delete': |
|
115 | - check_admin_referer( 'bulk-tags' ); |
|
112 | + break; |
|
116 | 113 | |
117 | - if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
118 | - wp_die( |
|
119 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
120 | - '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
|
121 | - 403 |
|
122 | - ); |
|
123 | - } |
|
114 | + case 'bulk-delete': |
|
115 | + check_admin_referer( 'bulk-tags' ); |
|
124 | 116 | |
125 | - $tags = (array) $_REQUEST['delete_tags']; |
|
126 | - foreach ( $tags as $tag_ID ) { |
|
127 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
128 | - } |
|
117 | + if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
118 | + wp_die( |
|
119 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
120 | + '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
|
121 | + 403 |
|
122 | + ); |
|
123 | + } |
|
129 | 124 | |
130 | - $location = add_query_arg( 'message', 6, $referer ); |
|
125 | + $tags = (array) $_REQUEST['delete_tags']; |
|
126 | + foreach ( $tags as $tag_ID ) { |
|
127 | + wp_delete_term( $tag_ID, $taxonomy ); |
|
128 | + } |
|
131 | 129 | |
132 | - break; |
|
130 | + $location = add_query_arg( 'message', 6, $referer ); |
|
133 | 131 | |
134 | -case 'edit': |
|
135 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
136 | 132 | break; |
137 | - } |
|
138 | 133 | |
139 | - $term_id = (int) $_REQUEST['tag_ID']; |
|
140 | - $term = get_term( $term_id ); |
|
134 | + case 'edit': |
|
135 | + if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
136 | + break; |
|
137 | + } |
|
141 | 138 | |
142 | - if ( ! $term instanceof WP_Term ) { |
|
143 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
144 | - } |
|
139 | + $term_id = (int) $_REQUEST['tag_ID']; |
|
140 | + $term = get_term( $term_id ); |
|
145 | 141 | |
146 | - wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); |
|
147 | - exit; |
|
142 | + if ( ! $term instanceof WP_Term ) { |
|
143 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
144 | + } |
|
148 | 145 | |
149 | -case 'editedtag': |
|
150 | - $tag_ID = (int) $_POST['tag_ID']; |
|
151 | - check_admin_referer( 'update-tag_' . $tag_ID ); |
|
146 | + wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); |
|
147 | + exit; |
|
152 | 148 | |
153 | - if ( ! current_user_can( 'edit_term', $tag_ID ) ) { |
|
154 | - wp_die( |
|
155 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
156 | - '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
157 | - 403 |
|
158 | - ); |
|
159 | - } |
|
149 | + case 'editedtag': |
|
150 | + $tag_ID = (int) $_POST['tag_ID']; |
|
151 | + check_admin_referer( 'update-tag_' . $tag_ID ); |
|
160 | 152 | |
161 | - $tag = get_term( $tag_ID, $taxonomy ); |
|
162 | - if ( ! $tag ) |
|
163 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
153 | + if ( ! current_user_can( 'edit_term', $tag_ID ) ) { |
|
154 | + wp_die( |
|
155 | + '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
156 | + '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
157 | + 403 |
|
158 | + ); |
|
159 | + } |
|
164 | 160 | |
165 | - $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
161 | + $tag = get_term( $tag_ID, $taxonomy ); |
|
162 | + if ( ! $tag ) |
|
163 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
166 | 164 | |
167 | - if ( $ret && ! is_wp_error( $ret ) ) { |
|
168 | - $location = add_query_arg( 'message', 3, $referer ); |
|
169 | - } else { |
|
170 | - $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $referer ); |
|
171 | - } |
|
172 | - break; |
|
173 | -default: |
|
174 | - if ( ! $wp_list_table->current_action() || ! isset( $_REQUEST['delete_tags'] ) ) { |
|
165 | + $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
166 | + |
|
167 | + if ( $ret && ! is_wp_error( $ret ) ) { |
|
168 | + $location = add_query_arg( 'message', 3, $referer ); |
|
169 | + } else { |
|
170 | + $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $referer ); |
|
171 | + } |
|
172 | + break; |
|
173 | + default: |
|
174 | + if ( ! $wp_list_table->current_action() || ! isset( $_REQUEST['delete_tags'] ) ) { |
|
175 | + break; |
|
176 | + } |
|
177 | + check_admin_referer( 'bulk-tags' ); |
|
178 | + $tags = (array) $_REQUEST['delete_tags']; |
|
179 | + /** This action is documented in wp-admin/edit-comments.php */ |
|
180 | + $location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $wp_list_table->current_action(), $tags ); |
|
175 | 181 | break; |
176 | - } |
|
177 | - check_admin_referer( 'bulk-tags' ); |
|
178 | - $tags = (array) $_REQUEST['delete_tags']; |
|
179 | - /** This action is documented in wp-admin/edit-comments.php */ |
|
180 | - $location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $wp_list_table->current_action(), $tags ); |
|
181 | - break; |
|
182 | 182 | } |
183 | 183 | |
184 | 184 | if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
@@ -7,24 +7,24 @@ 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 ( ! $taxnow ) |
|
13 | - wp_die( __( 'Invalid taxonomy.' ) ); |
|
12 | +if ( ! $taxnow) |
|
13 | + wp_die(__('Invalid taxonomy.')); |
|
14 | 14 | |
15 | -$tax = get_taxonomy( $taxnow ); |
|
15 | +$tax = get_taxonomy($taxnow); |
|
16 | 16 | |
17 | -if ( ! $tax ) |
|
18 | - wp_die( __( 'Invalid taxonomy.' ) ); |
|
17 | +if ( ! $tax) |
|
18 | + wp_die(__('Invalid taxonomy.')); |
|
19 | 19 | |
20 | -if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) { |
|
21 | - wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) ); |
|
20 | +if ( ! in_array($tax->name, get_taxonomies(array('show_ui' => true)))) { |
|
21 | + wp_die(__('Sorry, you are not allowed to edit terms in this taxonomy.')); |
|
22 | 22 | } |
23 | 23 | |
24 | -if ( ! current_user_can( $tax->cap->manage_terms ) ) { |
|
24 | +if ( ! current_user_can($tax->cap->manage_terms)) { |
|
25 | 25 | wp_die( |
26 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
27 | - '<p>' . __( 'Sorry, you are not allowed to manage terms in this taxonomy.' ) . '</p>', |
|
26 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
27 | + '<p>'.__('Sorry, you are not allowed to manage terms in this taxonomy.').'</p>', |
|
28 | 28 | 403 |
29 | 29 | ); |
30 | 30 | } |
@@ -41,10 +41,10 @@ discard block |
||
41 | 41 | |
42 | 42 | $title = $tax->labels->name; |
43 | 43 | |
44 | -if ( 'post' != $post_type ) { |
|
45 | - $parent_file = ( 'attachment' == $post_type ) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
44 | +if ('post' != $post_type) { |
|
45 | + $parent_file = ('attachment' == $post_type) ? 'upload.php' : "edit.php?post_type=$post_type"; |
|
46 | 46 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy&post_type=$post_type"; |
47 | -} elseif ( 'link_category' == $tax->name ) { |
|
47 | +} elseif ('link_category' == $tax->name) { |
|
48 | 48 | $parent_file = 'link-manager.php'; |
49 | 49 | $submenu_file = 'edit-tags.php?taxonomy=link_category'; |
50 | 50 | } else { |
@@ -52,142 +52,142 @@ discard block |
||
52 | 52 | $submenu_file = "edit-tags.php?taxonomy=$taxonomy"; |
53 | 53 | } |
54 | 54 | |
55 | -add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $tax->name . '_per_page' ) ); |
|
55 | +add_screen_option('per_page', array('default' => 20, 'option' => 'edit_'.$tax->name.'_per_page')); |
|
56 | 56 | |
57 | -get_current_screen()->set_screen_reader_content( array( |
|
57 | +get_current_screen()->set_screen_reader_content(array( |
|
58 | 58 | 'heading_pagination' => $tax->labels->items_list_navigation, |
59 | 59 | 'heading_list' => $tax->labels->items_list, |
60 | -) ); |
|
60 | +)); |
|
61 | 61 | |
62 | 62 | $location = false; |
63 | 63 | $referer = wp_get_referer(); |
64 | -if ( ! $referer ) { // For POST requests. |
|
65 | - $referer = wp_unslash( $_SERVER['REQUEST_URI'] ); |
|
64 | +if ( ! $referer) { // For POST requests. |
|
65 | + $referer = wp_unslash($_SERVER['REQUEST_URI']); |
|
66 | 66 | } |
67 | -$referer = remove_query_arg( array( '_wp_http_referer', '_wpnonce', 'error', 'message', 'paged' ), $referer ); |
|
68 | -switch ( $wp_list_table->current_action() ) { |
|
67 | +$referer = remove_query_arg(array('_wp_http_referer', '_wpnonce', 'error', 'message', 'paged'), $referer); |
|
68 | +switch ($wp_list_table->current_action()) { |
|
69 | 69 | |
70 | 70 | case 'add-tag': |
71 | - check_admin_referer( 'add-tag', '_wpnonce_add-tag' ); |
|
71 | + check_admin_referer('add-tag', '_wpnonce_add-tag'); |
|
72 | 72 | |
73 | - if ( ! current_user_can( $tax->cap->edit_terms ) ) { |
|
73 | + if ( ! current_user_can($tax->cap->edit_terms)) { |
|
74 | 74 | wp_die( |
75 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
76 | - '<p>' . __( 'Sorry, you are not allowed to create terms in this taxonomy.' ) . '</p>', |
|
75 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
76 | + '<p>'.__('Sorry, you are not allowed to create terms in this taxonomy.').'</p>', |
|
77 | 77 | 403 |
78 | 78 | ); |
79 | 79 | } |
80 | 80 | |
81 | - $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
|
82 | - if ( $ret && !is_wp_error( $ret ) ) |
|
83 | - $location = add_query_arg( 'message', 1, $referer ); |
|
81 | + $ret = wp_insert_term($_POST['tag-name'], $taxonomy, $_POST); |
|
82 | + if ($ret && ! is_wp_error($ret)) |
|
83 | + $location = add_query_arg('message', 1, $referer); |
|
84 | 84 | else |
85 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $referer ); |
|
85 | + $location = add_query_arg(array('error' => true, 'message' => 4), $referer); |
|
86 | 86 | |
87 | 87 | break; |
88 | 88 | |
89 | 89 | case 'delete': |
90 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
90 | + if ( ! isset($_REQUEST['tag_ID'])) { |
|
91 | 91 | break; |
92 | 92 | } |
93 | 93 | |
94 | 94 | $tag_ID = (int) $_REQUEST['tag_ID']; |
95 | - check_admin_referer( 'delete-tag_' . $tag_ID ); |
|
95 | + check_admin_referer('delete-tag_'.$tag_ID); |
|
96 | 96 | |
97 | - if ( ! current_user_can( 'delete_term', $tag_ID ) ) { |
|
97 | + if ( ! current_user_can('delete_term', $tag_ID)) { |
|
98 | 98 | wp_die( |
99 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
100 | - '<p>' . __( 'Sorry, you are not allowed to delete this item.' ) . '</p>', |
|
99 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
100 | + '<p>'.__('Sorry, you are not allowed to delete this item.').'</p>', |
|
101 | 101 | 403 |
102 | 102 | ); |
103 | 103 | } |
104 | 104 | |
105 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
105 | + wp_delete_term($tag_ID, $taxonomy); |
|
106 | 106 | |
107 | - $location = add_query_arg( 'message', 2, $referer ); |
|
107 | + $location = add_query_arg('message', 2, $referer); |
|
108 | 108 | |
109 | 109 | // When deleting a term, prevent the action from redirecting back to a term that no longer exists. |
110 | - $location = remove_query_arg( array( 'tag_ID', 'action' ), $location ); |
|
110 | + $location = remove_query_arg(array('tag_ID', 'action'), $location); |
|
111 | 111 | |
112 | 112 | break; |
113 | 113 | |
114 | 114 | case 'bulk-delete': |
115 | - check_admin_referer( 'bulk-tags' ); |
|
115 | + check_admin_referer('bulk-tags'); |
|
116 | 116 | |
117 | - if ( ! current_user_can( $tax->cap->delete_terms ) ) { |
|
117 | + if ( ! current_user_can($tax->cap->delete_terms)) { |
|
118 | 118 | wp_die( |
119 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
120 | - '<p>' . __( 'Sorry, you are not allowed to delete these items.' ) . '</p>', |
|
119 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
120 | + '<p>'.__('Sorry, you are not allowed to delete these items.').'</p>', |
|
121 | 121 | 403 |
122 | 122 | ); |
123 | 123 | } |
124 | 124 | |
125 | 125 | $tags = (array) $_REQUEST['delete_tags']; |
126 | - foreach ( $tags as $tag_ID ) { |
|
127 | - wp_delete_term( $tag_ID, $taxonomy ); |
|
126 | + foreach ($tags as $tag_ID) { |
|
127 | + wp_delete_term($tag_ID, $taxonomy); |
|
128 | 128 | } |
129 | 129 | |
130 | - $location = add_query_arg( 'message', 6, $referer ); |
|
130 | + $location = add_query_arg('message', 6, $referer); |
|
131 | 131 | |
132 | 132 | break; |
133 | 133 | |
134 | 134 | case 'edit': |
135 | - if ( ! isset( $_REQUEST['tag_ID'] ) ) { |
|
135 | + if ( ! isset($_REQUEST['tag_ID'])) { |
|
136 | 136 | break; |
137 | 137 | } |
138 | 138 | |
139 | 139 | $term_id = (int) $_REQUEST['tag_ID']; |
140 | - $term = get_term( $term_id ); |
|
140 | + $term = get_term($term_id); |
|
141 | 141 | |
142 | - if ( ! $term instanceof WP_Term ) { |
|
143 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
142 | + if ( ! $term instanceof WP_Term) { |
|
143 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
144 | 144 | } |
145 | 145 | |
146 | - wp_redirect( esc_url_raw( get_edit_term_link( $term_id, $taxonomy, $post_type ) ) ); |
|
146 | + wp_redirect(esc_url_raw(get_edit_term_link($term_id, $taxonomy, $post_type))); |
|
147 | 147 | exit; |
148 | 148 | |
149 | 149 | case 'editedtag': |
150 | 150 | $tag_ID = (int) $_POST['tag_ID']; |
151 | - check_admin_referer( 'update-tag_' . $tag_ID ); |
|
151 | + check_admin_referer('update-tag_'.$tag_ID); |
|
152 | 152 | |
153 | - if ( ! current_user_can( 'edit_term', $tag_ID ) ) { |
|
153 | + if ( ! current_user_can('edit_term', $tag_ID)) { |
|
154 | 154 | wp_die( |
155 | - '<h1>' . __( 'Cheatin’ uh?' ) . '</h1>' . |
|
156 | - '<p>' . __( 'Sorry, you are not allowed to edit this item.' ) . '</p>', |
|
155 | + '<h1>'.__('Cheatin’ uh?').'</h1>'. |
|
156 | + '<p>'.__('Sorry, you are not allowed to edit this item.').'</p>', |
|
157 | 157 | 403 |
158 | 158 | ); |
159 | 159 | } |
160 | 160 | |
161 | - $tag = get_term( $tag_ID, $taxonomy ); |
|
162 | - if ( ! $tag ) |
|
163 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
161 | + $tag = get_term($tag_ID, $taxonomy); |
|
162 | + if ( ! $tag) |
|
163 | + wp_die(__('You attempted to edit an item that doesn’t exist. Perhaps it was deleted?')); |
|
164 | 164 | |
165 | - $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
|
165 | + $ret = wp_update_term($tag_ID, $taxonomy, $_POST); |
|
166 | 166 | |
167 | - if ( $ret && ! is_wp_error( $ret ) ) { |
|
168 | - $location = add_query_arg( 'message', 3, $referer ); |
|
167 | + if ($ret && ! is_wp_error($ret)) { |
|
168 | + $location = add_query_arg('message', 3, $referer); |
|
169 | 169 | } else { |
170 | - $location = add_query_arg( array( 'error' => true, 'message' => 5 ), $referer ); |
|
170 | + $location = add_query_arg(array('error' => true, 'message' => 5), $referer); |
|
171 | 171 | } |
172 | 172 | break; |
173 | 173 | default: |
174 | - if ( ! $wp_list_table->current_action() || ! isset( $_REQUEST['delete_tags'] ) ) { |
|
174 | + if ( ! $wp_list_table->current_action() || ! isset($_REQUEST['delete_tags'])) { |
|
175 | 175 | break; |
176 | 176 | } |
177 | - check_admin_referer( 'bulk-tags' ); |
|
177 | + check_admin_referer('bulk-tags'); |
|
178 | 178 | $tags = (array) $_REQUEST['delete_tags']; |
179 | 179 | /** This action is documented in wp-admin/edit-comments.php */ |
180 | - $location = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $location, $wp_list_table->current_action(), $tags ); |
|
180 | + $location = apply_filters('handle_bulk_actions-'.get_current_screen()->id, $location, $wp_list_table->current_action(), $tags); |
|
181 | 181 | break; |
182 | 182 | } |
183 | 183 | |
184 | -if ( ! $location && ! empty( $_REQUEST['_wp_http_referer'] ) ) { |
|
185 | - $location = remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ); |
|
184 | +if ( ! $location && ! empty($_REQUEST['_wp_http_referer'])) { |
|
185 | + $location = remove_query_arg(array('_wp_http_referer', '_wpnonce'), wp_unslash($_SERVER['REQUEST_URI'])); |
|
186 | 186 | } |
187 | 187 | |
188 | -if ( $location ) { |
|
189 | - if ( $pagenum > 1 ) { |
|
190 | - $location = add_query_arg( 'paged', $pagenum, $location ); // $pagenum takes care of $total_pages. |
|
188 | +if ($location) { |
|
189 | + if ($pagenum > 1) { |
|
190 | + $location = add_query_arg('paged', $pagenum, $location); // $pagenum takes care of $total_pages. |
|
191 | 191 | } |
192 | 192 | |
193 | 193 | /** |
@@ -198,114 +198,114 @@ discard block |
||
198 | 198 | * @param string $location The destination URL. |
199 | 199 | * @param object $tax The taxonomy object. |
200 | 200 | */ |
201 | - wp_redirect( apply_filters( 'redirect_term_location', $location, $tax ) ); |
|
201 | + wp_redirect(apply_filters('redirect_term_location', $location, $tax)); |
|
202 | 202 | exit; |
203 | 203 | } |
204 | 204 | |
205 | 205 | $wp_list_table->prepare_items(); |
206 | -$total_pages = $wp_list_table->get_pagination_arg( 'total_pages' ); |
|
206 | +$total_pages = $wp_list_table->get_pagination_arg('total_pages'); |
|
207 | 207 | |
208 | -if ( $pagenum > $total_pages && $total_pages > 0 ) { |
|
209 | - wp_redirect( add_query_arg( 'paged', $total_pages ) ); |
|
208 | +if ($pagenum > $total_pages && $total_pages > 0) { |
|
209 | + wp_redirect(add_query_arg('paged', $total_pages)); |
|
210 | 210 | exit; |
211 | 211 | } |
212 | 212 | |
213 | 213 | wp_enqueue_script('admin-tags'); |
214 | -if ( current_user_can($tax->cap->edit_terms) ) |
|
214 | +if (current_user_can($tax->cap->edit_terms)) |
|
215 | 215 | wp_enqueue_script('inline-edit-tax'); |
216 | 216 | |
217 | -if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) { |
|
218 | - $help =''; |
|
219 | - if ( 'category' == $taxonomy ) |
|
220 | - $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; |
|
221 | - elseif ( 'link_category' == $taxonomy ) |
|
222 | - $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; |
|
217 | +if ('category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy) { |
|
218 | + $help = ''; |
|
219 | + if ('category' == $taxonomy) |
|
220 | + $help = '<p>'.sprintf(__('You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.'), 'options-writing.php').'</p>'; |
|
221 | + elseif ('link_category' == $taxonomy) |
|
222 | + $help = '<p>'.__('You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.').'</p>'; |
|
223 | 223 | else |
224 | - $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; |
|
224 | + $help = '<p>'.__('You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.').'</p>'; |
|
225 | 225 | |
226 | - if ( 'link_category' == $taxonomy ) |
|
227 | - $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; |
|
226 | + if ('link_category' == $taxonomy) |
|
227 | + $help .= '<p>'.__('You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.').'</p>'; |
|
228 | 228 | else |
229 | - $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; |
|
229 | + $help .= '<p>'.__('What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.').'</p>'; |
|
230 | 230 | |
231 | - get_current_screen()->add_help_tab( array( |
|
231 | + get_current_screen()->add_help_tab(array( |
|
232 | 232 | 'id' => 'overview', |
233 | 233 | 'title' => __('Overview'), |
234 | 234 | 'content' => $help, |
235 | - ) ); |
|
235 | + )); |
|
236 | 236 | |
237 | - if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) { |
|
238 | - if ( 'category' == $taxonomy ) |
|
239 | - $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
237 | + if ('category' == $taxonomy || 'post_tag' == $taxonomy) { |
|
238 | + if ('category' == $taxonomy) |
|
239 | + $help = '<p>'.__('When adding a new category on this screen, you’ll fill in the following fields:').'</p>'; |
|
240 | 240 | else |
241 | - $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
241 | + $help = '<p>'.__('When adding a new tag on this screen, you’ll fill in the following fields:').'</p>'; |
|
242 | 242 | |
243 | - $help .= '<ul>' . |
|
244 | - '<li>' . __( '<strong>Name</strong> — The name is how it appears on your site.' ) . '</li>'; |
|
243 | + $help .= '<ul>'. |
|
244 | + '<li>'.__('<strong>Name</strong> — The name is how it appears on your site.').'</li>'; |
|
245 | 245 | |
246 | - if ( ! global_terms_enabled() ) |
|
247 | - $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; |
|
246 | + if ( ! global_terms_enabled()) |
|
247 | + $help .= '<li>'.__('<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.').'</li>'; |
|
248 | 248 | |
249 | - if ( 'category' == $taxonomy ) |
|
250 | - $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; |
|
249 | + if ('category' == $taxonomy) |
|
250 | + $help .= '<li>'.__('<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.').'</li>'; |
|
251 | 251 | |
252 | - $help .= '<li>' . __( '<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.' ) . '</li>' . |
|
253 | - '</ul>' . |
|
254 | - '<p>' . __( 'You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.' ) . '</p>'; |
|
252 | + $help .= '<li>'.__('<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.').'</li>'. |
|
253 | + '</ul>'. |
|
254 | + '<p>'.__('You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.').'</p>'; |
|
255 | 255 | |
256 | - get_current_screen()->add_help_tab( array( |
|
256 | + get_current_screen()->add_help_tab(array( |
|
257 | 257 | 'id' => 'adding-terms', |
258 | - 'title' => 'category' == $taxonomy ? __( 'Adding Categories' ) : __( 'Adding Tags' ), |
|
258 | + 'title' => 'category' == $taxonomy ? __('Adding Categories') : __('Adding Tags'), |
|
259 | 259 | 'content' => $help, |
260 | - ) ); |
|
260 | + )); |
|
261 | 261 | } |
262 | 262 | |
263 | - $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>'; |
|
263 | + $help = '<p><strong>'.__('For more information:').'</strong></p>'; |
|
264 | 264 | |
265 | - if ( 'category' == $taxonomy ) |
|
266 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen">Documentation on Categories</a>' ) . '</p>'; |
|
267 | - elseif ( 'link_category' == $taxonomy ) |
|
268 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen">Documentation on Link Categories</a>' ) . '</p>'; |
|
265 | + if ('category' == $taxonomy) |
|
266 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Posts_Categories_Screen">Documentation on Categories</a>').'</p>'; |
|
267 | + elseif ('link_category' == $taxonomy) |
|
268 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Links_Link_Categories_Screen">Documentation on Link Categories</a>').'</p>'; |
|
269 | 269 | else |
270 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen">Documentation on Tags</a>' ) . '</p>'; |
|
270 | + $help .= '<p>'.__('<a href="https://codex.wordpress.org/Posts_Tags_Screen">Documentation on Tags</a>').'</p>'; |
|
271 | 271 | |
272 | - $help .= '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'; |
|
272 | + $help .= '<p>'.__('<a href="https://wordpress.org/support/">Support Forums</a>').'</p>'; |
|
273 | 273 | |
274 | - get_current_screen()->set_help_sidebar( $help ); |
|
274 | + get_current_screen()->set_help_sidebar($help); |
|
275 | 275 | |
276 | - unset( $help ); |
|
276 | + unset($help); |
|
277 | 277 | } |
278 | 278 | |
279 | -require_once( ABSPATH . 'wp-admin/admin-header.php' ); |
|
279 | +require_once(ABSPATH.'wp-admin/admin-header.php'); |
|
280 | 280 | |
281 | 281 | /** Also used by the Edit Tag form */ |
282 | -require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); |
|
282 | +require_once(ABSPATH.'wp-admin/includes/edit-tag-messages.php'); |
|
283 | 283 | |
284 | -$class = ( isset( $_REQUEST['error'] ) ) ? 'error' : 'updated'; |
|
284 | +$class = (isset($_REQUEST['error'])) ? 'error' : 'updated'; |
|
285 | 285 | |
286 | -if ( is_plugin_active( 'wpcat2tag-importer/wpcat2tag-importer.php' ) ) { |
|
287 | - $import_link = admin_url( 'admin.php?import=wpcat2tag' ); |
|
286 | +if (is_plugin_active('wpcat2tag-importer/wpcat2tag-importer.php')) { |
|
287 | + $import_link = admin_url('admin.php?import=wpcat2tag'); |
|
288 | 288 | } else { |
289 | - $import_link = admin_url( 'import.php' ); |
|
289 | + $import_link = admin_url('import.php'); |
|
290 | 290 | } |
291 | 291 | |
292 | 292 | ?> |
293 | 293 | |
294 | 294 | <div class="wrap nosubsub"> |
295 | -<h1 class="wp-heading-inline"><?php echo esc_html( $title ); ?></h1> |
|
295 | +<h1 class="wp-heading-inline"><?php echo esc_html($title); ?></h1> |
|
296 | 296 | |
297 | 297 | <?php |
298 | -if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { |
|
298 | +if (isset($_REQUEST['s']) && strlen($_REQUEST['s'])) { |
|
299 | 299 | /* translators: %s: search keywords */ |
300 | - printf( '<span class="subtitle">' . __( 'Search results for “%s”' ) . '</span>', esc_html( wp_unslash( $_REQUEST['s'] ) ) ); |
|
300 | + printf('<span class="subtitle">'.__('Search results for “%s”').'</span>', esc_html(wp_unslash($_REQUEST['s']))); |
|
301 | 301 | } |
302 | 302 | ?> |
303 | 303 | |
304 | 304 | <hr class="wp-header-end"> |
305 | 305 | |
306 | -<?php if ( $message ) : ?> |
|
306 | +<?php if ($message) : ?> |
|
307 | 307 | <div id="message" class="<?php echo $class; ?> notice is-dismissible"><p><?php echo $message; ?></p></div> |
308 | -<?php $_SERVER['REQUEST_URI'] = remove_query_arg( array( 'message', 'error' ), $_SERVER['REQUEST_URI'] ); |
|
308 | +<?php $_SERVER['REQUEST_URI'] = remove_query_arg(array('message', 'error'), $_SERVER['REQUEST_URI']); |
|
309 | 309 | endif; ?> |
310 | 310 | <div id="ajax-response"></div> |
311 | 311 | |
@@ -313,7 +313,7 @@ discard block |
||
313 | 313 | <input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> |
314 | 314 | <input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> |
315 | 315 | |
316 | -<?php $wp_list_table->search_box( $tax->labels->search_items, 'tag' ); ?> |
|
316 | +<?php $wp_list_table->search_box($tax->labels->search_items, 'tag'); ?> |
|
317 | 317 | |
318 | 318 | </form> |
319 | 319 | |
@@ -324,8 +324,8 @@ discard block |
||
324 | 324 | |
325 | 325 | <?php |
326 | 326 | |
327 | -if ( current_user_can($tax->cap->edit_terms) ) { |
|
328 | - if ( 'category' == $taxonomy ) { |
|
327 | +if (current_user_can($tax->cap->edit_terms)) { |
|
328 | + if ('category' == $taxonomy) { |
|
329 | 329 | /** |
330 | 330 | * Fires before the Add Category form. |
331 | 331 | * |
@@ -334,8 +334,8 @@ discard block |
||
334 | 334 | * |
335 | 335 | * @param object $arg Optional arguments cast to an object. |
336 | 336 | */ |
337 | - do_action( 'add_category_form_pre', (object) array( 'parent' => 0 ) ); |
|
338 | - } elseif ( 'link_category' == $taxonomy ) { |
|
337 | + do_action('add_category_form_pre', (object) array('parent' => 0)); |
|
338 | + } elseif ('link_category' == $taxonomy) { |
|
339 | 339 | /** |
340 | 340 | * Fires before the link category form. |
341 | 341 | * |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * |
345 | 345 | * @param object $arg Optional arguments cast to an object. |
346 | 346 | */ |
347 | - do_action( 'add_link_category_form_pre', (object) array( 'parent' => 0 ) ); |
|
347 | + do_action('add_link_category_form_pre', (object) array('parent' => 0)); |
|
348 | 348 | } else { |
349 | 349 | /** |
350 | 350 | * Fires before the Add Tag form. |
@@ -354,7 +354,7 @@ discard block |
||
354 | 354 | * |
355 | 355 | * @param string $taxonomy The taxonomy slug. |
356 | 356 | */ |
357 | - do_action( 'add_tag_form_pre', $taxonomy ); |
|
357 | + do_action('add_tag_form_pre', $taxonomy); |
|
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
@@ -366,7 +366,7 @@ discard block |
||
366 | 366 | * |
367 | 367 | * @param string $taxonomy The taxonomy slug. |
368 | 368 | */ |
369 | - do_action( "{$taxonomy}_pre_add_form", $taxonomy ); |
|
369 | + do_action("{$taxonomy}_pre_add_form", $taxonomy); |
|
370 | 370 | ?> |
371 | 371 | |
372 | 372 | <div class="form-wrap"> |
@@ -379,7 +379,7 @@ discard block |
||
379 | 379 | * |
380 | 380 | * @since 3.7.0 |
381 | 381 | */ |
382 | -do_action( "{$taxonomy}_term_new_form_tag" ); |
|
382 | +do_action("{$taxonomy}_term_new_form_tag"); |
|
383 | 383 | ?>> |
384 | 384 | <input type="hidden" name="action" value="add-tag" /> |
385 | 385 | <input type="hidden" name="screen" value="<?php echo esc_attr($current_screen->id); ?>" /> |
@@ -388,20 +388,20 @@ discard block |
||
388 | 388 | <?php wp_nonce_field('add-tag', '_wpnonce_add-tag'); ?> |
389 | 389 | |
390 | 390 | <div class="form-field form-required term-name-wrap"> |
391 | - <label for="tag-name"><?php _ex( 'Name', 'term name' ); ?></label> |
|
391 | + <label for="tag-name"><?php _ex('Name', 'term name'); ?></label> |
|
392 | 392 | <input name="tag-name" id="tag-name" type="text" value="" size="40" aria-required="true" /> |
393 | 393 | <p><?php _e('The name is how it appears on your site.'); ?></p> |
394 | 394 | </div> |
395 | -<?php if ( ! global_terms_enabled() ) : ?> |
|
395 | +<?php if ( ! global_terms_enabled()) : ?> |
|
396 | 396 | <div class="form-field term-slug-wrap"> |
397 | - <label for="tag-slug"><?php _e( 'Slug' ); ?></label> |
|
397 | + <label for="tag-slug"><?php _e('Slug'); ?></label> |
|
398 | 398 | <input name="slug" id="tag-slug" type="text" value="" size="40" /> |
399 | 399 | <p><?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> |
400 | 400 | </div> |
401 | 401 | <?php endif; // global_terms_enabled() ?> |
402 | -<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
|
402 | +<?php if (is_taxonomy_hierarchical($taxonomy)) : ?> |
|
403 | 403 | <div class="form-field term-parent-wrap"> |
404 | - <label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label> |
|
404 | + <label for="parent"><?php echo esc_html($tax->labels->parent_item); ?></label> |
|
405 | 405 | <?php |
406 | 406 | $dropdown_args = array( |
407 | 407 | 'hide_empty' => 0, |
@@ -410,7 +410,7 @@ discard block |
||
410 | 410 | 'name' => 'parent', |
411 | 411 | 'orderby' => 'name', |
412 | 412 | 'hierarchical' => true, |
413 | - 'show_option_none' => __( 'None' ), |
|
413 | + 'show_option_none' => __('None'), |
|
414 | 414 | ); |
415 | 415 | |
416 | 416 | /** |
@@ -434,25 +434,25 @@ discard block |
||
434 | 434 | * @param string $taxonomy The taxonomy slug. |
435 | 435 | * @param string $context Filter context. Accepts 'new' or 'edit'. |
436 | 436 | */ |
437 | - $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new' ); |
|
437 | + $dropdown_args = apply_filters('taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'new'); |
|
438 | 438 | |
439 | - wp_dropdown_categories( $dropdown_args ); |
|
439 | + wp_dropdown_categories($dropdown_args); |
|
440 | 440 | ?> |
441 | - <?php if ( 'category' == $taxonomy ) : ?> |
|
442 | - <p><?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> |
|
441 | + <?php if ('category' == $taxonomy) : ?> |
|
442 | + <p><?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> |
|
443 | 443 | <?php else : ?> |
444 | - <p><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p> |
|
444 | + <p><?php _e('Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.'); ?></p> |
|
445 | 445 | <?php endif; ?> |
446 | 446 | </div> |
447 | 447 | <?php endif; // is_taxonomy_hierarchical() ?> |
448 | 448 | <div class="form-field term-description-wrap"> |
449 | - <label for="tag-description"><?php _e( 'Description' ); ?></label> |
|
449 | + <label for="tag-description"><?php _e('Description'); ?></label> |
|
450 | 450 | <textarea name="description" id="tag-description" rows="5" cols="40"></textarea> |
451 | 451 | <p><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p> |
452 | 452 | </div> |
453 | 453 | |
454 | 454 | <?php |
455 | -if ( ! is_taxonomy_hierarchical( $taxonomy ) ) { |
|
455 | +if ( ! is_taxonomy_hierarchical($taxonomy)) { |
|
456 | 456 | /** |
457 | 457 | * Fires after the Add Tag form fields for non-hierarchical taxonomies. |
458 | 458 | * |
@@ -460,7 +460,7 @@ discard block |
||
460 | 460 | * |
461 | 461 | * @param string $taxonomy The taxonomy slug. |
462 | 462 | */ |
463 | - do_action( 'add_tag_form_fields', $taxonomy ); |
|
463 | + do_action('add_tag_form_fields', $taxonomy); |
|
464 | 464 | } |
465 | 465 | |
466 | 466 | /** |
@@ -472,11 +472,11 @@ discard block |
||
472 | 472 | * |
473 | 473 | * @param string $taxonomy The taxonomy slug. |
474 | 474 | */ |
475 | -do_action( "{$taxonomy}_add_form_fields", $taxonomy ); |
|
475 | +do_action("{$taxonomy}_add_form_fields", $taxonomy); |
|
476 | 476 | |
477 | -submit_button( $tax->labels->add_new_item ); |
|
477 | +submit_button($tax->labels->add_new_item); |
|
478 | 478 | |
479 | -if ( 'category' == $taxonomy ) { |
|
479 | +if ('category' == $taxonomy) { |
|
480 | 480 | /** |
481 | 481 | * Fires at the end of the Edit Category form. |
482 | 482 | * |
@@ -485,8 +485,8 @@ discard block |
||
485 | 485 | * |
486 | 486 | * @param object $arg Optional arguments cast to an object. |
487 | 487 | */ |
488 | - do_action( 'edit_category_form', (object) array( 'parent' => 0 ) ); |
|
489 | -} elseif ( 'link_category' == $taxonomy ) { |
|
488 | + do_action('edit_category_form', (object) array('parent' => 0)); |
|
489 | +} elseif ('link_category' == $taxonomy) { |
|
490 | 490 | /** |
491 | 491 | * Fires at the end of the Edit Link form. |
492 | 492 | * |
@@ -495,7 +495,7 @@ discard block |
||
495 | 495 | * |
496 | 496 | * @param object $arg Optional arguments cast to an object. |
497 | 497 | */ |
498 | - do_action( 'edit_link_category_form', (object) array( 'parent' => 0 ) ); |
|
498 | + do_action('edit_link_category_form', (object) array('parent' => 0)); |
|
499 | 499 | } else { |
500 | 500 | /** |
501 | 501 | * Fires at the end of the Add Tag form. |
@@ -505,7 +505,7 @@ discard block |
||
505 | 505 | * |
506 | 506 | * @param string $taxonomy The taxonomy slug. |
507 | 507 | */ |
508 | - do_action( 'add_tag_form', $taxonomy ); |
|
508 | + do_action('add_tag_form', $taxonomy); |
|
509 | 509 | } |
510 | 510 | |
511 | 511 | /** |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | * |
518 | 518 | * @param string $taxonomy The taxonomy slug. |
519 | 519 | */ |
520 | -do_action( "{$taxonomy}_add_form", $taxonomy ); |
|
520 | +do_action("{$taxonomy}_add_form", $taxonomy); |
|
521 | 521 | ?> |
522 | 522 | </form></div> |
523 | 523 | <?php } ?> |
@@ -528,33 +528,33 @@ discard block |
||
528 | 528 | <div id="col-right"> |
529 | 529 | <div class="col-wrap"> |
530 | 530 | <form id="posts-filter" method="post"> |
531 | -<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ); ?>" /> |
|
532 | -<input type="hidden" name="post_type" value="<?php echo esc_attr( $post_type ); ?>" /> |
|
531 | +<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy); ?>" /> |
|
532 | +<input type="hidden" name="post_type" value="<?php echo esc_attr($post_type); ?>" /> |
|
533 | 533 | |
534 | 534 | <?php $wp_list_table->display(); ?> |
535 | 535 | |
536 | 536 | </form> |
537 | 537 | |
538 | -<?php if ( 'category' == $taxonomy ) : ?> |
|
538 | +<?php if ('category' == $taxonomy) : ?> |
|
539 | 539 | <div class="form-wrap edit-term-notes"> |
540 | 540 | <p> |
541 | 541 | <?php |
542 | - echo '<strong>' . __( 'Note:' ) . '</strong><br />'; |
|
542 | + echo '<strong>'.__('Note:').'</strong><br />'; |
|
543 | 543 | printf( |
544 | 544 | /* translators: %s: default category */ |
545 | - __( 'Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.' ), |
|
545 | + __('Deleting a category does not delete the posts in that category. Instead, posts that were only assigned to the deleted category are set to the category %s.'), |
|
546 | 546 | /** This filter is documented in wp-includes/category-template.php */ |
547 | - '<strong>' . apply_filters( 'the_category', get_cat_name( get_option( 'default_category') ) ) . '</strong>' |
|
547 | + '<strong>'.apply_filters('the_category', get_cat_name(get_option('default_category'))).'</strong>' |
|
548 | 548 | ); |
549 | 549 | ?> |
550 | 550 | </p> |
551 | -<?php if ( current_user_can( 'import' ) ) : ?> |
|
552 | -<p><?php printf( __( 'Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.' ), esc_url( $import_link ) ) ?></p> |
|
551 | +<?php if (current_user_can('import')) : ?> |
|
552 | +<p><?php printf(__('Categories can be selectively converted to tags using the <a href="%s">category to tag converter</a>.'), esc_url($import_link)) ?></p> |
|
553 | 553 | <?php endif; ?> |
554 | 554 | </div> |
555 | -<?php elseif ( 'post_tag' == $taxonomy && current_user_can( 'import' ) ) : ?> |
|
555 | +<?php elseif ('post_tag' == $taxonomy && current_user_can('import')) : ?> |
|
556 | 556 | <div class="form-wrap edit-term-notes"> |
557 | -<p><?php printf( __( 'Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.' ), esc_url( $import_link ) ) ;?></p> |
|
557 | +<p><?php printf(__('Tags can be selectively converted to categories using the <a href="%s">tag to category converter</a>.'), esc_url($import_link)); ?></p> |
|
558 | 558 | </div> |
559 | 559 | <?php endif; |
560 | 560 | |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | * |
568 | 568 | * @param string $taxonomy The taxonomy name. |
569 | 569 | */ |
570 | -do_action( "after-{$taxonomy}-table", $taxonomy ); |
|
570 | +do_action("after-{$taxonomy}-table", $taxonomy); |
|
571 | 571 | ?> |
572 | 572 | |
573 | 573 | </div> |
@@ -576,7 +576,7 @@ discard block |
||
576 | 576 | </div><!-- /col-container --> |
577 | 577 | </div><!-- /wrap --> |
578 | 578 | |
579 | -<?php if ( ! wp_is_mobile() ) : ?> |
|
579 | +<?php if ( ! wp_is_mobile()) : ?> |
|
580 | 580 | <script type="text/javascript"> |
581 | 581 | try{document.forms.addtag['tag-name'].focus();}catch(e){} |
582 | 582 | </script> |
@@ -585,4 +585,4 @@ discard block |
||
585 | 585 | |
586 | 586 | $wp_list_table->inline_edit(); |
587 | 587 | |
588 | -include( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
588 | +include(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -9,13 +9,15 @@ discard block |
||
9 | 9 | /** WordPress Administration Bootstrap */ |
10 | 10 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
11 | 11 | |
12 | -if ( ! $taxnow ) |
|
12 | +if ( ! $taxnow ) { |
|
13 | 13 | wp_die( __( 'Invalid taxonomy.' ) ); |
14 | +} |
|
14 | 15 | |
15 | 16 | $tax = get_taxonomy( $taxnow ); |
16 | 17 | |
17 | -if ( ! $tax ) |
|
18 | +if ( ! $tax ) { |
|
18 | 19 | wp_die( __( 'Invalid taxonomy.' ) ); |
20 | +} |
|
19 | 21 | |
20 | 22 | if ( ! in_array( $tax->name, get_taxonomies( array( 'show_ui' => true ) ) ) ) { |
21 | 23 | wp_die( __( 'Sorry, you are not allowed to edit terms in this taxonomy.' ) ); |
@@ -79,10 +81,11 @@ discard block |
||
79 | 81 | } |
80 | 82 | |
81 | 83 | $ret = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); |
82 | - if ( $ret && !is_wp_error( $ret ) ) |
|
83 | - $location = add_query_arg( 'message', 1, $referer ); |
|
84 | - else |
|
85 | - $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $referer ); |
|
84 | + if ( $ret && !is_wp_error( $ret ) ) { |
|
85 | + $location = add_query_arg( 'message', 1, $referer ); |
|
86 | + } else { |
|
87 | + $location = add_query_arg( array( 'error' => true, 'message' => 4 ), $referer ); |
|
88 | + } |
|
86 | 89 | |
87 | 90 | break; |
88 | 91 | |
@@ -159,8 +162,9 @@ discard block |
||
159 | 162 | } |
160 | 163 | |
161 | 164 | $tag = get_term( $tag_ID, $taxonomy ); |
162 | - if ( ! $tag ) |
|
163 | - wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
165 | + if ( ! $tag ) { |
|
166 | + wp_die( __( 'You attempted to edit an item that doesn’t exist. Perhaps it was deleted?' ) ); |
|
167 | + } |
|
164 | 168 | |
165 | 169 | $ret = wp_update_term( $tag_ID, $taxonomy, $_POST ); |
166 | 170 | |
@@ -211,22 +215,25 @@ discard block |
||
211 | 215 | } |
212 | 216 | |
213 | 217 | wp_enqueue_script('admin-tags'); |
214 | -if ( current_user_can($tax->cap->edit_terms) ) |
|
218 | +if ( current_user_can($tax->cap->edit_terms) ) { |
|
215 | 219 | wp_enqueue_script('inline-edit-tax'); |
220 | +} |
|
216 | 221 | |
217 | 222 | if ( 'category' == $taxonomy || 'link_category' == $taxonomy || 'post_tag' == $taxonomy ) { |
218 | 223 | $help =''; |
219 | - if ( 'category' == $taxonomy ) |
|
220 | - $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; |
|
221 | - elseif ( 'link_category' == $taxonomy ) |
|
222 | - $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; |
|
223 | - else |
|
224 | - $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; |
|
225 | - |
|
226 | - if ( 'link_category' == $taxonomy ) |
|
227 | - $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; |
|
228 | - else |
|
229 | - $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; |
|
224 | + if ( 'category' == $taxonomy ) { |
|
225 | + $help = '<p>' . sprintf(__( 'You can use categories to define sections of your site and group related posts. The default category is “Uncategorized” until you change it in your <a href="%s">writing settings</a>.' ) , 'options-writing.php' ) . '</p>'; |
|
226 | + } elseif ( 'link_category' == $taxonomy ) { |
|
227 | + $help = '<p>' . __( 'You can create groups of links by using Link Categories. Link Category names must be unique and Link Categories are separate from the categories you use for posts.' ) . '</p>'; |
|
228 | + } else { |
|
229 | + $help = '<p>' . __( 'You can assign keywords to your posts using <strong>tags</strong>. Unlike categories, tags have no hierarchy, meaning there’s no relationship from one tag to another.' ) . '</p>'; |
|
230 | + } |
|
231 | + |
|
232 | + if ( 'link_category' == $taxonomy ) { |
|
233 | + $help .= '<p>' . __( 'You can delete Link Categories in the Bulk Action pull-down, but that action does not delete the links within the category. Instead, it moves them to the default Link Category.' ) . '</p>'; |
|
234 | + } else { |
|
235 | + $help .='<p>' . __( 'What’s the difference between categories and tags? Normally, tags are ad-hoc keywords that identify important information in your post (names, subjects, etc) that may or may not recur in other posts, while categories are pre-determined sections. If you think of your site like a book, the categories are like the Table of Contents and the tags are like the terms in the index.' ) . '</p>'; |
|
236 | + } |
|
230 | 237 | |
231 | 238 | get_current_screen()->add_help_tab( array( |
232 | 239 | 'id' => 'overview', |
@@ -235,19 +242,22 @@ discard block |
||
235 | 242 | ) ); |
236 | 243 | |
237 | 244 | if ( 'category' == $taxonomy || 'post_tag' == $taxonomy ) { |
238 | - if ( 'category' == $taxonomy ) |
|
239 | - $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
240 | - else |
|
241 | - $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
245 | + if ( 'category' == $taxonomy ) { |
|
246 | + $help = '<p>' . __( 'When adding a new category on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
247 | + } else { |
|
248 | + $help = '<p>' . __( 'When adding a new tag on this screen, you’ll fill in the following fields:' ) . '</p>'; |
|
249 | + } |
|
242 | 250 | |
243 | 251 | $help .= '<ul>' . |
244 | 252 | '<li>' . __( '<strong>Name</strong> — The name is how it appears on your site.' ) . '</li>'; |
245 | 253 | |
246 | - if ( ! global_terms_enabled() ) |
|
247 | - $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; |
|
254 | + if ( ! global_terms_enabled() ) { |
|
255 | + $help .= '<li>' . __( '<strong>Slug</strong> — The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.' ) . '</li>'; |
|
256 | + } |
|
248 | 257 | |
249 | - if ( 'category' == $taxonomy ) |
|
250 | - $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; |
|
258 | + if ( 'category' == $taxonomy ) { |
|
259 | + $help .= '<li>' . __( '<strong>Parent</strong> — Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have child categories for Bebop and Big Band. Totally optional. To create a subcategory, just choose another category from the Parent dropdown.' ) . '</li>'; |
|
260 | + } |
|
251 | 261 | |
252 | 262 | $help .= '<li>' . __( '<strong>Description</strong> — The description is not prominent by default; however, some themes may display it.' ) . '</li>' . |
253 | 263 | '</ul>' . |
@@ -262,12 +272,13 @@ discard block |
||
262 | 272 | |
263 | 273 | $help = '<p><strong>' . __( 'For more information:' ) . '</strong></p>'; |
264 | 274 | |
265 | - if ( 'category' == $taxonomy ) |
|
266 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen">Documentation on Categories</a>' ) . '</p>'; |
|
267 | - elseif ( 'link_category' == $taxonomy ) |
|
268 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen">Documentation on Link Categories</a>' ) . '</p>'; |
|
269 | - else |
|
270 | - $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen">Documentation on Tags</a>' ) . '</p>'; |
|
275 | + if ( 'category' == $taxonomy ) { |
|
276 | + $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Categories_Screen">Documentation on Categories</a>' ) . '</p>'; |
|
277 | + } elseif ( 'link_category' == $taxonomy ) { |
|
278 | + $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Links_Link_Categories_Screen">Documentation on Link Categories</a>' ) . '</p>'; |
|
279 | + } else { |
|
280 | + $help .= '<p>' . __( '<a href="https://codex.wordpress.org/Posts_Tags_Screen">Documentation on Tags</a>' ) . '</p>'; |
|
281 | + } |
|
271 | 282 | |
272 | 283 | $help .= '<p>' . __('<a href="https://wordpress.org/support/">Support Forums</a>') . '</p>'; |
273 | 284 | |
@@ -440,8 +451,11 @@ discard block |
||
440 | 451 | ?> |
441 | 452 | <?php if ( 'category' == $taxonomy ) : ?> |
442 | 453 | <p><?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> |
443 | - <?php else : ?> |
|
444 | - <p><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p> |
|
454 | + <?php else { |
|
455 | + : ?> |
|
456 | + <p><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); |
|
457 | +} |
|
458 | +?></p> |
|
445 | 459 | <?php endif; ?> |
446 | 460 | </div> |
447 | 461 | <?php endif; // is_taxonomy_hierarchical() ?> |
@@ -14,7 +14,7 @@ |
||
14 | 14 | // Back compat hooks |
15 | 15 | if ( 'category' == $taxonomy ) { |
16 | 16 | /** |
17 | - * Fires before the Edit Category form. |
|
17 | + * Fires before the Edit Category form. |
|
18 | 18 | * |
19 | 19 | * @since 2.1.0 |
20 | 20 | * @deprecated 3.0.0 Use {$taxonomy}_pre_edit_form instead. |
@@ -7,12 +7,12 @@ discard block |
||
7 | 7 | */ |
8 | 8 | |
9 | 9 | // don't load directly |
10 | -if ( ! defined( 'ABSPATH' ) ) { |
|
11 | - die( '-1' ); |
|
10 | +if ( ! defined('ABSPATH')) { |
|
11 | + die('-1'); |
|
12 | 12 | } |
13 | 13 | |
14 | 14 | // Back compat hooks |
15 | -if ( 'category' == $taxonomy ) { |
|
15 | +if ('category' == $taxonomy) { |
|
16 | 16 | /** |
17 | 17 | * Fires before the Edit Category form. |
18 | 18 | * |
@@ -21,8 +21,8 @@ discard block |
||
21 | 21 | * |
22 | 22 | * @param object $tag Current category term object. |
23 | 23 | */ |
24 | - do_action( 'edit_category_form_pre', $tag ); |
|
25 | -} elseif ( 'link_category' == $taxonomy ) { |
|
24 | + do_action('edit_category_form_pre', $tag); |
|
25 | +} elseif ('link_category' == $taxonomy) { |
|
26 | 26 | /** |
27 | 27 | * Fires before the Edit Link Category form. |
28 | 28 | * |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * |
32 | 32 | * @param object $tag Current link category term object. |
33 | 33 | */ |
34 | - do_action( 'edit_link_category_form_pre', $tag ); |
|
34 | + do_action('edit_link_category_form_pre', $tag); |
|
35 | 35 | } else { |
36 | 36 | /** |
37 | 37 | * Fires before the Edit Tag form. |
@@ -41,18 +41,18 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @param object $tag Current tag term object. |
43 | 43 | */ |
44 | - do_action( 'edit_tag_form_pre', $tag ); |
|
44 | + do_action('edit_tag_form_pre', $tag); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
48 | 48 | * Use with caution, see https://codex.wordpress.org/Function_Reference/wp_reset_vars |
49 | 49 | */ |
50 | -wp_reset_vars( array( 'wp_http_referer' ) ); |
|
50 | +wp_reset_vars(array('wp_http_referer')); |
|
51 | 51 | |
52 | -$wp_http_referer = remove_query_arg( array( 'action', 'message', 'tag_ID' ), $wp_http_referer ); |
|
52 | +$wp_http_referer = remove_query_arg(array('action', 'message', 'tag_ID'), $wp_http_referer); |
|
53 | 53 | |
54 | 54 | /** Also used by Edit Tags */ |
55 | -require_once( ABSPATH . 'wp-admin/includes/edit-tag-messages.php' ); |
|
55 | +require_once(ABSPATH.'wp-admin/includes/edit-tag-messages.php'); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * Fires before the Edit Term form for all taxonomies. |
@@ -65,18 +65,18 @@ discard block |
||
65 | 65 | * @param object $tag Current taxonomy term object. |
66 | 66 | * @param string $taxonomy Current $taxonomy slug. |
67 | 67 | */ |
68 | -do_action( "{$taxonomy}_pre_edit_form", $tag, $taxonomy ); ?> |
|
68 | +do_action("{$taxonomy}_pre_edit_form", $tag, $taxonomy); ?> |
|
69 | 69 | |
70 | 70 | <div class="wrap"> |
71 | 71 | <h1><?php echo $tax->labels->edit_item; ?></h1> |
72 | 72 | |
73 | -<?php if ( $message ) : ?> |
|
73 | +<?php if ($message) : ?> |
|
74 | 74 | <div id="message" class="updated"> |
75 | 75 | <p><strong><?php echo $message; ?></strong></p> |
76 | - <?php if ( $wp_http_referer ) { ?> |
|
77 | - <p><a href="<?php echo esc_url( $wp_http_referer ); ?>"><?php |
|
76 | + <?php if ($wp_http_referer) { ?> |
|
77 | + <p><a href="<?php echo esc_url($wp_http_referer); ?>"><?php |
|
78 | 78 | /* translators: %s: taxonomy name */ |
79 | - printf( _x( '← Back to %s', 'admin screen' ), $tax->labels->name ); |
|
79 | + printf(_x('← Back to %s', 'admin screen'), $tax->labels->name); |
|
80 | 80 | ?></a></p> |
81 | 81 | <?php } ?> |
82 | 82 | </div> |
@@ -92,14 +92,14 @@ discard block |
||
92 | 92 | * |
93 | 93 | * @since 3.7.0 |
94 | 94 | */ |
95 | -do_action( "{$taxonomy}_term_edit_form_tag" ); |
|
95 | +do_action("{$taxonomy}_term_edit_form_tag"); |
|
96 | 96 | ?>> |
97 | 97 | <input type="hidden" name="action" value="editedtag"/> |
98 | -<input type="hidden" name="tag_ID" value="<?php echo esc_attr( $tag_ID ) ?>"/> |
|
99 | -<input type="hidden" name="taxonomy" value="<?php echo esc_attr( $taxonomy ) ?>"/> |
|
98 | +<input type="hidden" name="tag_ID" value="<?php echo esc_attr($tag_ID) ?>"/> |
|
99 | +<input type="hidden" name="taxonomy" value="<?php echo esc_attr($taxonomy) ?>"/> |
|
100 | 100 | <?php |
101 | -wp_original_referer_field( true, 'previous' ); |
|
102 | -wp_nonce_field( 'update-tag_' . $tag_ID ); |
|
101 | +wp_original_referer_field(true, 'previous'); |
|
102 | +wp_nonce_field('update-tag_'.$tag_ID); |
|
103 | 103 | |
104 | 104 | /** |
105 | 105 | * Fires at the beginning of the Edit Term form. |
@@ -113,17 +113,17 @@ discard block |
||
113 | 113 | * @param object $tag Current taxonomy term object. |
114 | 114 | * @param string $taxonomy Current $taxonomy slug. |
115 | 115 | */ |
116 | -do_action( "{$taxonomy}_term_edit_form_top", $tag, $taxonomy ); |
|
116 | +do_action("{$taxonomy}_term_edit_form_top", $tag, $taxonomy); |
|
117 | 117 | ?> |
118 | 118 | <table class="form-table"> |
119 | 119 | <tr class="form-field form-required term-name-wrap"> |
120 | - <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
|
121 | - <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
120 | + <th scope="row"><label for="name"><?php _ex('Name', 'term name'); ?></label></th> |
|
121 | + <td><input name="name" id="name" type="text" value="<?php if (isset($tag->name)) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
122 | 122 | <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> |
123 | 123 | </tr> |
124 | -<?php if ( !global_terms_enabled() ) { ?> |
|
124 | +<?php if ( ! global_terms_enabled()) { ?> |
|
125 | 125 | <tr class="form-field term-slug-wrap"> |
126 | - <th scope="row"><label for="slug"><?php _e( 'Slug' ); ?></label></th> |
|
126 | + <th scope="row"><label for="slug"><?php _e('Slug'); ?></label></th> |
|
127 | 127 | <?php |
128 | 128 | /** |
129 | 129 | * Filters the editable slug. |
@@ -138,15 +138,15 @@ discard block |
||
138 | 138 | * upon the context in which it is evaluated. |
139 | 139 | * @param object|WP_Post $tag Term or WP_Post object. |
140 | 140 | */ |
141 | - $slug = isset( $tag->slug ) ? apply_filters( 'editable_slug', $tag->slug, $tag ) : ''; |
|
141 | + $slug = isset($tag->slug) ? apply_filters('editable_slug', $tag->slug, $tag) : ''; |
|
142 | 142 | ?> |
143 | - <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr( $slug ); ?>" size="40" /> |
|
143 | + <td><input name="slug" id="slug" type="text" value="<?php echo esc_attr($slug); ?>" size="40" /> |
|
144 | 144 | <p class="description"><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td> |
145 | 145 | </tr> |
146 | 146 | <?php } ?> |
147 | -<?php if ( is_taxonomy_hierarchical($taxonomy) ) : ?> |
|
147 | +<?php if (is_taxonomy_hierarchical($taxonomy)) : ?> |
|
148 | 148 | <tr class="form-field term-parent-wrap"> |
149 | - <th scope="row"><label for="parent"><?php echo esc_html( $tax->labels->parent_item ); ?></label></th> |
|
149 | + <th scope="row"><label for="parent"><?php echo esc_html($tax->labels->parent_item); ?></label></th> |
|
150 | 150 | <td> |
151 | 151 | <?php |
152 | 152 | $dropdown_args = array( |
@@ -158,28 +158,28 @@ discard block |
||
158 | 158 | 'selected' => $tag->parent, |
159 | 159 | 'exclude_tree' => $tag->term_id, |
160 | 160 | 'hierarchical' => true, |
161 | - 'show_option_none' => __( 'None' ), |
|
161 | + 'show_option_none' => __('None'), |
|
162 | 162 | ); |
163 | 163 | |
164 | 164 | /** This filter is documented in wp-admin/edit-tags.php */ |
165 | - $dropdown_args = apply_filters( 'taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit' ); |
|
166 | - wp_dropdown_categories( $dropdown_args ); ?> |
|
167 | - <?php if ( 'category' == $taxonomy ) : ?> |
|
168 | - <p class="description"><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p> |
|
165 | + $dropdown_args = apply_filters('taxonomy_parent_dropdown_args', $dropdown_args, $taxonomy, 'edit'); |
|
166 | + wp_dropdown_categories($dropdown_args); ?> |
|
167 | + <?php if ('category' == $taxonomy) : ?> |
|
168 | + <p class="description"><?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?></p> |
|
169 | 169 | <?php else : ?> |
170 | - <p class="description"><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p> |
|
170 | + <p class="description"><?php _e('Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.'); ?></p> |
|
171 | 171 | <?php endif; ?> |
172 | 172 | </td> |
173 | 173 | </tr> |
174 | 174 | <?php endif; // is_taxonomy_hierarchical() ?> |
175 | 175 | <tr class="form-field term-description-wrap"> |
176 | - <th scope="row"><label for="description"><?php _e( 'Description' ); ?></label></th> |
|
176 | + <th scope="row"><label for="description"><?php _e('Description'); ?></label></th> |
|
177 | 177 | <td><textarea name="description" id="description" rows="5" cols="50" class="large-text"><?php echo $tag->description; // textarea_escaped ?></textarea> |
178 | 178 | <p class="description"><?php _e('The description is not prominent by default; however, some themes may show it.'); ?></p></td> |
179 | 179 | </tr> |
180 | 180 | <?php |
181 | 181 | // Back compat hooks |
182 | - if ( 'category' == $taxonomy ) { |
|
182 | + if ('category' == $taxonomy) { |
|
183 | 183 | /** |
184 | 184 | * Fires after the Edit Category form fields are displayed. |
185 | 185 | * |
@@ -188,8 +188,8 @@ discard block |
||
188 | 188 | * |
189 | 189 | * @param object $tag Current category term object. |
190 | 190 | */ |
191 | - do_action( 'edit_category_form_fields', $tag ); |
|
192 | - } elseif ( 'link_category' == $taxonomy ) { |
|
191 | + do_action('edit_category_form_fields', $tag); |
|
192 | + } elseif ('link_category' == $taxonomy) { |
|
193 | 193 | /** |
194 | 194 | * Fires after the Edit Link Category form fields are displayed. |
195 | 195 | * |
@@ -198,7 +198,7 @@ discard block |
||
198 | 198 | * |
199 | 199 | * @param object $tag Current link category term object. |
200 | 200 | */ |
201 | - do_action( 'edit_link_category_form_fields', $tag ); |
|
201 | + do_action('edit_link_category_form_fields', $tag); |
|
202 | 202 | } else { |
203 | 203 | /** |
204 | 204 | * Fires after the Edit Tag form fields are displayed. |
@@ -208,7 +208,7 @@ discard block |
||
208 | 208 | * |
209 | 209 | * @param object $tag Current tag term object. |
210 | 210 | */ |
211 | - do_action( 'edit_tag_form_fields', $tag ); |
|
211 | + do_action('edit_tag_form_fields', $tag); |
|
212 | 212 | } |
213 | 213 | /** |
214 | 214 | * Fires after the Edit Term form fields are displayed. |
@@ -221,17 +221,17 @@ discard block |
||
221 | 221 | * @param object $tag Current taxonomy term object. |
222 | 222 | * @param string $taxonomy Current taxonomy slug. |
223 | 223 | */ |
224 | - do_action( "{$taxonomy}_edit_form_fields", $tag, $taxonomy ); |
|
224 | + do_action("{$taxonomy}_edit_form_fields", $tag, $taxonomy); |
|
225 | 225 | ?> |
226 | 226 | </table> |
227 | 227 | <?php |
228 | 228 | // Back compat hooks |
229 | -if ( 'category' == $taxonomy ) { |
|
229 | +if ('category' == $taxonomy) { |
|
230 | 230 | /** This action is documented in wp-admin/edit-tags.php */ |
231 | - do_action( 'edit_category_form', $tag ); |
|
232 | -} elseif ( 'link_category' == $taxonomy ) { |
|
231 | + do_action('edit_category_form', $tag); |
|
232 | +} elseif ('link_category' == $taxonomy) { |
|
233 | 233 | /** This action is documented in wp-admin/edit-tags.php */ |
234 | - do_action( 'edit_link_category_form', $tag ); |
|
234 | + do_action('edit_link_category_form', $tag); |
|
235 | 235 | } else { |
236 | 236 | /** |
237 | 237 | * Fires at the end of the Edit Term form. |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | * |
242 | 242 | * @param object $tag Current taxonomy term object. |
243 | 243 | */ |
244 | - do_action( 'edit_tag_form', $tag ); |
|
244 | + do_action('edit_tag_form', $tag); |
|
245 | 245 | } |
246 | 246 | /** |
247 | 247 | * Fires at the end of the Edit Term form for all taxonomies. |
@@ -253,16 +253,16 @@ discard block |
||
253 | 253 | * @param object $tag Current taxonomy term object. |
254 | 254 | * @param string $taxonomy Current taxonomy slug. |
255 | 255 | */ |
256 | -do_action( "{$taxonomy}_edit_form", $tag, $taxonomy ); |
|
256 | +do_action("{$taxonomy}_edit_form", $tag, $taxonomy); |
|
257 | 257 | ?> |
258 | 258 | |
259 | 259 | <div class="edit-tag-actions"> |
260 | 260 | |
261 | - <?php submit_button( __( 'Update' ), 'primary', null, false ); ?> |
|
261 | + <?php submit_button(__('Update'), 'primary', null, false); ?> |
|
262 | 262 | |
263 | - <?php if ( current_user_can( 'delete_term', $tag->term_id ) ) : ?> |
|
263 | + <?php if (current_user_can('delete_term', $tag->term_id)) : ?> |
|
264 | 264 | <span id="delete-link"> |
265 | - <a class="delete" href="<?php echo admin_url( wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ) ) ?>"><?php _e( 'Delete' ); ?></a> |
|
265 | + <a class="delete" href="<?php echo admin_url(wp_nonce_url("edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_'.$tag->term_id)) ?>"><?php _e('Delete'); ?></a> |
|
266 | 266 | </span> |
267 | 267 | <?php endif; ?> |
268 | 268 | |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | </form> |
272 | 272 | </div> |
273 | 273 | |
274 | -<?php if ( ! wp_is_mobile() ) : ?> |
|
274 | +<?php if ( ! wp_is_mobile()) : ?> |
|
275 | 275 | <script type="text/javascript"> |
276 | 276 | try{document.forms.edittag.name.focus();}catch(e){} |
277 | 277 | </script> |
@@ -118,7 +118,10 @@ discard block |
||
118 | 118 | <table class="form-table"> |
119 | 119 | <tr class="form-field form-required term-name-wrap"> |
120 | 120 | <th scope="row"><label for="name"><?php _ex( 'Name', 'term name' ); ?></label></th> |
121 | - <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) echo esc_attr($tag->name); ?>" size="40" aria-required="true" /> |
|
121 | + <td><input name="name" id="name" type="text" value="<?php if ( isset( $tag->name ) ) { |
|
122 | + echo esc_attr($tag->name); |
|
123 | +} |
|
124 | +?>" size="40" aria-required="true" /> |
|
122 | 125 | <p class="description"><?php _e('The name is how it appears on your site.'); ?></p></td> |
123 | 126 | </tr> |
124 | 127 | <?php if ( !global_terms_enabled() ) { ?> |
@@ -166,8 +169,11 @@ discard block |
||
166 | 169 | wp_dropdown_categories( $dropdown_args ); ?> |
167 | 170 | <?php if ( 'category' == $taxonomy ) : ?> |
168 | 171 | <p class="description"><?php _e( 'Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.' ); ?></p> |
169 | - <?php else : ?> |
|
170 | - <p class="description"><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); ?></p> |
|
172 | + <?php else { |
|
173 | + : ?> |
|
174 | + <p class="description"><?php _e( 'Assign a parent term to create a hierarchy. The term Jazz, for example, would be the parent of Bebop and Big Band.' ); |
|
175 | +} |
|
176 | +?></p> |
|
171 | 177 | <?php endif; ?> |
172 | 178 | </td> |
173 | 179 | </tr> |
@@ -52,12 +52,12 @@ |
||
52 | 52 | $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) ); |
53 | 53 | } else { |
54 | 54 | /** |
55 | - * Fires after a new user has been created via the network user-new.php page. |
|
56 | - * |
|
57 | - * @since 4.4.0 |
|
58 | - * |
|
59 | - * @param int $user_id ID of the newly created user. |
|
60 | - */ |
|
55 | + * Fires after a new user has been created via the network user-new.php page. |
|
56 | + * |
|
57 | + * @since 4.4.0 |
|
58 | + * |
|
59 | + * @param int $user_id ID of the newly created user. |
|
60 | + */ |
|
61 | 61 | do_action( 'network_user_new_created_user', $user_id ); |
62 | 62 | wp_redirect( add_query_arg( array('update' => 'added', 'user_id' => $user_id ), 'user-new.php' ) ); |
63 | 63 | exit; |
@@ -8,45 +8,45 @@ discard block |
||
8 | 8 | */ |
9 | 9 | |
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | -require_once( dirname( __FILE__ ) . '/admin.php' ); |
|
11 | +require_once(dirname(__FILE__).'/admin.php'); |
|
12 | 12 | |
13 | -if ( ! current_user_can('create_users') ) |
|
13 | +if ( ! current_user_can('create_users')) |
|
14 | 14 | wp_die(__('Sorry, you are not allowed to add users to this network.')); |
15 | 15 | |
16 | -get_current_screen()->add_help_tab( array( |
|
16 | +get_current_screen()->add_help_tab(array( |
|
17 | 17 | 'id' => 'overview', |
18 | 18 | 'title' => __('Overview'), |
19 | 19 | 'content' => |
20 | - '<p>' . __('Add User will set up a new user account on the network and send that person an email with username and password.') . '</p>' . |
|
21 | - '<p>' . __('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.') . '</p>' |
|
22 | -) ); |
|
20 | + '<p>'.__('Add User will set up a new user account on the network and send that person an email with username and password.').'</p>'. |
|
21 | + '<p>'.__('Users who are signed up to the network without a site are added as subscribers to the main or primary dashboard site, giving them profile pages to manage their accounts. These users will only see Dashboard and My Sites in the main navigation until a site is created for them.').'</p>' |
|
22 | +)); |
|
23 | 23 | |
24 | 24 | get_current_screen()->set_help_sidebar( |
25 | - '<p><strong>' . __('For more information:') . '</strong></p>' . |
|
26 | - '<p>' . __('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen">Documentation on Network Users</a>') . '</p>' . |
|
27 | - '<p>' . __('<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>') . '</p>' |
|
25 | + '<p><strong>'.__('For more information:').'</strong></p>'. |
|
26 | + '<p>'.__('<a href="https://codex.wordpress.org/Network_Admin_Users_Screen">Documentation on Network Users</a>').'</p>'. |
|
27 | + '<p>'.__('<a href="https://wordpress.org/support/forum/multisite/">Support Forums</a>').'</p>' |
|
28 | 28 | ); |
29 | 29 | |
30 | -if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) { |
|
31 | - check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
|
30 | +if (isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action']) { |
|
31 | + check_admin_referer('add-user', '_wpnonce_add-user'); |
|
32 | 32 | |
33 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
34 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
33 | + if ( ! current_user_can('manage_network_users')) |
|
34 | + wp_die(__('Sorry, you are not allowed to access this page.'), 403); |
|
35 | 35 | |
36 | - if ( ! is_array( $_POST['user'] ) ) |
|
37 | - wp_die( __( 'Cannot create an empty user.' ) ); |
|
36 | + if ( ! is_array($_POST['user'])) |
|
37 | + wp_die(__('Cannot create an empty user.')); |
|
38 | 38 | |
39 | - $user = wp_unslash( $_POST['user'] ); |
|
39 | + $user = wp_unslash($_POST['user']); |
|
40 | 40 | |
41 | - $user_details = wpmu_validate_user_signup( $user['username'], $user['email'] ); |
|
42 | - if ( is_wp_error( $user_details[ 'errors' ] ) && ! empty( $user_details[ 'errors' ]->errors ) ) { |
|
43 | - $add_user_errors = $user_details[ 'errors' ]; |
|
41 | + $user_details = wpmu_validate_user_signup($user['username'], $user['email']); |
|
42 | + if (is_wp_error($user_details['errors']) && ! empty($user_details['errors']->errors)) { |
|
43 | + $add_user_errors = $user_details['errors']; |
|
44 | 44 | } else { |
45 | - $password = wp_generate_password( 12, false); |
|
46 | - $user_id = wpmu_create_user( esc_html( strtolower( $user['username'] ) ), $password, sanitize_email( $user['email'] ) ); |
|
45 | + $password = wp_generate_password(12, false); |
|
46 | + $user_id = wpmu_create_user(esc_html(strtolower($user['username'])), $password, sanitize_email($user['email'])); |
|
47 | 47 | |
48 | - if ( ! $user_id ) { |
|
49 | - $add_user_errors = new WP_Error( 'add_user_fail', __( 'Cannot add user.' ) ); |
|
48 | + if ( ! $user_id) { |
|
49 | + $add_user_errors = new WP_Error('add_user_fail', __('Cannot add user.')); |
|
50 | 50 | } else { |
51 | 51 | /** |
52 | 52 | * Fires after a new user has been created via the network user-new.php page. |
@@ -55,29 +55,29 @@ discard block |
||
55 | 55 | * |
56 | 56 | * @param int $user_id ID of the newly created user. |
57 | 57 | */ |
58 | - do_action( 'network_user_new_created_user', $user_id ); |
|
59 | - wp_redirect( add_query_arg( array('update' => 'added', 'user_id' => $user_id ), 'user-new.php' ) ); |
|
58 | + do_action('network_user_new_created_user', $user_id); |
|
59 | + wp_redirect(add_query_arg(array('update' => 'added', 'user_id' => $user_id), 'user-new.php')); |
|
60 | 60 | exit; |
61 | 61 | } |
62 | 62 | } |
63 | 63 | } |
64 | 64 | |
65 | -if ( isset($_GET['update']) ) { |
|
65 | +if (isset($_GET['update'])) { |
|
66 | 66 | $messages = array(); |
67 | - if ( 'added' == $_GET['update'] ) { |
|
67 | + if ('added' == $_GET['update']) { |
|
68 | 68 | $edit_link = ''; |
69 | - if ( isset( $_GET['user_id'] ) ) { |
|
70 | - $user_id_new = absint( $_GET['user_id'] ); |
|
71 | - if ( $user_id_new ) { |
|
72 | - $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_id_new ) ) ); |
|
69 | + if (isset($_GET['user_id'])) { |
|
70 | + $user_id_new = absint($_GET['user_id']); |
|
71 | + if ($user_id_new) { |
|
72 | + $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_id_new))); |
|
73 | 73 | } |
74 | 74 | } |
75 | 75 | |
76 | - if ( empty( $edit_link ) ) { |
|
77 | - $messages[] = __( 'User added.' ); |
|
76 | + if (empty($edit_link)) { |
|
77 | + $messages[] = __('User added.'); |
|
78 | 78 | } else { |
79 | 79 | /* translators: %s: edit page url */ |
80 | - $messages[] = sprintf( __( 'User added. <a href="%s">Edit user</a>' ), $edit_link ); |
|
80 | + $messages[] = sprintf(__('User added. <a href="%s">Edit user</a>'), $edit_link); |
|
81 | 81 | } |
82 | 82 | } |
83 | 83 | } |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | $title = __('Add New User'); |
86 | 86 | $parent_file = 'users.php'; |
87 | 87 | |
88 | -require( ABSPATH . 'wp-admin/admin-header.php' ); ?> |
|
88 | +require(ABSPATH.'wp-admin/admin-header.php'); ?> |
|
89 | 89 | |
90 | 90 | <div class="wrap"> |
91 | -<h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
|
91 | +<h1 id="add-new-user"><?php _e('Add New User'); ?></h1> |
|
92 | 92 | <?php |
93 | -if ( ! empty( $messages ) ) { |
|
94 | - foreach ( $messages as $msg ) |
|
95 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
93 | +if ( ! empty($messages)) { |
|
94 | + foreach ($messages as $msg) |
|
95 | + echo '<div id="message" class="updated notice is-dismissible"><p>'.$msg.'</p></div>'; |
|
96 | 96 | } |
97 | 97 | |
98 | -if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
|
98 | +if (isset($add_user_errors) && is_wp_error($add_user_errors)) { ?> |
|
99 | 99 | <div class="error"> |
100 | 100 | <?php |
101 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
101 | + foreach ($add_user_errors->get_error_messages() as $message) |
|
102 | 102 | echo "<p>$message</p>"; |
103 | 103 | ?> |
104 | 104 | </div> |
@@ -106,15 +106,15 @@ discard block |
||
106 | 106 | <form action="<?php echo network_admin_url('user-new.php?action=add-user'); ?>" id="adduser" method="post" novalidate="novalidate"> |
107 | 107 | <table class="form-table"> |
108 | 108 | <tr class="form-field form-required"> |
109 | - <th scope="row"><label for="username"><?php _e( 'Username' ) ?></label></th> |
|
109 | + <th scope="row"><label for="username"><?php _e('Username') ?></label></th> |
|
110 | 110 | <td><input type="text" class="regular-text" name="user[username]" id="username" autocapitalize="none" autocorrect="off" maxlength="60" /></td> |
111 | 111 | </tr> |
112 | 112 | <tr class="form-field form-required"> |
113 | - <th scope="row"><label for="email"><?php _e( 'Email' ) ?></label></th> |
|
113 | + <th scope="row"><label for="email"><?php _e('Email') ?></label></th> |
|
114 | 114 | <td><input type="email" class="regular-text" name="user[email]" id="email"/></td> |
115 | 115 | </tr> |
116 | 116 | <tr class="form-field"> |
117 | - <td colspan="2"><?php _e( 'A password reset link will be sent to the user via email.' ) ?></td> |
|
117 | + <td colspan="2"><?php _e('A password reset link will be sent to the user via email.') ?></td> |
|
118 | 118 | </tr> |
119 | 119 | </table> |
120 | 120 | <?php |
@@ -123,12 +123,12 @@ discard block |
||
123 | 123 | * |
124 | 124 | * @since 4.5.0 |
125 | 125 | */ |
126 | - do_action( 'network_user_new_form' ); |
|
126 | + do_action('network_user_new_form'); |
|
127 | 127 | |
128 | - wp_nonce_field( 'add-user', '_wpnonce_add-user' ); |
|
129 | - submit_button( __('Add User'), 'primary', 'add-user' ); |
|
128 | + wp_nonce_field('add-user', '_wpnonce_add-user'); |
|
129 | + submit_button(__('Add User'), 'primary', 'add-user'); |
|
130 | 130 | ?> |
131 | 131 | </form> |
132 | 132 | </div> |
133 | 133 | <?php |
134 | -require( ABSPATH . 'wp-admin/admin-footer.php' ); |
|
134 | +require(ABSPATH.'wp-admin/admin-footer.php'); |
@@ -10,8 +10,9 @@ discard block |
||
10 | 10 | /** Load WordPress Administration Bootstrap */ |
11 | 11 | require_once( dirname( __FILE__ ) . '/admin.php' ); |
12 | 12 | |
13 | -if ( ! current_user_can('create_users') ) |
|
13 | +if ( ! current_user_can('create_users') ) { |
|
14 | 14 | wp_die(__('Sorry, you are not allowed to add users to this network.')); |
15 | +} |
|
15 | 16 | |
16 | 17 | get_current_screen()->add_help_tab( array( |
17 | 18 | 'id' => 'overview', |
@@ -30,11 +31,13 @@ discard block |
||
30 | 31 | if ( isset($_REQUEST['action']) && 'add-user' == $_REQUEST['action'] ) { |
31 | 32 | check_admin_referer( 'add-user', '_wpnonce_add-user' ); |
32 | 33 | |
33 | - if ( ! current_user_can( 'manage_network_users' ) ) |
|
34 | - wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
34 | + if ( ! current_user_can( 'manage_network_users' ) ) { |
|
35 | + wp_die( __( 'Sorry, you are not allowed to access this page.' ), 403 ); |
|
36 | + } |
|
35 | 37 | |
36 | - if ( ! is_array( $_POST['user'] ) ) |
|
37 | - wp_die( __( 'Cannot create an empty user.' ) ); |
|
38 | + if ( ! is_array( $_POST['user'] ) ) { |
|
39 | + wp_die( __( 'Cannot create an empty user.' ) ); |
|
40 | + } |
|
38 | 41 | |
39 | 42 | $user = wp_unslash( $_POST['user'] ); |
40 | 43 | |
@@ -91,15 +94,17 @@ discard block |
||
91 | 94 | <h1 id="add-new-user"><?php _e( 'Add New User' ); ?></h1> |
92 | 95 | <?php |
93 | 96 | if ( ! empty( $messages ) ) { |
94 | - foreach ( $messages as $msg ) |
|
95 | - echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
96 | -} |
|
97 | + foreach ( $messages as $msg ) { |
|
98 | + echo '<div id="message" class="updated notice is-dismissible"><p>' . $msg . '</p></div>'; |
|
99 | + } |
|
100 | + } |
|
97 | 101 | |
98 | 102 | if ( isset( $add_user_errors ) && is_wp_error( $add_user_errors ) ) { ?> |
99 | 103 | <div class="error"> |
100 | 104 | <?php |
101 | - foreach ( $add_user_errors->get_error_messages() as $message ) |
|
102 | - echo "<p>$message</p>"; |
|
105 | + foreach ( $add_user_errors->get_error_messages() as $message ) { |
|
106 | + echo "<p>$message</p>"; |
|
107 | + } |
|
103 | 108 | ?> |
104 | 109 | </div> |
105 | 110 | <?php } ?> |