35 $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
45 $_SERVER['REQUEST_URI'] = add_query_arg('s', wp_unslash($_REQUEST['s']) ); |
36 |
46 |
37 $page = $this->get_pagenum(); |
47 $page = $this->get_pagenum(); |
38 } |
48 } |
39 |
49 |
|
50 /** |
|
51 * @return array |
|
52 */ |
40 protected function get_table_classes() { |
53 protected function get_table_classes() { |
41 return array( 'widefat', $this->_args['plural'] ); |
54 return array( 'widefat', $this->_args['plural'] ); |
42 } |
55 } |
43 |
56 |
|
57 /** |
|
58 * @return bool |
|
59 */ |
44 public function ajax_user_can() { |
60 public function ajax_user_can() { |
45 return current_user_can('activate_plugins'); |
61 return current_user_can('activate_plugins'); |
46 } |
62 } |
47 |
63 |
|
64 /** |
|
65 * |
|
66 * @global string $status |
|
67 * @global array $plugins |
|
68 * @global array $totals |
|
69 * @global int $page |
|
70 * @global string $orderby |
|
71 * @global string $order |
|
72 * @global string $s |
|
73 */ |
48 public function prepare_items() { |
74 public function prepare_items() { |
49 global $status, $plugins, $totals, $page, $orderby, $order, $s; |
75 global $status, $plugins, $totals, $page, $orderby, $order, $s; |
50 |
76 |
51 wp_reset_vars( array( 'orderby', 'order', 's' ) ); |
77 wp_reset_vars( array( 'orderby', 'order' ) ); |
52 |
78 |
53 /** |
79 /** |
54 * Filter the full array of plugins to list in the Plugins list table. |
80 * Filters the full array of plugins to list in the Plugins list table. |
55 * |
81 * |
56 * @since 3.0.0 |
82 * @since 3.0.0 |
57 * |
83 * |
58 * @see get_plugins() |
84 * @see get_plugins() |
59 * |
85 * |
60 * @param array $plugins An array of plugins to display in the list table. |
86 * @param array $all_plugins An array of plugins to display in the list table. |
61 */ |
87 */ |
|
88 $all_plugins = apply_filters( 'all_plugins', get_plugins() ); |
|
89 |
62 $plugins = array( |
90 $plugins = array( |
63 'all' => apply_filters( 'all_plugins', get_plugins() ), |
91 'all' => $all_plugins, |
64 'search' => array(), |
92 'search' => array(), |
65 'active' => array(), |
93 'active' => array(), |
66 'inactive' => array(), |
94 'inactive' => array(), |
67 'recently_activated' => array(), |
95 'recently_activated' => array(), |
68 'upgrade' => array(), |
96 'upgrade' => array(), |
69 'mustuse' => array(), |
97 'mustuse' => array(), |
70 'dropins' => array() |
98 'dropins' => array(), |
71 ); |
99 ); |
72 |
100 |
73 $screen = $this->screen; |
101 $screen = $this->screen; |
74 |
102 |
75 if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { |
103 if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) { |
76 |
104 |
77 /** |
105 /** |
78 * Filter whether to display the advanced plugins list table. |
106 * Filters whether to display the advanced plugins list table. |
79 * |
107 * |
80 * There are two types of advanced plugins - must-use and drop-ins - |
108 * There are two types of advanced plugins - must-use and drop-ins - |
81 * which can be used in a single site or Multisite network. |
109 * which can be used in a single site or Multisite network. |
82 * |
110 * |
83 * The $type parameter allows you to differentiate between the type of advanced |
111 * The $type parameter allows you to differentiate between the type of advanced |
233 $b = $plugin_b[$orderby]; |
310 $b = $plugin_b[$orderby]; |
234 |
311 |
235 if ( $a == $b ) |
312 if ( $a == $b ) |
236 return 0; |
313 return 0; |
237 |
314 |
238 if ( 'DESC' == $order ) |
315 if ( 'DESC' === $order ) { |
239 return ( $a < $b ) ? 1 : -1; |
316 return strcasecmp( $b, $a ); |
240 else |
317 } else { |
241 return ( $a < $b ) ? -1 : 1; |
318 return strcasecmp( $a, $b ); |
242 } |
319 } |
243 |
320 } |
|
321 |
|
322 /** |
|
323 * |
|
324 * @global array $plugins |
|
325 */ |
244 public function no_items() { |
326 public function no_items() { |
245 global $plugins; |
327 global $plugins; |
246 |
328 |
247 if ( !empty( $plugins['all'] ) ) |
329 if ( ! empty( $_REQUEST['s'] ) ) { |
|
330 $s = esc_html( wp_unslash( $_REQUEST['s'] ) ); |
|
331 |
|
332 printf( __( 'No plugins found for “%s”.' ), $s ); |
|
333 |
|
334 // We assume that somebody who can install plugins in multisite is experienced enough to not need this helper link. |
|
335 if ( ! is_multisite() && current_user_can( 'install_plugins' ) ) { |
|
336 echo ' <a href="' . esc_url( admin_url( 'plugin-install.php?tab=search&s=' . urlencode( $s ) ) ) . '">' . __( 'Search for plugins in the WordPress Plugin Directory.' ) . '</a>'; |
|
337 } |
|
338 } elseif ( ! empty( $plugins['all'] ) ) |
248 _e( 'No plugins found.' ); |
339 _e( 'No plugins found.' ); |
249 else |
340 else |
250 _e( 'You do not appear to have any plugins available at this time.' ); |
341 _e( 'You do not appear to have any plugins available at this time.' ); |
251 } |
342 } |
252 |
343 |
|
344 /** |
|
345 * Displays the search box. |
|
346 * |
|
347 * @since 4.6.0 |
|
348 * |
|
349 * @param string $text The 'submit' button label. |
|
350 * @param string $input_id ID attribute value for the search input field. |
|
351 */ |
|
352 public function search_box( $text, $input_id ) { |
|
353 if ( empty( $_REQUEST['s'] ) && ! $this->has_items() ) { |
|
354 return; |
|
355 } |
|
356 |
|
357 $input_id = $input_id . '-search-input'; |
|
358 |
|
359 if ( ! empty( $_REQUEST['orderby'] ) ) { |
|
360 echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />'; |
|
361 } |
|
362 if ( ! empty( $_REQUEST['order'] ) ) { |
|
363 echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />'; |
|
364 } |
|
365 ?> |
|
366 <p class="search-box"> |
|
367 <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label> |
|
368 <input type="search" id="<?php echo esc_attr( $input_id ); ?>" class="wp-filter-search" name="s" value="<?php _admin_search_query(); ?>" placeholder="<?php esc_attr_e( 'Search installed plugins...' ); ?>"/> |
|
369 <?php submit_button( $text, 'hide-if-js', '', false, array( 'id' => 'search-submit' ) ); ?> |
|
370 </p> |
|
371 <?php |
|
372 } |
|
373 |
|
374 /** |
|
375 * |
|
376 * @global string $status |
|
377 * @return array |
|
378 */ |
253 public function get_columns() { |
379 public function get_columns() { |
254 global $status; |
380 global $status; |
255 |
381 |
256 return array( |
382 return array( |
257 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '', |
383 'cb' => !in_array( $status, array( 'mustuse', 'dropins' ) ) ? '<input type="checkbox" />' : '', |
258 'name' => __( 'Plugin' ), |
384 'name' => __( 'Plugin' ), |
259 'description' => __( 'Description' ), |
385 'description' => __( 'Description' ), |
260 ); |
386 ); |
261 } |
387 } |
262 |
388 |
|
389 /** |
|
390 * @return array |
|
391 */ |
263 protected function get_sortable_columns() { |
392 protected function get_sortable_columns() { |
264 return array(); |
393 return array(); |
265 } |
394 } |
266 |
395 |
|
396 /** |
|
397 * |
|
398 * @global array $totals |
|
399 * @global string $status |
|
400 * @return array |
|
401 */ |
267 protected function get_views() { |
402 protected function get_views() { |
268 global $totals, $status; |
403 global $totals, $status; |
269 |
404 |
270 $status_links = array(); |
405 $status_links = array(); |
271 foreach ( $totals as $type => $count ) { |
406 foreach ( $totals as $type => $count ) { |
419 } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true |
574 } elseif ( defined( $dropins[ $plugin_file ][1] ) && constant( $dropins[ $plugin_file ][1] ) ) { // Constant is true |
420 $is_active = true; |
575 $is_active = true; |
421 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
576 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . '</strong></p>'; |
422 } else { |
577 } else { |
423 $is_active = false; |
578 $is_active = false; |
424 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="attention">' . __('Inactive:') . '</span></strong> ' . sprintf( __( 'Requires <code>%s</code> in <code>wp-config.php</code>.' ), "define('" . $dropins[ $plugin_file ][1] . "', true);" ) . '</p>'; |
579 $description = '<p><strong>' . $dropins[ $plugin_file ][0] . ' <span class="error-message">' . __( 'Inactive:' ) . '</span></strong> ' . |
|
580 /* translators: 1: drop-in constant name, 2: wp-config.php */ |
|
581 sprintf( __( 'Requires %1$s in %2$s file.' ), |
|
582 "<code>define('" . $dropins[ $plugin_file ][1] . "', true);</code>", |
|
583 '<code>wp-config.php</code>' |
|
584 ) . '</p>'; |
425 } |
585 } |
426 if ( $plugin_data['Description'] ) |
586 if ( $plugin_data['Description'] ) |
427 $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
587 $description .= '<p>' . $plugin_data['Description'] . '</p>'; |
428 } else { |
588 } else { |
429 if ( $screen->in_admin( 'network' ) ) |
589 if ( $screen->in_admin( 'network' ) ) { |
430 $is_active = is_plugin_active_for_network( $plugin_file ); |
590 $is_active = is_plugin_active_for_network( $plugin_file ); |
431 else |
591 } else { |
432 $is_active = is_plugin_active( $plugin_file ); |
592 $is_active = is_plugin_active( $plugin_file ); |
|
593 $restrict_network_active = ( is_multisite() && is_plugin_active_for_network( $plugin_file ) ); |
|
594 $restrict_network_only = ( is_multisite() && is_network_only_plugin( $plugin_file ) && ! $is_active ); |
|
595 } |
433 |
596 |
434 if ( $screen->in_admin( 'network' ) ) { |
597 if ( $screen->in_admin( 'network' ) ) { |
435 if ( $is_active ) { |
598 if ( $is_active ) { |
436 if ( current_user_can( 'manage_network_plugins' ) ) |
599 if ( current_user_can( 'manage_network_plugins' ) ) { |
437 $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) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Network Deactivate') . '</a>'; |
600 /* translators: %s: plugin name */ |
|
601 $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Network Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Deactivate' ) . '</a>'; |
|
602 } |
438 } else { |
603 } else { |
439 if ( current_user_can( 'manage_network_plugins' ) ) |
604 if ( current_user_can( 'manage_network_plugins' ) ) { |
440 $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) . '" title="' . esc_attr__('Activate this plugin for all sites in this network') . '" class="edit">' . __('Network Activate') . '</a>'; |
605 /* translators: %s: plugin name */ |
441 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) |
606 $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Network Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Network Activate' ) . '</a>'; |
442 $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>'; |
607 } |
|
608 if ( current_user_can( 'delete_plugins' ) && ! is_plugin_active( $plugin_file ) ) { |
|
609 /* translators: %s: plugin name */ |
|
610 $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
611 } |
443 } |
612 } |
444 } else { |
613 } else { |
445 if ( $is_active ) { |
614 if ( $restrict_network_active ) { |
446 $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) . '" title="' . esc_attr__('Deactivate this plugin') . '">' . __('Deactivate') . '</a>'; |
615 $actions = array( |
|
616 'network_active' => __( 'Network Active' ), |
|
617 ); |
|
618 } elseif ( $restrict_network_only ) { |
|
619 $actions = array( |
|
620 'network_only' => __( 'Network Only' ), |
|
621 ); |
|
622 } elseif ( $is_active ) { |
|
623 if ( current_user_can( 'deactivate_plugin', $plugin_file ) ) { |
|
624 /* translators: %s: plugin name */ |
|
625 $actions['deactivate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=deactivate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'deactivate-plugin_' . $plugin_file ) . '" aria-label="' . esc_attr( sprintf( _x( 'Deactivate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Deactivate' ) . '</a>'; |
|
626 } |
447 } else { |
627 } else { |
448 $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) . '" title="' . esc_attr__('Activate this plugin') . '" class="edit">' . __('Activate') . '</a>'; |
628 if ( current_user_can( 'activate_plugin', $plugin_file ) ) { |
449 |
629 /* translators: %s: plugin name */ |
450 if ( ! is_multisite() && current_user_can('delete_plugins') ) |
630 $actions['activate'] = '<a href="' . wp_nonce_url( 'plugins.php?action=activate&plugin=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'activate-plugin_' . $plugin_file ) . '" class="edit" aria-label="' . esc_attr( sprintf( _x( 'Activate %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Activate' ) . '</a>'; |
451 $actions['delete'] = '<a href="' . wp_nonce_url('plugins.php?action=delete-selected&checked[]=' . $plugin_file . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins') . '" title="' . esc_attr__('Delete this plugin') . '" class="delete">' . __('Delete') . '</a>'; |
631 } |
|
632 |
|
633 if ( ! is_multisite() && current_user_can( 'delete_plugins' ) ) { |
|
634 /* translators: %s: plugin name */ |
|
635 $actions['delete'] = '<a href="' . wp_nonce_url( 'plugins.php?action=delete-selected&checked[]=' . urlencode( $plugin_file ) . '&plugin_status=' . $context . '&paged=' . $page . '&s=' . $s, 'bulk-plugins' ) . '" class="delete" aria-label="' . esc_attr( sprintf( _x( 'Delete %s', 'plugin' ), $plugin_data['Name'] ) ) . '">' . __( 'Delete' ) . '</a>'; |
|
636 } |
452 } // end if $is_active |
637 } // end if $is_active |
453 |
638 |
454 } // end if $screen->in_admin( 'network' ) |
639 } // end if $screen->in_admin( 'network' ) |
455 |
640 |
456 if ( ( ! is_multisite() || $screen->in_admin( 'network' ) ) && current_user_can('edit_plugins') && is_writable(WP_PLUGIN_DIR . '/' . $plugin_file) ) |
|
457 $actions['edit'] = '<a href="plugin-editor.php?file=' . $plugin_file . '" title="' . esc_attr__('Open this file in the Plugin Editor') . '" class="edit">' . __('Edit') . '</a>'; |
|
458 } // end if $context |
641 } // end if $context |
459 |
642 |
460 $prefix = $screen->in_admin( 'network' ) ? 'network_admin_' : ''; |
643 $actions = array_filter( $actions ); |
461 |
644 |
462 /** |
645 if ( $screen->in_admin( 'network' ) ) { |
463 * Filter the action links displayed for each plugin in the Plugins list table. |
646 |
464 * |
647 /** |
465 * The dynamic portion of the hook name, `$prefix`, refers to the context the |
648 * Filters the action links displayed for each plugin in the Network Admin Plugins list table. |
466 * action links are displayed in. The 'network_admin_' prefix is used if the |
649 * |
467 * current screen is the Network plugins list table. The prefix is empty ('') |
650 * @since 3.1.0 |
468 * if the current screen is the site plugins list table. |
651 * |
469 * |
652 * @param array $actions An array of plugin action links. By default this can include 'activate', |
470 * The default action links for the Network plugins list table include |
653 * 'deactivate', and 'delete'. |
471 * 'Network Activate', 'Network Deactivate', 'Edit', and 'Delete'. |
654 * @param string $plugin_file Path to the plugin file relative to the plugins directory. |
472 * |
655 * @param array $plugin_data An array of plugin data. See `get_plugin_data()`. |
473 * The default action links for the site plugins list table include |
656 * @param string $context The plugin context. By default this can include 'all', 'active', 'inactive', |
474 * 'Activate', 'Deactivate', and 'Edit', for a network site, and |
657 * 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'. |
475 * 'Activate', 'Deactivate', 'Edit', and 'Delete' for a single site. |
658 */ |
476 * |
659 $actions = apply_filters( 'network_admin_plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
477 * @since 2.5.0 |
660 |
478 * |
661 /** |
479 * @param array $actions An array of plugin action links. |
662 * Filters the list of action links displayed for a specific plugin in the Network Admin Plugins list table. |
480 * @param string $plugin_file Path to the plugin file. |
663 * |
481 * @param array $plugin_data An array of plugin data. |
664 * The dynamic portion of the hook name, `$plugin_file`, refers to the path |
482 * @param string $context The plugin context. Defaults are 'All', 'Active', |
665 * to the plugin file, relative to the plugins directory. |
483 * 'Inactive', 'Recently Activated', 'Upgrade', |
666 * |
484 * 'Must-Use', 'Drop-ins', 'Search'. |
667 * @since 3.1.0 |
485 */ |
668 * |
486 $actions = apply_filters( $prefix . 'plugin_action_links', array_filter( $actions ), $plugin_file, $plugin_data, $context ); |
669 * @param array $actions An array of plugin action links. By default this can include 'activate', |
487 |
670 * 'deactivate', and 'delete'. |
488 /** |
671 * @param string $plugin_file Path to the plugin file relative to the plugins directory. |
489 * Filter the list of action links displayed for a specific plugin. |
672 * @param array $plugin_data An array of plugin data. See `get_plugin_data()`. |
490 * |
673 * @param string $context The plugin context. By default this can include 'all', 'active', 'inactive', |
491 * The first dynamic portion of the hook name, $prefix, refers to the context |
674 * 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'. |
492 * the action links are displayed in. The 'network_admin_' prefix is used if the |
675 */ |
493 * current screen is the Network plugins list table. The prefix is empty ('') |
676 $actions = apply_filters( "network_admin_plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
494 * if the current screen is the site plugins list table. |
677 |
495 * |
678 } else { |
496 * The second dynamic portion of the hook name, $plugin_file, refers to the path |
679 |
497 * to the plugin file, relative to the plugins directory. |
680 /** |
498 * |
681 * Filters the action links displayed for each plugin in the Plugins list table. |
499 * @since 2.7.0 |
682 * |
500 * |
683 * @since 2.5.0 |
501 * @param array $actions An array of plugin action links. |
684 * @since 2.6.0 The `$context` parameter was added. |
502 * @param string $plugin_file Path to the plugin file. |
685 * @since 4.9.0 The 'Edit' link was removed from the list of action links. |
503 * @param array $plugin_data An array of plugin data. |
686 * |
504 * @param string $context The plugin context. Defaults are 'All', 'Active', |
687 * @param array $actions An array of plugin action links. By default this can include 'activate', |
505 * 'Inactive', 'Recently Activated', 'Upgrade', |
688 * 'deactivate', and 'delete'. With Multisite active this can also include |
506 * 'Must-Use', 'Drop-ins', 'Search'. |
689 * 'network_active' and 'network_only' items. |
507 */ |
690 * @param string $plugin_file Path to the plugin file relative to the plugins directory. |
508 $actions = apply_filters( $prefix . "plugin_action_links_$plugin_file", $actions, $plugin_file, $plugin_data, $context ); |
691 * @param array $plugin_data An array of plugin data. See `get_plugin_data()`. |
|
692 * @param string $context The plugin context. By default this can include 'all', 'active', 'inactive', |
|
693 * 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'. |
|
694 */ |
|
695 $actions = apply_filters( 'plugin_action_links', $actions, $plugin_file, $plugin_data, $context ); |
|
696 |
|
697 /** |
|
698 * Filters the list of action links displayed for a specific plugin in the Plugins list table. |
|
699 * |
|
700 * The dynamic portion of the hook name, `$plugin_file`, refers to the path |
|
701 * to the plugin file, relative to the plugins directory. |
|
702 * |
|
703 * @since 2.7.0 |
|
704 * @since 4.9.0 The 'Edit' link was removed from the list of action links. |
|
705 * |
|
706 * @param array $actions An array of plugin action links. By default this can include 'activate', |
|
707 * 'deactivate', and 'delete'. With Multisite active this can also include |
|
708 * 'network_active' and 'network_only' items. |
|
709 * @param string $plugin_file Path to the plugin file relative to the plugins directory. |
|
710 * @param array $plugin_data An array of plugin data. See `get_plugin_data()`. |
|
711 * @param string $context The plugin context. By default this can include 'all', 'active', 'inactive', |
|
712 * 'recently_activated', 'upgrade', 'mustuse', 'dropins', and 'search'. |
|
713 */ |
|
714 $actions = apply_filters( "plugin_action_links_{$plugin_file}", $actions, $plugin_file, $plugin_data, $context ); |
|
715 |
|
716 } |
509 |
717 |
510 $class = $is_active ? 'active' : 'inactive'; |
718 $class = $is_active ? 'active' : 'inactive'; |
511 $checkbox_id = "checkbox_" . md5($plugin_data['Name']); |
719 $checkbox_id = "checkbox_" . md5($plugin_data['Name']); |
512 if ( in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
720 if ( $restrict_network_active || $restrict_network_only || in_array( $status, array( 'mustuse', 'dropins' ) ) ) { |
513 $checkbox = ''; |
721 $checkbox = ''; |
514 } else { |
722 } else { |
515 $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>" |
723 $checkbox = "<label class='screen-reader-text' for='" . $checkbox_id . "' >" . sprintf( __( 'Select %s' ), $plugin_data['Name'] ) . "</label>" |
516 . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />"; |
724 . "<input type='checkbox' name='checked[]' value='" . esc_attr( $plugin_file ) . "' id='" . $checkbox_id . "' />"; |
517 } |
725 } |
518 if ( 'dropins' != $context ) { |
726 if ( 'dropins' != $context ) { |
519 $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>'; |
727 $description = '<p>' . ( $plugin_data['Description'] ? $plugin_data['Description'] : ' ' ) . '</p>'; |
520 $plugin_name = $plugin_data['Name']; |
728 $plugin_name = $plugin_data['Name']; |
521 } |
729 } |
522 |
730 |
523 $id = sanitize_title( $plugin_name ); |
|
524 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
731 if ( ! empty( $totals['upgrade'] ) && ! empty( $plugin_data['update'] ) ) |
525 $class .= ' update'; |
732 $class .= ' update'; |
526 |
733 |
527 $plugin_slug = ( isset( $plugin_data['slug'] ) ) ? $plugin_data['slug'] : ''; |
734 $plugin_slug = isset( $plugin_data['slug'] ) ? $plugin_data['slug'] : sanitize_title( $plugin_name ); |
528 printf( "<tr id='%s' class='%s' data-slug='%s'>", |
735 printf( '<tr class="%s" data-slug="%s" data-plugin="%s">', |
529 $id, |
736 esc_attr( $class ), |
530 $class, |
737 esc_attr( $plugin_slug ), |
531 $plugin_slug |
738 esc_attr( $plugin_file ) |
532 ); |
739 ); |
533 |
740 |
534 list( $columns, $hidden ) = $this->get_column_info(); |
741 list( $columns, $hidden, $sortable, $primary ) = $this->get_column_info(); |
535 |
742 |
536 foreach ( $columns as $column_name => $column_display_name ) { |
743 foreach ( $columns as $column_name => $column_display_name ) { |
537 $style = ''; |
744 $extra_classes = ''; |
538 if ( in_array( $column_name, $hidden ) ) |
745 if ( in_array( $column_name, $hidden ) ) { |
539 $style = ' style="display:none;"'; |
746 $extra_classes = ' hidden'; |
|
747 } |
540 |
748 |
541 switch ( $column_name ) { |
749 switch ( $column_name ) { |
542 case 'cb': |
750 case 'cb': |
543 echo "<th scope='row' class='check-column'>$checkbox</th>"; |
751 echo "<th scope='row' class='check-column'>$checkbox</th>"; |
544 break; |
752 break; |
545 case 'name': |
753 case 'name': |
546 echo "<td class='plugin-title'$style><strong>$plugin_name</strong>"; |
754 echo "<td class='plugin-title column-primary'><strong>$plugin_name</strong>"; |
547 echo $this->row_actions( $actions, true ); |
755 echo $this->row_actions( $actions, true ); |
548 echo "</td>"; |
756 echo "</td>"; |
549 break; |
757 break; |
550 case 'description': |
758 case 'description': |
551 echo "<td class='column-description desc'$style> |
759 $classes = 'column-description desc'; |
|
760 |
|
761 echo "<td class='$classes{$extra_classes}'> |
552 <div class='plugin-description'>$description</div> |
762 <div class='plugin-description'>$description</div> |
553 <div class='$class second plugin-version-author-uri'>"; |
763 <div class='$class second plugin-version-author-uri'>"; |
554 |
764 |
555 $plugin_meta = array(); |
765 $plugin_meta = array(); |
556 if ( !empty( $plugin_data['Version'] ) ) |
766 if ( !empty( $plugin_data['Version'] ) ) |