mirror of
https://gh.wpcy.net/https://github.com/aspirepress/aspireupdate.git
synced 2026-07-16 09:46:32 +08:00
* Add Coding Standard. * Add PHPCS cache directory. * Coding Standards: Apply PHPCBF to codebase. * Coding Standards: Add GitHub workflow. --------- Signed-off-by: Alex Sirota <alex@newpathconsulting.com> Co-authored-by: Alex Sirota <alex@newpathconsulting.com>
65 lines
1.2 KiB
PHP
65 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* The Class for overriding the default plugins screens.
|
|
*
|
|
* @package aspire-update
|
|
*/
|
|
|
|
namespace AspireUpdate;
|
|
|
|
/**
|
|
* The Class for overriding the default plugins screens.
|
|
*/
|
|
class Plugins_Screens {
|
|
/**
|
|
* Hold a single instance of the class.
|
|
*
|
|
* @var object
|
|
*/
|
|
private static $instance = null;
|
|
|
|
/**
|
|
* Hold an array of unsupported filters.
|
|
*
|
|
* @var array
|
|
*/
|
|
protected $unsupported_filters = [
|
|
'featured',
|
|
'favorites',
|
|
];
|
|
|
|
/**
|
|
* The Constructor.
|
|
*/
|
|
public function __construct() {
|
|
$admin_settings = Admin_Settings::get_instance();
|
|
if ( $admin_settings->get_setting( 'enable', false ) ) {
|
|
add_filter( 'install_plugins_tabs', [ $this, 'remove_unused_filter_tabs' ] );
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Initialize Class.
|
|
*
|
|
* @return object
|
|
*/
|
|
public static function get_instance() {
|
|
if ( null === self::$instance ) {
|
|
self::$instance = new self();
|
|
}
|
|
return self::$instance;
|
|
}
|
|
|
|
/**
|
|
* Remove unused filter tabs from the Add New Plugin screen.
|
|
*
|
|
* @param array $tabs An array of tab labels, keyed on each tab's slug.
|
|
* @return array An array of tabs.
|
|
*/
|
|
public function remove_unused_filter_tabs( $tabs ) {
|
|
foreach ( $this->unsupported_filters as $filter ) {
|
|
unset( $tabs[ $filter ] );
|
|
}
|
|
return $tabs;
|
|
}
|
|
}
|