| 1 |
<?php |
| 2 |
/** |
| 3 |
* WP Plugin Install Tab |
| 4 |
* |
| 5 |
* @package quadlayers/wp-plugin-install-tab |
| 6 |
* @author Francisco Mastromarino |
| 7 |
* @link https://github.com/quadlayers/wp-plugin-install-tab |
| 8 |
* @copyright Copyright (c) 2023 |
| 9 |
* @license GPL-3.0 |
| 10 |
*/ |
| 11 |
|
| 12 |
namespace QuadLayers\WP_Plugin_Install_Tab; |
| 13 |
|
| 14 |
use QuadLayers\WP_Plugin_Suggestions\Table; |
| 15 |
|
| 16 |
/** |
| 17 |
* Load class |
| 18 |
*/ |
| 19 |
class Load { |
| 20 |
|
| 21 |
/** |
| 22 |
* Instance |
| 23 |
* |
| 24 |
* @var null |
| 25 |
*/ |
| 26 |
protected static $instance; |
| 27 |
|
| 28 |
public $data = [ |
| 29 |
"author" => "quadlayers" |
| 30 |
]; |
| 31 |
|
| 32 |
public function __construct() { |
| 33 |
add_filter( 'install_plugins_tabs', array( $this, 'add_tab' ) ); |
| 34 |
add_action( 'install_plugins_quadlayers', array( $this, 'add_tab_content' ) ); |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Add tab |
| 39 |
* @param array $tabs |
| 40 |
* @return array |
| 41 |
*/ |
| 42 |
public function add_tab( $tabs ) { |
| 43 |
$tabs['quadlayers'] = 'QuadLayers'; |
| 44 |
return $tabs; |
| 45 |
} |
| 46 |
|
| 47 |
/** |
| 48 |
* Add tab content |
| 49 |
* @return void |
| 50 |
*/ |
| 51 |
public function add_tab_content() { |
| 52 |
$wp_list_table = new Table( $this->data ); |
| 53 |
$wp_list_table->prepare_items(); |
| 54 |
?> |
| 55 |
<form id="plugin-filter" method="post"> |
| 56 |
<?php $wp_list_table->display(); ?> |
| 57 |
</form> |
| 58 |
<?php |
| 59 |
} |
| 60 |
|
| 61 |
/** |
| 62 |
* Get the instance of the class. |
| 63 |
* |
| 64 |
* @return self |
| 65 |
*/ |
| 66 |
public static function instance() { |
| 67 |
if ( ! isset( self::$instance ) ) { |
| 68 |
self::$instance = new self(); |
| 69 |
} |
| 70 |
return self::$instance; |
| 71 |
} |
| 72 |
|
| 73 |
} |
| 74 |
|