Plugin Invisibility requires at least PHP 5.

'; } return; } class WP_Plugin_Hider { private $store_name = 'wpph_settings'; private $group_name = 'wpph_group'; private $filter_num = 0; private $filter_max = 6; private $headers = array( 'Author', //'AuthorName', 'AuthorURI', //'Description', //'DomainPath', 'Name', //'Network', 'PluginURI', //'TextDomain', //'Title', //'Version ' ); private $nice_header = array( 'Author' => 'Author', //'AuthorName' => 'Author Name', 'AuthorURI' => 'Author URI', //'Description' => 'Description', //'DomainPath' => 'Domain Path', 'Name' => 'Plugin Name', //'Network' => 'Network', 'PluginURI' => 'Plugin URI', //'TextDomain' => 'Plugin Text Domain', //'Title' => 'Plugin Title', //'Version' => 'Plugin Version' ); private $filters = array(); private $current = array(); public function __construct() { add_action( 'admin_init', array( $this, 'wpph_admin_init' ), 1000 ); add_action( 'admin_menu', array( $this, 'wpph_admin_menu' ), 1000 ); } public function wpph_admin_init() { if( !current_user_can( 'activate_plugins' ) ) return; global $pagenow; // Filter to increase filter set limit $this->filter_max = apply_filters( 'wpph_filter_number', $this->filter_max ); // Filter to add/remove header fields to check against $this->headers = apply_filters( 'wpph_headers', $this->headers ); // The currently saved data(if any) $this->current = get_option( $this->store_name ); // Register the option to hold saved data register_setting( $this->group_name, $this->store_name, array( $this, 'wpph_validate_input' ) ); // Bail if not the plugins listing if( 'plugins.php' != $pagenow ) return; // Only hook when there's filter sets configured if( $this->wpph_setup_sets() ) add_filter( 'all_plugins', array( $this, 'wpph_filter_plugins' ), 10000 ); } private function wpph_current_setting( $num, $name ) { if( !isset( $this->current['set-' . $num][$name] ) ) return ''; if( !empty( $this->current['set-' . $num][$name] ) ) return $this->current['set-' . $num][$name]; return ''; } private function wpph_setup_sets() { foreach( $this->current as $set => $headers ) $this->filters[$set] = array_filter( $headers ); $this->filters = array_filter( $this->filters ); if( !empty( $this->filters ) ) return true; return false; } public function wpph_admin_menu() { if( !current_user_can( 'activate_plugins' ) ) return; $hook = add_options_page( __( 'Plugin Hider' ), __( 'Plugin Hider' ), 'manage_options' , 'wppi', array( $this, 'wpph_plugin_page' ) ); add_action( 'admin_print_styles-' . $hook, array( $this, 'wpph_css' ) ); } public function wpph_validate_input( $input ) { $cleansed = array(); foreach( $input as $set => $data ) $cleansed['set-'.(int) substr( (string)$set, 4 )] = $data; return $cleansed; } public function wpph_filter_plugins( $all_plugins ) { // Loop over each plugin foreach( $all_plugins as $handle => $_plugin ) { // Loop over each set foreach( $this->filters as $data ) { $unset = true; // Loop each header foreach( $data as $header => $value ) { if( !isset( $_plugin[$header] ) ) { $unset = false; continue; } if( $_plugin[$header] != $value ) $unset = false; } if( $unset ) unset( $all_plugins[$handle] ); } } return $all_plugins; } public function wpph_css() { ?>

filter_sets(); ?> group_name ); ?>

filter_num; $this->filter_num < $this->filter_max; $this->filter_num++ ) : ?>

filter_num + 1 ); ?>

headers as $plugin_header ) : $current = $this->wpph_current_setting( $this->filter_num, $plugin_header ); ?>