@@ -58,7 +58,7 @@ discard block |
||
58 | 58 | /** |
59 | 59 | * @ignore |
60 | 60 | */ |
61 | -function is_admin() {return true;} |
|
61 | +function is_admin() {return true; } |
|
62 | 62 | |
63 | 63 | /** |
64 | 64 | * @ignore |
@@ -85,22 +85,22 @@ discard block |
||
85 | 85 | */ |
86 | 86 | function wp_guess_url() {} |
87 | 87 | |
88 | -if ( ! function_exists( 'json_encode' ) ) : |
|
88 | +if ( ! function_exists('json_encode')) : |
|
89 | 89 | /** |
90 | 90 | * @ignore |
91 | 91 | */ |
92 | 92 | function json_encode() {} |
93 | 93 | endif; |
94 | 94 | |
95 | -function get_file( $path ) { |
|
95 | +function get_file($path) { |
|
96 | 96 | |
97 | - if ( function_exists('realpath') ) { |
|
98 | - $path = realpath( $path ); |
|
97 | + if (function_exists('realpath')) { |
|
98 | + $path = realpath($path); |
|
99 | 99 | } |
100 | 100 | |
101 | - if ( ! $path || ! @is_file( $path ) ) { |
|
101 | + if ( ! $path || ! @is_file($path)) { |
|
102 | 102 | return ''; |
103 | 103 | } |
104 | 104 | |
105 | - return @file_get_contents( $path ); |
|
105 | + return @file_get_contents($path); |
|
106 | 106 | } |
107 | 107 | \ No newline at end of file |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * List Table API: WP_Media_List_Table class |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * List Table API: WP_Media_List_Table class |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Core class used to implement displaying media items in a list table. |
@@ -39,18 +39,18 @@ discard block |
||
39 | 39 | * |
40 | 40 | * @param array $args An associative array of arguments. |
41 | 41 | */ |
42 | - public function __construct( $args = array() ) { |
|
43 | - $this->detached = ( isset( $_REQUEST['attachment-filter'] ) && 'detached' === $_REQUEST['attachment-filter'] ); |
|
42 | + public function __construct($args = array()) { |
|
43 | + $this->detached = (isset($_REQUEST['attachment-filter']) && 'detached' === $_REQUEST['attachment-filter']); |
|
44 | 44 | |
45 | 45 | $this->modes = array( |
46 | - 'list' => __( 'List View' ), |
|
47 | - 'grid' => __( 'Grid View' ) |
|
46 | + 'list' => __('List View'), |
|
47 | + 'grid' => __('Grid View') |
|
48 | 48 | ); |
49 | 49 | |
50 | - parent::__construct( array( |
|
50 | + parent::__construct(array( |
|
51 | 51 | 'plural' => 'media', |
52 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
53 | - ) ); |
|
52 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
53 | + )); |
|
54 | 54 | } |
55 | 55 | |
56 | 56 | /** |
@@ -71,17 +71,17 @@ discard block |
||
71 | 71 | public function prepare_items() { |
72 | 72 | global $wp_query, $post_mime_types, $avail_post_mime_types, $mode; |
73 | 73 | |
74 | - list( $post_mime_types, $avail_post_mime_types ) = wp_edit_attachments_query( $_REQUEST ); |
|
74 | + list($post_mime_types, $avail_post_mime_types) = wp_edit_attachments_query($_REQUEST); |
|
75 | 75 | |
76 | - $this->is_trash = isset( $_REQUEST['attachment-filter'] ) && 'trash' === $_REQUEST['attachment-filter']; |
|
76 | + $this->is_trash = isset($_REQUEST['attachment-filter']) && 'trash' === $_REQUEST['attachment-filter']; |
|
77 | 77 | |
78 | - $mode = empty( $_REQUEST['mode'] ) ? 'list' : $_REQUEST['mode']; |
|
78 | + $mode = empty($_REQUEST['mode']) ? 'list' : $_REQUEST['mode']; |
|
79 | 79 | |
80 | - $this->set_pagination_args( array( |
|
80 | + $this->set_pagination_args(array( |
|
81 | 81 | 'total_items' => $wp_query->found_posts, |
82 | 82 | 'total_pages' => $wp_query->max_num_pages, |
83 | 83 | 'per_page' => $wp_query->query_vars['posts_per_page'], |
84 | - ) ); |
|
84 | + )); |
|
85 | 85 | } |
86 | 86 | |
87 | 87 | /** |
@@ -94,40 +94,40 @@ discard block |
||
94 | 94 | |
95 | 95 | $type_links = array(); |
96 | 96 | |
97 | - $filter = empty( $_GET['attachment-filter'] ) ? '' : $_GET['attachment-filter']; |
|
97 | + $filter = empty($_GET['attachment-filter']) ? '' : $_GET['attachment-filter']; |
|
98 | 98 | |
99 | 99 | $type_links['all'] = sprintf( |
100 | 100 | '<option value=""%s>%s</option>', |
101 | - selected( $filter, true, false ), |
|
102 | - __( 'All media items' ) |
|
101 | + selected($filter, true, false), |
|
102 | + __('All media items') |
|
103 | 103 | ); |
104 | 104 | |
105 | - foreach ( $post_mime_types as $mime_type => $label ) { |
|
106 | - if ( ! wp_match_mime_types( $mime_type, $avail_post_mime_types ) ) { |
|
105 | + foreach ($post_mime_types as $mime_type => $label) { |
|
106 | + if ( ! wp_match_mime_types($mime_type, $avail_post_mime_types)) { |
|
107 | 107 | continue; |
108 | 108 | } |
109 | 109 | |
110 | 110 | $selected = selected( |
111 | - $filter && 0 === strpos( $filter, 'post_mime_type:' ) && |
|
112 | - wp_match_mime_types( $mime_type, str_replace( 'post_mime_type:', '', $filter ) ), |
|
111 | + $filter && 0 === strpos($filter, 'post_mime_type:') && |
|
112 | + wp_match_mime_types($mime_type, str_replace('post_mime_type:', '', $filter)), |
|
113 | 113 | true, |
114 | 114 | false |
115 | 115 | ); |
116 | 116 | |
117 | 117 | $type_links[$mime_type] = sprintf( |
118 | 118 | '<option value="post_mime_type:%s"%s>%s</option>', |
119 | - esc_attr( $mime_type ), |
|
119 | + esc_attr($mime_type), |
|
120 | 120 | $selected, |
121 | 121 | $label[0] |
122 | 122 | ); |
123 | 123 | } |
124 | - $type_links['detached'] = '<option value="detached"' . ( $this->detached ? ' selected="selected"' : '' ) . '>' . __( 'Unattached' ) . '</option>'; |
|
124 | + $type_links['detached'] = '<option value="detached"'.($this->detached ? ' selected="selected"' : '').'>'.__('Unattached').'</option>'; |
|
125 | 125 | |
126 | - if ( $this->is_trash || ( defined( 'MEDIA_TRASH') && MEDIA_TRASH ) ) { |
|
126 | + if ($this->is_trash || (defined('MEDIA_TRASH') && MEDIA_TRASH)) { |
|
127 | 127 | $type_links['trash'] = sprintf( |
128 | 128 | '<option value="trash"%s>%s</option>', |
129 | - selected( 'trash' === $filter, true, false ), |
|
130 | - _x( 'Trash', 'attachment filter' ) |
|
129 | + selected('trash' === $filter, true, false), |
|
130 | + _x('Trash', 'attachment filter') |
|
131 | 131 | ); |
132 | 132 | } |
133 | 133 | return $type_links; |
@@ -139,19 +139,19 @@ discard block |
||
139 | 139 | */ |
140 | 140 | protected function get_bulk_actions() { |
141 | 141 | $actions = array(); |
142 | - if ( MEDIA_TRASH ) { |
|
143 | - if ( $this->is_trash ) { |
|
144 | - $actions['untrash'] = __( 'Restore' ); |
|
145 | - $actions['delete'] = __( 'Delete Permanently' ); |
|
142 | + if (MEDIA_TRASH) { |
|
143 | + if ($this->is_trash) { |
|
144 | + $actions['untrash'] = __('Restore'); |
|
145 | + $actions['delete'] = __('Delete Permanently'); |
|
146 | 146 | } else { |
147 | - $actions['trash'] = _x( 'Trash', 'verb' ); |
|
147 | + $actions['trash'] = _x('Trash', 'verb'); |
|
148 | 148 | } |
149 | 149 | } else { |
150 | - $actions['delete'] = __( 'Delete Permanently' ); |
|
150 | + $actions['delete'] = __('Delete Permanently'); |
|
151 | 151 | } |
152 | 152 | |
153 | - if ( $this->detached ) |
|
154 | - $actions['attach'] = __( 'Attach' ); |
|
153 | + if ($this->detached) |
|
154 | + $actions['attach'] = __('Attach'); |
|
155 | 155 | |
156 | 156 | return $actions; |
157 | 157 | } |
@@ -159,26 +159,26 @@ discard block |
||
159 | 159 | /** |
160 | 160 | * @param string $which |
161 | 161 | */ |
162 | - protected function extra_tablenav( $which ) { |
|
163 | - if ( 'bar' !== $which ) { |
|
162 | + protected function extra_tablenav($which) { |
|
163 | + if ('bar' !== $which) { |
|
164 | 164 | return; |
165 | 165 | } |
166 | 166 | ?> |
167 | 167 | <div class="actions"> |
168 | 168 | <?php |
169 | - if ( ! is_singular() ) { |
|
170 | - if ( ! $this->is_trash ) { |
|
171 | - $this->months_dropdown( 'attachment' ); |
|
169 | + if ( ! is_singular()) { |
|
170 | + if ( ! $this->is_trash) { |
|
171 | + $this->months_dropdown('attachment'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */ |
175 | - do_action( 'restrict_manage_posts', $this->screen->post_type ); |
|
175 | + do_action('restrict_manage_posts', $this->screen->post_type); |
|
176 | 176 | |
177 | - submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
|
177 | + submit_button(__('Filter'), 'button', 'filter_action', false, array('id' => 'post-query-submit')); |
|
178 | 178 | } |
179 | 179 | |
180 | - if ( $this->is_trash && current_user_can( 'edit_others_posts' ) ) { |
|
181 | - submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); |
|
180 | + if ($this->is_trash && current_user_can('edit_others_posts')) { |
|
181 | + submit_button(__('Empty Trash'), 'apply', 'delete_all', false); |
|
182 | 182 | } ?> |
183 | 183 | </div> |
184 | 184 | <?php |
@@ -189,13 +189,13 @@ discard block |
||
189 | 189 | * @return string |
190 | 190 | */ |
191 | 191 | public function current_action() { |
192 | - if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
192 | + if (isset($_REQUEST['found_post_id']) && isset($_REQUEST['media'])) |
|
193 | 193 | return 'attach'; |
194 | 194 | |
195 | - if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
195 | + if (isset($_REQUEST['parent_post_id']) && isset($_REQUEST['media'])) |
|
196 | 196 | return 'detach'; |
197 | 197 | |
198 | - if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
|
198 | + if (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) |
|
199 | 199 | return 'delete_all'; |
200 | 200 | |
201 | 201 | return parent::current_action(); |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | * @access public |
214 | 214 | */ |
215 | 215 | public function no_items() { |
216 | - _e( 'No media files found.' ); |
|
216 | + _e('No media files found.'); |
|
217 | 217 | } |
218 | 218 | |
219 | 219 | /** |
@@ -226,17 +226,17 @@ discard block |
||
226 | 226 | |
227 | 227 | $views = $this->get_views(); |
228 | 228 | |
229 | - $this->screen->render_screen_reader_content( 'heading_views' ); |
|
229 | + $this->screen->render_screen_reader_content('heading_views'); |
|
230 | 230 | ?> |
231 | 231 | <div class="wp-filter"> |
232 | 232 | <div class="filter-items"> |
233 | - <?php $this->view_switcher( $mode ); ?> |
|
233 | + <?php $this->view_switcher($mode); ?> |
|
234 | 234 | |
235 | - <label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label> |
|
235 | + <label for="attachment-filter" class="screen-reader-text"><?php _e('Filter by type'); ?></label> |
|
236 | 236 | <select class="attachment-filters" name="attachment-filter" id="attachment-filter"> |
237 | 237 | <?php |
238 | - if ( ! empty( $views ) ) { |
|
239 | - foreach ( $views as $class => $view ) { |
|
238 | + if ( ! empty($views)) { |
|
239 | + foreach ($views as $class => $view) { |
|
240 | 240 | echo "\t$view\n"; |
241 | 241 | } |
242 | 242 | } |
@@ -244,15 +244,15 @@ discard block |
||
244 | 244 | </select> |
245 | 245 | |
246 | 246 | <?php |
247 | - $this->extra_tablenav( 'bar' ); |
|
247 | + $this->extra_tablenav('bar'); |
|
248 | 248 | |
249 | 249 | /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */ |
250 | - $views = apply_filters( "views_{$this->screen->id}", array() ); |
|
250 | + $views = apply_filters("views_{$this->screen->id}", array()); |
|
251 | 251 | |
252 | 252 | // Back compat for pre-4.0 view links. |
253 | - if ( ! empty( $views ) ) { |
|
253 | + if ( ! empty($views)) { |
|
254 | 254 | echo '<ul class="filter-links">'; |
255 | - foreach ( $views as $class => $view ) { |
|
255 | + foreach ($views as $class => $view) { |
|
256 | 256 | echo "<li class='$class'>$view</li>"; |
257 | 257 | } |
258 | 258 | echo '</ul>'; |
@@ -261,8 +261,8 @@ discard block |
||
261 | 261 | </div> |
262 | 262 | |
263 | 263 | <div class="search-form"> |
264 | - <label for="media-search-input" class="screen-reader-text"><?php esc_html_e( 'Search Media' ); ?></label> |
|
265 | - <input type="search" placeholder="<?php esc_attr_e( 'Search' ) ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div> |
|
264 | + <label for="media-search-input" class="screen-reader-text"><?php esc_html_e('Search Media'); ?></label> |
|
265 | + <input type="search" placeholder="<?php esc_attr_e('Search') ?>" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div> |
|
266 | 266 | </div> |
267 | 267 | <?php |
268 | 268 | } |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | $posts_columns = array(); |
276 | 276 | $posts_columns['cb'] = '<input type="checkbox" />'; |
277 | 277 | /* translators: column name */ |
278 | - $posts_columns['title'] = _x( 'File', 'column name' ); |
|
279 | - $posts_columns['author'] = __( 'Author' ); |
|
278 | + $posts_columns['title'] = _x('File', 'column name'); |
|
279 | + $posts_columns['author'] = __('Author'); |
|
280 | 280 | |
281 | - $taxonomies = get_taxonomies_for_attachments( 'objects' ); |
|
282 | - $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' ); |
|
281 | + $taxonomies = get_taxonomies_for_attachments('objects'); |
|
282 | + $taxonomies = wp_filter_object_list($taxonomies, array('show_admin_column' => true), 'and', 'name'); |
|
283 | 283 | |
284 | 284 | /** |
285 | 285 | * Filter the taxonomy columns for attachments in the Media list table. |
@@ -289,28 +289,28 @@ discard block |
||
289 | 289 | * @param array $taxonomies An array of registered taxonomies to show for attachments. |
290 | 290 | * @param string $post_type The post type. Default 'attachment'. |
291 | 291 | */ |
292 | - $taxonomies = apply_filters( 'manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment' ); |
|
293 | - $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' ); |
|
292 | + $taxonomies = apply_filters('manage_taxonomies_for_attachment_columns', $taxonomies, 'attachment'); |
|
293 | + $taxonomies = array_filter($taxonomies, 'taxonomy_exists'); |
|
294 | 294 | |
295 | - foreach ( $taxonomies as $taxonomy ) { |
|
296 | - if ( 'category' === $taxonomy ) { |
|
295 | + foreach ($taxonomies as $taxonomy) { |
|
296 | + if ('category' === $taxonomy) { |
|
297 | 297 | $column_key = 'categories'; |
298 | - } elseif ( 'post_tag' === $taxonomy ) { |
|
298 | + } elseif ('post_tag' === $taxonomy) { |
|
299 | 299 | $column_key = 'tags'; |
300 | 300 | } else { |
301 | - $column_key = 'taxonomy-' . $taxonomy; |
|
301 | + $column_key = 'taxonomy-'.$taxonomy; |
|
302 | 302 | } |
303 | - $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name; |
|
303 | + $posts_columns[$column_key] = get_taxonomy($taxonomy)->labels->name; |
|
304 | 304 | } |
305 | 305 | |
306 | 306 | /* translators: column name */ |
307 | - if ( !$this->detached ) { |
|
308 | - $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); |
|
309 | - if ( post_type_supports( 'attachment', 'comments' ) ) |
|
310 | - $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
|
307 | + if ( ! $this->detached) { |
|
308 | + $posts_columns['parent'] = _x('Uploaded to', 'column name'); |
|
309 | + if (post_type_supports('attachment', 'comments')) |
|
310 | + $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="'.esc_attr__('Comments').'"><span class="screen-reader-text">'.__('Comments').'</span></span>'; |
|
311 | 311 | } |
312 | 312 | /* translators: column name */ |
313 | - $posts_columns['date'] = _x( 'Date', 'column name' ); |
|
313 | + $posts_columns['date'] = _x('Date', 'column name'); |
|
314 | 314 | /** |
315 | 315 | * Filter the Media list table columns. |
316 | 316 | * |
@@ -320,7 +320,7 @@ discard block |
||
320 | 320 | * @param bool $detached Whether the list table contains media not attached |
321 | 321 | * to any posts. Default true. |
322 | 322 | */ |
323 | - return apply_filters( 'manage_media_columns', $posts_columns, $this->detached ); |
|
323 | + return apply_filters('manage_media_columns', $posts_columns, $this->detached); |
|
324 | 324 | } |
325 | 325 | |
326 | 326 | /** |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | 'author' => 'author', |
334 | 334 | 'parent' => 'parent', |
335 | 335 | 'comments' => 'comment_count', |
336 | - 'date' => array( 'date', true ), |
|
336 | + 'date' => array('date', true), |
|
337 | 337 | ); |
338 | 338 | } |
339 | 339 | |
@@ -345,10 +345,10 @@ discard block |
||
345 | 345 | * |
346 | 346 | * @param WP_Post $post The current WP_Post object. |
347 | 347 | */ |
348 | - public function column_cb( $post ) { |
|
349 | - if ( current_user_can( 'edit_post', $post->ID ) ) { ?> |
|
348 | + public function column_cb($post) { |
|
349 | + if (current_user_can('edit_post', $post->ID)) { ?> |
|
350 | 350 | <label class="screen-reader-text" for="cb-select-<?php echo $post->ID; ?>"><?php |
351 | - echo sprintf( __( 'Select %s' ), _draft_or_post_title() ); |
|
351 | + echo sprintf(__('Select %s'), _draft_or_post_title()); |
|
352 | 352 | ?></label> |
353 | 353 | <input type="checkbox" name="media[]" id="cb-select-<?php echo $post->ID; ?>" value="<?php echo $post->ID; ?>" /> |
354 | 354 | <?php } |
@@ -362,19 +362,19 @@ discard block |
||
362 | 362 | * |
363 | 363 | * @param WP_Post $post The current WP_Post object. |
364 | 364 | */ |
365 | - public function column_title( $post ) { |
|
366 | - list( $mime ) = explode( '/', $post->post_mime_type ); |
|
365 | + public function column_title($post) { |
|
366 | + list($mime) = explode('/', $post->post_mime_type); |
|
367 | 367 | |
368 | 368 | $title = _draft_or_post_title(); |
369 | - $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) ); |
|
369 | + $thumb = wp_get_attachment_image($post->ID, array(60, 60), true, array('alt' => '')); |
|
370 | 370 | $link_start = $link_end = ''; |
371 | 371 | |
372 | - if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { |
|
372 | + if (current_user_can('edit_post', $post->ID) && ! $this->is_trash) { |
|
373 | 373 | $link_start = sprintf( |
374 | 374 | '<a href="%s" aria-label="%s">', |
375 | - get_edit_post_link( $post->ID ), |
|
375 | + get_edit_post_link($post->ID), |
|
376 | 376 | /* translators: %s: attachment title */ |
377 | - esc_attr( sprintf( __( '“%s” (Edit)' ), $title ) ) |
|
377 | + esc_attr(sprintf(__('“%s” (Edit)'), $title)) |
|
378 | 378 | ); |
379 | 379 | $link_end = '</a>'; |
380 | 380 | } |
@@ -384,18 +384,18 @@ discard block |
||
384 | 384 | <strong<?php echo $class; ?>> |
385 | 385 | <?php |
386 | 386 | echo $link_start; |
387 | - if ( $thumb ) : ?> |
|
388 | - <span class="media-icon <?php echo sanitize_html_class( $mime . '-icon' ); ?>"><?php echo $thumb; ?></span> |
|
387 | + if ($thumb) : ?> |
|
388 | + <span class="media-icon <?php echo sanitize_html_class($mime.'-icon'); ?>"><?php echo $thumb; ?></span> |
|
389 | 389 | <?php endif; |
390 | - echo $title . $link_end; |
|
391 | - _media_states( $post ); |
|
390 | + echo $title.$link_end; |
|
391 | + _media_states($post); |
|
392 | 392 | ?> |
393 | 393 | </strong> |
394 | 394 | <p class="filename"> |
395 | - <span class="screen-reader-text"><?php _e( 'File name:' ); ?> </span> |
|
395 | + <span class="screen-reader-text"><?php _e('File name:'); ?> </span> |
|
396 | 396 | <?php |
397 | - $file = get_attached_file( $post->ID ); |
|
398 | - echo wp_basename( $file ); |
|
397 | + $file = get_attached_file($post->ID); |
|
398 | + echo wp_basename($file); |
|
399 | 399 | ?> |
400 | 400 | </p> |
401 | 401 | <?php |
@@ -409,9 +409,9 @@ discard block |
||
409 | 409 | * |
410 | 410 | * @param WP_Post $post The current WP_Post object. |
411 | 411 | */ |
412 | - public function column_author( $post ) { |
|
413 | - printf( '<a href="%s">%s</a>', |
|
414 | - esc_url( add_query_arg( array( 'author' => get_the_author_meta('ID') ), 'upload.php' ) ), |
|
412 | + public function column_author($post) { |
|
413 | + printf('<a href="%s">%s</a>', |
|
414 | + esc_url(add_query_arg(array('author' => get_the_author_meta('ID')), 'upload.php')), |
|
415 | 415 | get_the_author() |
416 | 416 | ); |
417 | 417 | } |
@@ -424,7 +424,7 @@ discard block |
||
424 | 424 | * |
425 | 425 | * @param WP_Post $post The current WP_Post object. |
426 | 426 | */ |
427 | - public function column_desc( $post ) { |
|
427 | + public function column_desc($post) { |
|
428 | 428 | echo has_excerpt() ? $post->post_excerpt : ''; |
429 | 429 | } |
430 | 430 | |
@@ -436,20 +436,20 @@ discard block |
||
436 | 436 | * |
437 | 437 | * @param WP_Post $post The current WP_Post object. |
438 | 438 | */ |
439 | - public function column_date( $post ) { |
|
440 | - if ( '0000-00-00 00:00:00' === $post->post_date ) { |
|
441 | - $h_time = __( 'Unpublished' ); |
|
439 | + public function column_date($post) { |
|
440 | + if ('0000-00-00 00:00:00' === $post->post_date) { |
|
441 | + $h_time = __('Unpublished'); |
|
442 | 442 | } else { |
443 | 443 | $m_time = $post->post_date; |
444 | - $time = get_post_time( 'G', true, $post, false ); |
|
445 | - if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) { |
|
446 | - if ( $t_diff < 0 ) { |
|
447 | - $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) ); |
|
444 | + $time = get_post_time('G', true, $post, false); |
|
445 | + if ((abs($t_diff = time() - $time)) < DAY_IN_SECONDS) { |
|
446 | + if ($t_diff < 0) { |
|
447 | + $h_time = sprintf(__('%s from now'), human_time_diff($time)); |
|
448 | 448 | } else { |
449 | - $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) ); |
|
449 | + $h_time = sprintf(__('%s ago'), human_time_diff($time)); |
|
450 | 450 | } |
451 | 451 | } else { |
452 | - $h_time = mysql2date( __( 'Y/m/d' ), $m_time ); |
|
452 | + $h_time = mysql2date(__('Y/m/d'), $m_time); |
|
453 | 453 | } |
454 | 454 | } |
455 | 455 | |
@@ -464,52 +464,52 @@ discard block |
||
464 | 464 | * |
465 | 465 | * @param WP_Post $post The current WP_Post object. |
466 | 466 | */ |
467 | - public function column_parent( $post ) { |
|
468 | - $user_can_edit = current_user_can( 'edit_post', $post->ID ); |
|
467 | + public function column_parent($post) { |
|
468 | + $user_can_edit = current_user_can('edit_post', $post->ID); |
|
469 | 469 | |
470 | - if ( $post->post_parent > 0 ) { |
|
471 | - $parent = get_post( $post->post_parent ); |
|
470 | + if ($post->post_parent > 0) { |
|
471 | + $parent = get_post($post->post_parent); |
|
472 | 472 | } else { |
473 | 473 | $parent = false; |
474 | 474 | } |
475 | 475 | |
476 | - if ( $parent ) { |
|
477 | - $title = _draft_or_post_title( $post->post_parent ); |
|
478 | - $parent_type = get_post_type_object( $parent->post_type ); |
|
476 | + if ($parent) { |
|
477 | + $title = _draft_or_post_title($post->post_parent); |
|
478 | + $parent_type = get_post_type_object($parent->post_type); |
|
479 | 479 | ?> |
480 | 480 | <strong> |
481 | - <?php if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) { ?> |
|
482 | - <a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"> |
|
481 | + <?php if ($parent_type && $parent_type->show_ui && current_user_can('edit_post', $post->post_parent)) { ?> |
|
482 | + <a href="<?php echo get_edit_post_link($post->post_parent); ?>"> |
|
483 | 483 | <?php echo $title ?></a><?php |
484 | 484 | } else { |
485 | 485 | echo $title; |
486 | 486 | } ?></strong> |
487 | 487 | <br /> |
488 | 488 | <?php |
489 | - if ( $user_can_edit ): |
|
490 | - $detach_url = add_query_arg( array( |
|
489 | + if ($user_can_edit): |
|
490 | + $detach_url = add_query_arg(array( |
|
491 | 491 | 'parent_post_id' => $post->post_parent, |
492 | 492 | 'media[]' => $post->ID, |
493 | - '_wpnonce' => wp_create_nonce( 'bulk-' . $this->_args['plural'] ) |
|
494 | - ), 'upload.php' ); |
|
493 | + '_wpnonce' => wp_create_nonce('bulk-'.$this->_args['plural']) |
|
494 | + ), 'upload.php'); |
|
495 | 495 | printf( |
496 | 496 | '<a href="%s" class="hide-if-no-js detach-from-parent" aria-label="%s">%s</a>', |
497 | 497 | $detach_url, |
498 | 498 | /* translators: %s: title of the post the attachment is attached to */ |
499 | - esc_attr( sprintf( __( 'Detach from “%s”' ), $title ) ), |
|
500 | - __( 'Detach' ) |
|
499 | + esc_attr(sprintf(__('Detach from “%s”'), $title)), |
|
500 | + __('Detach') |
|
501 | 501 | ); |
502 | 502 | endif; |
503 | 503 | } else { |
504 | - _e( '(Unattached)' ); ?><br /> |
|
505 | - <?php if ( $user_can_edit ) { |
|
506 | - $title = _draft_or_post_title( $post->post_parent ); |
|
504 | + _e('(Unattached)'); ?><br /> |
|
505 | + <?php if ($user_can_edit) { |
|
506 | + $title = _draft_or_post_title($post->post_parent); |
|
507 | 507 | printf( |
508 | 508 | '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>', |
509 | 509 | $post->ID, |
510 | 510 | /* translators: %s: attachment title */ |
511 | - esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $title ) ), |
|
512 | - __( 'Attach' ) |
|
511 | + esc_attr(sprintf(__('Attach “%s” to existing content'), $title)), |
|
512 | + __('Attach') |
|
513 | 513 | ); |
514 | 514 | } |
515 | 515 | } |
@@ -523,16 +523,16 @@ discard block |
||
523 | 523 | * |
524 | 524 | * @param WP_Post $post The current WP_Post object. |
525 | 525 | */ |
526 | - public function column_comments( $post ) { |
|
526 | + public function column_comments($post) { |
|
527 | 527 | echo '<div class="post-com-count-wrapper">'; |
528 | 528 | |
529 | - if ( isset( $this->comment_pending_count[ $post->ID ] ) ) { |
|
530 | - $pending_comments = $this->comment_pending_count[ $post->ID ]; |
|
529 | + if (isset($this->comment_pending_count[$post->ID])) { |
|
530 | + $pending_comments = $this->comment_pending_count[$post->ID]; |
|
531 | 531 | } else { |
532 | - $pending_comments = get_pending_comments_num( $post->ID ); |
|
532 | + $pending_comments = get_pending_comments_num($post->ID); |
|
533 | 533 | } |
534 | 534 | |
535 | - $this->comments_bubble( $post->ID, $pending_comments ); |
|
535 | + $this->comments_bubble($post->ID, $pending_comments); |
|
536 | 536 | |
537 | 537 | echo '</div>'; |
538 | 538 | } |
@@ -546,35 +546,35 @@ discard block |
||
546 | 546 | * @param WP_Post $post The current WP_Post object. |
547 | 547 | * @param string $column_name Current column name. |
548 | 548 | */ |
549 | - public function column_default( $post, $column_name ) { |
|
550 | - if ( 'categories' === $column_name ) { |
|
549 | + public function column_default($post, $column_name) { |
|
550 | + if ('categories' === $column_name) { |
|
551 | 551 | $taxonomy = 'category'; |
552 | - } elseif ( 'tags' === $column_name ) { |
|
552 | + } elseif ('tags' === $column_name) { |
|
553 | 553 | $taxonomy = 'post_tag'; |
554 | - } elseif ( 0 === strpos( $column_name, 'taxonomy-' ) ) { |
|
555 | - $taxonomy = substr( $column_name, 9 ); |
|
554 | + } elseif (0 === strpos($column_name, 'taxonomy-')) { |
|
555 | + $taxonomy = substr($column_name, 9); |
|
556 | 556 | } else { |
557 | 557 | $taxonomy = false; |
558 | 558 | } |
559 | 559 | |
560 | - if ( $taxonomy ) { |
|
561 | - $terms = get_the_terms( $post->ID, $taxonomy ); |
|
562 | - if ( is_array( $terms ) ) { |
|
560 | + if ($taxonomy) { |
|
561 | + $terms = get_the_terms($post->ID, $taxonomy); |
|
562 | + if (is_array($terms)) { |
|
563 | 563 | $out = array(); |
564 | - foreach ( $terms as $t ) { |
|
564 | + foreach ($terms as $t) { |
|
565 | 565 | $posts_in_term_qv = array(); |
566 | 566 | $posts_in_term_qv['taxonomy'] = $taxonomy; |
567 | 567 | $posts_in_term_qv['term'] = $t->slug; |
568 | 568 | |
569 | - $out[] = sprintf( '<a href="%s">%s</a>', |
|
570 | - esc_url( add_query_arg( $posts_in_term_qv, 'upload.php' ) ), |
|
571 | - esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) ) |
|
569 | + $out[] = sprintf('<a href="%s">%s</a>', |
|
570 | + esc_url(add_query_arg($posts_in_term_qv, 'upload.php')), |
|
571 | + esc_html(sanitize_term_field('name', $t->name, $t->term_id, $taxonomy, 'display')) |
|
572 | 572 | ); |
573 | 573 | } |
574 | 574 | /* translators: used between list items, there is a space after the comma */ |
575 | - echo join( __( ', ' ), $out ); |
|
575 | + echo join(__(', '), $out); |
|
576 | 576 | } else { |
577 | - echo '<span aria-hidden="true">—</span><span class="screen-reader-text">' . get_taxonomy( $taxonomy )->labels->no_terms . '</span>'; |
|
577 | + echo '<span aria-hidden="true">—</span><span class="screen-reader-text">'.get_taxonomy($taxonomy)->labels->no_terms.'</span>'; |
|
578 | 578 | } |
579 | 579 | |
580 | 580 | return; |
@@ -590,7 +590,7 @@ discard block |
||
590 | 590 | * @param string $column_name Name of the custom column. |
591 | 591 | * @param int $post_id Attachment ID. |
592 | 592 | */ |
593 | - do_action( 'manage_media_custom_column', $column_name, $post->ID ); |
|
593 | + do_action('manage_media_custom_column', $column_name, $post->ID); |
|
594 | 594 | } |
595 | 595 | |
596 | 596 | /** |
@@ -600,24 +600,24 @@ discard block |
||
600 | 600 | public function display_rows() { |
601 | 601 | global $post, $wp_query; |
602 | 602 | |
603 | - $post_ids = wp_list_pluck( $wp_query->posts, 'ID' ); |
|
604 | - reset( $wp_query->posts ); |
|
603 | + $post_ids = wp_list_pluck($wp_query->posts, 'ID'); |
|
604 | + reset($wp_query->posts); |
|
605 | 605 | |
606 | - $this->comment_pending_count = get_pending_comments_num( $post_ids ); |
|
606 | + $this->comment_pending_count = get_pending_comments_num($post_ids); |
|
607 | 607 | |
608 | - add_filter( 'the_title','esc_html' ); |
|
608 | + add_filter('the_title', 'esc_html'); |
|
609 | 609 | |
610 | - while ( have_posts() ) : the_post(); |
|
610 | + while (have_posts()) : the_post(); |
|
611 | 611 | if ( |
612 | - ( $this->is_trash && $post->post_status != 'trash' ) |
|
613 | - || ( ! $this->is_trash && $post->post_status === 'trash' ) |
|
612 | + ($this->is_trash && $post->post_status != 'trash') |
|
613 | + || ( ! $this->is_trash && $post->post_status === 'trash') |
|
614 | 614 | ) { |
615 | 615 | continue; |
616 | 616 | } |
617 | - $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other'; |
|
617 | + $post_owner = (get_current_user_id() == $post->post_author) ? 'self' : 'other'; |
|
618 | 618 | ?> |
619 | - <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim( ' author-' . $post_owner . ' status-' . $post->post_status ); ?>"> |
|
620 | - <?php $this->single_row_columns( $post ); ?> |
|
619 | + <tr id="post-<?php echo $post->ID; ?>" class="<?php echo trim(' author-'.$post_owner.' status-'.$post->post_status); ?>"> |
|
620 | + <?php $this->single_row_columns($post); ?> |
|
621 | 621 | </tr> |
622 | 622 | <?php |
623 | 623 | endwhile; |
@@ -641,105 +641,105 @@ discard block |
||
641 | 641 | * |
642 | 642 | * @return array |
643 | 643 | */ |
644 | - private function _get_row_actions( $post, $att_title ) { |
|
644 | + private function _get_row_actions($post, $att_title) { |
|
645 | 645 | $actions = array(); |
646 | 646 | |
647 | - if ( $this->detached ) { |
|
648 | - if ( current_user_can( 'edit_post', $post->ID ) ) { |
|
647 | + if ($this->detached) { |
|
648 | + if (current_user_can('edit_post', $post->ID)) { |
|
649 | 649 | $actions['edit'] = sprintf( |
650 | 650 | '<a href="%s" aria-label="%s">%s</a>', |
651 | - get_edit_post_link( $post->ID ), |
|
651 | + get_edit_post_link($post->ID), |
|
652 | 652 | /* translators: %s: attachment title */ |
653 | - esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), |
|
654 | - __( 'Edit' ) |
|
653 | + esc_attr(sprintf(__('Edit “%s”'), $att_title)), |
|
654 | + __('Edit') |
|
655 | 655 | ); |
656 | 656 | } |
657 | - if ( current_user_can( 'delete_post', $post->ID ) ) { |
|
658 | - if ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
657 | + if (current_user_can('delete_post', $post->ID)) { |
|
658 | + if (EMPTY_TRASH_DAYS && MEDIA_TRASH) { |
|
659 | 659 | $actions['trash'] = sprintf( |
660 | 660 | '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', |
661 | - wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), |
|
661 | + wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_'.$post->ID), |
|
662 | 662 | /* translators: %s: attachment title */ |
663 | - esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), |
|
664 | - _x( 'Trash', 'verb' ) |
|
663 | + esc_attr(sprintf(__('Move “%s” to the Trash'), $att_title)), |
|
664 | + _x('Trash', 'verb') |
|
665 | 665 | ); |
666 | 666 | } else { |
667 | 667 | $delete_ays = ! MEDIA_TRASH ? " onclick='return showNotice.warn();'" : ''; |
668 | 668 | $actions['delete'] = sprintf( |
669 | 669 | '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>', |
670 | - wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), |
|
670 | + wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_'.$post->ID), |
|
671 | 671 | $delete_ays, |
672 | 672 | /* translators: %s: attachment title */ |
673 | - esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), |
|
674 | - __( 'Delete Permanently' ) |
|
673 | + esc_attr(sprintf(__('Delete “%s” permanently'), $att_title)), |
|
674 | + __('Delete Permanently') |
|
675 | 675 | ); |
676 | 676 | } |
677 | 677 | } |
678 | 678 | $actions['view'] = sprintf( |
679 | 679 | '<a href="%s" aria-label="%s" rel="permalink">%s</a>', |
680 | - get_permalink( $post->ID ), |
|
680 | + get_permalink($post->ID), |
|
681 | 681 | /* translators: %s: attachment title */ |
682 | - esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), |
|
683 | - __( 'View' ) |
|
682 | + esc_attr(sprintf(__('View “%s”'), $att_title)), |
|
683 | + __('View') |
|
684 | 684 | ); |
685 | 685 | |
686 | - if ( current_user_can( 'edit_post', $post->ID ) ) { |
|
686 | + if (current_user_can('edit_post', $post->ID)) { |
|
687 | 687 | $actions['attach'] = sprintf( |
688 | 688 | '<a href="#the-list" onclick="findPosts.open( \'media[]\', \'%s\' ); return false;" class="hide-if-no-js" aria-label="%s">%s</a>', |
689 | 689 | $post->ID, |
690 | 690 | /* translators: %s: attachment title */ |
691 | - esc_attr( sprintf( __( 'Attach “%s” to existing content' ), $att_title ) ), |
|
692 | - __( 'Attach' ) |
|
691 | + esc_attr(sprintf(__('Attach “%s” to existing content'), $att_title)), |
|
692 | + __('Attach') |
|
693 | 693 | ); |
694 | 694 | } |
695 | 695 | } |
696 | 696 | else { |
697 | - if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) { |
|
697 | + if (current_user_can('edit_post', $post->ID) && ! $this->is_trash) { |
|
698 | 698 | $actions['edit'] = sprintf( |
699 | 699 | '<a href="%s" aria-label="%s">%s</a>', |
700 | - get_edit_post_link( $post->ID ), |
|
700 | + get_edit_post_link($post->ID), |
|
701 | 701 | /* translators: %s: attachment title */ |
702 | - esc_attr( sprintf( __( 'Edit “%s”' ), $att_title ) ), |
|
703 | - __( 'Edit' ) |
|
702 | + esc_attr(sprintf(__('Edit “%s”'), $att_title)), |
|
703 | + __('Edit') |
|
704 | 704 | ); |
705 | 705 | } |
706 | - if ( current_user_can( 'delete_post', $post->ID ) ) { |
|
707 | - if ( $this->is_trash ) { |
|
706 | + if (current_user_can('delete_post', $post->ID)) { |
|
707 | + if ($this->is_trash) { |
|
708 | 708 | $actions['untrash'] = sprintf( |
709 | 709 | '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', |
710 | - wp_nonce_url( "post.php?action=untrash&post=$post->ID", 'untrash-post_' . $post->ID ), |
|
710 | + wp_nonce_url("post.php?action=untrash&post=$post->ID", 'untrash-post_'.$post->ID), |
|
711 | 711 | /* translators: %s: attachment title */ |
712 | - esc_attr( sprintf( __( 'Restore “%s” from the Trash' ), $att_title ) ), |
|
713 | - __( 'Restore' ) |
|
712 | + esc_attr(sprintf(__('Restore “%s” from the Trash'), $att_title)), |
|
713 | + __('Restore') |
|
714 | 714 | ); |
715 | - } elseif ( EMPTY_TRASH_DAYS && MEDIA_TRASH ) { |
|
715 | + } elseif (EMPTY_TRASH_DAYS && MEDIA_TRASH) { |
|
716 | 716 | $actions['trash'] = sprintf( |
717 | 717 | '<a href="%s" class="submitdelete" aria-label="%s">%s</a>', |
718 | - wp_nonce_url( "post.php?action=trash&post=$post->ID", 'trash-post_' . $post->ID ), |
|
718 | + wp_nonce_url("post.php?action=trash&post=$post->ID", 'trash-post_'.$post->ID), |
|
719 | 719 | /* translators: %s: attachment title */ |
720 | - esc_attr( sprintf( __( 'Move “%s” to the Trash' ), $att_title ) ), |
|
721 | - _x( 'Trash', 'verb' ) |
|
720 | + esc_attr(sprintf(__('Move “%s” to the Trash'), $att_title)), |
|
721 | + _x('Trash', 'verb') |
|
722 | 722 | ); |
723 | 723 | } |
724 | - if ( $this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH ) { |
|
725 | - $delete_ays = ( !$this->is_trash && !MEDIA_TRASH ) ? " onclick='return showNotice.warn();'" : ''; |
|
724 | + if ($this->is_trash || ! EMPTY_TRASH_DAYS || ! MEDIA_TRASH) { |
|
725 | + $delete_ays = ( ! $this->is_trash && ! MEDIA_TRASH) ? " onclick='return showNotice.warn();'" : ''; |
|
726 | 726 | $actions['delete'] = sprintf( |
727 | 727 | '<a href="%s" class="submitdelete"%s aria-label="%s">%s</a>', |
728 | - wp_nonce_url( "post.php?action=delete&post=$post->ID", 'delete-post_' . $post->ID ), |
|
728 | + wp_nonce_url("post.php?action=delete&post=$post->ID", 'delete-post_'.$post->ID), |
|
729 | 729 | $delete_ays, |
730 | 730 | /* translators: %s: attachment title */ |
731 | - esc_attr( sprintf( __( 'Delete “%s” permanently' ), $att_title ) ), |
|
732 | - __( 'Delete Permanently' ) |
|
731 | + esc_attr(sprintf(__('Delete “%s” permanently'), $att_title)), |
|
732 | + __('Delete Permanently') |
|
733 | 733 | ); |
734 | 734 | } |
735 | 735 | } |
736 | - if ( ! $this->is_trash ) { |
|
736 | + if ( ! $this->is_trash) { |
|
737 | 737 | $actions['view'] = sprintf( |
738 | 738 | '<a href="%s" aria-label="%s" rel="permalink">%s</a>', |
739 | - get_permalink( $post->ID ), |
|
739 | + get_permalink($post->ID), |
|
740 | 740 | /* translators: %s: attachment title */ |
741 | - esc_attr( sprintf( __( 'View “%s”' ), $att_title ) ), |
|
742 | - __( 'View' ) |
|
741 | + esc_attr(sprintf(__('View “%s”'), $att_title)), |
|
742 | + __('View') |
|
743 | 743 | ); |
744 | 744 | } |
745 | 745 | } |
@@ -755,7 +755,7 @@ discard block |
||
755 | 755 | * @param bool $detached Whether the list table contains media not attached |
756 | 756 | * to any posts. Default true. |
757 | 757 | */ |
758 | - return apply_filters( 'media_row_actions', $actions, $post, $this->detached ); |
|
758 | + return apply_filters('media_row_actions', $actions, $post, $this->detached); |
|
759 | 759 | } |
760 | 760 | |
761 | 761 | /** |
@@ -769,12 +769,12 @@ discard block |
||
769 | 769 | * @param string $primary Primary column name. |
770 | 770 | * @return string Row actions output for media attachments. |
771 | 771 | */ |
772 | - protected function handle_row_actions( $post, $column_name, $primary ) { |
|
773 | - if ( $primary !== $column_name ) { |
|
772 | + protected function handle_row_actions($post, $column_name, $primary) { |
|
773 | + if ($primary !== $column_name) { |
|
774 | 774 | return ''; |
775 | 775 | } |
776 | 776 | |
777 | 777 | $att_title = _draft_or_post_title(); |
778 | - return $this->row_actions( $this->_get_row_actions( $post, $att_title ) ); |
|
778 | + return $this->row_actions($this->_get_row_actions($post, $att_title)); |
|
779 | 779 | } |
780 | 780 | } |
@@ -150,8 +150,9 @@ discard block |
||
150 | 150 | $actions['delete'] = __( 'Delete Permanently' ); |
151 | 151 | } |
152 | 152 | |
153 | - if ( $this->detached ) |
|
154 | - $actions['attach'] = __( 'Attach' ); |
|
153 | + if ( $this->detached ) { |
|
154 | + $actions['attach'] = __( 'Attach' ); |
|
155 | + } |
|
155 | 156 | |
156 | 157 | return $actions; |
157 | 158 | } |
@@ -189,14 +190,17 @@ discard block |
||
189 | 190 | * @return string |
190 | 191 | */ |
191 | 192 | public function current_action() { |
192 | - if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
193 | - return 'attach'; |
|
193 | + if ( isset( $_REQUEST['found_post_id'] ) && isset( $_REQUEST['media'] ) ) { |
|
194 | + return 'attach'; |
|
195 | + } |
|
194 | 196 | |
195 | - if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) |
|
196 | - return 'detach'; |
|
197 | + if ( isset( $_REQUEST['parent_post_id'] ) && isset( $_REQUEST['media'] ) ) { |
|
198 | + return 'detach'; |
|
199 | + } |
|
197 | 200 | |
198 | - if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
|
199 | - return 'delete_all'; |
|
201 | + if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { |
|
202 | + return 'delete_all'; |
|
203 | + } |
|
200 | 204 | |
201 | 205 | return parent::current_action(); |
202 | 206 | } |
@@ -306,8 +310,9 @@ discard block |
||
306 | 310 | /* translators: column name */ |
307 | 311 | if ( !$this->detached ) { |
308 | 312 | $posts_columns['parent'] = _x( 'Uploaded to', 'column name' ); |
309 | - if ( post_type_supports( 'attachment', 'comments' ) ) |
|
310 | - $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
|
313 | + if ( post_type_supports( 'attachment', 'comments' ) ) { |
|
314 | + $posts_columns['comments'] = '<span class="vers comment-grey-bubble" title="' . esc_attr__( 'Comments' ) . '"><span class="screen-reader-text">' . __( 'Comments' ) . '</span></span>'; |
|
315 | + } |
|
311 | 316 | } |
312 | 317 | /* translators: column name */ |
313 | 318 | $posts_columns['date'] = _x( 'Date', 'column name' ); |
@@ -692,8 +697,7 @@ discard block |
||
692 | 697 | __( 'Attach' ) |
693 | 698 | ); |
694 | 699 | } |
695 | - } |
|
696 | - else { |
|
700 | + } else { |
|
697 | 701 | if ( current_user_can( 'edit_post', $post->ID ) && !$this->is_trash ) { |
698 | 702 | $actions['edit'] = sprintf( |
699 | 703 | '<a href="%s" aria-label="%s">%s</a>', |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * List Table API: WP_Theme_Install_List_Table class |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * List Table API: WP_Theme_Install_List_Table class |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Core class used to implement displaying themes to install in a list table. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * @return bool |
25 | 25 | */ |
26 | 26 | public function ajax_user_can() { |
27 | - return current_user_can( 'install_themes' ); |
|
27 | + return current_user_can('install_themes'); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | /** |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | * @global array $theme_field_defaults |
37 | 37 | */ |
38 | 38 | public function prepare_items() { |
39 | - include( ABSPATH . 'wp-admin/includes/theme-install.php' ); |
|
39 | + include(ABSPATH.'wp-admin/includes/theme-install.php'); |
|
40 | 40 | |
41 | 41 | global $tabs, $tab, $paged, $type, $theme_field_defaults; |
42 | - wp_reset_vars( array( 'tab' ) ); |
|
42 | + wp_reset_vars(array('tab')); |
|
43 | 43 | |
44 | 44 | $search_terms = array(); |
45 | 45 | $search_string = ''; |
46 | - if ( ! empty( $_REQUEST['s'] ) ){ |
|
47 | - $search_string = strtolower( wp_unslash( $_REQUEST['s'] ) ); |
|
48 | - $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); |
|
46 | + if ( ! empty($_REQUEST['s'])) { |
|
47 | + $search_string = strtolower(wp_unslash($_REQUEST['s'])); |
|
48 | + $search_terms = array_unique(array_filter(array_map('trim', explode(',', $search_string)))); |
|
49 | 49 | } |
50 | 50 | |
51 | - if ( ! empty( $_REQUEST['features'] ) ) |
|
51 | + if ( ! empty($_REQUEST['features'])) |
|
52 | 52 | $this->features = $_REQUEST['features']; |
53 | 53 | |
54 | 54 | $paged = $this->get_pagenum(); |
@@ -57,19 +57,19 @@ discard block |
||
57 | 57 | |
58 | 58 | // These are the tabs which are shown on the page, |
59 | 59 | $tabs = array(); |
60 | - $tabs['dashboard'] = __( 'Search' ); |
|
61 | - if ( 'search' === $tab ) |
|
62 | - $tabs['search'] = __( 'Search Results' ); |
|
63 | - $tabs['upload'] = __( 'Upload' ); |
|
64 | - $tabs['featured'] = _x( 'Featured', 'themes' ); |
|
60 | + $tabs['dashboard'] = __('Search'); |
|
61 | + if ('search' === $tab) |
|
62 | + $tabs['search'] = __('Search Results'); |
|
63 | + $tabs['upload'] = __('Upload'); |
|
64 | + $tabs['featured'] = _x('Featured', 'themes'); |
|
65 | 65 | //$tabs['popular'] = _x( 'Popular', 'themes' ); |
66 | - $tabs['new'] = _x( 'Latest', 'themes' ); |
|
67 | - $tabs['updated'] = _x( 'Recently Updated', 'themes' ); |
|
66 | + $tabs['new'] = _x('Latest', 'themes'); |
|
67 | + $tabs['updated'] = _x('Recently Updated', 'themes'); |
|
68 | 68 | |
69 | - $nonmenu_tabs = array( 'theme-information' ); // Valid actions to perform which do not have a Menu item. |
|
69 | + $nonmenu_tabs = array('theme-information'); // Valid actions to perform which do not have a Menu item. |
|
70 | 70 | |
71 | 71 | /** This filter is documented in wp-admin/theme-install.php */ |
72 | - $tabs = apply_filters( 'install_themes_tabs', $tabs ); |
|
72 | + $tabs = apply_filters('install_themes_tabs', $tabs); |
|
73 | 73 | |
74 | 74 | /** |
75 | 75 | * Filter tabs not associated with a menu item on the Install Themes screen. |
@@ -79,20 +79,20 @@ discard block |
||
79 | 79 | * @param array $nonmenu_tabs The tabs that don't have a menu item on |
80 | 80 | * the Install Themes screen. |
81 | 81 | */ |
82 | - $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); |
|
82 | + $nonmenu_tabs = apply_filters('install_themes_nonmenu_tabs', $nonmenu_tabs); |
|
83 | 83 | |
84 | 84 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
85 | - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) |
|
86 | - $tab = key( $tabs ); |
|
85 | + if (empty($tab) || ( ! isset($tabs[$tab]) && ! in_array($tab, (array) $nonmenu_tabs))) |
|
86 | + $tab = key($tabs); |
|
87 | 87 | |
88 | - $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults ); |
|
88 | + $args = array('page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults); |
|
89 | 89 | |
90 | - switch ( $tab ) { |
|
90 | + switch ($tab) { |
|
91 | 91 | case 'search': |
92 | - $type = isset( $_REQUEST['type'] ) ? wp_unslash( $_REQUEST['type'] ) : 'term'; |
|
93 | - switch ( $type ) { |
|
92 | + $type = isset($_REQUEST['type']) ? wp_unslash($_REQUEST['type']) : 'term'; |
|
93 | + switch ($type) { |
|
94 | 94 | case 'tag': |
95 | - $args['tag'] = array_map( 'sanitize_key', $search_terms ); |
|
95 | + $args['tag'] = array_map('sanitize_key', $search_terms); |
|
96 | 96 | break; |
97 | 97 | case 'term': |
98 | 98 | $args['search'] = $search_string; |
@@ -102,13 +102,13 @@ discard block |
||
102 | 102 | break; |
103 | 103 | } |
104 | 104 | |
105 | - if ( ! empty( $this->features ) ) { |
|
105 | + if ( ! empty($this->features)) { |
|
106 | 106 | $args['tag'] = $this->features; |
107 | - $_REQUEST['s'] = implode( ',', $this->features ); |
|
107 | + $_REQUEST['s'] = implode(',', $this->features); |
|
108 | 108 | $_REQUEST['type'] = 'tag'; |
109 | 109 | } |
110 | 110 | |
111 | - add_action( 'install_themes_table_header', 'install_theme_search_form', 10, 0 ); |
|
111 | + add_action('install_themes_table_header', 'install_theme_search_form', 10, 0); |
|
112 | 112 | break; |
113 | 113 | |
114 | 114 | case 'featured': |
@@ -134,30 +134,30 @@ discard block |
||
134 | 134 | * |
135 | 135 | * @param array $args An array of themes API arguments. |
136 | 136 | */ |
137 | - $args = apply_filters( 'install_themes_table_api_args_' . $tab, $args ); |
|
137 | + $args = apply_filters('install_themes_table_api_args_'.$tab, $args); |
|
138 | 138 | |
139 | - if ( ! $args ) |
|
139 | + if ( ! $args) |
|
140 | 140 | return; |
141 | 141 | |
142 | - $api = themes_api( 'query_themes', $args ); |
|
142 | + $api = themes_api('query_themes', $args); |
|
143 | 143 | |
144 | - if ( is_wp_error( $api ) ) |
|
145 | - wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' ); |
|
144 | + if (is_wp_error($api)) |
|
145 | + wp_die($api->get_error_message().'</p> <p><a href="#" onclick="document.location.reload(); return false;">'.__('Try again').'</a>'); |
|
146 | 146 | |
147 | 147 | $this->items = $api->themes; |
148 | 148 | |
149 | - $this->set_pagination_args( array( |
|
149 | + $this->set_pagination_args(array( |
|
150 | 150 | 'total_items' => $api->info['results'], |
151 | 151 | 'per_page' => $args['per_page'], |
152 | 152 | 'infinite_scroll' => true, |
153 | - ) ); |
|
153 | + )); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | /** |
157 | 157 | * @access public |
158 | 158 | */ |
159 | 159 | public function no_items() { |
160 | - _e( 'No themes match your request.' ); |
|
160 | + _e('No themes match your request.'); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | /** |
@@ -170,9 +170,9 @@ discard block |
||
170 | 170 | global $tabs, $tab; |
171 | 171 | |
172 | 172 | $display_tabs = array(); |
173 | - foreach ( (array) $tabs as $action => $text ) { |
|
174 | - $class = ( $action === $tab ) ? ' class="current"' : ''; |
|
175 | - $href = self_admin_url('theme-install.php?tab=' . $action); |
|
173 | + foreach ((array) $tabs as $action => $text) { |
|
174 | + $class = ($action === $tab) ? ' class="current"' : ''; |
|
175 | + $href = self_admin_url('theme-install.php?tab='.$action); |
|
176 | 176 | $display_tabs['theme-install-'.$action] = "<a href='$href'$class>$text</a>"; |
177 | 177 | } |
178 | 178 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @access public |
184 | 184 | */ |
185 | 185 | public function display() { |
186 | - wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
186 | + wp_nonce_field("fetch-list-".get_class($this), '_ajax_fetch_list_nonce'); |
|
187 | 187 | ?> |
188 | 188 | <div class="tablenav top themes"> |
189 | 189 | <div class="alignleft actions"> |
@@ -193,10 +193,10 @@ discard block |
||
193 | 193 | * |
194 | 194 | * @since 2.8.0 |
195 | 195 | */ |
196 | - do_action( 'install_themes_table_header' ); |
|
196 | + do_action('install_themes_table_header'); |
|
197 | 197 | ?> |
198 | 198 | </div> |
199 | - <?php $this->pagination( 'top' ); ?> |
|
199 | + <?php $this->pagination('top'); ?> |
|
200 | 200 | <br class="clear" /> |
201 | 201 | </div> |
202 | 202 | |
@@ -205,7 +205,7 @@ discard block |
||
205 | 205 | </div> |
206 | 206 | |
207 | 207 | <?php |
208 | - $this->tablenav( 'bottom' ); |
|
208 | + $this->tablenav('bottom'); |
|
209 | 209 | } |
210 | 210 | |
211 | 211 | /** |
@@ -213,10 +213,10 @@ discard block |
||
213 | 213 | */ |
214 | 214 | public function display_rows() { |
215 | 215 | $themes = $this->items; |
216 | - foreach ( $themes as $theme ) { |
|
216 | + foreach ($themes as $theme) { |
|
217 | 217 | ?> |
218 | 218 | <div class="available-theme installable-theme"><?php |
219 | - $this->single_row( $theme ); |
|
219 | + $this->single_row($theme); |
|
220 | 220 | ?></div> |
221 | 221 | <?php } // end foreach $theme_names |
222 | 222 | |
@@ -244,50 +244,50 @@ discard block |
||
244 | 244 | * public 'description' => string 'A basic magazine style layout with a fully customizable layout through a back-end interface. Designed by <a href="http://bavotasan.com">c.bavota</a> of <a href="http://tinkerpriestmedia.com">Tinker Priest Media</a>.' |
245 | 245 | * public 'download_link' => string 'http://wordpress.org/themes/download/magazine-basic.1.1.zip' |
246 | 246 | */ |
247 | - public function single_row( $theme ) { |
|
247 | + public function single_row($theme) { |
|
248 | 248 | global $themes_allowedtags; |
249 | 249 | |
250 | - if ( empty( $theme ) ) |
|
250 | + if (empty($theme)) |
|
251 | 251 | return; |
252 | 252 | |
253 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
254 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
253 | + $name = wp_kses($theme->name, $themes_allowedtags); |
|
254 | + $author = wp_kses($theme->author, $themes_allowedtags); |
|
255 | 255 | |
256 | - $preview_title = sprintf( __('Preview “%s”'), $name ); |
|
257 | - $preview_url = add_query_arg( array( |
|
256 | + $preview_title = sprintf(__('Preview “%s”'), $name); |
|
257 | + $preview_url = add_query_arg(array( |
|
258 | 258 | 'tab' => 'theme-information', |
259 | 259 | 'theme' => $theme->slug, |
260 | - ), self_admin_url( 'theme-install.php' ) ); |
|
260 | + ), self_admin_url('theme-install.php')); |
|
261 | 261 | |
262 | 262 | $actions = array(); |
263 | 263 | |
264 | - $install_url = add_query_arg( array( |
|
264 | + $install_url = add_query_arg(array( |
|
265 | 265 | 'action' => 'install-theme', |
266 | 266 | 'theme' => $theme->slug, |
267 | - ), self_admin_url( 'update.php' ) ); |
|
267 | + ), self_admin_url('update.php')); |
|
268 | 268 | |
269 | - $update_url = add_query_arg( array( |
|
269 | + $update_url = add_query_arg(array( |
|
270 | 270 | 'action' => 'upgrade-theme', |
271 | 271 | 'theme' => $theme->slug, |
272 | - ), self_admin_url( 'update.php' ) ); |
|
272 | + ), self_admin_url('update.php')); |
|
273 | 273 | |
274 | - $status = $this->_get_theme_status( $theme ); |
|
274 | + $status = $this->_get_theme_status($theme); |
|
275 | 275 | |
276 | - switch ( $status ) { |
|
276 | + switch ($status) { |
|
277 | 277 | case 'update_available': |
278 | - $actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>'; |
|
278 | + $actions[] = '<a class="install-now" href="'.esc_url(wp_nonce_url($update_url, 'upgrade-theme_'.$theme->slug)).'" title="'.esc_attr(sprintf(__('Update to version %s'), $theme->version)).'">'.__('Update').'</a>'; |
|
279 | 279 | break; |
280 | 280 | case 'newer_installed': |
281 | 281 | case 'latest_installed': |
282 | - $actions[] = '<span class="install-now" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>'; |
|
282 | + $actions[] = '<span class="install-now" title="'.esc_attr__('This theme is already installed and is up to date').'">'._x('Installed', 'theme').'</span>'; |
|
283 | 283 | break; |
284 | 284 | case 'install': |
285 | 285 | default: |
286 | - $actions[] = '<a class="install-now" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Install %s' ), $name ) ) . '">' . __( 'Install Now' ) . '</a>'; |
|
286 | + $actions[] = '<a class="install-now" href="'.esc_url(wp_nonce_url($install_url, 'install-theme_'.$theme->slug)).'" title="'.esc_attr(sprintf(__('Install %s'), $name)).'">'.__('Install Now').'</a>'; |
|
287 | 287 | break; |
288 | 288 | } |
289 | 289 | |
290 | - $actions[] = '<a class="install-theme-preview" href="' . esc_url( $preview_url ) . '" title="' . esc_attr( sprintf( __( 'Preview %s' ), $name ) ) . '">' . __( 'Preview' ) . '</a>'; |
|
290 | + $actions[] = '<a class="install-theme-preview" href="'.esc_url($preview_url).'" title="'.esc_attr(sprintf(__('Preview %s'), $name)).'">'.__('Preview').'</a>'; |
|
291 | 291 | |
292 | 292 | /** |
293 | 293 | * Filter the install action links for a theme in the Install Themes list table. |
@@ -298,19 +298,19 @@ discard block |
||
298 | 298 | * links to Install Now, Preview, and Details. |
299 | 299 | * @param WP_Theme $theme Theme object. |
300 | 300 | */ |
301 | - $actions = apply_filters( 'theme_install_actions', $actions, $theme ); |
|
301 | + $actions = apply_filters('theme_install_actions', $actions, $theme); |
|
302 | 302 | |
303 | 303 | ?> |
304 | - <a class="screenshot install-theme-preview" href="<?php echo esc_url( $preview_url ); ?>" title="<?php echo esc_attr( $preview_title ); ?>"> |
|
305 | - <img src="<?php echo esc_url( $theme->screenshot_url ); ?>" width="150" alt="" /> |
|
304 | + <a class="screenshot install-theme-preview" href="<?php echo esc_url($preview_url); ?>" title="<?php echo esc_attr($preview_title); ?>"> |
|
305 | + <img src="<?php echo esc_url($theme->screenshot_url); ?>" width="150" alt="" /> |
|
306 | 306 | </a> |
307 | 307 | |
308 | 308 | <h3><?php echo $name; ?></h3> |
309 | - <div class="theme-author"><?php printf( __( 'By %s' ), $author ); ?></div> |
|
309 | + <div class="theme-author"><?php printf(__('By %s'), $author); ?></div> |
|
310 | 310 | |
311 | 311 | <div class="action-links"> |
312 | 312 | <ul> |
313 | - <?php foreach ( $actions as $action ): ?> |
|
313 | + <?php foreach ($actions as $action): ?> |
|
314 | 314 | <li><?php echo $action; ?></li> |
315 | 315 | <?php endforeach; ?> |
316 | 316 | <li class="hide-if-no-js"><a href="#" class="theme-detail"><?php _e('Details') ?></a></li> |
@@ -318,7 +318,7 @@ discard block |
||
318 | 318 | </div> |
319 | 319 | |
320 | 320 | <?php |
321 | - $this->install_theme_info( $theme ); |
|
321 | + $this->install_theme_info($theme); |
|
322 | 322 | } |
323 | 323 | |
324 | 324 | /** |
@@ -329,16 +329,16 @@ discard block |
||
329 | 329 | <div id="theme-installer" class="wp-full-overlay expanded"> |
330 | 330 | <div class="wp-full-overlay-sidebar"> |
331 | 331 | <div class="wp-full-overlay-header"> |
332 | - <a href="#" class="close-full-overlay button-secondary"><?php _e( 'Close' ); ?></a> |
|
332 | + <a href="#" class="close-full-overlay button-secondary"><?php _e('Close'); ?></a> |
|
333 | 333 | <span class="theme-install"></span> |
334 | 334 | </div> |
335 | 335 | <div class="wp-full-overlay-sidebar-content"> |
336 | 336 | <div class="install-theme-info"></div> |
337 | 337 | </div> |
338 | 338 | <div class="wp-full-overlay-footer"> |
339 | - <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e( 'Collapse Sidebar' ); ?>"> |
|
339 | + <button type="button" class="collapse-sidebar button-secondary" aria-expanded="true" aria-label="<?php esc_attr_e('Collapse Sidebar'); ?>"> |
|
340 | 340 | <span class="collapse-sidebar-arrow"></span> |
341 | - <span class="collapse-sidebar-label"><?php _e( 'Collapse' ); ?></span> |
|
341 | + <span class="collapse-sidebar-label"><?php _e('Collapse'); ?></span> |
|
342 | 342 | </button> |
343 | 343 | </div> |
344 | 344 | </div> |
@@ -353,14 +353,14 @@ discard block |
||
353 | 353 | * |
354 | 354 | * @param object $theme - A WordPress.org Theme API object. |
355 | 355 | */ |
356 | - public function theme_installer_single( $theme ) { |
|
356 | + public function theme_installer_single($theme) { |
|
357 | 357 | ?> |
358 | 358 | <div id="theme-installer" class="wp-full-overlay single-theme"> |
359 | 359 | <div class="wp-full-overlay-sidebar"> |
360 | - <?php $this->install_theme_info( $theme ); ?> |
|
360 | + <?php $this->install_theme_info($theme); ?> |
|
361 | 361 | </div> |
362 | 362 | <div class="wp-full-overlay-main"> |
363 | - <iframe src="<?php echo esc_url( $theme->preview_url ); ?>"></iframe> |
|
363 | + <iframe src="<?php echo esc_url($theme->preview_url); ?>"></iframe> |
|
364 | 364 | </div> |
365 | 365 | </div> |
366 | 366 | <?php |
@@ -373,58 +373,58 @@ discard block |
||
373 | 373 | * |
374 | 374 | * @param object $theme - A WordPress.org Theme API object. |
375 | 375 | */ |
376 | - public function install_theme_info( $theme ) { |
|
376 | + public function install_theme_info($theme) { |
|
377 | 377 | global $themes_allowedtags; |
378 | 378 | |
379 | - if ( empty( $theme ) ) |
|
379 | + if (empty($theme)) |
|
380 | 380 | return; |
381 | 381 | |
382 | - $name = wp_kses( $theme->name, $themes_allowedtags ); |
|
383 | - $author = wp_kses( $theme->author, $themes_allowedtags ); |
|
382 | + $name = wp_kses($theme->name, $themes_allowedtags); |
|
383 | + $author = wp_kses($theme->author, $themes_allowedtags); |
|
384 | 384 | |
385 | - $install_url = add_query_arg( array( |
|
385 | + $install_url = add_query_arg(array( |
|
386 | 386 | 'action' => 'install-theme', |
387 | 387 | 'theme' => $theme->slug, |
388 | - ), self_admin_url( 'update.php' ) ); |
|
388 | + ), self_admin_url('update.php')); |
|
389 | 389 | |
390 | - $update_url = add_query_arg( array( |
|
390 | + $update_url = add_query_arg(array( |
|
391 | 391 | 'action' => 'upgrade-theme', |
392 | 392 | 'theme' => $theme->slug, |
393 | - ), self_admin_url( 'update.php' ) ); |
|
393 | + ), self_admin_url('update.php')); |
|
394 | 394 | |
395 | - $status = $this->_get_theme_status( $theme ); |
|
395 | + $status = $this->_get_theme_status($theme); |
|
396 | 396 | |
397 | 397 | ?> |
398 | 398 | <div class="install-theme-info"><?php |
399 | - switch ( $status ) { |
|
399 | + switch ($status) { |
|
400 | 400 | case 'update_available': |
401 | - echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $update_url, 'upgrade-theme_' . $theme->slug ) ) . '" title="' . esc_attr( sprintf( __( 'Update to version %s' ), $theme->version ) ) . '">' . __( 'Update' ) . '</a>'; |
|
401 | + echo '<a class="theme-install button-primary" href="'.esc_url(wp_nonce_url($update_url, 'upgrade-theme_'.$theme->slug)).'" title="'.esc_attr(sprintf(__('Update to version %s'), $theme->version)).'">'.__('Update').'</a>'; |
|
402 | 402 | break; |
403 | 403 | case 'newer_installed': |
404 | 404 | case 'latest_installed': |
405 | - echo '<span class="theme-install" title="' . esc_attr__( 'This theme is already installed and is up to date' ) . '">' . _x( 'Installed', 'theme' ) . '</span>'; |
|
405 | + echo '<span class="theme-install" title="'.esc_attr__('This theme is already installed and is up to date').'">'._x('Installed', 'theme').'</span>'; |
|
406 | 406 | break; |
407 | 407 | case 'install': |
408 | 408 | default: |
409 | - echo '<a class="theme-install button-primary" href="' . esc_url( wp_nonce_url( $install_url, 'install-theme_' . $theme->slug ) ) . '">' . __( 'Install' ) . '</a>'; |
|
409 | + echo '<a class="theme-install button-primary" href="'.esc_url(wp_nonce_url($install_url, 'install-theme_'.$theme->slug)).'">'.__('Install').'</a>'; |
|
410 | 410 | break; |
411 | 411 | } ?> |
412 | 412 | <h3 class="theme-name"><?php echo $name; ?></h3> |
413 | - <span class="theme-by"><?php printf( __( 'By %s' ), $author ); ?></span> |
|
414 | - <?php if ( isset( $theme->screenshot_url ) ): ?> |
|
415 | - <img class="theme-screenshot" src="<?php echo esc_url( $theme->screenshot_url ); ?>" alt="" /> |
|
413 | + <span class="theme-by"><?php printf(__('By %s'), $author); ?></span> |
|
414 | + <?php if (isset($theme->screenshot_url)): ?> |
|
415 | + <img class="theme-screenshot" src="<?php echo esc_url($theme->screenshot_url); ?>" alt="" /> |
|
416 | 416 | <?php endif; ?> |
417 | 417 | <div class="theme-details"> |
418 | - <?php wp_star_rating( array( 'rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings ) ); ?> |
|
418 | + <?php wp_star_rating(array('rating' => $theme->rating, 'type' => 'percent', 'number' => $theme->num_ratings)); ?> |
|
419 | 419 | <div class="theme-version"> |
420 | 420 | <strong><?php _e('Version:') ?> </strong> |
421 | - <?php echo wp_kses( $theme->version, $themes_allowedtags ); ?> |
|
421 | + <?php echo wp_kses($theme->version, $themes_allowedtags); ?> |
|
422 | 422 | </div> |
423 | 423 | <div class="theme-description"> |
424 | - <?php echo wp_kses( $theme->description, $themes_allowedtags ); ?> |
|
424 | + <?php echo wp_kses($theme->description, $themes_allowedtags); ?> |
|
425 | 425 | </div> |
426 | 426 | </div> |
427 | - <input class="theme-preview-url" type="hidden" value="<?php echo esc_url( $theme->preview_url ); ?>" /> |
|
427 | + <input class="theme-preview-url" type="hidden" value="<?php echo esc_url($theme->preview_url); ?>" /> |
|
428 | 428 | </div> |
429 | 429 | <?php |
430 | 430 | } |
@@ -440,9 +440,9 @@ discard block |
||
440 | 440 | * |
441 | 441 | * @param array $extra_args Unused. |
442 | 442 | */ |
443 | - public function _js_vars( $extra_args = array() ) { |
|
443 | + public function _js_vars($extra_args = array()) { |
|
444 | 444 | global $tab, $type; |
445 | - parent::_js_vars( compact( 'tab', 'type' ) ); |
|
445 | + parent::_js_vars(compact('tab', 'type')); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | /** |
@@ -454,14 +454,14 @@ discard block |
||
454 | 454 | * @param object $theme - A WordPress.org Theme API object. |
455 | 455 | * @return string Theme status. |
456 | 456 | */ |
457 | - private function _get_theme_status( $theme ) { |
|
457 | + private function _get_theme_status($theme) { |
|
458 | 458 | $status = 'install'; |
459 | 459 | |
460 | - $installed_theme = wp_get_theme( $theme->slug ); |
|
461 | - if ( $installed_theme->exists() ) { |
|
462 | - if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) |
|
460 | + $installed_theme = wp_get_theme($theme->slug); |
|
461 | + if ($installed_theme->exists()) { |
|
462 | + if (version_compare($installed_theme->get('Version'), $theme->version, '=')) |
|
463 | 463 | $status = 'latest_installed'; |
464 | - elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) |
|
464 | + elseif (version_compare($installed_theme->get('Version'), $theme->version, '>')) |
|
465 | 465 | $status = 'newer_installed'; |
466 | 466 | else |
467 | 467 | $status = 'update_available'; |
@@ -48,8 +48,9 @@ discard block |
||
48 | 48 | $search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', $search_string ) ) ) ); |
49 | 49 | } |
50 | 50 | |
51 | - if ( ! empty( $_REQUEST['features'] ) ) |
|
52 | - $this->features = $_REQUEST['features']; |
|
51 | + if ( ! empty( $_REQUEST['features'] ) ) { |
|
52 | + $this->features = $_REQUEST['features']; |
|
53 | + } |
|
53 | 54 | |
54 | 55 | $paged = $this->get_pagenum(); |
55 | 56 | |
@@ -58,8 +59,9 @@ discard block |
||
58 | 59 | // These are the tabs which are shown on the page, |
59 | 60 | $tabs = array(); |
60 | 61 | $tabs['dashboard'] = __( 'Search' ); |
61 | - if ( 'search' === $tab ) |
|
62 | - $tabs['search'] = __( 'Search Results' ); |
|
62 | + if ( 'search' === $tab ) { |
|
63 | + $tabs['search'] = __( 'Search Results' ); |
|
64 | + } |
|
63 | 65 | $tabs['upload'] = __( 'Upload' ); |
64 | 66 | $tabs['featured'] = _x( 'Featured', 'themes' ); |
65 | 67 | //$tabs['popular'] = _x( 'Popular', 'themes' ); |
@@ -82,8 +84,9 @@ discard block |
||
82 | 84 | $nonmenu_tabs = apply_filters( 'install_themes_nonmenu_tabs', $nonmenu_tabs ); |
83 | 85 | |
84 | 86 | // If a non-valid menu tab has been selected, And it's not a non-menu action. |
85 | - if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) |
|
86 | - $tab = key( $tabs ); |
|
87 | + if ( empty( $tab ) || ( ! isset( $tabs[ $tab ] ) && ! in_array( $tab, (array) $nonmenu_tabs ) ) ) { |
|
88 | + $tab = key( $tabs ); |
|
89 | + } |
|
87 | 90 | |
88 | 91 | $args = array( 'page' => $paged, 'per_page' => $per_page, 'fields' => $theme_field_defaults ); |
89 | 92 | |
@@ -136,13 +139,15 @@ discard block |
||
136 | 139 | */ |
137 | 140 | $args = apply_filters( 'install_themes_table_api_args_' . $tab, $args ); |
138 | 141 | |
139 | - if ( ! $args ) |
|
140 | - return; |
|
142 | + if ( ! $args ) { |
|
143 | + return; |
|
144 | + } |
|
141 | 145 | |
142 | 146 | $api = themes_api( 'query_themes', $args ); |
143 | 147 | |
144 | - if ( is_wp_error( $api ) ) |
|
145 | - wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' ); |
|
148 | + if ( is_wp_error( $api ) ) { |
|
149 | + wp_die( $api->get_error_message() . '</p> <p><a href="#" onclick="document.location.reload(); return false;">' . __( 'Try again' ) . '</a>' ); |
|
150 | + } |
|
146 | 151 | |
147 | 152 | $this->items = $api->themes; |
148 | 153 | |
@@ -247,8 +252,9 @@ discard block |
||
247 | 252 | public function single_row( $theme ) { |
248 | 253 | global $themes_allowedtags; |
249 | 254 | |
250 | - if ( empty( $theme ) ) |
|
251 | - return; |
|
255 | + if ( empty( $theme ) ) { |
|
256 | + return; |
|
257 | + } |
|
252 | 258 | |
253 | 259 | $name = wp_kses( $theme->name, $themes_allowedtags ); |
254 | 260 | $author = wp_kses( $theme->author, $themes_allowedtags ); |
@@ -376,8 +382,9 @@ discard block |
||
376 | 382 | public function install_theme_info( $theme ) { |
377 | 383 | global $themes_allowedtags; |
378 | 384 | |
379 | - if ( empty( $theme ) ) |
|
380 | - return; |
|
385 | + if ( empty( $theme ) ) { |
|
386 | + return; |
|
387 | + } |
|
381 | 388 | |
382 | 389 | $name = wp_kses( $theme->name, $themes_allowedtags ); |
383 | 390 | $author = wp_kses( $theme->author, $themes_allowedtags ); |
@@ -459,12 +466,13 @@ discard block |
||
459 | 466 | |
460 | 467 | $installed_theme = wp_get_theme( $theme->slug ); |
461 | 468 | if ( $installed_theme->exists() ) { |
462 | - if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) |
|
463 | - $status = 'latest_installed'; |
|
464 | - elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) |
|
465 | - $status = 'newer_installed'; |
|
466 | - else |
|
467 | - $status = 'update_available'; |
|
469 | + if ( version_compare( $installed_theme->get('Version'), $theme->version, '=' ) ) { |
|
470 | + $status = 'latest_installed'; |
|
471 | + } elseif ( version_compare( $installed_theme->get('Version'), $theme->version, '>' ) ) { |
|
472 | + $status = 'newer_installed'; |
|
473 | + } else { |
|
474 | + $status = 'update_available'; |
|
475 | + } |
|
468 | 476 | } |
469 | 477 | |
470 | 478 | return $status; |
@@ -1,11 +1,11 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * List Table API: WP_Users_List_Table class |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * List Table API: WP_Users_List_Table class |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Core class used to implement displaying users in a list table. |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | /** |
62 | 62 | * Check the current user's permissions. |
63 | 63 | * |
64 | - * @since 3.1.0 |
|
64 | + * @since 3.1.0 |
|
65 | 65 | * @access public |
66 | 66 | * |
67 | 67 | * @return bool |
@@ -45,17 +45,17 @@ discard block |
||
45 | 45 | * |
46 | 46 | * @param array $args An associative array of arguments. |
47 | 47 | */ |
48 | - public function __construct( $args = array() ) { |
|
49 | - parent::__construct( array( |
|
48 | + public function __construct($args = array()) { |
|
49 | + parent::__construct(array( |
|
50 | 50 | 'singular' => 'user', |
51 | 51 | 'plural' => 'users', |
52 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
53 | - ) ); |
|
52 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
53 | + )); |
|
54 | 54 | |
55 | 55 | $this->is_site_users = 'site-users-network' === $this->screen->id; |
56 | 56 | |
57 | - if ( $this->is_site_users ) |
|
58 | - $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
57 | + if ($this->is_site_users) |
|
58 | + $this->site_id = isset($_REQUEST['id']) ? intval($_REQUEST['id']) : 0; |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | /** |
@@ -67,10 +67,10 @@ discard block |
||
67 | 67 | * @return bool |
68 | 68 | */ |
69 | 69 | public function ajax_user_can() { |
70 | - if ( $this->is_site_users ) |
|
71 | - return current_user_can( 'manage_sites' ); |
|
70 | + if ($this->is_site_users) |
|
71 | + return current_user_can('manage_sites'); |
|
72 | 72 | else |
73 | - return current_user_can( 'list_users' ); |
|
73 | + return current_user_can('list_users'); |
|
74 | 74 | } |
75 | 75 | |
76 | 76 | /** |
@@ -85,19 +85,19 @@ discard block |
||
85 | 85 | public function prepare_items() { |
86 | 86 | global $role, $usersearch; |
87 | 87 | |
88 | - $usersearch = isset( $_REQUEST['s'] ) ? wp_unslash( trim( $_REQUEST['s'] ) ) : ''; |
|
88 | + $usersearch = isset($_REQUEST['s']) ? wp_unslash(trim($_REQUEST['s'])) : ''; |
|
89 | 89 | |
90 | - $role = isset( $_REQUEST['role'] ) ? $_REQUEST['role'] : ''; |
|
90 | + $role = isset($_REQUEST['role']) ? $_REQUEST['role'] : ''; |
|
91 | 91 | |
92 | - $per_page = ( $this->is_site_users ) ? 'site_users_network_per_page' : 'users_per_page'; |
|
93 | - $users_per_page = $this->get_items_per_page( $per_page ); |
|
92 | + $per_page = ($this->is_site_users) ? 'site_users_network_per_page' : 'users_per_page'; |
|
93 | + $users_per_page = $this->get_items_per_page($per_page); |
|
94 | 94 | |
95 | 95 | $paged = $this->get_pagenum(); |
96 | 96 | |
97 | - if ( 'none' === $role ) { |
|
97 | + if ('none' === $role) { |
|
98 | 98 | $args = array( |
99 | 99 | 'number' => $users_per_page, |
100 | - 'offset' => ( $paged-1 ) * $users_per_page, |
|
100 | + 'offset' => ($paged - 1) * $users_per_page, |
|
101 | 101 | 'include' => wp_get_users_with_no_role(), |
102 | 102 | 'search' => $usersearch, |
103 | 103 | 'fields' => 'all_with_meta' |
@@ -105,23 +105,23 @@ discard block |
||
105 | 105 | } else { |
106 | 106 | $args = array( |
107 | 107 | 'number' => $users_per_page, |
108 | - 'offset' => ( $paged-1 ) * $users_per_page, |
|
108 | + 'offset' => ($paged - 1) * $users_per_page, |
|
109 | 109 | 'role' => $role, |
110 | 110 | 'search' => $usersearch, |
111 | 111 | 'fields' => 'all_with_meta' |
112 | 112 | ); |
113 | 113 | } |
114 | 114 | |
115 | - if ( '' !== $args['search'] ) |
|
116 | - $args['search'] = '*' . $args['search'] . '*'; |
|
115 | + if ('' !== $args['search']) |
|
116 | + $args['search'] = '*'.$args['search'].'*'; |
|
117 | 117 | |
118 | - if ( $this->is_site_users ) |
|
118 | + if ($this->is_site_users) |
|
119 | 119 | $args['blog_id'] = $this->site_id; |
120 | 120 | |
121 | - if ( isset( $_REQUEST['orderby'] ) ) |
|
121 | + if (isset($_REQUEST['orderby'])) |
|
122 | 122 | $args['orderby'] = $_REQUEST['orderby']; |
123 | 123 | |
124 | - if ( isset( $_REQUEST['order'] ) ) |
|
124 | + if (isset($_REQUEST['order'])) |
|
125 | 125 | $args['order'] = $_REQUEST['order']; |
126 | 126 | |
127 | 127 | /** |
@@ -132,17 +132,17 @@ discard block |
||
132 | 132 | * @param array $args Arguments passed to WP_User_Query to retrieve items for the current |
133 | 133 | * users list table. |
134 | 134 | */ |
135 | - $args = apply_filters( 'users_list_table_query_args', $args ); |
|
135 | + $args = apply_filters('users_list_table_query_args', $args); |
|
136 | 136 | |
137 | 137 | // Query the user IDs for this page |
138 | - $wp_user_search = new WP_User_Query( $args ); |
|
138 | + $wp_user_search = new WP_User_Query($args); |
|
139 | 139 | |
140 | 140 | $this->items = $wp_user_search->get_results(); |
141 | 141 | |
142 | - $this->set_pagination_args( array( |
|
142 | + $this->set_pagination_args(array( |
|
143 | 143 | 'total_items' => $wp_user_search->get_total(), |
144 | 144 | 'per_page' => $users_per_page, |
145 | - ) ); |
|
145 | + )); |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /** |
@@ -152,7 +152,7 @@ discard block |
||
152 | 152 | * @access public |
153 | 153 | */ |
154 | 154 | public function no_items() { |
155 | - _e( 'No users found.' ); |
|
155 | + _e('No users found.'); |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | /** |
@@ -174,9 +174,9 @@ discard block |
||
174 | 174 | |
175 | 175 | $wp_roles = wp_roles(); |
176 | 176 | |
177 | - if ( $this->is_site_users ) { |
|
178 | - $url = 'site-users.php?id=' . $this->site_id; |
|
179 | - switch_to_blog( $this->site_id ); |
|
177 | + if ($this->is_site_users) { |
|
178 | + $url = 'site-users.php?id='.$this->site_id; |
|
179 | + switch_to_blog($this->site_id); |
|
180 | 180 | $users_of_blog = count_users(); |
181 | 181 | restore_current_blog(); |
182 | 182 | } else { |
@@ -185,40 +185,40 @@ discard block |
||
185 | 185 | } |
186 | 186 | |
187 | 187 | $total_users = $users_of_blog['total_users']; |
188 | - $avail_roles =& $users_of_blog['avail_roles']; |
|
188 | + $avail_roles = & $users_of_blog['avail_roles']; |
|
189 | 189 | unset($users_of_blog); |
190 | 190 | |
191 | 191 | $class = empty($role) ? ' class="current"' : ''; |
192 | 192 | $role_links = array(); |
193 | - $role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>'; |
|
194 | - foreach ( $wp_roles->get_names() as $this_role => $name ) { |
|
195 | - if ( !isset($avail_roles[$this_role]) ) |
|
193 | + $role_links['all'] = "<a href='$url'$class>".sprintf(_nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users'), number_format_i18n($total_users)).'</a>'; |
|
194 | + foreach ($wp_roles->get_names() as $this_role => $name) { |
|
195 | + if ( ! isset($avail_roles[$this_role])) |
|
196 | 196 | continue; |
197 | 197 | |
198 | 198 | $class = ''; |
199 | 199 | |
200 | - if ( $this_role === $role ) { |
|
200 | + if ($this_role === $role) { |
|
201 | 201 | $class = ' class="current"'; |
202 | 202 | } |
203 | 203 | |
204 | - $name = translate_user_role( $name ); |
|
204 | + $name = translate_user_role($name); |
|
205 | 205 | /* translators: User role name with count */ |
206 | - $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles[$this_role] ) ); |
|
207 | - $role_links[$this_role] = "<a href='" . esc_url( add_query_arg( 'role', $this_role, $url ) ) . "'$class>$name</a>"; |
|
206 | + $name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n($avail_roles[$this_role])); |
|
207 | + $role_links[$this_role] = "<a href='".esc_url(add_query_arg('role', $this_role, $url))."'$class>$name</a>"; |
|
208 | 208 | } |
209 | 209 | |
210 | - if ( ! empty( $avail_roles['none' ] ) ) { |
|
210 | + if ( ! empty($avail_roles['none'])) { |
|
211 | 211 | |
212 | 212 | $class = ''; |
213 | 213 | |
214 | - if ( 'none' === $role ) { |
|
214 | + if ('none' === $role) { |
|
215 | 215 | $class = ' class="current"'; |
216 | 216 | } |
217 | 217 | |
218 | - $name = __( 'No role' ); |
|
218 | + $name = __('No role'); |
|
219 | 219 | /* translators: User role name with count */ |
220 | - $name = sprintf( __('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n( $avail_roles['none' ] ) ); |
|
221 | - $role_links['none'] = "<a href='" . esc_url( add_query_arg( 'role', 'none', $url ) ) . "'$class>$name</a>"; |
|
220 | + $name = sprintf(__('%1$s <span class="count">(%2$s)</span>'), $name, number_format_i18n($avail_roles['none'])); |
|
221 | + $role_links['none'] = "<a href='".esc_url(add_query_arg('role', 'none', $url))."'$class>$name</a>"; |
|
222 | 222 | |
223 | 223 | } |
224 | 224 | |
@@ -236,12 +236,12 @@ discard block |
||
236 | 236 | protected function get_bulk_actions() { |
237 | 237 | $actions = array(); |
238 | 238 | |
239 | - if ( is_multisite() ) { |
|
240 | - if ( current_user_can( 'remove_users' ) ) |
|
241 | - $actions['remove'] = __( 'Remove' ); |
|
239 | + if (is_multisite()) { |
|
240 | + if (current_user_can('remove_users')) |
|
241 | + $actions['remove'] = __('Remove'); |
|
242 | 242 | } else { |
243 | - if ( current_user_can( 'delete_users' ) ) |
|
244 | - $actions['delete'] = __( 'Delete' ); |
|
243 | + if (current_user_can('delete_users')) |
|
244 | + $actions['delete'] = __('Delete'); |
|
245 | 245 | } |
246 | 246 | |
247 | 247 | return $actions; |
@@ -256,18 +256,18 @@ discard block |
||
256 | 256 | * @param string $which Whether this is being invoked above ("top") |
257 | 257 | * or below the table ("bottom"). |
258 | 258 | */ |
259 | - protected function extra_tablenav( $which ) { |
|
259 | + protected function extra_tablenav($which) { |
|
260 | 260 | $id = 'bottom' === $which ? 'new_role2' : 'new_role'; |
261 | 261 | ?> |
262 | 262 | <div class="alignleft actions"> |
263 | - <?php if ( current_user_can( 'promote_users' ) && $this->has_items() ) : ?> |
|
264 | - <label class="screen-reader-text" for="<?php echo $id ?>"><?php _e( 'Change role to…' ) ?></label> |
|
263 | + <?php if (current_user_can('promote_users') && $this->has_items()) : ?> |
|
264 | + <label class="screen-reader-text" for="<?php echo $id ?>"><?php _e('Change role to…') ?></label> |
|
265 | 265 | <select name="<?php echo $id ?>" id="<?php echo $id ?>"> |
266 | - <option value=""><?php _e( 'Change role to…' ) ?></option> |
|
266 | + <option value=""><?php _e('Change role to…') ?></option> |
|
267 | 267 | <?php wp_dropdown_roles(); ?> |
268 | 268 | </select> |
269 | 269 | <?php |
270 | - submit_button( __( 'Change' ), 'button', 'changeit', false ); |
|
270 | + submit_button(__('Change'), 'button', 'changeit', false); |
|
271 | 271 | endif; |
272 | 272 | |
273 | 273 | /** |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * |
277 | 277 | * @since 3.5.0 |
278 | 278 | */ |
279 | - do_action( 'restrict_manage_users' ); |
|
279 | + do_action('restrict_manage_users'); |
|
280 | 280 | echo '</div>'; |
281 | 281 | } |
282 | 282 | |
@@ -292,8 +292,8 @@ discard block |
||
292 | 292 | * @return string The bulk action required. |
293 | 293 | */ |
294 | 294 | public function current_action() { |
295 | - if ( isset( $_REQUEST['changeit'] ) && |
|
296 | - ( ! empty( $_REQUEST['new_role'] ) || ! empty( $_REQUEST['new_role2'] ) ) ) { |
|
295 | + if (isset($_REQUEST['changeit']) && |
|
296 | + ( ! empty($_REQUEST['new_role']) || ! empty($_REQUEST['new_role2']))) { |
|
297 | 297 | return 'promote'; |
298 | 298 | } |
299 | 299 | |
@@ -312,15 +312,15 @@ discard block |
||
312 | 312 | public function get_columns() { |
313 | 313 | $c = array( |
314 | 314 | 'cb' => '<input type="checkbox" />', |
315 | - 'username' => __( 'Username' ), |
|
316 | - 'name' => __( 'Name' ), |
|
317 | - 'email' => __( 'Email' ), |
|
318 | - 'role' => __( 'Role' ), |
|
319 | - 'posts' => __( 'Posts' ) |
|
315 | + 'username' => __('Username'), |
|
316 | + 'name' => __('Name'), |
|
317 | + 'email' => __('Email'), |
|
318 | + 'role' => __('Role'), |
|
319 | + 'posts' => __('Posts') |
|
320 | 320 | ); |
321 | 321 | |
322 | - if ( $this->is_site_users ) |
|
323 | - unset( $c['posts'] ); |
|
322 | + if ($this->is_site_users) |
|
323 | + unset($c['posts']); |
|
324 | 324 | |
325 | 325 | return $c; |
326 | 326 | } |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | */ |
352 | 352 | public function display_rows() { |
353 | 353 | // Query the post counts for this page |
354 | - if ( ! $this->is_site_users ) |
|
355 | - $post_counts = count_many_users_posts( array_keys( $this->items ) ); |
|
354 | + if ( ! $this->is_site_users) |
|
355 | + $post_counts = count_many_users_posts(array_keys($this->items)); |
|
356 | 356 | |
357 | - foreach ( $this->items as $userid => $user_object ) { |
|
358 | - if ( is_multisite() && empty( $user_object->allcaps ) ) |
|
357 | + foreach ($this->items as $userid => $user_object) { |
|
358 | + if (is_multisite() && empty($user_object->allcaps)) |
|
359 | 359 | continue; |
360 | 360 | |
361 | - echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); |
|
361 | + echo "\n\t".$this->single_row($user_object, '', '', isset($post_counts) ? $post_counts[$userid] : 0); |
|
362 | 362 | } |
363 | 363 | } |
364 | 364 | |
@@ -377,39 +377,39 @@ discard block |
||
377 | 377 | * to zero, as in, a new user has made zero posts. |
378 | 378 | * @return string Output for a single row. |
379 | 379 | */ |
380 | - public function single_row( $user_object, $style = '', $role = '', $numposts = 0 ) { |
|
381 | - if ( ! ( $user_object instanceof WP_User ) ) { |
|
382 | - $user_object = get_userdata( (int) $user_object ); |
|
380 | + public function single_row($user_object, $style = '', $role = '', $numposts = 0) { |
|
381 | + if ( ! ($user_object instanceof WP_User)) { |
|
382 | + $user_object = get_userdata((int) $user_object); |
|
383 | 383 | } |
384 | 384 | $user_object->filter = 'display'; |
385 | 385 | $email = $user_object->user_email; |
386 | 386 | |
387 | - if ( $this->is_site_users ) |
|
387 | + if ($this->is_site_users) |
|
388 | 388 | $url = "site-users.php?id={$this->site_id}&"; |
389 | 389 | else |
390 | 390 | $url = 'users.php?'; |
391 | 391 | |
392 | - $user_roles = $this->get_role_list( $user_object ); |
|
392 | + $user_roles = $this->get_role_list($user_object); |
|
393 | 393 | |
394 | 394 | // Set up the hover actions for this user |
395 | 395 | $actions = array(); |
396 | 396 | $checkbox = ''; |
397 | 397 | // Check if the user for this row is editable |
398 | - if ( current_user_can( 'list_users' ) ) { |
|
398 | + if (current_user_can('list_users')) { |
|
399 | 399 | // Set up the user editing link |
400 | - $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user_object->ID ) ) ); |
|
400 | + $edit_link = esc_url(add_query_arg('wp_http_referer', urlencode(wp_unslash($_SERVER['REQUEST_URI'])), get_edit_user_link($user_object->ID))); |
|
401 | 401 | |
402 | - if ( current_user_can( 'edit_user', $user_object->ID ) ) { |
|
402 | + if (current_user_can('edit_user', $user_object->ID)) { |
|
403 | 403 | $edit = "<strong><a href=\"$edit_link\">$user_object->user_login</a></strong><br />"; |
404 | - $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; |
|
404 | + $actions['edit'] = '<a href="'.$edit_link.'">'.__('Edit').'</a>'; |
|
405 | 405 | } else { |
406 | 406 | $edit = "<strong>$user_object->user_login</strong><br />"; |
407 | 407 | } |
408 | 408 | |
409 | - if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) |
|
410 | - $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>"; |
|
411 | - if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) |
|
412 | - $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>"; |
|
409 | + if ( ! is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('delete_user', $user_object->ID)) |
|
410 | + $actions['delete'] = "<a class='submitdelete' href='".wp_nonce_url("users.php?action=delete&user=$user_object->ID", 'bulk-users')."'>".__('Delete')."</a>"; |
|
411 | + if (is_multisite() && get_current_user_id() != $user_object->ID && current_user_can('remove_user', $user_object->ID)) |
|
412 | + $actions['remove'] = "<a class='submitdelete' href='".wp_nonce_url($url."action=remove&user=$user_object->ID", 'bulk-users')."'>".__('Remove')."</a>"; |
|
413 | 413 | |
414 | 414 | /** |
415 | 415 | * Filter the action links displayed under each user in the Users list table. |
@@ -421,49 +421,49 @@ discard block |
||
421 | 421 | * 'Edit', 'Remove' for Multisite. |
422 | 422 | * @param WP_User $user_object WP_User object for the currently-listed user. |
423 | 423 | */ |
424 | - $actions = apply_filters( 'user_row_actions', $actions, $user_object ); |
|
424 | + $actions = apply_filters('user_row_actions', $actions, $user_object); |
|
425 | 425 | |
426 | 426 | // Role classes. |
427 | - $role_classes = esc_attr( implode( ' ', array_keys( $user_roles ) ) ); |
|
427 | + $role_classes = esc_attr(implode(' ', array_keys($user_roles))); |
|
428 | 428 | |
429 | 429 | // Set up the checkbox ( because the user is editable, otherwise it's empty ) |
430 | - $checkbox = '<label class="screen-reader-text" for="user_' . $user_object->ID . '">' . sprintf( __( 'Select %s' ), $user_object->user_login ) . '</label>' |
|
430 | + $checkbox = '<label class="screen-reader-text" for="user_'.$user_object->ID.'">'.sprintf(__('Select %s'), $user_object->user_login).'</label>' |
|
431 | 431 | . "<input type='checkbox' name='users[]' id='user_{$user_object->ID}' class='{$role_classes}' value='{$user_object->ID}' />"; |
432 | 432 | |
433 | 433 | } else { |
434 | - $edit = '<strong>' . $user_object->user_login . '</strong>'; |
|
434 | + $edit = '<strong>'.$user_object->user_login.'</strong>'; |
|
435 | 435 | } |
436 | - $avatar = get_avatar( $user_object->ID, 32 ); |
|
436 | + $avatar = get_avatar($user_object->ID, 32); |
|
437 | 437 | |
438 | 438 | // Comma-separated list of user roles. |
439 | - $roles_list = implode( ', ', $user_roles ); |
|
439 | + $roles_list = implode(', ', $user_roles); |
|
440 | 440 | |
441 | 441 | $r = "<tr id='user-$user_object->ID'>"; |
442 | 442 | |
443 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
443 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
444 | 444 | |
445 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
445 | + foreach ($columns as $column_name => $column_display_name) { |
|
446 | 446 | $classes = "$column_name column-$column_name"; |
447 | - if ( $primary === $column_name ) { |
|
447 | + if ($primary === $column_name) { |
|
448 | 448 | $classes .= ' has-row-actions column-primary'; |
449 | 449 | } |
450 | - if ( 'posts' === $column_name ) { |
|
450 | + if ('posts' === $column_name) { |
|
451 | 451 | $classes .= ' num'; // Special case for that column |
452 | 452 | } |
453 | 453 | |
454 | - if ( in_array( $column_name, $hidden ) ) { |
|
454 | + if (in_array($column_name, $hidden)) { |
|
455 | 455 | $classes .= ' hidden'; |
456 | 456 | } |
457 | 457 | |
458 | - $data = 'data-colname="' . wp_strip_all_tags( $column_display_name ) . '"'; |
|
458 | + $data = 'data-colname="'.wp_strip_all_tags($column_display_name).'"'; |
|
459 | 459 | |
460 | 460 | $attributes = "class='$classes' $data"; |
461 | 461 | |
462 | - if ( 'cb' === $column_name ) { |
|
462 | + if ('cb' === $column_name) { |
|
463 | 463 | $r .= "<th scope='row' class='check-column'>$checkbox</th>"; |
464 | 464 | } else { |
465 | 465 | $r .= "<td $attributes>"; |
466 | - switch ( $column_name ) { |
|
466 | + switch ($column_name) { |
|
467 | 467 | case 'username': |
468 | 468 | $r .= "$avatar $edit"; |
469 | 469 | break; |
@@ -471,16 +471,16 @@ discard block |
||
471 | 471 | $r .= "$user_object->first_name $user_object->last_name"; |
472 | 472 | break; |
473 | 473 | case 'email': |
474 | - $r .= "<a href='" . esc_url( "mailto:$email" ) . "'>$email</a>"; |
|
474 | + $r .= "<a href='".esc_url("mailto:$email")."'>$email</a>"; |
|
475 | 475 | break; |
476 | 476 | case 'role': |
477 | - $r .= esc_html( $roles_list ); |
|
477 | + $r .= esc_html($roles_list); |
|
478 | 478 | break; |
479 | 479 | case 'posts': |
480 | - if ( $numposts > 0 ) { |
|
480 | + if ($numposts > 0) { |
|
481 | 481 | $r .= "<a href='edit.php?author=$user_object->ID' class='edit'>"; |
482 | - $r .= '<span aria-hidden="true">' . $numposts . '</span>'; |
|
483 | - $r .= '<span class="screen-reader-text">' . sprintf( _n( '%s post by this author', '%s posts by this author', $numposts ), number_format_i18n( $numposts ) ) . '</span>'; |
|
482 | + $r .= '<span aria-hidden="true">'.$numposts.'</span>'; |
|
483 | + $r .= '<span class="screen-reader-text">'.sprintf(_n('%s post by this author', '%s posts by this author', $numposts), number_format_i18n($numposts)).'</span>'; |
|
484 | 484 | $r .= '</a>'; |
485 | 485 | } else { |
486 | 486 | $r .= 0; |
@@ -496,11 +496,11 @@ discard block |
||
496 | 496 | * @param string $column_name Column name. |
497 | 497 | * @param int $user_id ID of the currently-listed user. |
498 | 498 | */ |
499 | - $r .= apply_filters( 'manage_users_custom_column', '', $column_name, $user_object->ID ); |
|
499 | + $r .= apply_filters('manage_users_custom_column', '', $column_name, $user_object->ID); |
|
500 | 500 | } |
501 | 501 | |
502 | - if ( $primary === $column_name ) { |
|
503 | - $r .= $this->row_actions( $actions ); |
|
502 | + if ($primary === $column_name) { |
|
503 | + $r .= $this->row_actions($actions); |
|
504 | 504 | } |
505 | 505 | $r .= "</td>"; |
506 | 506 | } |
@@ -531,19 +531,19 @@ discard block |
||
531 | 531 | * @param WP_User $user_object The WP_User object. |
532 | 532 | * @return array An array of user roles. |
533 | 533 | */ |
534 | - protected function get_role_list( $user_object ) { |
|
534 | + protected function get_role_list($user_object) { |
|
535 | 535 | $wp_roles = wp_roles(); |
536 | 536 | |
537 | 537 | $role_list = array(); |
538 | 538 | |
539 | - foreach ( $user_object->roles as $role ) { |
|
540 | - if ( isset( $wp_roles->role_names[ $role ] ) ) { |
|
541 | - $role_list[ $role ] = translate_user_role( $wp_roles->role_names[ $role ] ); |
|
539 | + foreach ($user_object->roles as $role) { |
|
540 | + if (isset($wp_roles->role_names[$role])) { |
|
541 | + $role_list[$role] = translate_user_role($wp_roles->role_names[$role]); |
|
542 | 542 | } |
543 | 543 | } |
544 | 544 | |
545 | - if ( empty( $role_list ) ) { |
|
546 | - $role_list['none'] = _x( 'None', 'no user roles' ); |
|
545 | + if (empty($role_list)) { |
|
546 | + $role_list['none'] = _x('None', 'no user roles'); |
|
547 | 547 | } |
548 | 548 | |
549 | 549 | /** |
@@ -554,7 +554,7 @@ discard block |
||
554 | 554 | * @param array $role_list An array of user roles. |
555 | 555 | * @param WP_User $user_object A WP_User object. |
556 | 556 | */ |
557 | - return apply_filters( 'get_role_list', $role_list, $user_object ); |
|
557 | + return apply_filters('get_role_list', $role_list, $user_object); |
|
558 | 558 | } |
559 | 559 | |
560 | 560 | } |
@@ -54,8 +54,9 @@ discard block |
||
54 | 54 | |
55 | 55 | $this->is_site_users = 'site-users-network' === $this->screen->id; |
56 | 56 | |
57 | - if ( $this->is_site_users ) |
|
58 | - $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
57 | + if ( $this->is_site_users ) { |
|
58 | + $this->site_id = isset( $_REQUEST['id'] ) ? intval( $_REQUEST['id'] ) : 0; |
|
59 | + } |
|
59 | 60 | } |
60 | 61 | |
61 | 62 | /** |
@@ -67,10 +68,11 @@ discard block |
||
67 | 68 | * @return bool |
68 | 69 | */ |
69 | 70 | public function ajax_user_can() { |
70 | - if ( $this->is_site_users ) |
|
71 | - return current_user_can( 'manage_sites' ); |
|
72 | - else |
|
73 | - return current_user_can( 'list_users' ); |
|
71 | + if ( $this->is_site_users ) { |
|
72 | + return current_user_can( 'manage_sites' ); |
|
73 | + } else { |
|
74 | + return current_user_can( 'list_users' ); |
|
75 | + } |
|
74 | 76 | } |
75 | 77 | |
76 | 78 | /** |
@@ -112,17 +114,21 @@ discard block |
||
112 | 114 | ); |
113 | 115 | } |
114 | 116 | |
115 | - if ( '' !== $args['search'] ) |
|
116 | - $args['search'] = '*' . $args['search'] . '*'; |
|
117 | + if ( '' !== $args['search'] ) { |
|
118 | + $args['search'] = '*' . $args['search'] . '*'; |
|
119 | + } |
|
117 | 120 | |
118 | - if ( $this->is_site_users ) |
|
119 | - $args['blog_id'] = $this->site_id; |
|
121 | + if ( $this->is_site_users ) { |
|
122 | + $args['blog_id'] = $this->site_id; |
|
123 | + } |
|
120 | 124 | |
121 | - if ( isset( $_REQUEST['orderby'] ) ) |
|
122 | - $args['orderby'] = $_REQUEST['orderby']; |
|
125 | + if ( isset( $_REQUEST['orderby'] ) ) { |
|
126 | + $args['orderby'] = $_REQUEST['orderby']; |
|
127 | + } |
|
123 | 128 | |
124 | - if ( isset( $_REQUEST['order'] ) ) |
|
125 | - $args['order'] = $_REQUEST['order']; |
|
129 | + if ( isset( $_REQUEST['order'] ) ) { |
|
130 | + $args['order'] = $_REQUEST['order']; |
|
131 | + } |
|
126 | 132 | |
127 | 133 | /** |
128 | 134 | * Filter the query arguments used to retrieve users for the current users list table. |
@@ -192,8 +198,9 @@ discard block |
||
192 | 198 | $role_links = array(); |
193 | 199 | $role_links['all'] = "<a href='$url'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_users, 'users' ), number_format_i18n( $total_users ) ) . '</a>'; |
194 | 200 | foreach ( $wp_roles->get_names() as $this_role => $name ) { |
195 | - if ( !isset($avail_roles[$this_role]) ) |
|
196 | - continue; |
|
201 | + if ( !isset($avail_roles[$this_role]) ) { |
|
202 | + continue; |
|
203 | + } |
|
197 | 204 | |
198 | 205 | $class = ''; |
199 | 206 | |
@@ -237,11 +244,13 @@ discard block |
||
237 | 244 | $actions = array(); |
238 | 245 | |
239 | 246 | if ( is_multisite() ) { |
240 | - if ( current_user_can( 'remove_users' ) ) |
|
241 | - $actions['remove'] = __( 'Remove' ); |
|
247 | + if ( current_user_can( 'remove_users' ) ) { |
|
248 | + $actions['remove'] = __( 'Remove' ); |
|
249 | + } |
|
242 | 250 | } else { |
243 | - if ( current_user_can( 'delete_users' ) ) |
|
244 | - $actions['delete'] = __( 'Delete' ); |
|
251 | + if ( current_user_can( 'delete_users' ) ) { |
|
252 | + $actions['delete'] = __( 'Delete' ); |
|
253 | + } |
|
245 | 254 | } |
246 | 255 | |
247 | 256 | return $actions; |
@@ -319,8 +328,9 @@ discard block |
||
319 | 328 | 'posts' => __( 'Posts' ) |
320 | 329 | ); |
321 | 330 | |
322 | - if ( $this->is_site_users ) |
|
323 | - unset( $c['posts'] ); |
|
331 | + if ( $this->is_site_users ) { |
|
332 | + unset( $c['posts'] ); |
|
333 | + } |
|
324 | 334 | |
325 | 335 | return $c; |
326 | 336 | } |
@@ -351,12 +361,14 @@ discard block |
||
351 | 361 | */ |
352 | 362 | public function display_rows() { |
353 | 363 | // Query the post counts for this page |
354 | - if ( ! $this->is_site_users ) |
|
355 | - $post_counts = count_many_users_posts( array_keys( $this->items ) ); |
|
364 | + if ( ! $this->is_site_users ) { |
|
365 | + $post_counts = count_many_users_posts( array_keys( $this->items ) ); |
|
366 | + } |
|
356 | 367 | |
357 | 368 | foreach ( $this->items as $userid => $user_object ) { |
358 | - if ( is_multisite() && empty( $user_object->allcaps ) ) |
|
359 | - continue; |
|
369 | + if ( is_multisite() && empty( $user_object->allcaps ) ) { |
|
370 | + continue; |
|
371 | + } |
|
360 | 372 | |
361 | 373 | echo "\n\t" . $this->single_row( $user_object, '', '', isset( $post_counts ) ? $post_counts[ $userid ] : 0 ); |
362 | 374 | } |
@@ -384,10 +396,11 @@ discard block |
||
384 | 396 | $user_object->filter = 'display'; |
385 | 397 | $email = $user_object->user_email; |
386 | 398 | |
387 | - if ( $this->is_site_users ) |
|
388 | - $url = "site-users.php?id={$this->site_id}&"; |
|
389 | - else |
|
390 | - $url = 'users.php?'; |
|
399 | + if ( $this->is_site_users ) { |
|
400 | + $url = "site-users.php?id={$this->site_id}&"; |
|
401 | + } else { |
|
402 | + $url = 'users.php?'; |
|
403 | + } |
|
391 | 404 | |
392 | 405 | $user_roles = $this->get_role_list( $user_object ); |
393 | 406 | |
@@ -406,10 +419,12 @@ discard block |
||
406 | 419 | $edit = "<strong>$user_object->user_login</strong><br />"; |
407 | 420 | } |
408 | 421 | |
409 | - if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) |
|
410 | - $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>"; |
|
411 | - if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) |
|
412 | - $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>"; |
|
422 | + if ( !is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'delete_user', $user_object->ID ) ) { |
|
423 | + $actions['delete'] = "<a class='submitdelete' href='" . wp_nonce_url( "users.php?action=delete&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Delete' ) . "</a>"; |
|
424 | + } |
|
425 | + if ( is_multisite() && get_current_user_id() != $user_object->ID && current_user_can( 'remove_user', $user_object->ID ) ) { |
|
426 | + $actions['remove'] = "<a class='submitdelete' href='" . wp_nonce_url( $url."action=remove&user=$user_object->ID", 'bulk-users' ) . "'>" . __( 'Remove' ) . "</a>"; |
|
427 | + } |
|
413 | 428 | |
414 | 429 | /** |
415 | 430 | * Filter the action links displayed under each user in the Users list table. |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * List Table API: WP_Comments_List_Table class |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * List Table API: WP_Comments_List_Table class |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Core class used to implement displaying comments in a list table. |
@@ -37,26 +37,26 @@ discard block |
||
37 | 37 | * |
38 | 38 | * @param array $args An associative array of arguments. |
39 | 39 | */ |
40 | - public function __construct( $args = array() ) { |
|
40 | + public function __construct($args = array()) { |
|
41 | 41 | global $post_id; |
42 | 42 | |
43 | - $post_id = isset( $_REQUEST['p'] ) ? absint( $_REQUEST['p'] ) : 0; |
|
43 | + $post_id = isset($_REQUEST['p']) ? absint($_REQUEST['p']) : 0; |
|
44 | 44 | |
45 | - if ( get_option( 'show_avatars' ) ) { |
|
46 | - add_filter( 'comment_author', array( $this, 'floated_admin_avatar' ), 10, 2 ); |
|
45 | + if (get_option('show_avatars')) { |
|
46 | + add_filter('comment_author', array($this, 'floated_admin_avatar'), 10, 2); |
|
47 | 47 | } |
48 | 48 | |
49 | - parent::__construct( array( |
|
49 | + parent::__construct(array( |
|
50 | 50 | 'plural' => 'comments', |
51 | 51 | 'singular' => 'comment', |
52 | 52 | 'ajax' => true, |
53 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
54 | - ) ); |
|
53 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
54 | + )); |
|
55 | 55 | } |
56 | 56 | |
57 | - public function floated_admin_avatar( $name, $comment_ID ) { |
|
58 | - $comment = get_comment( $comment_ID ); |
|
59 | - $avatar = get_avatar( $comment, 32, 'mystery' ); |
|
57 | + public function floated_admin_avatar($name, $comment_ID) { |
|
58 | + $comment = get_comment($comment_ID); |
|
59 | + $avatar = get_avatar($comment, 32, 'mystery'); |
|
60 | 60 | return "$avatar $name"; |
61 | 61 | } |
62 | 62 | |
@@ -77,41 +77,41 @@ discard block |
||
77 | 77 | public function prepare_items() { |
78 | 78 | global $post_id, $comment_status, $search, $comment_type; |
79 | 79 | |
80 | - $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
|
81 | - if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) ) |
|
80 | + $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all'; |
|
81 | + if ( ! in_array($comment_status, array('all', 'moderated', 'approved', 'spam', 'trash'))) |
|
82 | 82 | $comment_status = 'all'; |
83 | 83 | |
84 | - $comment_type = !empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : ''; |
|
84 | + $comment_type = ! empty($_REQUEST['comment_type']) ? $_REQUEST['comment_type'] : ''; |
|
85 | 85 | |
86 | - $search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : ''; |
|
86 | + $search = (isset($_REQUEST['s'])) ? $_REQUEST['s'] : ''; |
|
87 | 87 | |
88 | - $post_type = ( isset( $_REQUEST['post_type'] ) ) ? sanitize_key( $_REQUEST['post_type'] ) : ''; |
|
88 | + $post_type = (isset($_REQUEST['post_type'])) ? sanitize_key($_REQUEST['post_type']) : ''; |
|
89 | 89 | |
90 | - $user_id = ( isset( $_REQUEST['user_id'] ) ) ? $_REQUEST['user_id'] : ''; |
|
90 | + $user_id = (isset($_REQUEST['user_id'])) ? $_REQUEST['user_id'] : ''; |
|
91 | 91 | |
92 | - $orderby = ( isset( $_REQUEST['orderby'] ) ) ? $_REQUEST['orderby'] : ''; |
|
93 | - $order = ( isset( $_REQUEST['order'] ) ) ? $_REQUEST['order'] : ''; |
|
92 | + $orderby = (isset($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : ''; |
|
93 | + $order = (isset($_REQUEST['order'])) ? $_REQUEST['order'] : ''; |
|
94 | 94 | |
95 | - $comments_per_page = $this->get_per_page( $comment_status ); |
|
95 | + $comments_per_page = $this->get_per_page($comment_status); |
|
96 | 96 | |
97 | - $doing_ajax = defined( 'DOING_AJAX' ) && DOING_AJAX; |
|
97 | + $doing_ajax = defined('DOING_AJAX') && DOING_AJAX; |
|
98 | 98 | |
99 | - if ( isset( $_REQUEST['number'] ) ) { |
|
99 | + if (isset($_REQUEST['number'])) { |
|
100 | 100 | $number = (int) $_REQUEST['number']; |
101 | 101 | } |
102 | 102 | else { |
103 | - $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra |
|
103 | + $number = $comments_per_page + min(8, $comments_per_page); // Grab a few extra |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | $page = $this->get_pagenum(); |
107 | 107 | |
108 | - if ( isset( $_REQUEST['start'] ) ) { |
|
108 | + if (isset($_REQUEST['start'])) { |
|
109 | 109 | $start = $_REQUEST['start']; |
110 | 110 | } else { |
111 | - $start = ( $page - 1 ) * $comments_per_page; |
|
111 | + $start = ($page - 1) * $comments_per_page; |
|
112 | 112 | } |
113 | 113 | |
114 | - if ( $doing_ajax && isset( $_REQUEST['offset'] ) ) { |
|
114 | + if ($doing_ajax && isset($_REQUEST['offset'])) { |
|
115 | 115 | $start += $_REQUEST['offset']; |
116 | 116 | } |
117 | 117 | |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | ); |
123 | 123 | |
124 | 124 | $args = array( |
125 | - 'status' => isset( $status_map[$comment_status] ) ? $status_map[$comment_status] : $comment_status, |
|
125 | + 'status' => isset($status_map[$comment_status]) ? $status_map[$comment_status] : $comment_status, |
|
126 | 126 | 'search' => $search, |
127 | 127 | 'user_id' => $user_id, |
128 | 128 | 'offset' => $start, |
@@ -134,28 +134,28 @@ discard block |
||
134 | 134 | 'post_type' => $post_type, |
135 | 135 | ); |
136 | 136 | |
137 | - $_comments = get_comments( $args ); |
|
138 | - if ( is_array( $_comments ) ) { |
|
139 | - update_comment_cache( $_comments ); |
|
137 | + $_comments = get_comments($args); |
|
138 | + if (is_array($_comments)) { |
|
139 | + update_comment_cache($_comments); |
|
140 | 140 | |
141 | - $this->items = array_slice( $_comments, 0, $comments_per_page ); |
|
142 | - $this->extra_items = array_slice( $_comments, $comments_per_page ); |
|
141 | + $this->items = array_slice($_comments, 0, $comments_per_page); |
|
142 | + $this->extra_items = array_slice($_comments, $comments_per_page); |
|
143 | 143 | |
144 | - $_comment_post_ids = array_unique( wp_list_pluck( $_comments, 'comment_post_ID' ) ); |
|
144 | + $_comment_post_ids = array_unique(wp_list_pluck($_comments, 'comment_post_ID')); |
|
145 | 145 | |
146 | - $this->pending_count = get_pending_comments_num( $_comment_post_ids ); |
|
146 | + $this->pending_count = get_pending_comments_num($_comment_post_ids); |
|
147 | 147 | } |
148 | 148 | |
149 | - $total_comments = get_comments( array_merge( $args, array( |
|
149 | + $total_comments = get_comments(array_merge($args, array( |
|
150 | 150 | 'count' => true, |
151 | 151 | 'offset' => 0, |
152 | 152 | 'number' => 0 |
153 | - ) ) ); |
|
153 | + ))); |
|
154 | 154 | |
155 | - $this->set_pagination_args( array( |
|
155 | + $this->set_pagination_args(array( |
|
156 | 156 | 'total_items' => $total_comments, |
157 | 157 | 'per_page' => $comments_per_page, |
158 | - ) ); |
|
158 | + )); |
|
159 | 159 | } |
160 | 160 | |
161 | 161 | /** |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * @param string $comment_status |
164 | 164 | * @return int |
165 | 165 | */ |
166 | - public function get_per_page( $comment_status = 'all' ) { |
|
167 | - $comments_per_page = $this->get_items_per_page( 'edit_comments_per_page' ); |
|
166 | + public function get_per_page($comment_status = 'all') { |
|
167 | + $comments_per_page = $this->get_items_per_page('edit_comments_per_page'); |
|
168 | 168 | /** |
169 | 169 | * Filter the number of comments listed per page in the comments list table. |
170 | 170 | * |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | * @param int $comments_per_page The number of comments to list per page. |
174 | 174 | * @param string $comment_status The comment status name. Default 'All'. |
175 | 175 | */ |
176 | - return apply_filters( 'comments_per_page', $comments_per_page, $comment_status ); |
|
176 | + return apply_filters('comments_per_page', $comments_per_page, $comment_status); |
|
177 | 177 | } |
178 | 178 | |
179 | 179 | /** |
@@ -183,10 +183,10 @@ discard block |
||
183 | 183 | public function no_items() { |
184 | 184 | global $comment_status; |
185 | 185 | |
186 | - if ( 'moderated' === $comment_status ) { |
|
187 | - _e( 'No comments awaiting moderation.' ); |
|
186 | + if ('moderated' === $comment_status) { |
|
187 | + _e('No comments awaiting moderation.'); |
|
188 | 188 | } else { |
189 | - _e( 'No comments found.' ); |
|
189 | + _e('No comments found.'); |
|
190 | 190 | } |
191 | 191 | } |
192 | 192 | |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | global $post_id, $comment_status, $comment_type; |
201 | 201 | |
202 | 202 | $status_links = array(); |
203 | - $num_comments = ( $post_id ) ? wp_count_comments( $post_id ) : wp_count_comments(); |
|
203 | + $num_comments = ($post_id) ? wp_count_comments($post_id) : wp_count_comments(); |
|
204 | 204 | //, number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), |
205 | 205 | //, number_format_i18n($num_comments->spam) ), "<span class='spam-comment-count'>" . number_format_i18n($num_comments->spam) . "</span>") |
206 | 206 | $stati = array( |
@@ -240,33 +240,33 @@ discard block |
||
240 | 240 | ) |
241 | 241 | ); |
242 | 242 | |
243 | - if ( !EMPTY_TRASH_DAYS ) |
|
243 | + if ( ! EMPTY_TRASH_DAYS) |
|
244 | 244 | unset($stati['trash']); |
245 | 245 | |
246 | - $link = admin_url( 'edit-comments.php' ); |
|
247 | - if ( !empty($comment_type) && 'all' != $comment_type ) |
|
248 | - $link = add_query_arg( 'comment_type', $comment_type, $link ); |
|
246 | + $link = admin_url('edit-comments.php'); |
|
247 | + if ( ! empty($comment_type) && 'all' != $comment_type) |
|
248 | + $link = add_query_arg('comment_type', $comment_type, $link); |
|
249 | 249 | |
250 | - foreach ( $stati as $status => $label ) { |
|
251 | - $class = ( $status === $comment_status ) ? ' class="current"' : ''; |
|
250 | + foreach ($stati as $status => $label) { |
|
251 | + $class = ($status === $comment_status) ? ' class="current"' : ''; |
|
252 | 252 | |
253 | - if ( !isset( $num_comments->$status ) ) |
|
253 | + if ( ! isset($num_comments->$status)) |
|
254 | 254 | $num_comments->$status = 10; |
255 | - $link = add_query_arg( 'comment_status', $status, $link ); |
|
256 | - if ( $post_id ) |
|
257 | - $link = add_query_arg( 'p', absint( $post_id ), $link ); |
|
255 | + $link = add_query_arg('comment_status', $status, $link); |
|
256 | + if ($post_id) |
|
257 | + $link = add_query_arg('p', absint($post_id), $link); |
|
258 | 258 | /* |
259 | 259 | // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark |
260 | 260 | if ( !empty( $_REQUEST['s'] ) ) |
261 | 261 | $link = add_query_arg( 's', esc_attr( wp_unslash( $_REQUEST['s'] ) ), $link ); |
262 | 262 | */ |
263 | - $status_links[ $status ] = "<a href='$link'$class>" . sprintf( |
|
264 | - translate_nooped_plural( $label, $num_comments->$status ), |
|
265 | - sprintf( '<span class="%s-count">%s</span>', |
|
266 | - ( 'moderated' === $status ) ? 'pending' : $status, |
|
267 | - number_format_i18n( $num_comments->$status ) |
|
263 | + $status_links[$status] = "<a href='$link'$class>".sprintf( |
|
264 | + translate_nooped_plural($label, $num_comments->$status), |
|
265 | + sprintf('<span class="%s-count">%s</span>', |
|
266 | + ('moderated' === $status) ? 'pending' : $status, |
|
267 | + number_format_i18n($num_comments->$status) |
|
268 | 268 | ) |
269 | - ) . '</a>'; |
|
269 | + ).'</a>'; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @param array $status_links An array of fully-formed status links. Default 'All'. |
278 | 278 | * Accepts 'All', 'Pending', 'Approved', 'Spam', and 'Trash'. |
279 | 279 | */ |
280 | - return apply_filters( 'comment_status_links', $status_links ); |
|
280 | + return apply_filters('comment_status_links', $status_links); |
|
281 | 281 | } |
282 | 282 | |
283 | 283 | /** |
@@ -290,23 +290,23 @@ discard block |
||
290 | 290 | global $comment_status; |
291 | 291 | |
292 | 292 | $actions = array(); |
293 | - if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) |
|
294 | - $actions['unapprove'] = __( 'Unapprove' ); |
|
295 | - if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) |
|
296 | - $actions['approve'] = __( 'Approve' ); |
|
297 | - if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) |
|
298 | - $actions['spam'] = _x( 'Mark as Spam', 'comment' ); |
|
293 | + if (in_array($comment_status, array('all', 'approved'))) |
|
294 | + $actions['unapprove'] = __('Unapprove'); |
|
295 | + if (in_array($comment_status, array('all', 'moderated'))) |
|
296 | + $actions['approve'] = __('Approve'); |
|
297 | + if (in_array($comment_status, array('all', 'moderated', 'approved', 'trash'))) |
|
298 | + $actions['spam'] = _x('Mark as Spam', 'comment'); |
|
299 | 299 | |
300 | - if ( 'trash' === $comment_status ) { |
|
301 | - $actions['untrash'] = __( 'Restore' ); |
|
302 | - } elseif ( 'spam' === $comment_status ) { |
|
303 | - $actions['unspam'] = _x( 'Not Spam', 'comment' ); |
|
300 | + if ('trash' === $comment_status) { |
|
301 | + $actions['untrash'] = __('Restore'); |
|
302 | + } elseif ('spam' === $comment_status) { |
|
303 | + $actions['unspam'] = _x('Not Spam', 'comment'); |
|
304 | 304 | } |
305 | 305 | |
306 | - if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS ) |
|
307 | - $actions['delete'] = __( 'Delete Permanently' ); |
|
306 | + if (in_array($comment_status, array('trash', 'spam')) || ! EMPTY_TRASH_DAYS) |
|
307 | + $actions['delete'] = __('Delete Permanently'); |
|
308 | 308 | else |
309 | - $actions['trash'] = __( 'Move to Trash' ); |
|
309 | + $actions['trash'] = __('Move to Trash'); |
|
310 | 310 | |
311 | 311 | return $actions; |
312 | 312 | } |
@@ -318,16 +318,16 @@ discard block |
||
318 | 318 | * |
319 | 319 | * @param string $which |
320 | 320 | */ |
321 | - protected function extra_tablenav( $which ) { |
|
321 | + protected function extra_tablenav($which) { |
|
322 | 322 | global $comment_status, $comment_type; |
323 | 323 | ?> |
324 | 324 | <div class="alignleft actions"> |
325 | 325 | <?php |
326 | - if ( 'top' === $which ) { |
|
326 | + if ('top' === $which) { |
|
327 | 327 | ?> |
328 | - <label class="screen-reader-text" for="filter-by-comment-type"><?php _e( 'Filter by comment type' ); ?></label> |
|
328 | + <label class="screen-reader-text" for="filter-by-comment-type"><?php _e('Filter by comment type'); ?></label> |
|
329 | 329 | <select id="filter-by-comment-type" name="comment_type"> |
330 | - <option value=""><?php _e( 'All comment types' ); ?></option> |
|
330 | + <option value=""><?php _e('All comment types'); ?></option> |
|
331 | 331 | <?php |
332 | 332 | /** |
333 | 333 | * Filter the comment types dropdown menu. |
@@ -336,13 +336,13 @@ discard block |
||
336 | 336 | * |
337 | 337 | * @param array $comment_types An array of comment types. Accepts 'Comments', 'Pings'. |
338 | 338 | */ |
339 | - $comment_types = apply_filters( 'admin_comment_types_dropdown', array( |
|
340 | - 'comment' => __( 'Comments' ), |
|
341 | - 'pings' => __( 'Pings' ), |
|
342 | - ) ); |
|
339 | + $comment_types = apply_filters('admin_comment_types_dropdown', array( |
|
340 | + 'comment' => __('Comments'), |
|
341 | + 'pings' => __('Pings'), |
|
342 | + )); |
|
343 | 343 | |
344 | - foreach ( $comment_types as $type => $label ) |
|
345 | - echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n"; |
|
344 | + foreach ($comment_types as $type => $label) |
|
345 | + echo "\t".'<option value="'.esc_attr($type).'"'.selected($comment_type, $type, false).">$label</option>\n"; |
|
346 | 346 | ?> |
347 | 347 | </select> |
348 | 348 | <?php |
@@ -351,14 +351,14 @@ discard block |
||
351 | 351 | * |
352 | 352 | * @since 3.5.0 |
353 | 353 | */ |
354 | - do_action( 'restrict_manage_comments' ); |
|
355 | - submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); |
|
354 | + do_action('restrict_manage_comments'); |
|
355 | + submit_button(__('Filter'), 'button', 'filter_action', false, array('id' => 'post-query-submit')); |
|
356 | 356 | } |
357 | 357 | |
358 | - if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) && current_user_can( 'moderate_comments' ) ) { |
|
359 | - wp_nonce_field( 'bulk-destroy', '_destroy_nonce' ); |
|
360 | - $title = ( 'spam' === $comment_status ) ? esc_attr__( 'Empty Spam' ) : esc_attr__( 'Empty Trash' ); |
|
361 | - submit_button( $title, 'apply', 'delete_all', false ); |
|
358 | + if (('spam' === $comment_status || 'trash' === $comment_status) && current_user_can('moderate_comments')) { |
|
359 | + wp_nonce_field('bulk-destroy', '_destroy_nonce'); |
|
360 | + $title = ('spam' === $comment_status) ? esc_attr__('Empty Spam') : esc_attr__('Empty Trash'); |
|
361 | + submit_button($title, 'apply', 'delete_all', false); |
|
362 | 362 | } |
363 | 363 | /** |
364 | 364 | * Fires after the Filter submit button for comment types. |
@@ -367,7 +367,7 @@ discard block |
||
367 | 367 | * |
368 | 368 | * @param string $comment_status The comment status name. Default 'All'. |
369 | 369 | */ |
370 | - do_action( 'manage_comments_nav', $comment_status ); |
|
370 | + do_action('manage_comments_nav', $comment_status); |
|
371 | 371 | echo '</div>'; |
372 | 372 | } |
373 | 373 | |
@@ -375,7 +375,7 @@ discard block |
||
375 | 375 | * @return string|false |
376 | 376 | */ |
377 | 377 | public function current_action() { |
378 | - if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
|
378 | + if (isset($_REQUEST['delete_all']) || isset($_REQUEST['delete_all2'])) |
|
379 | 379 | return 'delete_all'; |
380 | 380 | |
381 | 381 | return parent::current_action(); |
@@ -392,18 +392,18 @@ discard block |
||
392 | 392 | |
393 | 393 | $columns = array(); |
394 | 394 | |
395 | - if ( $this->checkbox ) |
|
395 | + if ($this->checkbox) |
|
396 | 396 | $columns['cb'] = '<input type="checkbox" />'; |
397 | 397 | |
398 | - $columns['author'] = __( 'Author' ); |
|
399 | - $columns['comment'] = _x( 'Comment', 'column name' ); |
|
398 | + $columns['author'] = __('Author'); |
|
399 | + $columns['comment'] = _x('Comment', 'column name'); |
|
400 | 400 | |
401 | - if ( ! $post_id ) { |
|
401 | + if ( ! $post_id) { |
|
402 | 402 | /* translators: column name or table row header */ |
403 | - $columns['response'] = __( 'In Response To' ); |
|
403 | + $columns['response'] = __('In Response To'); |
|
404 | 404 | } |
405 | 405 | |
406 | - $columns['date'] = _x( 'Submitted On', 'column name' ); |
|
406 | + $columns['date'] = _x('Submitted On', 'column name'); |
|
407 | 407 | |
408 | 408 | return $columns; |
409 | 409 | } |
@@ -436,14 +436,14 @@ discard block |
||
436 | 436 | * @access public |
437 | 437 | */ |
438 | 438 | public function display() { |
439 | - wp_nonce_field( "fetch-list-" . get_class( $this ), '_ajax_fetch_list_nonce' ); |
|
439 | + wp_nonce_field("fetch-list-".get_class($this), '_ajax_fetch_list_nonce'); |
|
440 | 440 | |
441 | - $this->display_tablenav( 'top' ); |
|
441 | + $this->display_tablenav('top'); |
|
442 | 442 | |
443 | - $this->screen->render_screen_reader_content( 'heading_list' ); |
|
443 | + $this->screen->render_screen_reader_content('heading_list'); |
|
444 | 444 | |
445 | 445 | ?> |
446 | -<table class="wp-list-table <?php echo implode( ' ', $this->get_table_classes() ); ?>"> |
|
446 | +<table class="wp-list-table <?php echo implode(' ', $this->get_table_classes()); ?>"> |
|
447 | 447 | <thead> |
448 | 448 | <tr> |
449 | 449 | <?php $this->print_column_headers(); ?> |
@@ -463,14 +463,14 @@ discard block |
||
463 | 463 | |
464 | 464 | <tfoot> |
465 | 465 | <tr> |
466 | - <?php $this->print_column_headers( false ); ?> |
|
466 | + <?php $this->print_column_headers(false); ?> |
|
467 | 467 | </tr> |
468 | 468 | </tfoot> |
469 | 469 | |
470 | 470 | </table> |
471 | 471 | <?php |
472 | 472 | |
473 | - $this->display_tablenav( 'bottom' ); |
|
473 | + $this->display_tablenav('bottom'); |
|
474 | 474 | } |
475 | 475 | |
476 | 476 | /** |
@@ -479,27 +479,27 @@ discard block |
||
479 | 479 | * |
480 | 480 | * @param WP_Comment $item |
481 | 481 | */ |
482 | - public function single_row( $item ) { |
|
482 | + public function single_row($item) { |
|
483 | 483 | global $post, $comment; |
484 | 484 | |
485 | 485 | $comment = $item; |
486 | 486 | |
487 | - $the_comment_class = wp_get_comment_status( $comment ); |
|
488 | - if ( ! $the_comment_class ) { |
|
487 | + $the_comment_class = wp_get_comment_status($comment); |
|
488 | + if ( ! $the_comment_class) { |
|
489 | 489 | $the_comment_class = ''; |
490 | 490 | } |
491 | - $the_comment_class = join( ' ', get_comment_class( $the_comment_class, $comment, $comment->comment_post_ID ) ); |
|
491 | + $the_comment_class = join(' ', get_comment_class($the_comment_class, $comment, $comment->comment_post_ID)); |
|
492 | 492 | |
493 | - if ( $comment->comment_post_ID > 0 ) { |
|
494 | - $post = get_post( $comment->comment_post_ID ); |
|
493 | + if ($comment->comment_post_ID > 0) { |
|
494 | + $post = get_post($comment->comment_post_ID); |
|
495 | 495 | } |
496 | - $this->user_can = current_user_can( 'edit_comment', $comment->comment_ID ); |
|
496 | + $this->user_can = current_user_can('edit_comment', $comment->comment_ID); |
|
497 | 497 | |
498 | 498 | echo "<tr id='comment-$comment->comment_ID' class='$the_comment_class'>"; |
499 | - $this->single_row_columns( $comment ); |
|
499 | + $this->single_row_columns($comment); |
|
500 | 500 | echo "</tr>\n"; |
501 | 501 | |
502 | - unset( $GLOBALS['post'], $GLOBALS['comment'] ); |
|
502 | + unset($GLOBALS['post'], $GLOBALS['comment']); |
|
503 | 503 | } |
504 | 504 | |
505 | 505 | /** |
@@ -515,33 +515,33 @@ discard block |
||
515 | 515 | * @param string $primary Primary column name. |
516 | 516 | * @return string|void Comment row actions output. |
517 | 517 | */ |
518 | - protected function handle_row_actions( $comment, $column_name, $primary ) { |
|
518 | + protected function handle_row_actions($comment, $column_name, $primary) { |
|
519 | 519 | global $comment_status; |
520 | 520 | |
521 | - if ( $primary !== $column_name ) { |
|
521 | + if ($primary !== $column_name) { |
|
522 | 522 | return ''; |
523 | 523 | } |
524 | 524 | |
525 | - if ( ! $this->user_can ) { |
|
525 | + if ( ! $this->user_can) { |
|
526 | 526 | return; |
527 | 527 | } |
528 | 528 | |
529 | - $the_comment_status = wp_get_comment_status( $comment ); |
|
529 | + $the_comment_status = wp_get_comment_status($comment); |
|
530 | 530 | |
531 | 531 | $out = ''; |
532 | 532 | |
533 | - $del_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "delete-comment_$comment->comment_ID" ) ); |
|
534 | - $approve_nonce = esc_html( '_wpnonce=' . wp_create_nonce( "approve-comment_$comment->comment_ID" ) ); |
|
533 | + $del_nonce = esc_html('_wpnonce='.wp_create_nonce("delete-comment_$comment->comment_ID")); |
|
534 | + $approve_nonce = esc_html('_wpnonce='.wp_create_nonce("approve-comment_$comment->comment_ID")); |
|
535 | 535 | |
536 | 536 | $url = "comment.php?c=$comment->comment_ID"; |
537 | 537 | |
538 | - $approve_url = esc_url( $url . "&action=approvecomment&$approve_nonce" ); |
|
539 | - $unapprove_url = esc_url( $url . "&action=unapprovecomment&$approve_nonce" ); |
|
540 | - $spam_url = esc_url( $url . "&action=spamcomment&$del_nonce" ); |
|
541 | - $unspam_url = esc_url( $url . "&action=unspamcomment&$del_nonce" ); |
|
542 | - $trash_url = esc_url( $url . "&action=trashcomment&$del_nonce" ); |
|
543 | - $untrash_url = esc_url( $url . "&action=untrashcomment&$del_nonce" ); |
|
544 | - $delete_url = esc_url( $url . "&action=deletecomment&$del_nonce" ); |
|
538 | + $approve_url = esc_url($url."&action=approvecomment&$approve_nonce"); |
|
539 | + $unapprove_url = esc_url($url."&action=unapprovecomment&$approve_nonce"); |
|
540 | + $spam_url = esc_url($url."&action=spamcomment&$del_nonce"); |
|
541 | + $unspam_url = esc_url($url."&action=unspamcomment&$del_nonce"); |
|
542 | + $trash_url = esc_url($url."&action=trashcomment&$del_nonce"); |
|
543 | + $untrash_url = esc_url($url."&action=untrashcomment&$del_nonce"); |
|
544 | + $delete_url = esc_url($url."&action=deletecomment&$del_nonce"); |
|
545 | 545 | |
546 | 546 | // Preorder it: Approve | Reply | Quick Edit | Edit | Spam | Trash. |
547 | 547 | $actions = array( |
@@ -554,57 +554,57 @@ discard block |
||
554 | 554 | ); |
555 | 555 | |
556 | 556 | // Not looking at all comments. |
557 | - if ( $comment_status && 'all' != $comment_status ) { |
|
558 | - if ( 'approved' === $the_comment_status ) { |
|
559 | - $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' class='vim-u vim-destructive' aria-label='" . esc_attr__( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a>'; |
|
560 | - } elseif ( 'unapproved' === $the_comment_status ) { |
|
561 | - $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' class='vim-a vim-destructive' aria-label='" . esc_attr__( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a>'; |
|
557 | + if ($comment_status && 'all' != $comment_status) { |
|
558 | + if ('approved' === $the_comment_status) { |
|
559 | + $actions['unapprove'] = "<a href='$unapprove_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' class='vim-u vim-destructive' aria-label='".esc_attr__('Unapprove this comment')."'>".__('Unapprove').'</a>'; |
|
560 | + } elseif ('unapproved' === $the_comment_status) { |
|
561 | + $actions['approve'] = "<a href='$approve_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' class='vim-a vim-destructive' aria-label='".esc_attr__('Approve this comment')."'>".__('Approve').'</a>'; |
|
562 | 562 | } |
563 | 563 | } else { |
564 | - $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>'; |
|
565 | - $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>'; |
|
564 | + $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>'; |
|
565 | + $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>'; |
|
566 | 566 | } |
567 | 567 | |
568 | - if ( 'spam' !== $the_comment_status ) { |
|
569 | - $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>'; |
|
570 | - } elseif ( 'spam' === $the_comment_status ) { |
|
571 | - $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive' aria-label='" . esc_attr__( 'Restore this comment from the spam' ) . "'>" . _x( 'Not Spam', 'comment' ) . '</a>'; |
|
568 | + if ('spam' !== $the_comment_status) { |
|
569 | + $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>'; |
|
570 | + } elseif ('spam' === $the_comment_status) { |
|
571 | + $actions['unspam'] = "<a href='$unspam_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:unspam=1' class='vim-z vim-destructive' aria-label='".esc_attr__('Restore this comment from the spam')."'>"._x('Not Spam', 'comment').'</a>'; |
|
572 | 572 | } |
573 | 573 | |
574 | - if ( 'trash' === $the_comment_status ) { |
|
575 | - $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive' aria-label='" . esc_attr__( 'Restore this comment from the Trash' ) . "'>" . __( 'Restore' ) . '</a>'; |
|
574 | + if ('trash' === $the_comment_status) { |
|
575 | + $actions['untrash'] = "<a href='$untrash_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID:66cc66:untrash=1' class='vim-z vim-destructive' aria-label='".esc_attr__('Restore this comment from the Trash')."'>".__('Restore').'</a>'; |
|
576 | 576 | } |
577 | 577 | |
578 | - if ( 'spam' === $the_comment_status || 'trash' === $the_comment_status || !EMPTY_TRASH_DAYS ) { |
|
579 | - $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive' aria-label='" . esc_attr__( 'Delete this comment permanently' ) . "'>" . __( 'Delete Permanently' ) . '</a>'; |
|
578 | + if ('spam' === $the_comment_status || 'trash' === $the_comment_status || ! EMPTY_TRASH_DAYS) { |
|
579 | + $actions['delete'] = "<a href='$delete_url' data-wp-lists='delete:the-comment-list:comment-$comment->comment_ID::delete=1' class='delete vim-d vim-destructive' aria-label='".esc_attr__('Delete this comment permanently')."'>".__('Delete Permanently').'</a>'; |
|
580 | 580 | } else { |
581 | - $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>'; |
|
581 | + $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>'; |
|
582 | 582 | } |
583 | 583 | |
584 | - if ( 'spam' !== $the_comment_status && 'trash' !== $the_comment_status ) { |
|
585 | - $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='" . esc_attr__( 'Edit this comment' ) . "'>". __( 'Edit' ) . '</a>'; |
|
584 | + if ('spam' !== $the_comment_status && 'trash' !== $the_comment_status) { |
|
585 | + $actions['edit'] = "<a href='comment.php?action=editcomment&c={$comment->comment_ID}' aria-label='".esc_attr__('Edit this comment')."'>".__('Edit').'</a>'; |
|
586 | 586 | |
587 | 587 | $format = '<a data-comment-id="%d" data-post-id="%d" data-action="%s" class="%s" aria-label="%s" href="#">%s</a>'; |
588 | 588 | |
589 | - $actions['quickedit'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'edit', 'vim-q comment-inline', esc_attr__( 'Quick edit this comment inline' ), __( 'Quick Edit' ) ); |
|
589 | + $actions['quickedit'] = sprintf($format, $comment->comment_ID, $comment->comment_post_ID, 'edit', 'vim-q comment-inline', esc_attr__('Quick edit this comment inline'), __('Quick Edit')); |
|
590 | 590 | |
591 | - $actions['reply'] = sprintf( $format, $comment->comment_ID, $comment->comment_post_ID, 'replyto', 'vim-r comment-inline', esc_attr__( 'Reply to this comment' ), __( 'Reply' ) ); |
|
591 | + $actions['reply'] = sprintf($format, $comment->comment_ID, $comment->comment_post_ID, 'replyto', 'vim-r comment-inline', esc_attr__('Reply to this comment'), __('Reply')); |
|
592 | 592 | } |
593 | 593 | |
594 | 594 | /** This filter is documented in wp-admin/includes/dashboard.php */ |
595 | - $actions = apply_filters( 'comment_row_actions', array_filter( $actions ), $comment ); |
|
595 | + $actions = apply_filters('comment_row_actions', array_filter($actions), $comment); |
|
596 | 596 | |
597 | 597 | $i = 0; |
598 | 598 | $out .= '<div class="row-actions">'; |
599 | - foreach ( $actions as $action => $link ) { |
|
599 | + foreach ($actions as $action => $link) { |
|
600 | 600 | ++$i; |
601 | - ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
|
601 | + ((('approve' === $action || 'unapprove' === $action) && 2 === $i) || 1 === $i) ? $sep = '' : $sep = ' | '; |
|
602 | 602 | |
603 | 603 | // Reply and quickedit need a hide-if-no-js span when not added with ajax |
604 | - if ( ( 'reply' === $action || 'quickedit' === $action ) && ! defined('DOING_AJAX') ) |
|
604 | + if (('reply' === $action || 'quickedit' === $action) && ! defined('DOING_AJAX')) |
|
605 | 605 | $action .= ' hide-if-no-js'; |
606 | - elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) { |
|
607 | - if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) |
|
606 | + elseif (($action === 'untrash' && $the_comment_status === 'trash') || ($action === 'unspam' && $the_comment_status === 'spam')) { |
|
607 | + if ('1' == get_comment_meta($comment->comment_ID, '_wp_trash_meta_status', true)) |
|
608 | 608 | $action .= ' approve'; |
609 | 609 | else |
610 | 610 | $action .= ' unapprove'; |
@@ -614,7 +614,7 @@ discard block |
||
614 | 614 | } |
615 | 615 | $out .= '</div>'; |
616 | 616 | |
617 | - $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">' . __( 'Show more details' ) . '</span></button>'; |
|
617 | + $out .= '<button type="button" class="toggle-row"><span class="screen-reader-text">'.__('Show more details').'</span></button>'; |
|
618 | 618 | |
619 | 619 | return $out; |
620 | 620 | } |
@@ -623,9 +623,9 @@ discard block |
||
623 | 623 | * |
624 | 624 | * @param WP_Comment $comment The comment object. |
625 | 625 | */ |
626 | - public function column_cb( $comment ) { |
|
627 | - if ( $this->user_can ) { ?> |
|
628 | - <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e( 'Select comment' ); ?></label> |
|
626 | + public function column_cb($comment) { |
|
627 | + if ($this->user_can) { ?> |
|
628 | + <label class="screen-reader-text" for="cb-select-<?php echo $comment->comment_ID; ?>"><?php _e('Select comment'); ?></label> |
|
629 | 629 | <input id="cb-select-<?php echo $comment->comment_ID; ?>" type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /> |
630 | 630 | <?php |
631 | 631 | } |
@@ -634,34 +634,34 @@ discard block |
||
634 | 634 | /** |
635 | 635 | * @param WP_Comment $comment The comment object. |
636 | 636 | */ |
637 | - public function column_comment( $comment ) { |
|
637 | + public function column_comment($comment) { |
|
638 | 638 | echo '<div class="comment-author">'; |
639 | - $this->column_author( $comment ); |
|
639 | + $this->column_author($comment); |
|
640 | 640 | echo '</div>'; |
641 | 641 | |
642 | - if ( $comment->comment_parent ) { |
|
643 | - $parent = get_comment( $comment->comment_parent ); |
|
644 | - if ( $parent ) { |
|
645 | - $parent_link = esc_url( get_comment_link( $parent ) ); |
|
646 | - $name = get_comment_author( $parent ); |
|
642 | + if ($comment->comment_parent) { |
|
643 | + $parent = get_comment($comment->comment_parent); |
|
644 | + if ($parent) { |
|
645 | + $parent_link = esc_url(get_comment_link($parent)); |
|
646 | + $name = get_comment_author($parent); |
|
647 | 647 | printf( |
648 | 648 | /* translators: %s: comment link */ |
649 | - __( 'In reply to %s.' ), |
|
650 | - '<a href="' . $parent_link . '">' . $name . '</a>' |
|
649 | + __('In reply to %s.'), |
|
650 | + '<a href="'.$parent_link.'">'.$name.'</a>' |
|
651 | 651 | ); |
652 | 652 | } |
653 | 653 | } |
654 | 654 | |
655 | - comment_text( $comment ); |
|
656 | - if ( $this->user_can ) { ?> |
|
655 | + comment_text($comment); |
|
656 | + if ($this->user_can) { ?> |
|
657 | 657 | <div id="inline-<?php echo $comment->comment_ID; ?>" class="hidden"> |
658 | 658 | <textarea class="comment" rows="1" cols="1"><?php |
659 | 659 | /** This filter is documented in wp-admin/includes/comment.php */ |
660 | - echo esc_textarea( apply_filters( 'comment_edit_pre', $comment->comment_content ) ); |
|
660 | + echo esc_textarea(apply_filters('comment_edit_pre', $comment->comment_content)); |
|
661 | 661 | ?></textarea> |
662 | - <div class="author-email"><?php echo esc_attr( $comment->comment_author_email ); ?></div> |
|
663 | - <div class="author"><?php echo esc_attr( $comment->comment_author ); ?></div> |
|
664 | - <div class="author-url"><?php echo esc_attr( $comment->comment_author_url ); ?></div> |
|
662 | + <div class="author-email"><?php echo esc_attr($comment->comment_author_email); ?></div> |
|
663 | + <div class="author"><?php echo esc_attr($comment->comment_author); ?></div> |
|
664 | + <div class="author-url"><?php echo esc_attr($comment->comment_author_url); ?></div> |
|
665 | 665 | <div class="comment_status"><?php echo $comment->comment_approved; ?></div> |
666 | 666 | </div> |
667 | 667 | <?php |
@@ -674,38 +674,38 @@ discard block |
||
674 | 674 | * |
675 | 675 | * @param WP_Comment $comment The comment object. |
676 | 676 | */ |
677 | - public function column_author( $comment ) { |
|
677 | + public function column_author($comment) { |
|
678 | 678 | global $comment_status; |
679 | 679 | |
680 | - $author_url = get_comment_author_url( $comment ); |
|
680 | + $author_url = get_comment_author_url($comment); |
|
681 | 681 | |
682 | - $author_url_display = untrailingslashit( preg_replace( '|^http(s)?://(www\.)?|i', '', $author_url ) ); |
|
683 | - if ( strlen( $author_url_display ) > 50 ) { |
|
684 | - $author_url_display = wp_html_excerpt( $author_url_display, 49, '…' ); |
|
682 | + $author_url_display = untrailingslashit(preg_replace('|^http(s)?://(www\.)?|i', '', $author_url)); |
|
683 | + if (strlen($author_url_display) > 50) { |
|
684 | + $author_url_display = wp_html_excerpt($author_url_display, 49, '…'); |
|
685 | 685 | } |
686 | 686 | |
687 | - echo "<strong>"; comment_author( $comment ); echo '</strong><br />'; |
|
688 | - if ( ! empty( $author_url_display ) ) { |
|
689 | - printf( '<a href="%s">%s</a><br />', esc_url( $author_url ), esc_html( $author_url_display ) ); |
|
687 | + echo "<strong>"; comment_author($comment); echo '</strong><br />'; |
|
688 | + if ( ! empty($author_url_display)) { |
|
689 | + printf('<a href="%s">%s</a><br />', esc_url($author_url), esc_html($author_url_display)); |
|
690 | 690 | } |
691 | 691 | |
692 | - if ( $this->user_can ) { |
|
693 | - if ( ! empty( $comment->comment_author_email ) ) { |
|
692 | + if ($this->user_can) { |
|
693 | + if ( ! empty($comment->comment_author_email)) { |
|
694 | 694 | /* This filter is documented in wp-includes/comment-template.php */ |
695 | - $email = apply_filters( 'comment_email', $comment->comment_author_email, $comment ); |
|
695 | + $email = apply_filters('comment_email', $comment->comment_author_email, $comment); |
|
696 | 696 | |
697 | - if ( ! empty( $email ) && '@' !== $email ) { |
|
698 | - printf( '<a href="%1$s">%2$s</a><br />', esc_url( 'mailto:' . $email ), esc_html( $email ) ); |
|
697 | + if ( ! empty($email) && '@' !== $email) { |
|
698 | + printf('<a href="%1$s">%2$s</a><br />', esc_url('mailto:'.$email), esc_html($email)); |
|
699 | 699 | } |
700 | 700 | } |
701 | 701 | |
702 | - $author_ip = get_comment_author_IP( $comment ); |
|
703 | - if ( $author_ip ) { |
|
704 | - $author_ip_url = add_query_arg( array( 's' => $author_ip, 'mode' => 'detail' ), admin_url( 'edit-comments.php' ) ); |
|
705 | - if ( 'spam' === $comment_status ) { |
|
706 | - $author_ip_url = add_query_arg( 'comment_status', 'spam', $author_ip_url ); |
|
702 | + $author_ip = get_comment_author_IP($comment); |
|
703 | + if ($author_ip) { |
|
704 | + $author_ip_url = add_query_arg(array('s' => $author_ip, 'mode' => 'detail'), admin_url('edit-comments.php')); |
|
705 | + if ('spam' === $comment_status) { |
|
706 | + $author_ip_url = add_query_arg('comment_status', 'spam', $author_ip_url); |
|
707 | 707 | } |
708 | - printf( '<a href="%1$s">%2$s</a>', esc_url( $author_ip_url ), esc_html( $author_ip ) ); |
|
708 | + printf('<a href="%1$s">%2$s</a>', esc_url($author_ip_url), esc_html($author_ip)); |
|
709 | 709 | } |
710 | 710 | } |
711 | 711 | } |
@@ -715,19 +715,19 @@ discard block |
||
715 | 715 | * |
716 | 716 | * @param WP_Comment $comment The comment object. |
717 | 717 | */ |
718 | - public function column_date( $comment ) { |
|
718 | + public function column_date($comment) { |
|
719 | 719 | /* translators: 1: comment date, 2: comment time */ |
720 | - $submitted = sprintf( __( '%1$s at %2$s' ), |
|
720 | + $submitted = sprintf(__('%1$s at %2$s'), |
|
721 | 721 | /* translators: comment date format. See http://php.net/date */ |
722 | - get_comment_date( __( 'Y/m/d' ), $comment ), |
|
723 | - get_comment_date( __( 'g:i a' ), $comment ) |
|
722 | + get_comment_date(__('Y/m/d'), $comment), |
|
723 | + get_comment_date(__('g:i a'), $comment) |
|
724 | 724 | ); |
725 | 725 | |
726 | 726 | echo '<div class="submitted-on">'; |
727 | - if ( 'approved' === wp_get_comment_status( $comment ) && ! empty ( $comment->comment_post_ID ) ) { |
|
727 | + if ('approved' === wp_get_comment_status($comment) && ! empty ($comment->comment_post_ID)) { |
|
728 | 728 | printf( |
729 | 729 | '<a href="%s">%s</a>', |
730 | - esc_url( get_comment_link( $comment ) ), |
|
730 | + esc_url(get_comment_link($comment)), |
|
731 | 731 | $submitted |
732 | 732 | ); |
733 | 733 | } else { |
@@ -741,36 +741,36 @@ discard block |
||
741 | 741 | * |
742 | 742 | * @param WP_Comment $comment The comment object. |
743 | 743 | */ |
744 | - public function column_response( $comment ) { |
|
744 | + public function column_response($comment) { |
|
745 | 745 | $post = get_post(); |
746 | 746 | |
747 | - if ( ! $post ) { |
|
747 | + if ( ! $post) { |
|
748 | 748 | return; |
749 | 749 | } |
750 | 750 | |
751 | - if ( isset( $this->pending_count[$post->ID] ) ) { |
|
751 | + if (isset($this->pending_count[$post->ID])) { |
|
752 | 752 | $pending_comments = $this->pending_count[$post->ID]; |
753 | 753 | } else { |
754 | - $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); |
|
754 | + $_pending_count_temp = get_pending_comments_num(array($post->ID)); |
|
755 | 755 | $pending_comments = $this->pending_count[$post->ID] = $_pending_count_temp[$post->ID]; |
756 | 756 | } |
757 | 757 | |
758 | - if ( current_user_can( 'edit_post', $post->ID ) ) { |
|
759 | - $post_link = "<a href='" . get_edit_post_link( $post->ID ) . "' class='comments-edit-item-link'>"; |
|
760 | - $post_link .= esc_html( get_the_title( $post->ID ) ) . '</a>'; |
|
758 | + if (current_user_can('edit_post', $post->ID)) { |
|
759 | + $post_link = "<a href='".get_edit_post_link($post->ID)."' class='comments-edit-item-link'>"; |
|
760 | + $post_link .= esc_html(get_the_title($post->ID)).'</a>'; |
|
761 | 761 | } else { |
762 | - $post_link = esc_html( get_the_title( $post->ID ) ); |
|
762 | + $post_link = esc_html(get_the_title($post->ID)); |
|
763 | 763 | } |
764 | 764 | |
765 | 765 | echo '<div class="response-links">'; |
766 | - if ( 'attachment' === $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) ) { |
|
766 | + if ('attachment' === $post->post_type && ($thumb = wp_get_attachment_image($post->ID, array(80, 60), true))) { |
|
767 | 767 | echo $thumb; |
768 | 768 | } |
769 | 769 | echo $post_link; |
770 | - $post_type_object = get_post_type_object( $post->post_type ); |
|
771 | - echo "<a href='" . get_permalink( $post->ID ) . "' class='comments-view-item-link'>" . $post_type_object->labels->view_item . '</a>'; |
|
770 | + $post_type_object = get_post_type_object($post->post_type); |
|
771 | + echo "<a href='".get_permalink($post->ID)."' class='comments-view-item-link'>".$post_type_object->labels->view_item.'</a>'; |
|
772 | 772 | echo '<span class="post-com-count-wrapper post-com-count-', $post->ID, '">'; |
773 | - $this->comments_bubble( $post->ID, $pending_comments ); |
|
773 | + $this->comments_bubble($post->ID, $pending_comments); |
|
774 | 774 | echo '</span> '; |
775 | 775 | echo '</div>'; |
776 | 776 | } |
@@ -780,7 +780,7 @@ discard block |
||
780 | 780 | * @param WP_Comment $comment The comment object. |
781 | 781 | * @param string $column_name The custom column's name. |
782 | 782 | */ |
783 | - public function column_default( $comment, $column_name ) { |
|
783 | + public function column_default($comment, $column_name) { |
|
784 | 784 | /** |
785 | 785 | * Fires when the default column output is displayed for a single row. |
786 | 786 | * |
@@ -789,6 +789,6 @@ discard block |
||
789 | 789 | * @param string $column_name The custom column's name. |
790 | 790 | * @param int $comment->comment_ID The custom column's unique ID number. |
791 | 791 | */ |
792 | - do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID ); |
|
792 | + do_action('manage_comments_custom_column', $column_name, $comment->comment_ID); |
|
793 | 793 | } |
794 | 794 | } |
@@ -78,8 +78,9 @@ discard block |
||
78 | 78 | global $post_id, $comment_status, $search, $comment_type; |
79 | 79 | |
80 | 80 | $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
81 | - if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) ) |
|
82 | - $comment_status = 'all'; |
|
81 | + if ( !in_array( $comment_status, array( 'all', 'moderated', 'approved', 'spam', 'trash' ) ) ) { |
|
82 | + $comment_status = 'all'; |
|
83 | + } |
|
83 | 84 | |
84 | 85 | $comment_type = !empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : ''; |
85 | 86 | |
@@ -98,8 +99,7 @@ discard block |
||
98 | 99 | |
99 | 100 | if ( isset( $_REQUEST['number'] ) ) { |
100 | 101 | $number = (int) $_REQUEST['number']; |
101 | - } |
|
102 | - else { |
|
102 | + } else { |
|
103 | 103 | $number = $comments_per_page + min( 8, $comments_per_page ); // Grab a few extra |
104 | 104 | } |
105 | 105 | |
@@ -240,21 +240,25 @@ discard block |
||
240 | 240 | ) |
241 | 241 | ); |
242 | 242 | |
243 | - if ( !EMPTY_TRASH_DAYS ) |
|
244 | - unset($stati['trash']); |
|
243 | + if ( !EMPTY_TRASH_DAYS ) { |
|
244 | + unset($stati['trash']); |
|
245 | + } |
|
245 | 246 | |
246 | 247 | $link = admin_url( 'edit-comments.php' ); |
247 | - if ( !empty($comment_type) && 'all' != $comment_type ) |
|
248 | - $link = add_query_arg( 'comment_type', $comment_type, $link ); |
|
248 | + if ( !empty($comment_type) && 'all' != $comment_type ) { |
|
249 | + $link = add_query_arg( 'comment_type', $comment_type, $link ); |
|
250 | + } |
|
249 | 251 | |
250 | 252 | foreach ( $stati as $status => $label ) { |
251 | 253 | $class = ( $status === $comment_status ) ? ' class="current"' : ''; |
252 | 254 | |
253 | - if ( !isset( $num_comments->$status ) ) |
|
254 | - $num_comments->$status = 10; |
|
255 | + if ( !isset( $num_comments->$status ) ) { |
|
256 | + $num_comments->$status = 10; |
|
257 | + } |
|
255 | 258 | $link = add_query_arg( 'comment_status', $status, $link ); |
256 | - if ( $post_id ) |
|
257 | - $link = add_query_arg( 'p', absint( $post_id ), $link ); |
|
259 | + if ( $post_id ) { |
|
260 | + $link = add_query_arg( 'p', absint( $post_id ), $link ); |
|
261 | + } |
|
258 | 262 | /* |
259 | 263 | // I toyed with this, but decided against it. Leaving it in here in case anyone thinks it is a good idea. ~ Mark |
260 | 264 | if ( !empty( $_REQUEST['s'] ) ) |
@@ -290,12 +294,15 @@ discard block |
||
290 | 294 | global $comment_status; |
291 | 295 | |
292 | 296 | $actions = array(); |
293 | - if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) |
|
294 | - $actions['unapprove'] = __( 'Unapprove' ); |
|
295 | - if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) |
|
296 | - $actions['approve'] = __( 'Approve' ); |
|
297 | - if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) |
|
298 | - $actions['spam'] = _x( 'Mark as Spam', 'comment' ); |
|
297 | + if ( in_array( $comment_status, array( 'all', 'approved' ) ) ) { |
|
298 | + $actions['unapprove'] = __( 'Unapprove' ); |
|
299 | + } |
|
300 | + if ( in_array( $comment_status, array( 'all', 'moderated' ) ) ) { |
|
301 | + $actions['approve'] = __( 'Approve' ); |
|
302 | + } |
|
303 | + if ( in_array( $comment_status, array( 'all', 'moderated', 'approved', 'trash' ) ) ) { |
|
304 | + $actions['spam'] = _x( 'Mark as Spam', 'comment' ); |
|
305 | + } |
|
299 | 306 | |
300 | 307 | if ( 'trash' === $comment_status ) { |
301 | 308 | $actions['untrash'] = __( 'Restore' ); |
@@ -303,10 +310,11 @@ discard block |
||
303 | 310 | $actions['unspam'] = _x( 'Not Spam', 'comment' ); |
304 | 311 | } |
305 | 312 | |
306 | - if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS ) |
|
307 | - $actions['delete'] = __( 'Delete Permanently' ); |
|
308 | - else |
|
309 | - $actions['trash'] = __( 'Move to Trash' ); |
|
313 | + if ( in_array( $comment_status, array( 'trash', 'spam' ) ) || !EMPTY_TRASH_DAYS ) { |
|
314 | + $actions['delete'] = __( 'Delete Permanently' ); |
|
315 | + } else { |
|
316 | + $actions['trash'] = __( 'Move to Trash' ); |
|
317 | + } |
|
310 | 318 | |
311 | 319 | return $actions; |
312 | 320 | } |
@@ -341,8 +349,9 @@ discard block |
||
341 | 349 | 'pings' => __( 'Pings' ), |
342 | 350 | ) ); |
343 | 351 | |
344 | - foreach ( $comment_types as $type => $label ) |
|
345 | - echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n"; |
|
352 | + foreach ( $comment_types as $type => $label ) { |
|
353 | + echo "\t" . '<option value="' . esc_attr( $type ) . '"' . selected( $comment_type, $type, false ) . ">$label</option>\n"; |
|
354 | + } |
|
346 | 355 | ?> |
347 | 356 | </select> |
348 | 357 | <?php |
@@ -375,8 +384,9 @@ discard block |
||
375 | 384 | * @return string|false |
376 | 385 | */ |
377 | 386 | public function current_action() { |
378 | - if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) |
|
379 | - return 'delete_all'; |
|
387 | + if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) ) { |
|
388 | + return 'delete_all'; |
|
389 | + } |
|
380 | 390 | |
381 | 391 | return parent::current_action(); |
382 | 392 | } |
@@ -392,8 +402,9 @@ discard block |
||
392 | 402 | |
393 | 403 | $columns = array(); |
394 | 404 | |
395 | - if ( $this->checkbox ) |
|
396 | - $columns['cb'] = '<input type="checkbox" />'; |
|
405 | + if ( $this->checkbox ) { |
|
406 | + $columns['cb'] = '<input type="checkbox" />'; |
|
407 | + } |
|
397 | 408 | |
398 | 409 | $columns['author'] = __( 'Author' ); |
399 | 410 | $columns['comment'] = _x( 'Comment', 'column name' ); |
@@ -601,13 +612,14 @@ discard block |
||
601 | 612 | ( ( ( 'approve' === $action || 'unapprove' === $action ) && 2 === $i ) || 1 === $i ) ? $sep = '' : $sep = ' | '; |
602 | 613 | |
603 | 614 | // Reply and quickedit need a hide-if-no-js span when not added with ajax |
604 | - if ( ( 'reply' === $action || 'quickedit' === $action ) && ! defined('DOING_AJAX') ) |
|
605 | - $action .= ' hide-if-no-js'; |
|
606 | - elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) { |
|
607 | - if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) |
|
608 | - $action .= ' approve'; |
|
609 | - else |
|
610 | - $action .= ' unapprove'; |
|
615 | + if ( ( 'reply' === $action || 'quickedit' === $action ) && ! defined('DOING_AJAX') ) { |
|
616 | + $action .= ' hide-if-no-js'; |
|
617 | + } elseif ( ( $action === 'untrash' && $the_comment_status === 'trash' ) || ( $action === 'unspam' && $the_comment_status === 'spam' ) ) { |
|
618 | + if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) ) { |
|
619 | + $action .= ' approve'; |
|
620 | + } else { |
|
621 | + $action .= ' unapprove'; |
|
622 | + } |
|
611 | 623 | } |
612 | 624 | |
613 | 625 | $out .= "<span class='$action'>$sep$link</span>"; |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * List Table API: WP_Plugins_List_Table class |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 3.1.0 |
|
8 | - */ |
|
3 | + * List Table API: WP_Plugins_List_Table class |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 3.1.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Core class used to implement displaying installed plugins in a list table. |
@@ -30,20 +30,20 @@ discard block |
||
30 | 30 | * |
31 | 31 | * @param array $args An associative array of arguments. |
32 | 32 | */ |
33 | - public function __construct( $args = array() ) { |
|
33 | + public function __construct($args = array()) { |
|
34 | 34 | global $status, $page; |
35 | 35 | |
36 | - parent::__construct( array( |
|
36 | + parent::__construct(array( |
|
37 | 37 | 'plural' => 'plugins', |
38 | - 'screen' => isset( $args['screen'] ) ? $args['screen'] : null, |
|
39 | - ) ); |
|
38 | + 'screen' => isset($args['screen']) ? $args['screen'] : null, |
|
39 | + )); |
|
40 | 40 | |
41 | 41 | $status = 'all'; |
42 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
42 | + if (isset($_REQUEST['plugin_status']) && in_array($_REQUEST['plugin_status'], array('active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search'))) |
|
43 | 43 | $status = $_REQUEST['plugin_status']; |
44 | 44 | |
45 | - if ( isset($_REQUEST['s']) ) |
|
46 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
45 | + if (isset($_REQUEST['s'])) |
|
46 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s'])); |
|
47 | 47 | |
48 | 48 | $page = $this->get_pagenum(); |
49 | 49 | } |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * @return array |
53 | 53 | */ |
54 | 54 | protected function get_table_classes() { |
55 | - return array( 'widefat', $this->_args['plural'] ); |
|
55 | + return array('widefat', $this->_args['plural']); |
|
56 | 56 | } |
57 | 57 | |
58 | 58 | /** |
@@ -75,7 +75,7 @@ discard block |
||
75 | 75 | public function prepare_items() { |
76 | 76 | global $status, $plugins, $totals, $page, $orderby, $order, $s; |
77 | 77 | |
78 | - wp_reset_vars( array( 'orderby', 'order' ) ); |
|
78 | + wp_reset_vars(array('orderby', 'order')); |
|
79 | 79 | |
80 | 80 | /** |
81 | 81 | * Filters the full array of plugins to list in the Plugins list table. |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | * |
87 | 87 | * @param array $all_plugins An array of plugins to display in the list table. |
88 | 88 | */ |
89 | - $all_plugins = apply_filters( 'all_plugins', get_plugins() ); |
|
89 | + $all_plugins = apply_filters('all_plugins', get_plugins()); |
|
90 | 90 | |
91 | 91 | $plugins = array( |
92 | 92 | 'all' => $all_plugins, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | $screen = $this->screen; |
103 | 103 | |
104 | - if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { |
|
104 | + if ( ! is_multisite() || ($screen->in_admin('network') && current_user_can('manage_network_plugins'))) { |
|
105 | 105 | |
106 | 106 | /** |
107 | 107 | * Filter whether to display the advanced plugins list table. |
@@ -118,27 +118,27 @@ discard block |
||
118 | 118 | * plugin type. Default true. |
119 | 119 | * @param string $type The plugin type. Accepts 'mustuse', 'dropins'. |
120 | 120 | */ |
121 | - if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) { |
|
121 | + if (apply_filters('show_advanced_plugins', true, 'mustuse')) { |
|
122 | 122 | $plugins['mustuse'] = get_mu_plugins(); |
123 | 123 | } |
124 | 124 | |
125 | 125 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
126 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
126 | + if (apply_filters('show_advanced_plugins', true, 'dropins')) |
|
127 | 127 | $plugins['dropins'] = get_dropins(); |
128 | 128 | |
129 | - if ( current_user_can( 'update_plugins' ) ) { |
|
130 | - $current = get_site_transient( 'update_plugins' ); |
|
131 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
132 | - if ( isset( $current->response[ $plugin_file ] ) ) { |
|
133 | - $plugins['all'][ $plugin_file ]['update'] = true; |
|
134 | - $plugins['upgrade'][ $plugin_file ] = $plugins['all'][ $plugin_file ]; |
|
129 | + if (current_user_can('update_plugins')) { |
|
130 | + $current = get_site_transient('update_plugins'); |
|
131 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
132 | + if (isset($current->response[$plugin_file])) { |
|
133 | + $plugins['all'][$plugin_file]['update'] = true; |
|
134 | + $plugins['upgrade'][$plugin_file] = $plugins['all'][$plugin_file]; |
|
135 | 135 | } |
136 | 136 | } |
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
140 | - if ( ! $screen->in_admin( 'network' ) ) { |
|
141 | - $show = current_user_can( 'manage_network_plugins' ); |
|
140 | + if ( ! $screen->in_admin('network')) { |
|
141 | + $show = current_user_can('manage_network_plugins'); |
|
142 | 142 | /** |
143 | 143 | * Filter whether to display network-active plugins alongside plugins active for the current site. |
144 | 144 | * |
@@ -152,121 +152,121 @@ discard block |
||
152 | 152 | * @param bool $show Whether to show network-active plugins. Default is whether the current |
153 | 153 | * user can manage network plugins (ie. a Super Admin). |
154 | 154 | */ |
155 | - $show_network_active = apply_filters( 'show_network_active_plugins', $show ); |
|
155 | + $show_network_active = apply_filters('show_network_active_plugins', $show); |
|
156 | 156 | } |
157 | 157 | |
158 | - set_transient( 'plugin_slugs', array_keys( $plugins['all'] ), DAY_IN_SECONDS ); |
|
158 | + set_transient('plugin_slugs', array_keys($plugins['all']), DAY_IN_SECONDS); |
|
159 | 159 | |
160 | - if ( $screen->in_admin( 'network' ) ) { |
|
161 | - $recently_activated = get_site_option( 'recently_activated', array() ); |
|
160 | + if ($screen->in_admin('network')) { |
|
161 | + $recently_activated = get_site_option('recently_activated', array()); |
|
162 | 162 | } else { |
163 | - $recently_activated = get_option( 'recently_activated', array() ); |
|
163 | + $recently_activated = get_option('recently_activated', array()); |
|
164 | 164 | } |
165 | 165 | |
166 | - foreach ( $recently_activated as $key => $time ) { |
|
167 | - if ( $time + WEEK_IN_SECONDS < time() ) { |
|
168 | - unset( $recently_activated[$key] ); |
|
166 | + foreach ($recently_activated as $key => $time) { |
|
167 | + if ($time + WEEK_IN_SECONDS < time()) { |
|
168 | + unset($recently_activated[$key]); |
|
169 | 169 | } |
170 | 170 | } |
171 | 171 | |
172 | - if ( $screen->in_admin( 'network' ) ) { |
|
173 | - update_site_option( 'recently_activated', $recently_activated ); |
|
172 | + if ($screen->in_admin('network')) { |
|
173 | + update_site_option('recently_activated', $recently_activated); |
|
174 | 174 | } else { |
175 | - update_option( 'recently_activated', $recently_activated ); |
|
175 | + update_option('recently_activated', $recently_activated); |
|
176 | 176 | } |
177 | 177 | |
178 | - $plugin_info = get_site_transient( 'update_plugins' ); |
|
178 | + $plugin_info = get_site_transient('update_plugins'); |
|
179 | 179 | |
180 | - foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) { |
|
180 | + foreach ((array) $plugins['all'] as $plugin_file => $plugin_data) { |
|
181 | 181 | // Extra info if known. array_merge() ensures $plugin_data has precedence if keys collide. |
182 | - if ( isset( $plugin_info->response[ $plugin_file ] ) ) { |
|
183 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
182 | + if (isset($plugin_info->response[$plugin_file])) { |
|
183 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
184 | 184 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
185 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
186 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->response[ $plugin_file ], $plugin_data ); |
|
185 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
186 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->response[$plugin_file], $plugin_data); |
|
187 | 187 | } |
188 | 188 | |
189 | - } elseif ( isset( $plugin_info->no_update[ $plugin_file ] ) ) { |
|
190 | - $plugins['all'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
189 | + } elseif (isset($plugin_info->no_update[$plugin_file])) { |
|
190 | + $plugins['all'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
191 | 191 | // Make sure that $plugins['upgrade'] also receives the extra info since it is used on ?plugin_status=upgrade |
192 | - if ( isset( $plugins['upgrade'][ $plugin_file ] ) ) { |
|
193 | - $plugins['upgrade'][ $plugin_file ] = $plugin_data = array_merge( (array) $plugin_info->no_update[ $plugin_file ], $plugin_data ); |
|
192 | + if (isset($plugins['upgrade'][$plugin_file])) { |
|
193 | + $plugins['upgrade'][$plugin_file] = $plugin_data = array_merge((array) $plugin_info->no_update[$plugin_file], $plugin_data); |
|
194 | 194 | } |
195 | 195 | } |
196 | 196 | |
197 | 197 | // Filter into individual sections |
198 | - if ( is_multisite() && ! $screen->in_admin( 'network' ) && is_network_only_plugin( $plugin_file ) && ! is_plugin_active( $plugin_file ) ) { |
|
199 | - if ( $show_network_active ) { |
|
198 | + if (is_multisite() && ! $screen->in_admin('network') && is_network_only_plugin($plugin_file) && ! is_plugin_active($plugin_file)) { |
|
199 | + if ($show_network_active) { |
|
200 | 200 | // On the non-network screen, show inactive network-only plugins if allowed |
201 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
201 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
202 | 202 | } else { |
203 | 203 | // On the non-network screen, filter out network-only plugins as long as they're not individually active |
204 | - unset( $plugins['all'][ $plugin_file ] ); |
|
204 | + unset($plugins['all'][$plugin_file]); |
|
205 | 205 | } |
206 | - } elseif ( ! $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) { |
|
207 | - if ( $show_network_active ) { |
|
206 | + } elseif ( ! $screen->in_admin('network') && is_plugin_active_for_network($plugin_file)) { |
|
207 | + if ($show_network_active) { |
|
208 | 208 | // On the non-network screen, show network-active plugins if allowed |
209 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
209 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
210 | 210 | } else { |
211 | 211 | // On the non-network screen, filter out network-active plugins |
212 | - unset( $plugins['all'][ $plugin_file ] ); |
|
212 | + unset($plugins['all'][$plugin_file]); |
|
213 | 213 | } |
214 | - } elseif ( ( ! $screen->in_admin( 'network' ) && is_plugin_active( $plugin_file ) ) |
|
215 | - || ( $screen->in_admin( 'network' ) && is_plugin_active_for_network( $plugin_file ) ) ) { |
|
214 | + } elseif (( ! $screen->in_admin('network') && is_plugin_active($plugin_file)) |
|
215 | + || ($screen->in_admin('network') && is_plugin_active_for_network($plugin_file))) { |
|
216 | 216 | // On the non-network screen, populate the active list with plugins that are individually activated |
217 | 217 | // On the network-admin screen, populate the active list with plugins that are network activated |
218 | - $plugins['active'][ $plugin_file ] = $plugin_data; |
|
218 | + $plugins['active'][$plugin_file] = $plugin_data; |
|
219 | 219 | } else { |
220 | - if ( isset( $recently_activated[ $plugin_file ] ) ) { |
|
220 | + if (isset($recently_activated[$plugin_file])) { |
|
221 | 221 | // Populate the recently activated list with plugins that have been recently activated |
222 | - $plugins['recently_activated'][ $plugin_file ] = $plugin_data; |
|
222 | + $plugins['recently_activated'][$plugin_file] = $plugin_data; |
|
223 | 223 | } |
224 | 224 | // Populate the inactive list with plugins that aren't activated |
225 | - $plugins['inactive'][ $plugin_file ] = $plugin_data; |
|
225 | + $plugins['inactive'][$plugin_file] = $plugin_data; |
|
226 | 226 | } |
227 | 227 | } |
228 | 228 | |
229 | - if ( strlen( $s ) ) { |
|
229 | + if (strlen($s)) { |
|
230 | 230 | $status = 'search'; |
231 | - $plugins['search'] = array_filter( $plugins['all'], array( $this, '_search_callback' ) ); |
|
231 | + $plugins['search'] = array_filter($plugins['all'], array($this, '_search_callback')); |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | $totals = array(); |
235 | - foreach ( $plugins as $type => $list ) |
|
236 | - $totals[ $type ] = count( $list ); |
|
235 | + foreach ($plugins as $type => $list) |
|
236 | + $totals[$type] = count($list); |
|
237 | 237 | |
238 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
238 | + if (empty($plugins[$status]) && ! in_array($status, array('all', 'search'))) |
|
239 | 239 | $status = 'all'; |
240 | 240 | |
241 | 241 | $this->items = array(); |
242 | - foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
|
242 | + foreach ($plugins[$status] as $plugin_file => $plugin_data) { |
|
243 | 243 | // Translate, Don't Apply Markup, Sanitize HTML |
244 | - $this->items[$plugin_file] = _get_plugin_data_markup_translate( $plugin_file, $plugin_data, false, true ); |
|
244 | + $this->items[$plugin_file] = _get_plugin_data_markup_translate($plugin_file, $plugin_data, false, true); |
|
245 | 245 | } |
246 | 246 | |
247 | - $total_this_page = $totals[ $status ]; |
|
247 | + $total_this_page = $totals[$status]; |
|
248 | 248 | |
249 | - if ( ! $orderby ) { |
|
249 | + if ( ! $orderby) { |
|
250 | 250 | $orderby = 'Name'; |
251 | 251 | } else { |
252 | - $orderby = ucfirst( $orderby ); |
|
252 | + $orderby = ucfirst($orderby); |
|
253 | 253 | } |
254 | 254 | |
255 | - $order = strtoupper( $order ); |
|
255 | + $order = strtoupper($order); |
|
256 | 256 | |
257 | - uasort( $this->items, array( $this, '_order_callback' ) ); |
|
257 | + uasort($this->items, array($this, '_order_callback')); |
|
258 | 258 | |
259 | - $plugins_per_page = $this->get_items_per_page( str_replace( '-', '_', $screen->id . '_per_page' ), 999 ); |
|
259 | + $plugins_per_page = $this->get_items_per_page(str_replace('-', '_', $screen->id.'_per_page'), 999); |
|
260 | 260 | |
261 | - $start = ( $page - 1 ) * $plugins_per_page; |
|
261 | + $start = ($page - 1) * $plugins_per_page; |
|
262 | 262 | |
263 | - if ( $total_this_page > $plugins_per_page ) |
|
264 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
263 | + if ($total_this_page > $plugins_per_page) |
|
264 | + $this->items = array_slice($this->items, $start, $plugins_per_page); |
|
265 | 265 | |
266 | - $this->set_pagination_args( array( |
|
266 | + $this->set_pagination_args(array( |
|
267 | 267 | 'total_items' => $total_this_page, |
268 | 268 | 'per_page' => $plugins_per_page, |
269 | - ) ); |
|
269 | + )); |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | /** |
@@ -275,11 +275,11 @@ discard block |
||
275 | 275 | * @param array $plugin |
276 | 276 | * @return bool |
277 | 277 | */ |
278 | - public function _search_callback( $plugin ) { |
|
278 | + public function _search_callback($plugin) { |
|
279 | 279 | global $s; |
280 | 280 | |
281 | - foreach ( $plugin as $value ) { |
|
282 | - if ( is_string( $value ) && false !== stripos( strip_tags( $value ), urldecode( $s ) ) ) { |
|
281 | + foreach ($plugin as $value) { |
|
282 | + if (is_string($value) && false !== stripos(strip_tags($value), urldecode($s))) { |
|
283 | 283 | return true; |
284 | 284 | } |
285 | 285 | } |
@@ -294,19 +294,19 @@ discard block |
||
294 | 294 | * @param array $plugin_b |
295 | 295 | * @return int |
296 | 296 | */ |
297 | - public function _order_callback( $plugin_a, $plugin_b ) { |
|
297 | + public function _order_callback($plugin_a, $plugin_b) { |
|
298 | 298 | global $orderby, $order; |
299 | 299 | |
300 | 300 | $a = $plugin_a[$orderby]; |
301 | 301 | $b = $plugin_b[$orderby]; |
302 | 302 | |
303 | - if ( $a == $b ) |
|
303 | + if ($a == $b) |
|
304 | 304 | return 0; |
305 | 305 | |
306 | - if ( 'DESC' === $order ) { |
|
307 | - return strcasecmp( $b, $a ); |
|
306 | + if ('DESC' === $order) { |
|
307 | + return strcasecmp($b, $a); |
|
308 | 308 | } else { |
309 | - return strcasecmp( $a, $b ); |
|
309 | + return strcasecmp($a, $b); |
|
310 | 310 | } |
311 | 311 | } |
312 | 312 | |
@@ -317,19 +317,19 @@ discard block |
||
317 | 317 | public function no_items() { |
318 | 318 | global $plugins; |
319 | 319 | |
320 | - if ( ! empty( $_REQUEST['s'] ) ) { |
|
321 | - $s = esc_html( wp_unslash( $_REQUEST['s'] ) ); |
|
320 | + if ( ! empty($_REQUEST['s'])) { |
|
321 | + $s = esc_html(wp_unslash($_REQUEST['s'])); |
|
322 | 322 | |
323 | - printf( __( 'No plugins found for “%s”.' ), $s ); |
|
323 | + printf(__('No plugins found for “%s”.'), $s); |
|
324 | 324 | |
325 | 325 | // We assume that somebody who can install plugins in multisite is experienced enough to not need this helper link. |
326 | - if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
|
327 | - echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
|
326 | + if ( ! is_multisite() && current_user_can('install_plugins')) { |
|
327 | + echo ' <a href="'.esc_url(admin_url('plugin-install.php?tab=search&s='.urlencode($s))).'">'.__('Search for plugins in the WordPress Plugin Directory.').'</a>'; |
|
328 | 328 | } |
329 | - } elseif ( ! empty( $plugins['all'] ) ) |
|
330 | - _e( 'No plugins found.' ); |
|
329 | + } elseif ( ! empty($plugins['all'])) |
|
330 | + _e('No plugins found.'); |
|
331 | 331 | else |
332 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
332 | + _e('You do not appear to have any plugins available at this time.'); |
|
333 | 333 | } |
334 | 334 | |
335 | 335 | /** |
@@ -341,9 +341,9 @@ discard block |
||
341 | 341 | global $status; |
342 | 342 | |
343 | 343 | return array( |
344 | - 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '', |
|
345 | - 'name' => __( 'Plugin' ), |
|
346 | - 'description' => __( 'Description' ), |
|
344 | + 'cb' => ! in_array($status, array('mustuse', 'dropins')) ? '<input type="checkbox" />' : '', |
|
345 | + 'name' => __('Plugin'), |
|
346 | + 'description' => __('Description'), |
|
347 | 347 | ); |
348 | 348 | } |
349 | 349 | |
@@ -364,39 +364,39 @@ discard block |
||
364 | 364 | global $totals, $status; |
365 | 365 | |
366 | 366 | $status_links = array(); |
367 | - foreach ( $totals as $type => $count ) { |
|
368 | - if ( !$count ) |
|
367 | + foreach ($totals as $type => $count) { |
|
368 | + if ( ! $count) |
|
369 | 369 | continue; |
370 | 370 | |
371 | - switch ( $type ) { |
|
371 | + switch ($type) { |
|
372 | 372 | case 'all': |
373 | - $text = _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins' ); |
|
373 | + $text = _nx('All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $count, 'plugins'); |
|
374 | 374 | break; |
375 | 375 | case 'active': |
376 | - $text = _n( 'Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count ); |
|
376 | + $text = _n('Active <span class="count">(%s)</span>', 'Active <span class="count">(%s)</span>', $count); |
|
377 | 377 | break; |
378 | 378 | case 'recently_activated': |
379 | - $text = _n( 'Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count ); |
|
379 | + $text = _n('Recently Active <span class="count">(%s)</span>', 'Recently Active <span class="count">(%s)</span>', $count); |
|
380 | 380 | break; |
381 | 381 | case 'inactive': |
382 | - $text = _n( 'Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count ); |
|
382 | + $text = _n('Inactive <span class="count">(%s)</span>', 'Inactive <span class="count">(%s)</span>', $count); |
|
383 | 383 | break; |
384 | 384 | case 'mustuse': |
385 | - $text = _n( 'Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count ); |
|
385 | + $text = _n('Must-Use <span class="count">(%s)</span>', 'Must-Use <span class="count">(%s)</span>', $count); |
|
386 | 386 | break; |
387 | 387 | case 'dropins': |
388 | - $text = _n( 'Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count ); |
|
388 | + $text = _n('Drop-ins <span class="count">(%s)</span>', 'Drop-ins <span class="count">(%s)</span>', $count); |
|
389 | 389 | break; |
390 | 390 | case 'upgrade': |
391 | - $text = _n( 'Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count ); |
|
391 | + $text = _n('Update Available <span class="count">(%s)</span>', 'Update Available <span class="count">(%s)</span>', $count); |
|
392 | 392 | break; |
393 | 393 | } |
394 | 394 | |
395 | - if ( 'search' !== $type ) { |
|
396 | - $status_links[$type] = sprintf( "<a href='%s' %s>%s</a>", |
|
395 | + if ('search' !== $type) { |
|
396 | + $status_links[$type] = sprintf("<a href='%s' %s>%s</a>", |
|
397 | 397 | add_query_arg('plugin_status', $type, 'plugins.php'), |
398 | - ( $type === $status ) ? ' class="current"' : '', |
|
399 | - sprintf( $text, number_format_i18n( $count ) ) |
|
398 | + ($type === $status) ? ' class="current"' : '', |
|
399 | + sprintf($text, number_format_i18n($count)) |
|
400 | 400 | ); |
401 | 401 | } |
402 | 402 | } |
@@ -414,17 +414,17 @@ discard block |
||
414 | 414 | |
415 | 415 | $actions = array(); |
416 | 416 | |
417 | - if ( 'active' != $status ) |
|
418 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
417 | + if ('active' != $status) |
|
418 | + $actions['activate-selected'] = $this->screen->in_admin('network') ? __('Network Activate') : __('Activate'); |
|
419 | 419 | |
420 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
421 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
420 | + if ('inactive' != $status && 'recent' != $status) |
|
421 | + $actions['deactivate-selected'] = $this->screen->in_admin('network') ? __('Network Deactivate') : __('Deactivate'); |
|
422 | 422 | |
423 | - if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
|
424 | - if ( current_user_can( 'update_plugins' ) ) |
|
425 | - $actions['update-selected'] = __( 'Update' ); |
|
426 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
427 | - $actions['delete-selected'] = __( 'Delete' ); |
|
423 | + if ( ! is_multisite() || $this->screen->in_admin('network')) { |
|
424 | + if (current_user_can('update_plugins')) |
|
425 | + $actions['update-selected'] = __('Update'); |
|
426 | + if (current_user_can('delete_plugins') && ('active' != $status)) |
|
427 | + $actions['delete-selected'] = __('Delete'); |
|
428 | 428 | } |
429 | 429 | |
430 | 430 | return $actions; |
@@ -434,39 +434,39 @@ discard block |
||
434 | 434 | * @global string $status |
435 | 435 | * @param string $which |
436 | 436 | */ |
437 | - public function bulk_actions( $which = '' ) { |
|
437 | + public function bulk_actions($which = '') { |
|
438 | 438 | global $status; |
439 | 439 | |
440 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
440 | + if (in_array($status, array('mustuse', 'dropins'))) |
|
441 | 441 | return; |
442 | 442 | |
443 | - parent::bulk_actions( $which ); |
|
443 | + parent::bulk_actions($which); |
|
444 | 444 | } |
445 | 445 | |
446 | 446 | /** |
447 | 447 | * @global string $status |
448 | 448 | * @param string $which |
449 | 449 | */ |
450 | - protected function extra_tablenav( $which ) { |
|
450 | + protected function extra_tablenav($which) { |
|
451 | 451 | global $status; |
452 | 452 | |
453 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
453 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins'))) |
|
454 | 454 | return; |
455 | 455 | |
456 | 456 | echo '<div class="alignleft actions">'; |
457 | 457 | |
458 | - if ( 'recently_activated' == $status ) { |
|
459 | - submit_button( __( 'Clear List' ), 'button', 'clear-recent-list', false ); |
|
460 | - } elseif ( 'top' === $which && 'mustuse' === $status ) { |
|
458 | + if ('recently_activated' == $status) { |
|
459 | + submit_button(__('Clear List'), 'button', 'clear-recent-list', false); |
|
460 | + } elseif ('top' === $which && 'mustuse' === $status) { |
|
461 | 461 | /* translators: %s: mu-plugins directory name */ |
462 | - echo '<p>' . sprintf( __( 'Files in the %s directory are executed automatically.' ), |
|
463 | - '<code>' . str_replace( ABSPATH, '/', WPMU_PLUGIN_DIR ) . '</code>' |
|
464 | - ) . '</p>'; |
|
465 | - } elseif ( 'top' === $which && 'dropins' === $status ) { |
|
462 | + echo '<p>'.sprintf(__('Files in the %s directory are executed automatically.'), |
|
463 | + '<code>'.str_replace(ABSPATH, '/', WPMU_PLUGIN_DIR).'</code>' |
|
464 | + ).'</p>'; |
|
465 | + } elseif ('top' === $which && 'dropins' === $status) { |
|
466 | 466 | /* translators: %s: wp-content directory name */ |
467 | - echo '<p>' . sprintf( __( 'Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.' ), |
|
468 | - '<code>' . str_replace( ABSPATH, '', WP_CONTENT_DIR ) . '</code>' |
|
469 | - ) . '</p>'; |
|
467 | + echo '<p>'.sprintf(__('Drop-ins are advanced plugins in the %s directory that replace WordPress functionality when present.'), |
|
468 | + '<code>'.str_replace(ABSPATH, '', WP_CONTENT_DIR).'</code>' |
|
469 | + ).'</p>'; |
|
470 | 470 | } |
471 | 471 | echo '</div>'; |
472 | 472 | } |
@@ -475,7 +475,7 @@ discard block |
||
475 | 475 | * @return string |
476 | 476 | */ |
477 | 477 | public function current_action() { |
478 | - if ( isset($_POST['clear-recent-list']) ) |
|
478 | + if (isset($_POST['clear-recent-list'])) |
|
479 | 479 | return 'clear-recent-list'; |
480 | 480 | |
481 | 481 | return parent::current_action(); |
@@ -488,11 +488,11 @@ discard block |
||
488 | 488 | public function display_rows() { |
489 | 489 | global $status; |
490 | 490 | |
491 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
491 | + if (is_multisite() && ! $this->screen->in_admin('network') && in_array($status, array('mustuse', 'dropins'))) |
|
492 | 492 | return; |
493 | 493 | |
494 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
495 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
494 | + foreach ($this->items as $plugin_file => $plugin_data) |
|
495 | + $this->single_row(array($plugin_file, $plugin_data)); |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | /** |
@@ -503,10 +503,10 @@ discard block |
||
503 | 503 | * |
504 | 504 | * @param array $item |
505 | 505 | */ |
506 | - public function single_row( $item ) { |
|
506 | + public function single_row($item) { |
|
507 | 507 | global $status, $page, $s, $totals; |
508 | 508 | |
509 | - list( $plugin_file, $plugin_data ) = $item; |
|
509 | + list($plugin_file, $plugin_data) = $item; |
|
510 | 510 | $context = $status; |
511 | 511 | $screen = $this->screen; |
512 | 512 | |
@@ -523,88 +523,88 @@ discard block |
||
523 | 523 | $restrict_network_active = false; |
524 | 524 | $restrict_network_only = false; |
525 | 525 | |
526 | - if ( 'mustuse' === $context ) { |
|
526 | + if ('mustuse' === $context) { |
|
527 | 527 | $is_active = true; |
528 | - } elseif ( 'dropins' === $context ) { |
|
528 | + } elseif ('dropins' === $context) { |
|
529 | 529 | $dropins = _get_dropins(); |
530 | 530 | $plugin_name = $plugin_file; |
531 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
532 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
533 | - if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
|
531 | + if ($plugin_file != $plugin_data['Name']) |
|
532 | + $plugin_name .= '<br/>'.$plugin_data['Name']; |
|
533 | + if (true === ($dropins[$plugin_file][1])) { // Doesn't require a constant |
|
534 | 534 | $is_active = true; |
535 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
536 | - } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true |
|
535 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
536 | + } elseif (defined($dropins[$plugin_file][1]) && constant($dropins[$plugin_file][1])) { // Constant is true |
|
537 | 537 | $is_active = true; |
538 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
|
538 | + $description = '<p><strong>'.$dropins[$plugin_file][0].'</strong></p>'; |
|
539 | 539 | } else { |
540 | 540 | $is_active = false; |
541 | - $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' . |
|
541 | + $description = '<p><strong>'.$dropins[$plugin_file][0].' <span class="error-message">'.__('Inactive:').'</span></strong> '. |
|
542 | 542 | /* translators: 1: drop-in constant name, 2: wp-config.php */ |
543 | - sprintf( __( 'Requires %1$s in %2$s file.' ), |
|
544 | - "<code>define('" . $dropins[ $plugin_file ][1] . "', true);</code>", |
|
543 | + sprintf(__('Requires %1$s in %2$s file.'), |
|
544 | + "<code>define('".$dropins[$plugin_file][1]."', true);</code>", |
|
545 | 545 | '<code>wp-config.php</code>' |
546 | - ) . '</p>'; |
|
546 | + ).'</p>'; |
|
547 | 547 | } |
548 | - if ( $plugin_data['Description'] ) |
|
549 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
548 | + if ($plugin_data['Description']) |
|
549 | + $description .= '<p>'.$plugin_data['Description'].'</p>'; |
|
550 | 550 | } else { |
551 | - if ( $screen->in_admin( 'network' ) ) { |
|
552 | - $is_active = is_plugin_active_for_network( $plugin_file ); |
|
551 | + if ($screen->in_admin('network')) { |
|
552 | + $is_active = is_plugin_active_for_network($plugin_file); |
|
553 | 553 | } else { |
554 | - $is_active = is_plugin_active( $plugin_file ); |
|
555 | - $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); |
|
556 | - $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); |
|
554 | + $is_active = is_plugin_active($plugin_file); |
|
555 | + $restrict_network_active = (is_multisite() && is_plugin_active_for_network($plugin_file)); |
|
556 | + $restrict_network_only = (is_multisite() && is_network_only_plugin($plugin_file) && ! $is_active); |
|
557 | 557 | } |
558 | 558 | |
559 | - if ( $screen->in_admin( 'network' ) ) { |
|
560 | - if ( $is_active ) { |
|
561 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
559 | + if ($screen->in_admin('network')) { |
|
560 | + if ($is_active) { |
|
561 | + if (current_user_can('manage_network_plugins')) { |
|
562 | 562 | /* translators: %s: plugin name */ |
563 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( __( 'Network deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>'; |
|
563 | + $actions['deactivate'] = '<a href="'.wp_nonce_url('plugins.php?action=deactivate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'deactivate-plugin_'.$plugin_file).'" aria-label="'.esc_attr(sprintf(__('Network deactivate %s'), $plugin_data['Name'])).'">'.__('Network Deactivate').'</a>'; |
|
564 | 564 | } |
565 | 565 | } else { |
566 | - if ( current_user_can( 'manage_network_plugins' ) ) { |
|
566 | + if (current_user_can('manage_network_plugins')) { |
|
567 | 567 | /* translators: %s: plugin name */ |
568 | - $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Network Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>'; |
|
568 | + $actions['activate'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'activate-plugin_'.$plugin_file).'" class="edit" aria-label="'.esc_attr(sprintf(__('Network Activate %s'), $plugin_data['Name'])).'">'.__('Network Activate').'</a>'; |
|
569 | 569 | } |
570 | - if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { |
|
570 | + if (current_user_can('delete_plugins') && ! is_plugin_active($plugin_file)) { |
|
571 | 571 | /* translators: %s: plugin name */ |
572 | - $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
572 | + $actions['delete'] = '<a href="'.wp_nonce_url('plugins.php?action=delete-selected&checked[]='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'bulk-plugins').'" class="delete" aria-label="'.esc_attr(sprintf(__('Delete %s'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
573 | 573 | } |
574 | 574 | } |
575 | 575 | } else { |
576 | - if ( $restrict_network_active ) { |
|
576 | + if ($restrict_network_active) { |
|
577 | 577 | $actions = array( |
578 | - 'network_active' => __( 'Network Active' ), |
|
578 | + 'network_active' => __('Network Active'), |
|
579 | 579 | ); |
580 | - } elseif ( $restrict_network_only ) { |
|
580 | + } elseif ($restrict_network_only) { |
|
581 | 581 | $actions = array( |
582 | - 'network_only' => __( 'Network Only' ), |
|
582 | + 'network_only' => __('Network Only'), |
|
583 | 583 | ); |
584 | - } elseif ( $is_active ) { |
|
584 | + } elseif ($is_active) { |
|
585 | 585 | /* translators: %s: plugin name */ |
586 | - $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( __( 'Deactivate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; |
|
586 | + $actions['deactivate'] = '<a href="'.wp_nonce_url('plugins.php?action=deactivate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'deactivate-plugin_'.$plugin_file).'" aria-label="'.esc_attr(sprintf(__('Deactivate %s'), $plugin_data['Name'])).'">'.__('Deactivate').'</a>'; |
|
587 | 587 | } else { |
588 | 588 | /* translators: %s: plugin name */ |
589 | - $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Activate %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>'; |
|
589 | + $actions['activate'] = '<a href="'.wp_nonce_url('plugins.php?action=activate&plugin='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'activate-plugin_'.$plugin_file).'" class="edit" aria-label="'.esc_attr(sprintf(__('Activate %s'), $plugin_data['Name'])).'">'.__('Activate').'</a>'; |
|
590 | 590 | |
591 | - if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { |
|
591 | + if ( ! is_multisite() && current_user_can('delete_plugins')) { |
|
592 | 592 | /* translators: %s: plugin name */ |
593 | - $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( __( 'Delete %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
593 | + $actions['delete'] = '<a href="'.wp_nonce_url('plugins.php?action=delete-selected&checked[]='.$plugin_file.'&plugin_status='.$context.'&paged='.$page.'&s='.$s, 'bulk-plugins').'" class="delete" aria-label="'.esc_attr(sprintf(__('Delete %s'), $plugin_data['Name'])).'">'.__('Delete').'</a>'; |
|
594 | 594 | } |
595 | 595 | } // end if $is_active |
596 | 596 | |
597 | 597 | } // end if $screen->in_admin( 'network' ) |
598 | 598 | |
599 | - if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can( 'edit_plugins' ) && is_writable( WP_PLUGIN_DIR . '/' . $plugin_file ) ) { |
|
599 | + if (( ! is_multisite() || $screen->in_admin('network')) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR.'/'.$plugin_file)) { |
|
600 | 600 | /* translators: %s: plugin name */ |
601 | - $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" class="edit" aria-label="' . esc_attr( sprintf( __( 'Edit %s' ), $plugin_data['Name'] ) ) . '">' . __( 'Edit' ) . '</a>'; |
|
601 | + $actions['edit'] = '<a href="plugin-editor.php?file='.$plugin_file.'" class="edit" aria-label="'.esc_attr(sprintf(__('Edit %s'), $plugin_data['Name'])).'">'.__('Edit').'</a>'; |
|
602 | 602 | } |
603 | 603 | } // end if $context |
604 | 604 | |
605 | - $actions = array_filter( $actions ); |
|
605 | + $actions = array_filter($actions); |
|
606 | 606 | |
607 | - if ( $screen->in_admin( 'network' ) ) { |
|
607 | + if ($screen->in_admin('network')) { |
|
608 | 608 | |
609 | 609 | /** |
610 | 610 | * Filter the action links displayed for each plugin in the Network Admin Plugins list table. |
@@ -622,7 +622,7 @@ discard block |
||
622 | 622 | * 'Inactive', 'Recently Activated', 'Upgrade', |
623 | 623 | * 'Must-Use', 'Drop-ins', 'Search'. |
624 | 624 | */ |
625 | - $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
625 | + $actions = apply_filters('network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
626 | 626 | |
627 | 627 | /** |
628 | 628 | * Filter the list of action links displayed for a specific plugin in the Network Admin Plugins list table. |
@@ -640,7 +640,7 @@ discard block |
||
640 | 640 | * 'Inactive', 'Recently Activated', 'Upgrade', |
641 | 641 | * 'Must-Use', 'Drop-ins', 'Search'. |
642 | 642 | */ |
643 | - $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
643 | + $actions = apply_filters("network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
644 | 644 | |
645 | 645 | } else { |
646 | 646 | |
@@ -661,7 +661,7 @@ discard block |
||
661 | 661 | * 'Inactive', 'Recently Activated', 'Upgrade', |
662 | 662 | * 'Must-Use', 'Drop-ins', 'Search'. |
663 | 663 | */ |
664 | - $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
664 | + $actions = apply_filters('plugin_action_links', $actions, $plugin_file, $plugin_data, $context); |
|
665 | 665 | |
666 | 666 | /** |
667 | 667 | * Filter the list of action links displayed for a specific plugin in the Plugins list table. |
@@ -679,48 +679,48 @@ discard block |
||
679 | 679 | * 'Inactive', 'Recently Activated', 'Upgrade', |
680 | 680 | * 'Must-Use', 'Drop-ins', 'Search'. |
681 | 681 | */ |
682 | - $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
682 | + $actions = apply_filters("plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context); |
|
683 | 683 | |
684 | 684 | } |
685 | 685 | |
686 | 686 | $class = $is_active ? 'active' : 'inactive'; |
687 | - $checkbox_id = "checkbox_" . md5($plugin_data['Name']); |
|
688 | - if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
687 | + $checkbox_id = "checkbox_".md5($plugin_data['Name']); |
|
688 | + if ($restrict_network_active || $restrict_network_only || in_array($status, array('mustuse', 'dropins'))) { |
|
689 | 689 | $checkbox = ''; |
690 | 690 | } else { |
691 | - $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>" |
|
692 | - . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />"; |
|
691 | + $checkbox = "<label class='screen-reader-text' for='".$checkbox_id."' >".sprintf(__('Select %s'), $plugin_data['Name'])."</label>" |
|
692 | + . "<input type='checkbox' name='checked[]' value='".esc_attr($plugin_file)."' id='".$checkbox_id."' />"; |
|
693 | 693 | } |
694 | - if ( 'dropins' != $context ) { |
|
695 | - $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>'; |
|
694 | + if ('dropins' != $context) { |
|
695 | + $description = '<p>'.($plugin_data['Description'] ? $plugin_data['Description'] : ' ').'</p>'; |
|
696 | 696 | $plugin_name = $plugin_data['Name']; |
697 | 697 | } |
698 | 698 | |
699 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
699 | + if ( ! empty($totals['upgrade']) && ! empty($plugin_data['update'])) |
|
700 | 700 | $class .= ' update'; |
701 | 701 | |
702 | - $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name ); |
|
703 | - printf( '<tr class="%s" data-slug="%s" data-plugin="%s">', |
|
704 | - esc_attr( $class ), |
|
705 | - esc_attr( $plugin_slug ), |
|
706 | - esc_attr( $plugin_file ) |
|
702 | + $plugin_slug = isset($plugin_data['slug']) ? $plugin_data['slug'] : sanitize_title($plugin_name); |
|
703 | + printf('<tr class="%s" data-slug="%s" data-plugin="%s">', |
|
704 | + esc_attr($class), |
|
705 | + esc_attr($plugin_slug), |
|
706 | + esc_attr($plugin_file) |
|
707 | 707 | ); |
708 | 708 | |
709 | - list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
|
709 | + list($columns, $hidden, $sortable, $primary) = $this->get_column_info(); |
|
710 | 710 | |
711 | - foreach ( $columns as $column_name => $column_display_name ) { |
|
711 | + foreach ($columns as $column_name => $column_display_name) { |
|
712 | 712 | $extra_classes = ''; |
713 | - if ( in_array( $column_name, $hidden ) ) { |
|
713 | + if (in_array($column_name, $hidden)) { |
|
714 | 714 | $extra_classes = ' hidden'; |
715 | 715 | } |
716 | 716 | |
717 | - switch ( $column_name ) { |
|
717 | + switch ($column_name) { |
|
718 | 718 | case 'cb': |
719 | 719 | echo "<th scope='row' class='check-column'>$checkbox</th>"; |
720 | 720 | break; |
721 | 721 | case 'name': |
722 | 722 | echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>"; |
723 | - echo $this->row_actions( $actions, true ); |
|
723 | + echo $this->row_actions($actions, true); |
|
724 | 724 | echo "</td>"; |
725 | 725 | break; |
726 | 726 | case 'description': |
@@ -731,28 +731,28 @@ discard block |
||
731 | 731 | <div class='$class second plugin-version-author-uri'>"; |
732 | 732 | |
733 | 733 | $plugin_meta = array(); |
734 | - if ( !empty( $plugin_data['Version'] ) ) |
|
735 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
736 | - if ( !empty( $plugin_data['Author'] ) ) { |
|
734 | + if ( ! empty($plugin_data['Version'])) |
|
735 | + $plugin_meta[] = sprintf(__('Version %s'), $plugin_data['Version']); |
|
736 | + if ( ! empty($plugin_data['Author'])) { |
|
737 | 737 | $author = $plugin_data['Author']; |
738 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
739 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
740 | - $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
|
738 | + if ( ! empty($plugin_data['AuthorURI'])) |
|
739 | + $author = '<a href="'.$plugin_data['AuthorURI'].'">'.$plugin_data['Author'].'</a>'; |
|
740 | + $plugin_meta[] = sprintf(__('By %s'), $author); |
|
741 | 741 | } |
742 | 742 | |
743 | 743 | // Details link using API info, if available |
744 | - if ( isset( $plugin_data['slug'] ) && current_user_can( 'install_plugins' ) ) { |
|
745 | - $plugin_meta[] = sprintf( '<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
|
746 | - esc_url( network_admin_url( 'plugin-install.php?tab=plugin-information&plugin=' . $plugin_data['slug'] . |
|
747 | - '&TB_iframe=true&width=600&height=550' ) ), |
|
748 | - esc_attr( sprintf( __( 'More information about %s' ), $plugin_name ) ), |
|
749 | - esc_attr( $plugin_name ), |
|
750 | - __( 'View details' ) |
|
744 | + if (isset($plugin_data['slug']) && current_user_can('install_plugins')) { |
|
745 | + $plugin_meta[] = sprintf('<a href="%s" class="thickbox open-plugin-details-modal" aria-label="%s" data-title="%s">%s</a>', |
|
746 | + esc_url(network_admin_url('plugin-install.php?tab=plugin-information&plugin='.$plugin_data['slug']. |
|
747 | + '&TB_iframe=true&width=600&height=550')), |
|
748 | + esc_attr(sprintf(__('More information about %s'), $plugin_name)), |
|
749 | + esc_attr($plugin_name), |
|
750 | + __('View details') |
|
751 | 751 | ); |
752 | - } elseif ( ! empty( $plugin_data['PluginURI'] ) ) { |
|
753 | - $plugin_meta[] = sprintf( '<a href="%s">%s</a>', |
|
754 | - esc_url( $plugin_data['PluginURI'] ), |
|
755 | - __( 'Visit plugin site' ) |
|
752 | + } elseif ( ! empty($plugin_data['PluginURI'])) { |
|
753 | + $plugin_meta[] = sprintf('<a href="%s">%s</a>', |
|
754 | + esc_url($plugin_data['PluginURI']), |
|
755 | + __('Visit plugin site') |
|
756 | 756 | ); |
757 | 757 | } |
758 | 758 | |
@@ -770,8 +770,8 @@ discard block |
||
770 | 770 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
771 | 771 | * 'Drop-ins', 'Search'. |
772 | 772 | */ |
773 | - $plugin_meta = apply_filters( 'plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status ); |
|
774 | - echo implode( ' | ', $plugin_meta ); |
|
773 | + $plugin_meta = apply_filters('plugin_row_meta', $plugin_meta, $plugin_file, $plugin_data, $status); |
|
774 | + echo implode(' | ', $plugin_meta); |
|
775 | 775 | |
776 | 776 | echo "</div></td>"; |
777 | 777 | break; |
@@ -789,7 +789,7 @@ discard block |
||
789 | 789 | * @param string $plugin_file Path to the plugin file. |
790 | 790 | * @param array $plugin_data An array of plugin data. |
791 | 791 | */ |
792 | - do_action( 'manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data ); |
|
792 | + do_action('manage_plugins_custom_column', $column_name, $plugin_file, $plugin_data); |
|
793 | 793 | |
794 | 794 | echo "</td>"; |
795 | 795 | } |
@@ -808,7 +808,7 @@ discard block |
||
808 | 808 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
809 | 809 | * 'Drop-ins', 'Search'. |
810 | 810 | */ |
811 | - do_action( 'after_plugin_row', $plugin_file, $plugin_data, $status ); |
|
811 | + do_action('after_plugin_row', $plugin_file, $plugin_data, $status); |
|
812 | 812 | |
813 | 813 | /** |
814 | 814 | * Fires after each specific row in the Plugins list table. |
@@ -824,7 +824,7 @@ discard block |
||
824 | 824 | * 'Inactive', 'Recently Activated', 'Upgrade', 'Must-Use', |
825 | 825 | * 'Drop-ins', 'Search'. |
826 | 826 | */ |
827 | - do_action( "after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status ); |
|
827 | + do_action("after_plugin_row_$plugin_file", $plugin_file, $plugin_data, $status); |
|
828 | 828 | } |
829 | 829 | |
830 | 830 | /** |
@@ -39,11 +39,13 @@ discard block |
||
39 | 39 | ) ); |
40 | 40 | |
41 | 41 | $status = 'all'; |
42 | - if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) |
|
43 | - $status = $_REQUEST['plugin_status']; |
|
42 | + if ( isset( $_REQUEST['plugin_status'] ) && in_array( $_REQUEST['plugin_status'], array( 'active', 'inactive', 'recently_activated', 'upgrade', 'mustuse', 'dropins', 'search' ) ) ) { |
|
43 | + $status = $_REQUEST['plugin_status']; |
|
44 | + } |
|
44 | 45 | |
45 | - if ( isset($_REQUEST['s']) ) |
|
46 | - $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
46 | + if ( isset($_REQUEST['s']) ) { |
|
47 | + $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
|
48 | + } |
|
47 | 49 | |
48 | 50 | $page = $this->get_pagenum(); |
49 | 51 | } |
@@ -123,8 +125,9 @@ discard block |
||
123 | 125 | } |
124 | 126 | |
125 | 127 | /** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */ |
126 | - if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) |
|
127 | - $plugins['dropins'] = get_dropins(); |
|
128 | + if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) { |
|
129 | + $plugins['dropins'] = get_dropins(); |
|
130 | + } |
|
128 | 131 | |
129 | 132 | if ( current_user_can( 'update_plugins' ) ) { |
130 | 133 | $current = get_site_transient( 'update_plugins' ); |
@@ -232,11 +235,13 @@ discard block |
||
232 | 235 | } |
233 | 236 | |
234 | 237 | $totals = array(); |
235 | - foreach ( $plugins as $type => $list ) |
|
236 | - $totals[ $type ] = count( $list ); |
|
238 | + foreach ( $plugins as $type => $list ) { |
|
239 | + $totals[ $type ] = count( $list ); |
|
240 | + } |
|
237 | 241 | |
238 | - if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) |
|
239 | - $status = 'all'; |
|
242 | + if ( empty( $plugins[ $status ] ) && !in_array( $status, array( 'all', 'search' ) ) ) { |
|
243 | + $status = 'all'; |
|
244 | + } |
|
240 | 245 | |
241 | 246 | $this->items = array(); |
242 | 247 | foreach ( $plugins[ $status ] as $plugin_file => $plugin_data ) { |
@@ -260,8 +265,9 @@ discard block |
||
260 | 265 | |
261 | 266 | $start = ( $page - 1 ) * $plugins_per_page; |
262 | 267 | |
263 | - if ( $total_this_page > $plugins_per_page ) |
|
264 | - $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
268 | + if ( $total_this_page > $plugins_per_page ) { |
|
269 | + $this->items = array_slice( $this->items, $start, $plugins_per_page ); |
|
270 | + } |
|
265 | 271 | |
266 | 272 | $this->set_pagination_args( array( |
267 | 273 | 'total_items' => $total_this_page, |
@@ -300,8 +306,9 @@ discard block |
||
300 | 306 | $a = $plugin_a[$orderby]; |
301 | 307 | $b = $plugin_b[$orderby]; |
302 | 308 | |
303 | - if ( $a == $b ) |
|
304 | - return 0; |
|
309 | + if ( $a == $b ) { |
|
310 | + return 0; |
|
311 | + } |
|
305 | 312 | |
306 | 313 | if ( 'DESC' === $order ) { |
307 | 314 | return strcasecmp( $b, $a ); |
@@ -326,10 +333,11 @@ discard block |
||
326 | 333 | if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
327 | 334 | echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
328 | 335 | } |
329 | - } elseif ( ! empty( $plugins['all'] ) ) |
|
330 | - _e( 'No plugins found.' ); |
|
331 | - else |
|
332 | - _e( 'You do not appear to have any plugins available at this time.' ); |
|
336 | + } elseif ( ! empty( $plugins['all'] ) ) { |
|
337 | + _e( 'No plugins found.' ); |
|
338 | + } else { |
|
339 | + _e( 'You do not appear to have any plugins available at this time.' ); |
|
340 | + } |
|
333 | 341 | } |
334 | 342 | |
335 | 343 | /** |
@@ -365,8 +373,9 @@ discard block |
||
365 | 373 | |
366 | 374 | $status_links = array(); |
367 | 375 | foreach ( $totals as $type => $count ) { |
368 | - if ( !$count ) |
|
369 | - continue; |
|
376 | + if ( !$count ) { |
|
377 | + continue; |
|
378 | + } |
|
370 | 379 | |
371 | 380 | switch ( $type ) { |
372 | 381 | case 'all': |
@@ -414,17 +423,21 @@ discard block |
||
414 | 423 | |
415 | 424 | $actions = array(); |
416 | 425 | |
417 | - if ( 'active' != $status ) |
|
418 | - $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
426 | + if ( 'active' != $status ) { |
|
427 | + $actions['activate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Activate' ) : __( 'Activate' ); |
|
428 | + } |
|
419 | 429 | |
420 | - if ( 'inactive' != $status && 'recent' != $status ) |
|
421 | - $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
430 | + if ( 'inactive' != $status && 'recent' != $status ) { |
|
431 | + $actions['deactivate-selected'] = $this->screen->in_admin( 'network' ) ? __( 'Network Deactivate' ) : __( 'Deactivate' ); |
|
432 | + } |
|
422 | 433 | |
423 | 434 | if ( !is_multisite() || $this->screen->in_admin( 'network' ) ) { |
424 | - if ( current_user_can( 'update_plugins' ) ) |
|
425 | - $actions['update-selected'] = __( 'Update' ); |
|
426 | - if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) |
|
427 | - $actions['delete-selected'] = __( 'Delete' ); |
|
435 | + if ( current_user_can( 'update_plugins' ) ) { |
|
436 | + $actions['update-selected'] = __( 'Update' ); |
|
437 | + } |
|
438 | + if ( current_user_can( 'delete_plugins' ) && ( 'active' != $status ) ) { |
|
439 | + $actions['delete-selected'] = __( 'Delete' ); |
|
440 | + } |
|
428 | 441 | } |
429 | 442 | |
430 | 443 | return $actions; |
@@ -437,8 +450,9 @@ discard block |
||
437 | 450 | public function bulk_actions( $which = '' ) { |
438 | 451 | global $status; |
439 | 452 | |
440 | - if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
441 | - return; |
|
453 | + if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
454 | + return; |
|
455 | + } |
|
442 | 456 | |
443 | 457 | parent::bulk_actions( $which ); |
444 | 458 | } |
@@ -450,8 +464,9 @@ discard block |
||
450 | 464 | protected function extra_tablenav( $which ) { |
451 | 465 | global $status; |
452 | 466 | |
453 | - if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) |
|
454 | - return; |
|
467 | + if ( ! in_array($status, array('recently_activated', 'mustuse', 'dropins') ) ) { |
|
468 | + return; |
|
469 | + } |
|
455 | 470 | |
456 | 471 | echo '<div class="alignleft actions">'; |
457 | 472 | |
@@ -475,8 +490,9 @@ discard block |
||
475 | 490 | * @return string |
476 | 491 | */ |
477 | 492 | public function current_action() { |
478 | - if ( isset($_POST['clear-recent-list']) ) |
|
479 | - return 'clear-recent-list'; |
|
493 | + if ( isset($_POST['clear-recent-list']) ) { |
|
494 | + return 'clear-recent-list'; |
|
495 | + } |
|
480 | 496 | |
481 | 497 | return parent::current_action(); |
482 | 498 | } |
@@ -488,11 +504,13 @@ discard block |
||
488 | 504 | public function display_rows() { |
489 | 505 | global $status; |
490 | 506 | |
491 | - if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) |
|
492 | - return; |
|
507 | + if ( is_multisite() && ! $this->screen->in_admin( 'network' ) && in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
|
508 | + return; |
|
509 | + } |
|
493 | 510 | |
494 | - foreach ( $this->items as $plugin_file => $plugin_data ) |
|
495 | - $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
511 | + foreach ( $this->items as $plugin_file => $plugin_data ) { |
|
512 | + $this->single_row( array( $plugin_file, $plugin_data ) ); |
|
513 | + } |
|
496 | 514 | } |
497 | 515 | |
498 | 516 | /** |
@@ -528,8 +546,9 @@ discard block |
||
528 | 546 | } elseif ( 'dropins' === $context ) { |
529 | 547 | $dropins = _get_dropins(); |
530 | 548 | $plugin_name = $plugin_file; |
531 | - if ( $plugin_file != $plugin_data['Name'] ) |
|
532 | - $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
549 | + if ( $plugin_file != $plugin_data['Name'] ) { |
|
550 | + $plugin_name .= '<br/>' . $plugin_data['Name']; |
|
551 | + } |
|
533 | 552 | if ( true === ( $dropins[ $plugin_file ][1] ) ) { // Doesn't require a constant |
534 | 553 | $is_active = true; |
535 | 554 | $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
@@ -545,8 +564,9 @@ discard block |
||
545 | 564 | '<code>wp-config.php</code>' |
546 | 565 | ) . '</p>'; |
547 | 566 | } |
548 | - if ( $plugin_data['Description'] ) |
|
549 | - $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
567 | + if ( $plugin_data['Description'] ) { |
|
568 | + $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
|
569 | + } |
|
550 | 570 | } else { |
551 | 571 | if ( $screen->in_admin( 'network' ) ) { |
552 | 572 | $is_active = is_plugin_active_for_network( $plugin_file ); |
@@ -696,8 +716,9 @@ discard block |
||
696 | 716 | $plugin_name = $plugin_data['Name']; |
697 | 717 | } |
698 | 718 | |
699 | - if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
|
700 | - $class .= ' update'; |
|
719 | + if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) { |
|
720 | + $class .= ' update'; |
|
721 | + } |
|
701 | 722 | |
702 | 723 | $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name ); |
703 | 724 | printf( '<tr class="%s" data-slug="%s" data-plugin="%s">', |
@@ -731,12 +752,14 @@ discard block |
||
731 | 752 | <div class='$class second plugin-version-author-uri'>"; |
732 | 753 | |
733 | 754 | $plugin_meta = array(); |
734 | - if ( !empty( $plugin_data['Version'] ) ) |
|
735 | - $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
755 | + if ( !empty( $plugin_data['Version'] ) ) { |
|
756 | + $plugin_meta[] = sprintf( __( 'Version %s' ), $plugin_data['Version'] ); |
|
757 | + } |
|
736 | 758 | if ( !empty( $plugin_data['Author'] ) ) { |
737 | 759 | $author = $plugin_data['Author']; |
738 | - if ( !empty( $plugin_data['AuthorURI'] ) ) |
|
739 | - $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
760 | + if ( !empty( $plugin_data['AuthorURI'] ) ) { |
|
761 | + $author = '<a href="' . $plugin_data['AuthorURI'] . '">' . $plugin_data['Author'] . '</a>'; |
|
762 | + } |
|
740 | 763 | $plugin_meta[] = sprintf( __( 'By %s' ), $author ); |
741 | 764 | } |
742 | 765 |
@@ -143,12 +143,12 @@ discard block |
||
143 | 143 | private $_help_sidebar = ''; |
144 | 144 | |
145 | 145 | /** |
146 | - * The accessible hidden headings and text associated with the screen, if any. |
|
147 | - * |
|
148 | - * @since 4.4.0 |
|
149 | - * @access private |
|
150 | - * @var array |
|
151 | - */ |
|
146 | + * The accessible hidden headings and text associated with the screen, if any. |
|
147 | + * |
|
148 | + * @since 4.4.0 |
|
149 | + * @access private |
|
150 | + * @var array |
|
151 | + */ |
|
152 | 152 | private $_screen_reader_content = array(); |
153 | 153 | |
154 | 154 | /** |
@@ -656,14 +656,14 @@ discard block |
||
656 | 656 | } |
657 | 657 | |
658 | 658 | /** |
659 | - * Get the accessible hidden headings and text used in the screen. |
|
660 | - * |
|
661 | - * @since 4.4.0 |
|
662 | - * |
|
663 | - * @see set_screen_reader_content() For more information on the array format. |
|
664 | - * |
|
665 | - * @return array An associative array of screen reader text strings. |
|
666 | - */ |
|
659 | + * Get the accessible hidden headings and text used in the screen. |
|
660 | + * |
|
661 | + * @since 4.4.0 |
|
662 | + * |
|
663 | + * @see set_screen_reader_content() For more information on the array format. |
|
664 | + * |
|
665 | + * @return array An associative array of screen reader text strings. |
|
666 | + */ |
|
667 | 667 | public function get_screen_reader_content() { |
668 | 668 | return $this->_screen_reader_content; |
669 | 669 | } |
@@ -214,8 +214,8 @@ discard block |
||
214 | 214 | * Defaults to the current $hook_suffix global. |
215 | 215 | * @return WP_Screen Screen object. |
216 | 216 | */ |
217 | - public static function get( $hook_name = '' ) { |
|
218 | - if ( $hook_name instanceof WP_Screen ) { |
|
217 | + public static function get($hook_name = '') { |
|
218 | + if ($hook_name instanceof WP_Screen) { |
|
219 | 219 | return $hook_name; |
220 | 220 | } |
221 | 221 | |
@@ -223,146 +223,146 @@ discard block |
||
223 | 223 | $in_admin = false; |
224 | 224 | $action = ''; |
225 | 225 | |
226 | - if ( $hook_name ) |
|
226 | + if ($hook_name) |
|
227 | 227 | $id = $hook_name; |
228 | 228 | else |
229 | 229 | $id = $GLOBALS['hook_suffix']; |
230 | 230 | |
231 | 231 | // For those pesky meta boxes. |
232 | - if ( $hook_name && post_type_exists( $hook_name ) ) { |
|
232 | + if ($hook_name && post_type_exists($hook_name)) { |
|
233 | 233 | $post_type = $id; |
234 | 234 | $id = 'post'; // changes later. ends up being $base. |
235 | 235 | } else { |
236 | - if ( '.php' == substr( $id, -4 ) ) |
|
237 | - $id = substr( $id, 0, -4 ); |
|
236 | + if ('.php' == substr($id, -4)) |
|
237 | + $id = substr($id, 0, -4); |
|
238 | 238 | |
239 | - if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) { |
|
240 | - $id = substr( $id, 0, -4 ); |
|
239 | + if ('post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id) { |
|
240 | + $id = substr($id, 0, -4); |
|
241 | 241 | $action = 'add'; |
242 | 242 | } |
243 | 243 | } |
244 | 244 | |
245 | - if ( ! $post_type && $hook_name ) { |
|
246 | - if ( '-network' == substr( $id, -8 ) ) { |
|
247 | - $id = substr( $id, 0, -8 ); |
|
245 | + if ( ! $post_type && $hook_name) { |
|
246 | + if ('-network' == substr($id, -8)) { |
|
247 | + $id = substr($id, 0, -8); |
|
248 | 248 | $in_admin = 'network'; |
249 | - } elseif ( '-user' == substr( $id, -5 ) ) { |
|
250 | - $id = substr( $id, 0, -5 ); |
|
249 | + } elseif ('-user' == substr($id, -5)) { |
|
250 | + $id = substr($id, 0, -5); |
|
251 | 251 | $in_admin = 'user'; |
252 | 252 | } |
253 | 253 | |
254 | - $id = sanitize_key( $id ); |
|
255 | - if ( 'edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr( $id, 0, 5 ) ) { |
|
256 | - $maybe = substr( $id, 5 ); |
|
257 | - if ( taxonomy_exists( $maybe ) ) { |
|
254 | + $id = sanitize_key($id); |
|
255 | + if ('edit-comments' != $id && 'edit-tags' != $id && 'edit-' == substr($id, 0, 5)) { |
|
256 | + $maybe = substr($id, 5); |
|
257 | + if (taxonomy_exists($maybe)) { |
|
258 | 258 | $id = 'edit-tags'; |
259 | 259 | $taxonomy = $maybe; |
260 | - } elseif ( post_type_exists( $maybe ) ) { |
|
260 | + } elseif (post_type_exists($maybe)) { |
|
261 | 261 | $id = 'edit'; |
262 | 262 | $post_type = $maybe; |
263 | 263 | } |
264 | 264 | } |
265 | 265 | |
266 | - if ( ! $in_admin ) |
|
266 | + if ( ! $in_admin) |
|
267 | 267 | $in_admin = 'site'; |
268 | 268 | } else { |
269 | - if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) |
|
269 | + if (defined('WP_NETWORK_ADMIN') && WP_NETWORK_ADMIN) |
|
270 | 270 | $in_admin = 'network'; |
271 | - elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) |
|
271 | + elseif (defined('WP_USER_ADMIN') && WP_USER_ADMIN) |
|
272 | 272 | $in_admin = 'user'; |
273 | 273 | else |
274 | 274 | $in_admin = 'site'; |
275 | 275 | } |
276 | 276 | |
277 | - if ( 'index' == $id ) |
|
277 | + if ('index' == $id) |
|
278 | 278 | $id = 'dashboard'; |
279 | - elseif ( 'front' == $id ) |
|
279 | + elseif ('front' == $id) |
|
280 | 280 | $in_admin = false; |
281 | 281 | |
282 | 282 | $base = $id; |
283 | 283 | |
284 | 284 | // If this is the current screen, see if we can be more accurate for post types and taxonomies. |
285 | - if ( ! $hook_name ) { |
|
286 | - if ( isset( $_REQUEST['post_type'] ) ) |
|
287 | - $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
288 | - if ( isset( $_REQUEST['taxonomy'] ) ) |
|
289 | - $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
285 | + if ( ! $hook_name) { |
|
286 | + if (isset($_REQUEST['post_type'])) |
|
287 | + $post_type = post_type_exists($_REQUEST['post_type']) ? $_REQUEST['post_type'] : false; |
|
288 | + if (isset($_REQUEST['taxonomy'])) |
|
289 | + $taxonomy = taxonomy_exists($_REQUEST['taxonomy']) ? $_REQUEST['taxonomy'] : false; |
|
290 | 290 | |
291 | - switch ( $base ) { |
|
291 | + switch ($base) { |
|
292 | 292 | case 'post' : |
293 | - if ( isset( $_GET['post'] ) ) |
|
293 | + if (isset($_GET['post'])) |
|
294 | 294 | $post_id = (int) $_GET['post']; |
295 | - elseif ( isset( $_POST['post_ID'] ) ) |
|
295 | + elseif (isset($_POST['post_ID'])) |
|
296 | 296 | $post_id = (int) $_POST['post_ID']; |
297 | 297 | else |
298 | 298 | $post_id = 0; |
299 | 299 | |
300 | - if ( $post_id ) { |
|
301 | - $post = get_post( $post_id ); |
|
302 | - if ( $post ) |
|
300 | + if ($post_id) { |
|
301 | + $post = get_post($post_id); |
|
302 | + if ($post) |
|
303 | 303 | $post_type = $post->post_type; |
304 | 304 | } |
305 | 305 | break; |
306 | 306 | case 'edit-tags' : |
307 | 307 | case 'term' : |
308 | - if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) |
|
308 | + if (null === $post_type && is_object_in_taxonomy('post', $taxonomy ? $taxonomy : 'post_tag')) |
|
309 | 309 | $post_type = 'post'; |
310 | 310 | break; |
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
314 | - switch ( $base ) { |
|
314 | + switch ($base) { |
|
315 | 315 | case 'post' : |
316 | - if ( null === $post_type ) |
|
316 | + if (null === $post_type) |
|
317 | 317 | $post_type = 'post'; |
318 | 318 | $id = $post_type; |
319 | 319 | break; |
320 | 320 | case 'edit' : |
321 | - if ( null === $post_type ) |
|
321 | + if (null === $post_type) |
|
322 | 322 | $post_type = 'post'; |
323 | - $id .= '-' . $post_type; |
|
323 | + $id .= '-'.$post_type; |
|
324 | 324 | break; |
325 | 325 | case 'edit-tags' : |
326 | 326 | case 'term' : |
327 | - if ( null === $taxonomy ) |
|
327 | + if (null === $taxonomy) |
|
328 | 328 | $taxonomy = 'post_tag'; |
329 | 329 | // The edit-tags ID does not contain the post type. Look for it in the request. |
330 | - if ( null === $post_type ) { |
|
330 | + if (null === $post_type) { |
|
331 | 331 | $post_type = 'post'; |
332 | - if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
332 | + if (isset($_REQUEST['post_type']) && post_type_exists($_REQUEST['post_type'])) |
|
333 | 333 | $post_type = $_REQUEST['post_type']; |
334 | 334 | } |
335 | 335 | |
336 | - $id = 'edit-' . $taxonomy; |
|
336 | + $id = 'edit-'.$taxonomy; |
|
337 | 337 | break; |
338 | 338 | } |
339 | 339 | |
340 | - if ( 'network' == $in_admin ) { |
|
340 | + if ('network' == $in_admin) { |
|
341 | 341 | $id .= '-network'; |
342 | 342 | $base .= '-network'; |
343 | - } elseif ( 'user' == $in_admin ) { |
|
343 | + } elseif ('user' == $in_admin) { |
|
344 | 344 | $id .= '-user'; |
345 | 345 | $base .= '-user'; |
346 | 346 | } |
347 | 347 | |
348 | - if ( isset( self::$_registry[ $id ] ) ) { |
|
349 | - $screen = self::$_registry[ $id ]; |
|
350 | - if ( $screen === get_current_screen() ) |
|
348 | + if (isset(self::$_registry[$id])) { |
|
349 | + $screen = self::$_registry[$id]; |
|
350 | + if ($screen === get_current_screen()) |
|
351 | 351 | return $screen; |
352 | 352 | } else { |
353 | 353 | $screen = new WP_Screen(); |
354 | - $screen->id = $id; |
|
354 | + $screen->id = $id; |
|
355 | 355 | } |
356 | 356 | |
357 | 357 | $screen->base = $base; |
358 | 358 | $screen->action = $action; |
359 | 359 | $screen->post_type = (string) $post_type; |
360 | 360 | $screen->taxonomy = (string) $taxonomy; |
361 | - $screen->is_user = ( 'user' == $in_admin ); |
|
362 | - $screen->is_network = ( 'network' == $in_admin ); |
|
361 | + $screen->is_user = ('user' == $in_admin); |
|
362 | + $screen->is_network = ('network' == $in_admin); |
|
363 | 363 | $screen->in_admin = $in_admin; |
364 | 364 | |
365 | - self::$_registry[ $id ] = $screen; |
|
365 | + self::$_registry[$id] = $screen; |
|
366 | 366 | |
367 | 367 | return $screen; |
368 | 368 | } |
@@ -390,7 +390,7 @@ discard block |
||
390 | 390 | * |
391 | 391 | * @param WP_Screen $current_screen Current WP_Screen object. |
392 | 392 | */ |
393 | - do_action( 'current_screen', $current_screen ); |
|
393 | + do_action('current_screen', $current_screen); |
|
394 | 394 | } |
395 | 395 | |
396 | 396 | /** |
@@ -410,11 +410,11 @@ discard block |
||
410 | 410 | * If empty any of the three admins will result in true. |
411 | 411 | * @return bool True if the screen is in the indicated admin, false otherwise. |
412 | 412 | */ |
413 | - public function in_admin( $admin = null ) { |
|
414 | - if ( empty( $admin ) ) |
|
413 | + public function in_admin($admin = null) { |
|
414 | + if (empty($admin)) |
|
415 | 415 | return (bool) $this->in_admin; |
416 | 416 | |
417 | - return ( $admin == $this->in_admin ); |
|
417 | + return ($admin == $this->in_admin); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | /** |
@@ -429,8 +429,8 @@ discard block |
||
429 | 429 | * @param WP_Screen $screen A screen object. |
430 | 430 | * @param string $help Help text. |
431 | 431 | */ |
432 | - public static function add_old_compat_help( $screen, $help ) { |
|
433 | - self::$_old_compat_help[ $screen->id ] = $help; |
|
432 | + public static function add_old_compat_help($screen, $help) { |
|
433 | + self::$_old_compat_help[$screen->id] = $help; |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -441,10 +441,10 @@ discard block |
||
441 | 441 | * |
442 | 442 | * @param string $parent_file The parent file of the screen. Typically the $parent_file global. |
443 | 443 | */ |
444 | - public function set_parentage( $parent_file ) { |
|
444 | + public function set_parentage($parent_file) { |
|
445 | 445 | $this->parent_file = $parent_file; |
446 | - list( $this->parent_base ) = explode( '?', $parent_file ); |
|
447 | - $this->parent_base = str_replace( '.php', '', $this->parent_base ); |
|
446 | + list($this->parent_base) = explode('?', $parent_file); |
|
447 | + $this->parent_base = str_replace('.php', '', $this->parent_base); |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | /** |
@@ -456,8 +456,8 @@ discard block |
||
456 | 456 | * @param string $option Option ID |
457 | 457 | * @param mixed $args Option-dependent arguments. |
458 | 458 | */ |
459 | - public function add_option( $option, $args = array() ) { |
|
460 | - $this->_options[ $option ] = $args; |
|
459 | + public function add_option($option, $args = array()) { |
|
460 | + $this->_options[$option] = $args; |
|
461 | 461 | } |
462 | 462 | |
463 | 463 | /** |
@@ -467,8 +467,8 @@ discard block |
||
467 | 467 | * |
468 | 468 | * @param string $option Option ID. |
469 | 469 | */ |
470 | - public function remove_option( $option ) { |
|
471 | - unset( $this->_options[ $option ] ); |
|
470 | + public function remove_option($option) { |
|
471 | + unset($this->_options[$option]); |
|
472 | 472 | } |
473 | 473 | |
474 | 474 | /** |
@@ -501,15 +501,15 @@ discard block |
||
501 | 501 | * Default false. |
502 | 502 | * @return string The option value if set, null otherwise. |
503 | 503 | */ |
504 | - public function get_option( $option, $key = false ) { |
|
505 | - if ( ! isset( $this->_options[ $option ] ) ) |
|
504 | + public function get_option($option, $key = false) { |
|
505 | + if ( ! isset($this->_options[$option])) |
|
506 | 506 | return null; |
507 | - if ( $key ) { |
|
508 | - if ( isset( $this->_options[ $option ][ $key ] ) ) |
|
509 | - return $this->_options[ $option ][ $key ]; |
|
507 | + if ($key) { |
|
508 | + if (isset($this->_options[$option][$key])) |
|
509 | + return $this->_options[$option][$key]; |
|
510 | 510 | return null; |
511 | 511 | } |
512 | - return $this->_options[ $option ]; |
|
512 | + return $this->_options[$option]; |
|
513 | 513 | } |
514 | 514 | |
515 | 515 | /** |
@@ -524,20 +524,20 @@ discard block |
||
524 | 524 | $help_tabs = $this->_help_tabs; |
525 | 525 | |
526 | 526 | $priorities = array(); |
527 | - foreach ( $help_tabs as $help_tab ) { |
|
528 | - if ( isset( $priorities[ $help_tab['priority'] ] ) ) { |
|
529 | - $priorities[ $help_tab['priority'] ][] = $help_tab; |
|
527 | + foreach ($help_tabs as $help_tab) { |
|
528 | + if (isset($priorities[$help_tab['priority']])) { |
|
529 | + $priorities[$help_tab['priority']][] = $help_tab; |
|
530 | 530 | } else { |
531 | - $priorities[ $help_tab['priority'] ] = array( $help_tab ); |
|
531 | + $priorities[$help_tab['priority']] = array($help_tab); |
|
532 | 532 | } |
533 | 533 | } |
534 | 534 | |
535 | - ksort( $priorities ); |
|
535 | + ksort($priorities); |
|
536 | 536 | |
537 | 537 | $sorted = array(); |
538 | - foreach ( $priorities as $list ) { |
|
539 | - foreach ( $list as $tab ) { |
|
540 | - $sorted[ $tab['id'] ] = $tab; |
|
538 | + foreach ($priorities as $list) { |
|
539 | + foreach ($list as $tab) { |
|
540 | + $sorted[$tab['id']] = $tab; |
|
541 | 541 | } |
542 | 542 | } |
543 | 543 | |
@@ -552,10 +552,10 @@ discard block |
||
552 | 552 | * @param string $id Help Tab ID. |
553 | 553 | * @return array Help tab arguments. |
554 | 554 | */ |
555 | - public function get_help_tab( $id ) { |
|
556 | - if ( ! isset( $this->_help_tabs[ $id ] ) ) |
|
555 | + public function get_help_tab($id) { |
|
556 | + if ( ! isset($this->_help_tabs[$id])) |
|
557 | 557 | return null; |
558 | - return $this->_help_tabs[ $id ]; |
|
558 | + return $this->_help_tabs[$id]; |
|
559 | 559 | } |
560 | 560 | |
561 | 561 | /** |
@@ -575,7 +575,7 @@ discard block |
||
575 | 575 | * @type int $priority Optional. The priority of the tab, used for ordering. Default 10. |
576 | 576 | * } |
577 | 577 | */ |
578 | - public function add_help_tab( $args ) { |
|
578 | + public function add_help_tab($args) { |
|
579 | 579 | $defaults = array( |
580 | 580 | 'title' => false, |
581 | 581 | 'id' => false, |
@@ -583,16 +583,16 @@ discard block |
||
583 | 583 | 'callback' => false, |
584 | 584 | 'priority' => 10, |
585 | 585 | ); |
586 | - $args = wp_parse_args( $args, $defaults ); |
|
586 | + $args = wp_parse_args($args, $defaults); |
|
587 | 587 | |
588 | - $args['id'] = sanitize_html_class( $args['id'] ); |
|
588 | + $args['id'] = sanitize_html_class($args['id']); |
|
589 | 589 | |
590 | 590 | // Ensure we have an ID and title. |
591 | - if ( ! $args['id'] || ! $args['title'] ) |
|
591 | + if ( ! $args['id'] || ! $args['title']) |
|
592 | 592 | return; |
593 | 593 | |
594 | 594 | // Allows for overriding an existing tab with that ID. |
595 | - $this->_help_tabs[ $args['id'] ] = $args; |
|
595 | + $this->_help_tabs[$args['id']] = $args; |
|
596 | 596 | } |
597 | 597 | |
598 | 598 | /** |
@@ -602,8 +602,8 @@ discard block |
||
602 | 602 | * |
603 | 603 | * @param string $id The help tab ID. |
604 | 604 | */ |
605 | - public function remove_help_tab( $id ) { |
|
606 | - unset( $this->_help_tabs[ $id ] ); |
|
605 | + public function remove_help_tab($id) { |
|
606 | + unset($this->_help_tabs[$id]); |
|
607 | 607 | } |
608 | 608 | |
609 | 609 | /** |
@@ -634,7 +634,7 @@ discard block |
||
634 | 634 | * |
635 | 635 | * @param string $content Sidebar content in plain text or HTML. |
636 | 636 | */ |
637 | - public function set_help_sidebar( $content ) { |
|
637 | + public function set_help_sidebar($content) { |
|
638 | 638 | $this->_help_sidebar = $content; |
639 | 639 | } |
640 | 640 | |
@@ -676,11 +676,11 @@ discard block |
||
676 | 676 | * @param string $key Screen reader text array named key. |
677 | 677 | * @return string Screen reader text string. |
678 | 678 | */ |
679 | - public function get_screen_reader_text( $key ) { |
|
680 | - if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { |
|
679 | + public function get_screen_reader_text($key) { |
|
680 | + if ( ! isset($this->_screen_reader_content[$key])) { |
|
681 | 681 | return null; |
682 | 682 | } |
683 | - return $this->_screen_reader_content[ $key ]; |
|
683 | + return $this->_screen_reader_content[$key]; |
|
684 | 684 | } |
685 | 685 | |
686 | 686 | /** |
@@ -699,13 +699,13 @@ discard block |
||
699 | 699 | * Default 'Items list'. |
700 | 700 | * } |
701 | 701 | */ |
702 | - public function set_screen_reader_content( $content = array() ) { |
|
702 | + public function set_screen_reader_content($content = array()) { |
|
703 | 703 | $defaults = array( |
704 | - 'heading_views' => __( 'Filter items list' ), |
|
705 | - 'heading_pagination' => __( 'Items list navigation' ), |
|
706 | - 'heading_list' => __( 'Items list' ), |
|
704 | + 'heading_views' => __('Filter items list'), |
|
705 | + 'heading_pagination' => __('Items list navigation'), |
|
706 | + 'heading_list' => __('Items list'), |
|
707 | 707 | ); |
708 | - $content = wp_parse_args( $content, $defaults ); |
|
708 | + $content = wp_parse_args($content, $defaults); |
|
709 | 709 | |
710 | 710 | $this->_screen_reader_content = $content; |
711 | 711 | } |
@@ -740,9 +740,9 @@ discard block |
||
740 | 740 | * @param array $old_compat_help Old contextual help. |
741 | 741 | * @param WP_Screen $this Current WP_Screen instance. |
742 | 742 | */ |
743 | - self::$_old_compat_help = apply_filters( 'contextual_help_list', self::$_old_compat_help, $this ); |
|
743 | + self::$_old_compat_help = apply_filters('contextual_help_list', self::$_old_compat_help, $this); |
|
744 | 744 | |
745 | - $old_help = isset( self::$_old_compat_help[ $this->id ] ) ? self::$_old_compat_help[ $this->id ] : ''; |
|
745 | + $old_help = isset(self::$_old_compat_help[$this->id]) ? self::$_old_compat_help[$this->id] : ''; |
|
746 | 746 | |
747 | 747 | /** |
748 | 748 | * Filter the legacy contextual help text. |
@@ -756,10 +756,10 @@ discard block |
||
756 | 756 | * @param WP_Screen $this Current WP_Screen instance. |
757 | 757 | * |
758 | 758 | */ |
759 | - $old_help = apply_filters( 'contextual_help', $old_help, $this->id, $this ); |
|
759 | + $old_help = apply_filters('contextual_help', $old_help, $this->id, $this); |
|
760 | 760 | |
761 | 761 | // Default help only if there is no old-style block of text and no new-style help tabs. |
762 | - if ( empty( $old_help ) && ! $this->get_help_tabs() ) { |
|
762 | + if (empty($old_help) && ! $this->get_help_tabs()) { |
|
763 | 763 | |
764 | 764 | /** |
765 | 765 | * Filter the default legacy contextual help text. |
@@ -770,44 +770,44 @@ discard block |
||
770 | 770 | * |
771 | 771 | * @param string $old_help_default Default contextual help text. |
772 | 772 | */ |
773 | - $default_help = apply_filters( 'default_contextual_help', '' ); |
|
774 | - if ( $default_help ) |
|
775 | - $old_help = '<p>' . $default_help . '</p>'; |
|
773 | + $default_help = apply_filters('default_contextual_help', ''); |
|
774 | + if ($default_help) |
|
775 | + $old_help = '<p>'.$default_help.'</p>'; |
|
776 | 776 | } |
777 | 777 | |
778 | - if ( $old_help ) { |
|
779 | - $this->add_help_tab( array( |
|
778 | + if ($old_help) { |
|
779 | + $this->add_help_tab(array( |
|
780 | 780 | 'id' => 'old-contextual-help', |
781 | 781 | 'title' => __('Overview'), |
782 | 782 | 'content' => $old_help, |
783 | - ) ); |
|
783 | + )); |
|
784 | 784 | } |
785 | 785 | |
786 | 786 | $help_sidebar = $this->get_help_sidebar(); |
787 | 787 | |
788 | 788 | $help_class = 'hidden'; |
789 | - if ( ! $help_sidebar ) |
|
789 | + if ( ! $help_sidebar) |
|
790 | 790 | $help_class .= ' no-sidebar'; |
791 | 791 | |
792 | 792 | // Time to render! |
793 | 793 | ?> |
794 | 794 | <div id="screen-meta" class="metabox-prefs"> |
795 | 795 | |
796 | - <div id="contextual-help-wrap" class="<?php echo esc_attr( $help_class ); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> |
|
796 | + <div id="contextual-help-wrap" class="<?php echo esc_attr($help_class); ?>" tabindex="-1" aria-label="<?php esc_attr_e('Contextual Help Tab'); ?>"> |
|
797 | 797 | <div id="contextual-help-back"></div> |
798 | 798 | <div id="contextual-help-columns"> |
799 | 799 | <div class="contextual-help-tabs"> |
800 | 800 | <ul> |
801 | 801 | <?php |
802 | 802 | $class = ' class="active"'; |
803 | - foreach ( $this->get_help_tabs() as $tab ) : |
|
803 | + foreach ($this->get_help_tabs() as $tab) : |
|
804 | 804 | $link_id = "tab-link-{$tab['id']}"; |
805 | 805 | $panel_id = "tab-panel-{$tab['id']}"; |
806 | 806 | ?> |
807 | 807 | |
808 | - <li id="<?php echo esc_attr( $link_id ); ?>"<?php echo $class; ?>> |
|
809 | - <a href="<?php echo esc_url( "#$panel_id" ); ?>" aria-controls="<?php echo esc_attr( $panel_id ); ?>"> |
|
810 | - <?php echo esc_html( $tab['title'] ); ?> |
|
808 | + <li id="<?php echo esc_attr($link_id); ?>"<?php echo $class; ?>> |
|
809 | + <a href="<?php echo esc_url("#$panel_id"); ?>" aria-controls="<?php echo esc_attr($panel_id); ?>"> |
|
810 | + <?php echo esc_html($tab['title']); ?> |
|
811 | 811 | </a> |
812 | 812 | </li> |
813 | 813 | <?php |
@@ -817,7 +817,7 @@ discard block |
||
817 | 817 | </ul> |
818 | 818 | </div> |
819 | 819 | |
820 | - <?php if ( $help_sidebar ) : ?> |
|
820 | + <?php if ($help_sidebar) : ?> |
|
821 | 821 | <div class="contextual-help-sidebar"> |
822 | 822 | <?php echo $help_sidebar; ?> |
823 | 823 | </div> |
@@ -826,18 +826,18 @@ discard block |
||
826 | 826 | <div class="contextual-help-tabs-wrap"> |
827 | 827 | <?php |
828 | 828 | $classes = 'help-tab-content active'; |
829 | - foreach ( $this->get_help_tabs() as $tab ): |
|
829 | + foreach ($this->get_help_tabs() as $tab): |
|
830 | 830 | $panel_id = "tab-panel-{$tab['id']}"; |
831 | 831 | ?> |
832 | 832 | |
833 | - <div id="<?php echo esc_attr( $panel_id ); ?>" class="<?php echo $classes; ?>"> |
|
833 | + <div id="<?php echo esc_attr($panel_id); ?>" class="<?php echo $classes; ?>"> |
|
834 | 834 | <?php |
835 | 835 | // Print tab content. |
836 | 836 | echo $tab['content']; |
837 | 837 | |
838 | 838 | // If it exists, fire tab callback. |
839 | - if ( ! empty( $tab['callback'] ) ) |
|
840 | - call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
839 | + if ( ! empty($tab['callback'])) |
|
840 | + call_user_func_array($tab['callback'], array($this, $tab)); |
|
841 | 841 | ?> |
842 | 842 | </div> |
843 | 843 | <?php |
@@ -862,37 +862,37 @@ discard block |
||
862 | 862 | * @param string $screen_id Screen ID. |
863 | 863 | * @param WP_Screen $this Current WP_Screen instance. |
864 | 864 | */ |
865 | - $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
|
865 | + $columns = apply_filters('screen_layout_columns', array(), $this->id, $this); |
|
866 | 866 | |
867 | - if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|
868 | - $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
867 | + if ( ! empty($columns) && isset($columns[$this->id])) |
|
868 | + $this->add_option('layout_columns', array('max' => $columns[$this->id])); |
|
869 | 869 | |
870 | - if ( $this->get_option( 'layout_columns' ) ) { |
|
870 | + if ($this->get_option('layout_columns')) { |
|
871 | 871 | $this->columns = (int) get_user_option("screen_layout_$this->id"); |
872 | 872 | |
873 | - if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|
874 | - $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
873 | + if ( ! $this->columns && $this->get_option('layout_columns', 'default')) |
|
874 | + $this->columns = $this->get_option('layout_columns', 'default'); |
|
875 | 875 | } |
876 | - $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
|
876 | + $GLOBALS['screen_layout_columns'] = $this->columns; // Set the global for back-compat. |
|
877 | 877 | |
878 | 878 | // Add screen options |
879 | - if ( $this->show_screen_options() ) |
|
879 | + if ($this->show_screen_options()) |
|
880 | 880 | $this->render_screen_options(); |
881 | 881 | ?> |
882 | 882 | </div> |
883 | 883 | <?php |
884 | - if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) |
|
884 | + if ( ! $this->get_help_tabs() && ! $this->show_screen_options()) |
|
885 | 885 | return; |
886 | 886 | ?> |
887 | 887 | <div id="screen-meta-links"> |
888 | - <?php if ( $this->get_help_tabs() ) : ?> |
|
888 | + <?php if ($this->get_help_tabs()) : ?> |
|
889 | 889 | <div id="contextual-help-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
890 | - <button type="button" id="contextual-help-link" class="button show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e( 'Help' ); ?></button> |
|
890 | + <button type="button" id="contextual-help-link" class="button show-settings" aria-controls="contextual-help-wrap" aria-expanded="false"><?php _e('Help'); ?></button> |
|
891 | 891 | </div> |
892 | 892 | <?php endif; |
893 | - if ( $this->show_screen_options() ) : ?> |
|
893 | + if ($this->show_screen_options()) : ?> |
|
894 | 894 | <div id="screen-options-link-wrap" class="hide-if-no-js screen-meta-toggle"> |
895 | - <button type="button" id="show-settings-link" class="button show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e( 'Screen Options' ); ?></button> |
|
895 | + <button type="button" id="show-settings-link" class="button show-settings" aria-controls="screen-options-wrap" aria-expanded="false"><?php _e('Screen Options'); ?></button> |
|
896 | 896 | </div> |
897 | 897 | <?php endif; ?> |
898 | 898 | </div> |
@@ -908,21 +908,21 @@ discard block |
||
908 | 908 | public function show_screen_options() { |
909 | 909 | global $wp_meta_boxes; |
910 | 910 | |
911 | - if ( is_bool( $this->_show_screen_options ) ) |
|
911 | + if (is_bool($this->_show_screen_options)) |
|
912 | 912 | return $this->_show_screen_options; |
913 | 913 | |
914 | - $columns = get_column_headers( $this ); |
|
914 | + $columns = get_column_headers($this); |
|
915 | 915 | |
916 | - $show_screen = ! empty( $wp_meta_boxes[ $this->id ] ) || $columns || $this->get_option( 'per_page' ); |
|
916 | + $show_screen = ! empty($wp_meta_boxes[$this->id]) || $columns || $this->get_option('per_page'); |
|
917 | 917 | |
918 | - switch ( $this->base ) { |
|
918 | + switch ($this->base) { |
|
919 | 919 | case 'widgets': |
920 | - $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">' . __('Enable accessibility mode') . '</a><a id="access-off" href="widgets.php?widgets-access=off">' . __('Disable accessibility mode') . "</a></p>\n"; |
|
920 | + $this->_screen_settings = '<p><a id="access-on" href="widgets.php?widgets-access=on">'.__('Enable accessibility mode').'</a><a id="access-off" href="widgets.php?widgets-access=off">'.__('Disable accessibility mode')."</a></p>\n"; |
|
921 | 921 | break; |
922 | 922 | case 'post' : |
923 | - $expand = '<fieldset class="editor-expand hidden"><legend>' . __( 'Additional settings' ) . '</legend><label for="editor-expand-toggle">'; |
|
924 | - $expand .= '<input type="checkbox" id="editor-expand-toggle"' . checked( get_user_setting( 'editor_expand', 'on' ), 'on', false ) . ' />'; |
|
925 | - $expand .= __( 'Enable full-height editor and distraction-free functionality.' ) . '</label></fieldset>'; |
|
923 | + $expand = '<fieldset class="editor-expand hidden"><legend>'.__('Additional settings').'</legend><label for="editor-expand-toggle">'; |
|
924 | + $expand .= '<input type="checkbox" id="editor-expand-toggle"'.checked(get_user_setting('editor_expand', 'on'), 'on', false).' />'; |
|
925 | + $expand .= __('Enable full-height editor and distraction-free functionality.').'</label></fieldset>'; |
|
926 | 926 | $this->_screen_settings = $expand; |
927 | 927 | break; |
928 | 928 | default: |
@@ -941,9 +941,9 @@ discard block |
||
941 | 941 | * @param string $screen_settings Screen settings. |
942 | 942 | * @param WP_Screen $this WP_Screen object. |
943 | 943 | */ |
944 | - $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); |
|
944 | + $this->_screen_settings = apply_filters('screen_settings', $this->_screen_settings, $this); |
|
945 | 945 | |
946 | - if ( $this->_screen_settings || $this->_options ) |
|
946 | + if ($this->_screen_settings || $this->_options) |
|
947 | 947 | $show_screen = true; |
948 | 948 | |
949 | 949 | /** |
@@ -955,7 +955,7 @@ discard block |
||
955 | 955 | * Default true. |
956 | 956 | * @param WP_Screen $this Current WP_Screen instance. |
957 | 957 | */ |
958 | - $this->_show_screen_options = apply_filters( 'screen_options_show_screen', $show_screen, $this ); |
|
958 | + $this->_show_screen_options = apply_filters('screen_options_show_screen', $show_screen, $this); |
|
959 | 959 | return $this->_show_screen_options; |
960 | 960 | } |
961 | 961 | |
@@ -968,26 +968,26 @@ discard block |
||
968 | 968 | * @type bool $wrap Whether the screen-options-wrap div will be included. Defaults to true. |
969 | 969 | * } |
970 | 970 | */ |
971 | - public function render_screen_options( $options = array() ) { |
|
972 | - $options = wp_parse_args( $options, array( |
|
971 | + public function render_screen_options($options = array()) { |
|
972 | + $options = wp_parse_args($options, array( |
|
973 | 973 | 'wrap' => true, |
974 | - ) ); |
|
974 | + )); |
|
975 | 975 | |
976 | 976 | $wrapper_start = $wrapper_end = $form_start = $form_end = ''; |
977 | 977 | |
978 | 978 | // Output optional wrapper. |
979 | - if ( $options['wrap'] ) { |
|
980 | - $wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="' . esc_attr__( 'Screen Options Tab' ) . '">'; |
|
979 | + if ($options['wrap']) { |
|
980 | + $wrapper_start = '<div id="screen-options-wrap" class="hidden" tabindex="-1" aria-label="'.esc_attr__('Screen Options Tab').'">'; |
|
981 | 981 | $wrapper_end = '</div>'; |
982 | 982 | } |
983 | 983 | |
984 | 984 | // Don't output the form and nonce for the widgets accessibility mode links. |
985 | - if ( 'widgets' !== $this->base ) { |
|
985 | + if ('widgets' !== $this->base) { |
|
986 | 986 | $form_start = "\n<form id='adv-settings' method='post'>\n"; |
987 | - $form_end = "\n" . wp_nonce_field( 'screen-options-nonce', 'screenoptionnonce', false, false ) . "\n</form>\n"; |
|
987 | + $form_end = "\n".wp_nonce_field('screen-options-nonce', 'screenoptionnonce', false, false)."\n</form>\n"; |
|
988 | 988 | } |
989 | 989 | |
990 | - echo $wrapper_start . $form_start; |
|
990 | + echo $wrapper_start.$form_start; |
|
991 | 991 | |
992 | 992 | $this->render_meta_boxes_preferences(); |
993 | 993 | $this->render_list_table_columns_preferences(); |
@@ -1005,13 +1005,13 @@ discard block |
||
1005 | 1005 | * Default false. |
1006 | 1006 | * @param WP_Screen $this Current WP_Screen instance. |
1007 | 1007 | */ |
1008 | - $show_button = apply_filters( 'screen_options_show_submit', false, $this ); |
|
1008 | + $show_button = apply_filters('screen_options_show_submit', false, $this); |
|
1009 | 1009 | |
1010 | - if ( $show_button ) { |
|
1011 | - submit_button( __( 'Apply' ), 'primary', 'screen-options-apply', true ); |
|
1010 | + if ($show_button) { |
|
1011 | + submit_button(__('Apply'), 'primary', 'screen-options-apply', true); |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | - echo $form_end . $wrapper_end; |
|
1014 | + echo $form_end.$wrapper_end; |
|
1015 | 1015 | } |
1016 | 1016 | |
1017 | 1017 | /** |
@@ -1024,28 +1024,28 @@ discard block |
||
1024 | 1024 | public function render_meta_boxes_preferences() { |
1025 | 1025 | global $wp_meta_boxes; |
1026 | 1026 | |
1027 | - if ( ! isset( $wp_meta_boxes[ $this->id ] ) ) { |
|
1027 | + if ( ! isset($wp_meta_boxes[$this->id])) { |
|
1028 | 1028 | return; |
1029 | 1029 | } |
1030 | 1030 | ?> |
1031 | 1031 | <fieldset class="metabox-prefs"> |
1032 | - <legend><?php _e( 'Boxes' ); ?></legend> |
|
1032 | + <legend><?php _e('Boxes'); ?></legend> |
|
1033 | 1033 | <?php |
1034 | - meta_box_prefs( $this ); |
|
1034 | + meta_box_prefs($this); |
|
1035 | 1035 | |
1036 | - if ( 'dashboard' === $this->id && has_action( 'welcome_panel' ) && current_user_can( 'edit_theme_options' ) ) { |
|
1037 | - if ( isset( $_GET['welcome'] ) ) { |
|
1038 | - $welcome_checked = empty( $_GET['welcome'] ) ? 0 : 1; |
|
1039 | - update_user_meta( get_current_user_id(), 'show_welcome_panel', $welcome_checked ); |
|
1036 | + if ('dashboard' === $this->id && has_action('welcome_panel') && current_user_can('edit_theme_options')) { |
|
1037 | + if (isset($_GET['welcome'])) { |
|
1038 | + $welcome_checked = empty($_GET['welcome']) ? 0 : 1; |
|
1039 | + update_user_meta(get_current_user_id(), 'show_welcome_panel', $welcome_checked); |
|
1040 | 1040 | } else { |
1041 | - $welcome_checked = get_user_meta( get_current_user_id(), 'show_welcome_panel', true ); |
|
1042 | - if ( 2 == $welcome_checked && wp_get_current_user()->user_email != get_option( 'admin_email' ) ) { |
|
1041 | + $welcome_checked = get_user_meta(get_current_user_id(), 'show_welcome_panel', true); |
|
1042 | + if (2 == $welcome_checked && wp_get_current_user()->user_email != get_option('admin_email')) { |
|
1043 | 1043 | $welcome_checked = false; |
1044 | 1044 | } |
1045 | 1045 | } |
1046 | 1046 | echo '<label for="wp_welcome_panel-hide">'; |
1047 | - echo '<input type="checkbox" id="wp_welcome_panel-hide"' . checked( (bool) $welcome_checked, true, false ) . ' />'; |
|
1048 | - echo _x( 'Welcome', 'Welcome panel' ) . "</label>\n"; |
|
1047 | + echo '<input type="checkbox" id="wp_welcome_panel-hide"'.checked((bool) $welcome_checked, true, false).' />'; |
|
1048 | + echo _x('Welcome', 'Welcome panel')."</label>\n"; |
|
1049 | 1049 | } |
1050 | 1050 | ?> |
1051 | 1051 | </fieldset> |
@@ -1059,37 +1059,37 @@ discard block |
||
1059 | 1059 | */ |
1060 | 1060 | public function render_list_table_columns_preferences() { |
1061 | 1061 | |
1062 | - $columns = get_column_headers( $this ); |
|
1063 | - $hidden = get_hidden_columns( $this ); |
|
1062 | + $columns = get_column_headers($this); |
|
1063 | + $hidden = get_hidden_columns($this); |
|
1064 | 1064 | |
1065 | - if ( ! $columns ) { |
|
1065 | + if ( ! $columns) { |
|
1066 | 1066 | return; |
1067 | 1067 | } |
1068 | 1068 | |
1069 | - $legend = ! empty( $columns['_title'] ) ? $columns['_title'] : __( 'Columns' ); |
|
1069 | + $legend = ! empty($columns['_title']) ? $columns['_title'] : __('Columns'); |
|
1070 | 1070 | ?> |
1071 | 1071 | <fieldset class="metabox-prefs"> |
1072 | 1072 | <legend><?php echo $legend; ?></legend> |
1073 | 1073 | <?php |
1074 | - $special = array( '_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname' ); |
|
1074 | + $special = array('_title', 'cb', 'comment', 'media', 'name', 'title', 'username', 'blogname'); |
|
1075 | 1075 | |
1076 | - foreach ( $columns as $column => $title ) { |
|
1076 | + foreach ($columns as $column => $title) { |
|
1077 | 1077 | // Can't hide these for they are special |
1078 | - if ( in_array( $column, $special ) ) { |
|
1078 | + if (in_array($column, $special)) { |
|
1079 | 1079 | continue; |
1080 | 1080 | } |
1081 | 1081 | |
1082 | - if ( empty( $title ) ) { |
|
1082 | + if (empty($title)) { |
|
1083 | 1083 | continue; |
1084 | 1084 | } |
1085 | 1085 | |
1086 | - if ( 'comments' == $column ) { |
|
1087 | - $title = __( 'Comments' ); |
|
1086 | + if ('comments' == $column) { |
|
1087 | + $title = __('Comments'); |
|
1088 | 1088 | } |
1089 | 1089 | |
1090 | 1090 | $id = "$column-hide"; |
1091 | 1091 | echo '<label>'; |
1092 | - echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />'; |
|
1092 | + echo '<input class="hide-column-tog" name="'.$id.'" type="checkbox" id="'.$id.'" value="'.$column.'"'.checked( ! in_array($column, $hidden), true, false).' />'; |
|
1093 | 1093 | echo "$title</label>\n"; |
1094 | 1094 | } |
1095 | 1095 | ?> |
@@ -1103,22 +1103,22 @@ discard block |
||
1103 | 1103 | * @since 3.3.0 |
1104 | 1104 | */ |
1105 | 1105 | public function render_screen_layout() { |
1106 | - if ( ! $this->get_option( 'layout_columns' ) ) { |
|
1106 | + if ( ! $this->get_option('layout_columns')) { |
|
1107 | 1107 | return; |
1108 | 1108 | } |
1109 | 1109 | |
1110 | 1110 | $screen_layout_columns = $this->get_columns(); |
1111 | - $num = $this->get_option( 'layout_columns', 'max' ); |
|
1111 | + $num = $this->get_option('layout_columns', 'max'); |
|
1112 | 1112 | |
1113 | 1113 | ?> |
1114 | 1114 | <fieldset class='columns-prefs'> |
1115 | - <legend class="screen-layout"><?php _e( 'Layout' ); ?></legend><?php |
|
1116 | - for ( $i = 1; $i <= $num; ++$i ): |
|
1115 | + <legend class="screen-layout"><?php _e('Layout'); ?></legend><?php |
|
1116 | + for ($i = 1; $i <= $num; ++$i): |
|
1117 | 1117 | ?> |
1118 | 1118 | <label class="columns-prefs-<?php echo $i; ?>"> |
1119 | - <input type='radio' name='screen_columns' value='<?php echo esc_attr( $i ); ?>' |
|
1120 | - <?php checked( $screen_layout_columns, $i ); ?> /> |
|
1121 | - <?php printf( _n( '%s column', '%s columns', $i ), number_format_i18n( $i ) ); ?> |
|
1119 | + <input type='radio' name='screen_columns' value='<?php echo esc_attr($i); ?>' |
|
1120 | + <?php checked($screen_layout_columns, $i); ?> /> |
|
1121 | + <?php printf(_n('%s column', '%s columns', $i), number_format_i18n($i)); ?> |
|
1122 | 1122 | </label> |
1123 | 1123 | <?php |
1124 | 1124 | endfor; ?> |
@@ -1132,60 +1132,60 @@ discard block |
||
1132 | 1132 | * @since 3.3.0 |
1133 | 1133 | */ |
1134 | 1134 | public function render_per_page_options() { |
1135 | - if ( null === $this->get_option( 'per_page' ) ) { |
|
1135 | + if (null === $this->get_option('per_page')) { |
|
1136 | 1136 | return; |
1137 | 1137 | } |
1138 | 1138 | |
1139 | - $per_page_label = $this->get_option( 'per_page', 'label' ); |
|
1140 | - if ( null === $per_page_label ) { |
|
1141 | - $per_page_label = __( 'Number of items per page:' ); |
|
1139 | + $per_page_label = $this->get_option('per_page', 'label'); |
|
1140 | + if (null === $per_page_label) { |
|
1141 | + $per_page_label = __('Number of items per page:'); |
|
1142 | 1142 | } |
1143 | 1143 | |
1144 | - $option = $this->get_option( 'per_page', 'option' ); |
|
1145 | - if ( ! $option ) { |
|
1146 | - $option = str_replace( '-', '_', "{$this->id}_per_page" ); |
|
1144 | + $option = $this->get_option('per_page', 'option'); |
|
1145 | + if ( ! $option) { |
|
1146 | + $option = str_replace('-', '_', "{$this->id}_per_page"); |
|
1147 | 1147 | } |
1148 | 1148 | |
1149 | - $per_page = (int) get_user_option( $option ); |
|
1150 | - if ( empty( $per_page ) || $per_page < 1 ) { |
|
1151 | - $per_page = $this->get_option( 'per_page', 'default' ); |
|
1152 | - if ( ! $per_page ) { |
|
1149 | + $per_page = (int) get_user_option($option); |
|
1150 | + if (empty($per_page) || $per_page < 1) { |
|
1151 | + $per_page = $this->get_option('per_page', 'default'); |
|
1152 | + if ( ! $per_page) { |
|
1153 | 1153 | $per_page = 20; |
1154 | 1154 | } |
1155 | 1155 | } |
1156 | 1156 | |
1157 | - if ( 'edit_comments_per_page' == $option ) { |
|
1158 | - $comment_status = isset( $_REQUEST['comment_status'] ) ? $_REQUEST['comment_status'] : 'all'; |
|
1157 | + if ('edit_comments_per_page' == $option) { |
|
1158 | + $comment_status = isset($_REQUEST['comment_status']) ? $_REQUEST['comment_status'] : 'all'; |
|
1159 | 1159 | |
1160 | 1160 | /** This filter is documented in wp-admin/includes/class-wp-comments-list-table.php */ |
1161 | - $per_page = apply_filters( 'comments_per_page', $per_page, $comment_status ); |
|
1162 | - } elseif ( 'categories_per_page' == $option ) { |
|
1161 | + $per_page = apply_filters('comments_per_page', $per_page, $comment_status); |
|
1162 | + } elseif ('categories_per_page' == $option) { |
|
1163 | 1163 | /** This filter is documented in wp-admin/includes/class-wp-terms-list-table.php */ |
1164 | - $per_page = apply_filters( 'edit_categories_per_page', $per_page ); |
|
1164 | + $per_page = apply_filters('edit_categories_per_page', $per_page); |
|
1165 | 1165 | } else { |
1166 | 1166 | /** This filter is documented in wp-admin/includes/class-wp-list-table.php */ |
1167 | - $per_page = apply_filters( $option, $per_page ); |
|
1167 | + $per_page = apply_filters($option, $per_page); |
|
1168 | 1168 | } |
1169 | 1169 | |
1170 | 1170 | // Back compat |
1171 | - if ( isset( $this->post_type ) ) { |
|
1171 | + if (isset($this->post_type)) { |
|
1172 | 1172 | /** This filter is documented in wp-admin/includes/post.php */ |
1173 | - $per_page = apply_filters( 'edit_posts_per_page', $per_page, $this->post_type ); |
|
1173 | + $per_page = apply_filters('edit_posts_per_page', $per_page, $this->post_type); |
|
1174 | 1174 | } |
1175 | 1175 | |
1176 | 1176 | // This needs a submit button |
1177 | - add_filter( 'screen_options_show_submit', '__return_true' ); |
|
1177 | + add_filter('screen_options_show_submit', '__return_true'); |
|
1178 | 1178 | |
1179 | 1179 | ?> |
1180 | 1180 | <fieldset class="screen-options"> |
1181 | - <legend><?php _e( 'Pagination' ); ?></legend> |
|
1182 | - <?php if ( $per_page_label ) : ?> |
|
1183 | - <label for="<?php echo esc_attr( $option ); ?>"><?php echo $per_page_label; ?></label> |
|
1181 | + <legend><?php _e('Pagination'); ?></legend> |
|
1182 | + <?php if ($per_page_label) : ?> |
|
1183 | + <label for="<?php echo esc_attr($option); ?>"><?php echo $per_page_label; ?></label> |
|
1184 | 1184 | <input type="number" step="1" min="1" max="999" class="screen-per-page" name="wp_screen_options[value]" |
1185 | - id="<?php echo esc_attr( $option ); ?>" maxlength="3" |
|
1186 | - value="<?php echo esc_attr( $per_page ); ?>" /> |
|
1185 | + id="<?php echo esc_attr($option); ?>" maxlength="3" |
|
1186 | + value="<?php echo esc_attr($per_page); ?>" /> |
|
1187 | 1187 | <?php endif; ?> |
1188 | - <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr( $option ); ?>" /> |
|
1188 | + <input type="hidden" name="wp_screen_options[option]" value="<?php echo esc_attr($option); ?>" /> |
|
1189 | 1189 | </fieldset> |
1190 | 1190 | <?php |
1191 | 1191 | } |
@@ -1199,11 +1199,11 @@ discard block |
||
1199 | 1199 | $screen = get_current_screen(); |
1200 | 1200 | |
1201 | 1201 | // Currently only enabled for posts lists |
1202 | - if ( 'edit' !== $screen->base ) { |
|
1202 | + if ('edit' !== $screen->base) { |
|
1203 | 1203 | return; |
1204 | 1204 | } |
1205 | 1205 | |
1206 | - $view_mode_post_types = get_post_types( array( 'hierarchical' => false, 'show_ui' => true ) ); |
|
1206 | + $view_mode_post_types = get_post_types(array('hierarchical' => false, 'show_ui' => true)); |
|
1207 | 1207 | |
1208 | 1208 | /** |
1209 | 1209 | * Filter the post types that have different view mode options. |
@@ -1213,26 +1213,26 @@ discard block |
||
1213 | 1213 | * @param array $view_mode_post_types Array of post types that can change view modes. |
1214 | 1214 | * Default hierarchical post types with show_ui on. |
1215 | 1215 | */ |
1216 | - $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types ); |
|
1216 | + $view_mode_post_types = apply_filters('view_mode_post_types', $view_mode_post_types); |
|
1217 | 1217 | |
1218 | - if ( ! in_array( $this->post_type, $view_mode_post_types ) ) { |
|
1218 | + if ( ! in_array($this->post_type, $view_mode_post_types)) { |
|
1219 | 1219 | return; |
1220 | 1220 | } |
1221 | 1221 | |
1222 | 1222 | global $mode; |
1223 | 1223 | |
1224 | 1224 | // This needs a submit button |
1225 | - add_filter( 'screen_options_show_submit', '__return_true' ); |
|
1225 | + add_filter('screen_options_show_submit', '__return_true'); |
|
1226 | 1226 | ?> |
1227 | 1227 | <fieldset class="metabox-prefs view-mode"> |
1228 | - <legend><?php _e( 'View Mode' ); ?></legend> |
|
1228 | + <legend><?php _e('View Mode'); ?></legend> |
|
1229 | 1229 | <label for="list-view-mode"> |
1230 | - <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked( 'list', $mode ); ?> /> |
|
1231 | - <?php _e( 'List View' ); ?> |
|
1230 | + <input id="list-view-mode" type="radio" name="mode" value="list" <?php checked('list', $mode); ?> /> |
|
1231 | + <?php _e('List View'); ?> |
|
1232 | 1232 | </label> |
1233 | 1233 | <label for="excerpt-view-mode"> |
1234 | - <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked( 'excerpt', $mode ); ?> /> |
|
1235 | - <?php _e( 'Excerpt View' ); ?> |
|
1234 | + <input id="excerpt-view-mode" type="radio" name="mode" value="excerpt" <?php checked('excerpt', $mode); ?> /> |
|
1235 | + <?php _e('Excerpt View'); ?> |
|
1236 | 1236 | </label> |
1237 | 1237 | </fieldset> |
1238 | 1238 | <?php |
@@ -1246,11 +1246,11 @@ discard block |
||
1246 | 1246 | * @param string $key The screen reader text array named key. |
1247 | 1247 | * @param string $tag Optional. The HTML tag to wrap the screen reader text. Default h2. |
1248 | 1248 | */ |
1249 | - public function render_screen_reader_content( $key = '', $tag = 'h2' ) { |
|
1249 | + public function render_screen_reader_content($key = '', $tag = 'h2') { |
|
1250 | 1250 | |
1251 | - if ( ! isset( $this->_screen_reader_content[ $key ] ) ) { |
|
1251 | + if ( ! isset($this->_screen_reader_content[$key])) { |
|
1252 | 1252 | return; |
1253 | 1253 | } |
1254 | - echo "<$tag class='screen-reader-text'>" . $this->_screen_reader_content[ $key ] . "</$tag>"; |
|
1254 | + echo "<$tag class='screen-reader-text'>".$this->_screen_reader_content[$key]."</$tag>"; |
|
1255 | 1255 | } |
1256 | 1256 | } |
@@ -223,18 +223,20 @@ discard block |
||
223 | 223 | $in_admin = false; |
224 | 224 | $action = ''; |
225 | 225 | |
226 | - if ( $hook_name ) |
|
227 | - $id = $hook_name; |
|
228 | - else |
|
229 | - $id = $GLOBALS['hook_suffix']; |
|
226 | + if ( $hook_name ) { |
|
227 | + $id = $hook_name; |
|
228 | + } else { |
|
229 | + $id = $GLOBALS['hook_suffix']; |
|
230 | + } |
|
230 | 231 | |
231 | 232 | // For those pesky meta boxes. |
232 | 233 | if ( $hook_name && post_type_exists( $hook_name ) ) { |
233 | 234 | $post_type = $id; |
234 | 235 | $id = 'post'; // changes later. ends up being $base. |
235 | 236 | } else { |
236 | - if ( '.php' == substr( $id, -4 ) ) |
|
237 | - $id = substr( $id, 0, -4 ); |
|
237 | + if ( '.php' == substr( $id, -4 ) ) { |
|
238 | + $id = substr( $id, 0, -4 ); |
|
239 | + } |
|
238 | 240 | |
239 | 241 | if ( 'post-new' == $id || 'link-add' == $id || 'media-new' == $id || 'user-new' == $id ) { |
240 | 242 | $id = substr( $id, 0, -4 ); |
@@ -263,74 +265,86 @@ discard block |
||
263 | 265 | } |
264 | 266 | } |
265 | 267 | |
266 | - if ( ! $in_admin ) |
|
267 | - $in_admin = 'site'; |
|
268 | + if ( ! $in_admin ) { |
|
269 | + $in_admin = 'site'; |
|
270 | + } |
|
268 | 271 | } else { |
269 | - if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) |
|
270 | - $in_admin = 'network'; |
|
271 | - elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) |
|
272 | - $in_admin = 'user'; |
|
273 | - else |
|
274 | - $in_admin = 'site'; |
|
272 | + if ( defined( 'WP_NETWORK_ADMIN' ) && WP_NETWORK_ADMIN ) { |
|
273 | + $in_admin = 'network'; |
|
274 | + } elseif ( defined( 'WP_USER_ADMIN' ) && WP_USER_ADMIN ) { |
|
275 | + $in_admin = 'user'; |
|
276 | + } else { |
|
277 | + $in_admin = 'site'; |
|
278 | + } |
|
275 | 279 | } |
276 | 280 | |
277 | - if ( 'index' == $id ) |
|
278 | - $id = 'dashboard'; |
|
279 | - elseif ( 'front' == $id ) |
|
280 | - $in_admin = false; |
|
281 | + if ( 'index' == $id ) { |
|
282 | + $id = 'dashboard'; |
|
283 | + } elseif ( 'front' == $id ) { |
|
284 | + $in_admin = false; |
|
285 | + } |
|
281 | 286 | |
282 | 287 | $base = $id; |
283 | 288 | |
284 | 289 | // If this is the current screen, see if we can be more accurate for post types and taxonomies. |
285 | 290 | if ( ! $hook_name ) { |
286 | - if ( isset( $_REQUEST['post_type'] ) ) |
|
287 | - $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
288 | - if ( isset( $_REQUEST['taxonomy'] ) ) |
|
289 | - $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
291 | + if ( isset( $_REQUEST['post_type'] ) ) { |
|
292 | + $post_type = post_type_exists( $_REQUEST['post_type'] ) ? $_REQUEST['post_type'] : false; |
|
293 | + } |
|
294 | + if ( isset( $_REQUEST['taxonomy'] ) ) { |
|
295 | + $taxonomy = taxonomy_exists( $_REQUEST['taxonomy'] ) ? $_REQUEST['taxonomy'] : false; |
|
296 | + } |
|
290 | 297 | |
291 | 298 | switch ( $base ) { |
292 | 299 | case 'post' : |
293 | - if ( isset( $_GET['post'] ) ) |
|
294 | - $post_id = (int) $_GET['post']; |
|
295 | - elseif ( isset( $_POST['post_ID'] ) ) |
|
296 | - $post_id = (int) $_POST['post_ID']; |
|
297 | - else |
|
298 | - $post_id = 0; |
|
300 | + if ( isset( $_GET['post'] ) ) { |
|
301 | + $post_id = (int) $_GET['post']; |
|
302 | + } elseif ( isset( $_POST['post_ID'] ) ) { |
|
303 | + $post_id = (int) $_POST['post_ID']; |
|
304 | + } else { |
|
305 | + $post_id = 0; |
|
306 | + } |
|
299 | 307 | |
300 | 308 | if ( $post_id ) { |
301 | 309 | $post = get_post( $post_id ); |
302 | - if ( $post ) |
|
303 | - $post_type = $post->post_type; |
|
310 | + if ( $post ) { |
|
311 | + $post_type = $post->post_type; |
|
312 | + } |
|
304 | 313 | } |
305 | 314 | break; |
306 | 315 | case 'edit-tags' : |
307 | 316 | case 'term' : |
308 | - if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) |
|
309 | - $post_type = 'post'; |
|
317 | + if ( null === $post_type && is_object_in_taxonomy( 'post', $taxonomy ? $taxonomy : 'post_tag' ) ) { |
|
318 | + $post_type = 'post'; |
|
319 | + } |
|
310 | 320 | break; |
311 | 321 | } |
312 | 322 | } |
313 | 323 | |
314 | 324 | switch ( $base ) { |
315 | 325 | case 'post' : |
316 | - if ( null === $post_type ) |
|
317 | - $post_type = 'post'; |
|
326 | + if ( null === $post_type ) { |
|
327 | + $post_type = 'post'; |
|
328 | + } |
|
318 | 329 | $id = $post_type; |
319 | 330 | break; |
320 | 331 | case 'edit' : |
321 | - if ( null === $post_type ) |
|
322 | - $post_type = 'post'; |
|
332 | + if ( null === $post_type ) { |
|
333 | + $post_type = 'post'; |
|
334 | + } |
|
323 | 335 | $id .= '-' . $post_type; |
324 | 336 | break; |
325 | 337 | case 'edit-tags' : |
326 | 338 | case 'term' : |
327 | - if ( null === $taxonomy ) |
|
328 | - $taxonomy = 'post_tag'; |
|
339 | + if ( null === $taxonomy ) { |
|
340 | + $taxonomy = 'post_tag'; |
|
341 | + } |
|
329 | 342 | // The edit-tags ID does not contain the post type. Look for it in the request. |
330 | 343 | if ( null === $post_type ) { |
331 | 344 | $post_type = 'post'; |
332 | - if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) |
|
333 | - $post_type = $_REQUEST['post_type']; |
|
345 | + if ( isset( $_REQUEST['post_type'] ) && post_type_exists( $_REQUEST['post_type'] ) ) { |
|
346 | + $post_type = $_REQUEST['post_type']; |
|
347 | + } |
|
334 | 348 | } |
335 | 349 | |
336 | 350 | $id = 'edit-' . $taxonomy; |
@@ -347,8 +361,9 @@ discard block |
||
347 | 361 | |
348 | 362 | if ( isset( self::$_registry[ $id ] ) ) { |
349 | 363 | $screen = self::$_registry[ $id ]; |
350 | - if ( $screen === get_current_screen() ) |
|
351 | - return $screen; |
|
364 | + if ( $screen === get_current_screen() ) { |
|
365 | + return $screen; |
|
366 | + } |
|
352 | 367 | } else { |
353 | 368 | $screen = new WP_Screen(); |
354 | 369 | $screen->id = $id; |
@@ -411,8 +426,9 @@ discard block |
||
411 | 426 | * @return bool True if the screen is in the indicated admin, false otherwise. |
412 | 427 | */ |
413 | 428 | public function in_admin( $admin = null ) { |
414 | - if ( empty( $admin ) ) |
|
415 | - return (bool) $this->in_admin; |
|
429 | + if ( empty( $admin ) ) { |
|
430 | + return (bool) $this->in_admin; |
|
431 | + } |
|
416 | 432 | |
417 | 433 | return ( $admin == $this->in_admin ); |
418 | 434 | } |
@@ -502,11 +518,13 @@ discard block |
||
502 | 518 | * @return string The option value if set, null otherwise. |
503 | 519 | */ |
504 | 520 | public function get_option( $option, $key = false ) { |
505 | - if ( ! isset( $this->_options[ $option ] ) ) |
|
506 | - return null; |
|
521 | + if ( ! isset( $this->_options[ $option ] ) ) { |
|
522 | + return null; |
|
523 | + } |
|
507 | 524 | if ( $key ) { |
508 | - if ( isset( $this->_options[ $option ][ $key ] ) ) |
|
509 | - return $this->_options[ $option ][ $key ]; |
|
525 | + if ( isset( $this->_options[ $option ][ $key ] ) ) { |
|
526 | + return $this->_options[ $option ][ $key ]; |
|
527 | + } |
|
510 | 528 | return null; |
511 | 529 | } |
512 | 530 | return $this->_options[ $option ]; |
@@ -553,8 +571,9 @@ discard block |
||
553 | 571 | * @return array Help tab arguments. |
554 | 572 | */ |
555 | 573 | public function get_help_tab( $id ) { |
556 | - if ( ! isset( $this->_help_tabs[ $id ] ) ) |
|
557 | - return null; |
|
574 | + if ( ! isset( $this->_help_tabs[ $id ] ) ) { |
|
575 | + return null; |
|
576 | + } |
|
558 | 577 | return $this->_help_tabs[ $id ]; |
559 | 578 | } |
560 | 579 | |
@@ -588,8 +607,9 @@ discard block |
||
588 | 607 | $args['id'] = sanitize_html_class( $args['id'] ); |
589 | 608 | |
590 | 609 | // Ensure we have an ID and title. |
591 | - if ( ! $args['id'] || ! $args['title'] ) |
|
592 | - return; |
|
610 | + if ( ! $args['id'] || ! $args['title'] ) { |
|
611 | + return; |
|
612 | + } |
|
593 | 613 | |
594 | 614 | // Allows for overriding an existing tab with that ID. |
595 | 615 | $this->_help_tabs[ $args['id'] ] = $args; |
@@ -771,8 +791,9 @@ discard block |
||
771 | 791 | * @param string $old_help_default Default contextual help text. |
772 | 792 | */ |
773 | 793 | $default_help = apply_filters( 'default_contextual_help', '' ); |
774 | - if ( $default_help ) |
|
775 | - $old_help = '<p>' . $default_help . '</p>'; |
|
794 | + if ( $default_help ) { |
|
795 | + $old_help = '<p>' . $default_help . '</p>'; |
|
796 | + } |
|
776 | 797 | } |
777 | 798 | |
778 | 799 | if ( $old_help ) { |
@@ -786,8 +807,9 @@ discard block |
||
786 | 807 | $help_sidebar = $this->get_help_sidebar(); |
787 | 808 | |
788 | 809 | $help_class = 'hidden'; |
789 | - if ( ! $help_sidebar ) |
|
790 | - $help_class .= ' no-sidebar'; |
|
810 | + if ( ! $help_sidebar ) { |
|
811 | + $help_class .= ' no-sidebar'; |
|
812 | + } |
|
791 | 813 | |
792 | 814 | // Time to render! |
793 | 815 | ?> |
@@ -836,8 +858,9 @@ discard block |
||
836 | 858 | echo $tab['content']; |
837 | 859 | |
838 | 860 | // If it exists, fire tab callback. |
839 | - if ( ! empty( $tab['callback'] ) ) |
|
840 | - call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
861 | + if ( ! empty( $tab['callback'] ) ) { |
|
862 | + call_user_func_array( $tab['callback'], array( $this, $tab ) ); |
|
863 | + } |
|
841 | 864 | ?> |
842 | 865 | </div> |
843 | 866 | <?php |
@@ -864,25 +887,29 @@ discard block |
||
864 | 887 | */ |
865 | 888 | $columns = apply_filters( 'screen_layout_columns', array(), $this->id, $this ); |
866 | 889 | |
867 | - if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) |
|
868 | - $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
890 | + if ( ! empty( $columns ) && isset( $columns[ $this->id ] ) ) { |
|
891 | + $this->add_option( 'layout_columns', array('max' => $columns[ $this->id ] ) ); |
|
892 | + } |
|
869 | 893 | |
870 | 894 | if ( $this->get_option( 'layout_columns' ) ) { |
871 | 895 | $this->columns = (int) get_user_option("screen_layout_$this->id"); |
872 | 896 | |
873 | - if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) |
|
874 | - $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
897 | + if ( ! $this->columns && $this->get_option( 'layout_columns', 'default' ) ) { |
|
898 | + $this->columns = $this->get_option( 'layout_columns', 'default' ); |
|
899 | + } |
|
875 | 900 | } |
876 | 901 | $GLOBALS[ 'screen_layout_columns' ] = $this->columns; // Set the global for back-compat. |
877 | 902 | |
878 | 903 | // Add screen options |
879 | - if ( $this->show_screen_options() ) |
|
880 | - $this->render_screen_options(); |
|
904 | + if ( $this->show_screen_options() ) { |
|
905 | + $this->render_screen_options(); |
|
906 | + } |
|
881 | 907 | ?> |
882 | 908 | </div> |
883 | 909 | <?php |
884 | - if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) |
|
885 | - return; |
|
910 | + if ( ! $this->get_help_tabs() && ! $this->show_screen_options() ) { |
|
911 | + return; |
|
912 | + } |
|
886 | 913 | ?> |
887 | 914 | <div id="screen-meta-links"> |
888 | 915 | <?php if ( $this->get_help_tabs() ) : ?> |
@@ -908,8 +935,9 @@ discard block |
||
908 | 935 | public function show_screen_options() { |
909 | 936 | global $wp_meta_boxes; |
910 | 937 | |
911 | - if ( is_bool( $this->_show_screen_options ) ) |
|
912 | - return $this->_show_screen_options; |
|
938 | + if ( is_bool( $this->_show_screen_options ) ) { |
|
939 | + return $this->_show_screen_options; |
|
940 | + } |
|
913 | 941 | |
914 | 942 | $columns = get_column_headers( $this ); |
915 | 943 | |
@@ -943,8 +971,9 @@ discard block |
||
943 | 971 | */ |
944 | 972 | $this->_screen_settings = apply_filters( 'screen_settings', $this->_screen_settings, $this ); |
945 | 973 | |
946 | - if ( $this->_screen_settings || $this->_options ) |
|
947 | - $show_screen = true; |
|
974 | + if ( $this->_screen_settings || $this->_options ) { |
|
975 | + $show_screen = true; |
|
976 | + } |
|
948 | 977 | |
949 | 978 | /** |
950 | 979 | * Filter whether to show the Screen Options tab. |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Administration API: WP_Internal_Pointers class |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 4.4.0 |
|
8 | - */ |
|
3 | + * Administration API: WP_Internal_Pointers class |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 4.4.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Core class used to implement an internal admin pointers API. |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * |
29 | 29 | * @param string $hook_suffix The current admin page. |
30 | 30 | */ |
31 | - public static function enqueue_scripts( $hook_suffix ) { |
|
31 | + public static function enqueue_scripts($hook_suffix) { |
|
32 | 32 | /* |
33 | 33 | * Register feature pointers |
34 | 34 | * |
@@ -47,10 +47,10 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Check if screen related pointer is registered |
50 | - if ( empty( $registered_pointers[ $hook_suffix ] ) ) |
|
50 | + if (empty($registered_pointers[$hook_suffix])) |
|
51 | 51 | return; |
52 | 52 | |
53 | - $pointers = (array) $registered_pointers[ $hook_suffix ]; |
|
53 | + $pointers = (array) $registered_pointers[$hook_suffix]; |
|
54 | 54 | |
55 | 55 | /* |
56 | 56 | * Specify required capabilities for feature pointers |
@@ -70,28 +70,28 @@ discard block |
||
70 | 70 | ); |
71 | 71 | |
72 | 72 | // Get dismissed pointers |
73 | - $dismissed = explode( ',', (string) get_user_meta( get_current_user_id(), 'dismissed_wp_pointers', true ) ); |
|
73 | + $dismissed = explode(',', (string) get_user_meta(get_current_user_id(), 'dismissed_wp_pointers', true)); |
|
74 | 74 | |
75 | 75 | $got_pointers = false; |
76 | - foreach ( array_diff( $pointers, $dismissed ) as $pointer ) { |
|
77 | - if ( isset( $caps_required[ $pointer ] ) ) { |
|
78 | - foreach ( $caps_required[ $pointer ] as $cap ) { |
|
79 | - if ( ! current_user_can( $cap ) ) |
|
76 | + foreach (array_diff($pointers, $dismissed) as $pointer) { |
|
77 | + if (isset($caps_required[$pointer])) { |
|
78 | + foreach ($caps_required[$pointer] as $cap) { |
|
79 | + if ( ! current_user_can($cap)) |
|
80 | 80 | continue 2; |
81 | 81 | } |
82 | 82 | } |
83 | 83 | |
84 | 84 | // Bind pointer print function |
85 | - add_action( 'admin_print_footer_scripts', array( 'WP_Internal_Pointers', 'pointer_' . $pointer ) ); |
|
85 | + add_action('admin_print_footer_scripts', array('WP_Internal_Pointers', 'pointer_'.$pointer)); |
|
86 | 86 | $got_pointers = true; |
87 | 87 | } |
88 | 88 | |
89 | - if ( ! $got_pointers ) |
|
89 | + if ( ! $got_pointers) |
|
90 | 90 | return; |
91 | 91 | |
92 | 92 | // Add pointers script and style to queue |
93 | - wp_enqueue_style( 'wp-pointer' ); |
|
94 | - wp_enqueue_script( 'wp-pointer' ); |
|
93 | + wp_enqueue_style('wp-pointer'); |
|
94 | + wp_enqueue_script('wp-pointer'); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | /** |
@@ -105,14 +105,14 @@ discard block |
||
105 | 105 | * @param string $selector The HTML elements, on which the pointer should be attached. |
106 | 106 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). |
107 | 107 | */ |
108 | - private static function print_js( $pointer_id, $selector, $args ) { |
|
109 | - if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
|
108 | + private static function print_js($pointer_id, $selector, $args) { |
|
109 | + if (empty($pointer_id) || empty($selector) || empty($args) || empty($args['content'])) |
|
110 | 110 | return; |
111 | 111 | |
112 | 112 | ?> |
113 | 113 | <script type="text/javascript"> |
114 | 114 | (function($){ |
115 | - var options = <?php echo wp_json_encode( $args ); ?>, setup; |
|
115 | + var options = <?php echo wp_json_encode($args); ?>, setup; |
|
116 | 116 | |
117 | 117 | if ( ! options ) |
118 | 118 | return; |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * |
161 | 161 | * @param int $user_id User ID. |
162 | 162 | */ |
163 | - public static function dismiss_pointers_for_new_users( $user_id ) { |
|
164 | - add_user_meta( $user_id, 'dismissed_wp_pointers', '' ); |
|
163 | + public static function dismiss_pointers_for_new_users($user_id) { |
|
164 | + add_user_meta($user_id, 'dismissed_wp_pointers', ''); |
|
165 | 165 | } |
166 | 166 | } |
@@ -47,8 +47,9 @@ discard block |
||
47 | 47 | ); |
48 | 48 | |
49 | 49 | // Check if screen related pointer is registered |
50 | - if ( empty( $registered_pointers[ $hook_suffix ] ) ) |
|
51 | - return; |
|
50 | + if ( empty( $registered_pointers[ $hook_suffix ] ) ) { |
|
51 | + return; |
|
52 | + } |
|
52 | 53 | |
53 | 54 | $pointers = (array) $registered_pointers[ $hook_suffix ]; |
54 | 55 | |
@@ -76,8 +77,9 @@ discard block |
||
76 | 77 | foreach ( array_diff( $pointers, $dismissed ) as $pointer ) { |
77 | 78 | if ( isset( $caps_required[ $pointer ] ) ) { |
78 | 79 | foreach ( $caps_required[ $pointer ] as $cap ) { |
79 | - if ( ! current_user_can( $cap ) ) |
|
80 | - continue 2; |
|
80 | + if ( ! current_user_can( $cap ) ) { |
|
81 | + continue 2; |
|
82 | + } |
|
81 | 83 | } |
82 | 84 | } |
83 | 85 | |
@@ -86,8 +88,9 @@ discard block |
||
86 | 88 | $got_pointers = true; |
87 | 89 | } |
88 | 90 | |
89 | - if ( ! $got_pointers ) |
|
90 | - return; |
|
91 | + if ( ! $got_pointers ) { |
|
92 | + return; |
|
93 | + } |
|
91 | 94 | |
92 | 95 | // Add pointers script and style to queue |
93 | 96 | wp_enqueue_style( 'wp-pointer' ); |
@@ -106,8 +109,9 @@ discard block |
||
106 | 109 | * @param array $args Arguments to be passed to the pointer JS (see wp-pointer.js). |
107 | 110 | */ |
108 | 111 | private static function print_js( $pointer_id, $selector, $args ) { |
109 | - if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) |
|
110 | - return; |
|
112 | + if ( empty( $pointer_id ) || empty( $selector ) || empty( $args ) || empty( $args['content'] ) ) { |
|
113 | + return; |
|
114 | + } |
|
111 | 115 | |
112 | 116 | ?> |
113 | 117 | <script type="text/javascript"> |
@@ -1,11 +1,11 @@ |
||
1 | 1 | <?php |
2 | 2 | /** |
3 | - * Taxonomy API: Walker_Category_Checklist class |
|
4 | - * |
|
5 | - * @package WordPress |
|
6 | - * @subpackage Administration |
|
7 | - * @since 4.4.0 |
|
8 | - */ |
|
3 | + * Taxonomy API: Walker_Category_Checklist class |
|
4 | + * |
|
5 | + * @package WordPress |
|
6 | + * @subpackage Administration |
|
7 | + * @since 4.4.0 |
|
8 | + */ |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Core walker class to output an unordered list of category checkbox input elements. |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | */ |
19 | 19 | class Walker_Category_Checklist extends Walker { |
20 | 20 | public $tree_type = 'category'; |
21 | - public $db_fields = array ('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this |
|
21 | + public $db_fields = array('parent' => 'parent', 'id' => 'term_id'); //TODO: decouple this |
|
22 | 22 | |
23 | 23 | /** |
24 | 24 | * Starts the list before the elements are added. |
@@ -31,7 +31,7 @@ discard block |
||
31 | 31 | * @param int $depth Depth of category. Used for tab indentation. |
32 | 32 | * @param array $args An array of arguments. @see wp_terms_checklist() |
33 | 33 | */ |
34 | - public function start_lvl( &$output, $depth = 0, $args = array() ) { |
|
34 | + public function start_lvl(&$output, $depth = 0, $args = array()) { |
|
35 | 35 | $indent = str_repeat("\t", $depth); |
36 | 36 | $output .= "$indent<ul class='children'>\n"; |
37 | 37 | } |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * @param int $depth Depth of category. Used for tab indentation. |
48 | 48 | * @param array $args An array of arguments. @see wp_terms_checklist() |
49 | 49 | */ |
50 | - public function end_lvl( &$output, $depth = 0, $args = array() ) { |
|
50 | + public function end_lvl(&$output, $depth = 0, $args = array()) { |
|
51 | 51 | $indent = str_repeat("\t", $depth); |
52 | 52 | $output .= "$indent</ul>\n"; |
53 | 53 | } |
@@ -65,45 +65,45 @@ discard block |
||
65 | 65 | * @param array $args An array of arguments. @see wp_terms_checklist() |
66 | 66 | * @param int $id ID of the current term. |
67 | 67 | */ |
68 | - public function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { |
|
69 | - if ( empty( $args['taxonomy'] ) ) { |
|
68 | + public function start_el(&$output, $category, $depth = 0, $args = array(), $id = 0) { |
|
69 | + if (empty($args['taxonomy'])) { |
|
70 | 70 | $taxonomy = 'category'; |
71 | 71 | } else { |
72 | 72 | $taxonomy = $args['taxonomy']; |
73 | 73 | } |
74 | 74 | |
75 | - if ( $taxonomy == 'category' ) { |
|
75 | + if ($taxonomy == 'category') { |
|
76 | 76 | $name = 'post_category'; |
77 | 77 | } else { |
78 | - $name = 'tax_input[' . $taxonomy . ']'; |
|
78 | + $name = 'tax_input['.$taxonomy.']'; |
|
79 | 79 | } |
80 | 80 | |
81 | - $args['popular_cats'] = empty( $args['popular_cats'] ) ? array() : $args['popular_cats']; |
|
82 | - $class = in_array( $category->term_id, $args['popular_cats'] ) ? ' class="popular-category"' : ''; |
|
81 | + $args['popular_cats'] = empty($args['popular_cats']) ? array() : $args['popular_cats']; |
|
82 | + $class = in_array($category->term_id, $args['popular_cats']) ? ' class="popular-category"' : ''; |
|
83 | 83 | |
84 | - $args['selected_cats'] = empty( $args['selected_cats'] ) ? array() : $args['selected_cats']; |
|
84 | + $args['selected_cats'] = empty($args['selected_cats']) ? array() : $args['selected_cats']; |
|
85 | 85 | |
86 | - if ( ! empty( $args['list_only'] ) ) { |
|
86 | + if ( ! empty($args['list_only'])) { |
|
87 | 87 | $aria_cheched = 'false'; |
88 | 88 | $inner_class = 'category'; |
89 | 89 | |
90 | - if ( in_array( $category->term_id, $args['selected_cats'] ) ) { |
|
90 | + if (in_array($category->term_id, $args['selected_cats'])) { |
|
91 | 91 | $inner_class .= ' selected'; |
92 | 92 | $aria_cheched = 'true'; |
93 | 93 | } |
94 | 94 | |
95 | 95 | /** This filter is documented in wp-includes/category-template.php */ |
96 | - $output .= "\n" . '<li' . $class . '>' . |
|
97 | - '<div class="' . $inner_class . '" data-term-id=' . $category->term_id . |
|
98 | - ' tabindex="0" role="checkbox" aria-checked="' . $aria_cheched . '">' . |
|
99 | - esc_html( apply_filters( 'the_category', $category->name ) ) . '</div>'; |
|
96 | + $output .= "\n".'<li'.$class.'>'. |
|
97 | + '<div class="'.$inner_class.'" data-term-id='.$category->term_id. |
|
98 | + ' tabindex="0" role="checkbox" aria-checked="'.$aria_cheched.'">'. |
|
99 | + esc_html(apply_filters('the_category', $category->name)).'</div>'; |
|
100 | 100 | } else { |
101 | 101 | /** This filter is documented in wp-includes/category-template.php */ |
102 | - $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>" . |
|
103 | - '<label class="selectit"><input value="' . $category->term_id . '" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-' . $category->term_id . '"' . |
|
104 | - checked( in_array( $category->term_id, $args['selected_cats'] ), true, false ) . |
|
105 | - disabled( empty( $args['disabled'] ), false, false ) . ' /> ' . |
|
106 | - esc_html( apply_filters( 'the_category', $category->name ) ) . '</label>'; |
|
102 | + $output .= "\n<li id='{$taxonomy}-{$category->term_id}'$class>". |
|
103 | + '<label class="selectit"><input value="'.$category->term_id.'" type="checkbox" name="'.$name.'[]" id="in-'.$taxonomy.'-'.$category->term_id.'"'. |
|
104 | + checked(in_array($category->term_id, $args['selected_cats']), true, false). |
|
105 | + disabled(empty($args['disabled']), false, false).' /> '. |
|
106 | + esc_html(apply_filters('the_category', $category->name)).'</label>'; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | * @param int $depth Depth of the term in reference to parents. Default 0. |
120 | 120 | * @param array $args An array of arguments. @see wp_terms_checklist() |
121 | 121 | */ |
122 | - public function end_el( &$output, $category, $depth = 0, $args = array() ) { |
|
122 | + public function end_el(&$output, $category, $depth = 0, $args = array()) { |
|
123 | 123 | $output .= "</li>\n"; |
124 | 124 | } |
125 | 125 | } |