WP_Plugins_List_Table::prepare_items() –

You appear to be a bot. Output may be restricted

Description

Usage

WP_Plugins_List_Table::prepare_items();

Parameters

Returns

void

Source

File name: wordpress/wp-admin/includes/class-wp-plugins-list-table.php


Lines:

1 to 100 of 282
  public function prepare_items() {
    global $status, $plugins, $totals, $page, $orderby, $order, $s;

    wp_reset_vars( array( 'orderby', 'order' ) );

    
/**
 * Filters the full array of plugins to list in the Plugins list table.
 *
 * @since 3.0.0
 *
 * @see get_plugins()
 *
 * @param array $all_plugins An array of plugins to display in the list table.
 */
    $all_plugins = apply_filters( 'all_plugins', get_plugins() );

    $plugins = array(
      'all'                => $all_plugins,
      'search'             => array(),
      'active'             => array(),
      'inactive'           => array(),
      'recently_activated' => array(),
      'upgrade'            => array(),
      'mustuse'            => array(),
      'dropins'            => array(),
      'paused'             => array(),
    );
    if ( $this->show_autoupdates ) {
      $auto_updates = (array) get_site_option( 'auto_update_plugins', array() );

      $plugins['auto-update-enabled']  = array();
      $plugins['auto-update-disabled'] = array();
    }

    $screen = $this->screen;

    if ( ! is_multisite() || ( $screen->in_admin( 'network' ) && current_user_can( 'manage_network_plugins' ) ) ) {

      
/**
 * Filters whether to display the advanced plugins list table.
 *
 * There are two types of advanced plugins - must-use and drop-ins -
 * which can be used in a single site or Multisite network.
 *
 * The $type parameter allows you to differentiate between the type of advanced
 * plugins to filter the display of. Contexts include 'mustuse' and 'dropins'.
 *
 * @since 3.0.0
 *
 * @param bool   $show Whether to show the advanced plugins for the specified
 *                     plugin type. Default true.
 * @param string $type The plugin type. Accepts 'mustuse', 'dropins'.
 */
      if ( apply_filters( 'show_advanced_plugins', true, 'mustuse' ) ) {
        $plugins['mustuse'] = get_mu_plugins();
      }

      
/** This action is documented in wp-admin/includes/class-wp-plugins-list-table.php */
      if ( apply_filters( 'show_advanced_plugins', true, 'dropins' ) ) {
        $plugins['dropins'] = get_dropins();
      }

      if ( current_user_can( 'update_plugins' ) ) {
        $current = get_site_transient( 'update_plugins' );
        foreach ( (array) $plugins['all'] as $plugin_file => $plugin_data ) {
          if ( isset( $current->response[ $plugin_file ] ) ) {
            $plugins['all'][ $plugin_file ]['update'] = true;
            $plugins['upgrade'][ $plugin_file ]       = $plugins['all'][ $plugin_file ];
          }
        }
      }
    }

    if ( ! $screen->in_admin( 'network' ) ) {
      $show = current_user_can( 'manage_network_plugins' );
      
/**
 * Filters whether to display network-active plugins alongside plugins active for the current site.
 *
 * This also controls the display of inactive network-only plugins (plugins with
 * "Network: true" in the plugin header).
 *
 * Plugins cannot be network-activated or network-deactivated from this screen.
 *
 * @since 4.4.0
 *
 * @param bool $show Whether to show network-active plugins. Default is whether the current
 *                   user can manage network plugins (ie. a Super Admin).
 */
      $show_network_active = apply_filters( 'show_network_active_plugins', $show );
    }

    if ( $screen->in_admin( 'network' ) ) {
      $recently_activated = get_site_option( 'recently_activated', array() );
    } else {
      $recently_activated = get_option( 'recently_activated', array() );
    }

 View on GitHub View on Trac