| 1 |
<?php |
| 2 |
declare(strict_types=1); |
| 3 |
|
| 4 |
namespace Imagify\Admin; |
| 5 |
|
| 6 |
use Imagify\EventManagement\SubscriberInterface; |
| 7 |
use Imagify\Dependencies\WPMedia\PluginFamily\Controller\{ PluginFamily, PluginFamilyInterface }; |
| 8 |
|
| 9 |
/** |
| 10 |
* Process plugin family actions. |
| 11 |
*/ |
| 12 |
class PluginFamilySubscriber implements SubscriberInterface, PluginFamilyInterface { |
| 13 |
|
| 14 |
/** |
| 15 |
* PluginFamily instance. |
| 16 |
* |
| 17 |
* @var PluginFamily |
| 18 |
*/ |
| 19 |
protected $plugin_family; |
| 20 |
|
| 21 |
/** |
| 22 |
* Instantiate the class |
| 23 |
* |
| 24 |
* @param PluginFamily $plugin_family PluginFamily instance. |
| 25 |
*/ |
| 26 |
public function __construct( PluginFamily $plugin_family ) { |
| 27 |
$this->plugin_family = $plugin_family; |
| 28 |
} |
| 29 |
|
| 30 |
/** |
| 31 |
* Returns an array of events this subscriber listens to |
| 32 |
* |
| 33 |
* @return array |
| 34 |
*/ |
| 35 |
public static function get_subscribed_events() { |
| 36 |
$events = PluginFamily::get_subscribed_events(); |
| 37 |
|
| 38 |
return $events; |
| 39 |
} |
| 40 |
|
| 41 |
/** |
| 42 |
* Process to install & activate plugin. |
| 43 |
* |
| 44 |
* @return void |
| 45 |
*/ |
| 46 |
public function install_activate() { |
| 47 |
$this->plugin_family->install_activate(); |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Display error notice if available. |
| 52 |
* |
| 53 |
* @return void |
| 54 |
*/ |
| 55 |
public function display_error_notice() { |
| 56 |
$this->plugin_family->display_error_notice(); |
| 57 |
} |
| 58 |
|
| 59 |
/** |
| 60 |
* Enqueue block editor assets. |
| 61 |
* |
| 62 |
* @return void |
| 63 |
*/ |
| 64 |
public function enqueue_assets(): void { |
| 65 |
$this->plugin_family->enqueue_assets(); |
| 66 |
} |
| 67 |
|
| 68 |
/** |
| 69 |
* Install Imagify using the ajax request. |
| 70 |
* |
| 71 |
* @return void |
| 72 |
*/ |
| 73 |
public function install_imagify(): void { |
| 74 |
$this->plugin_family->install_imagify(); |
| 75 |
} |
| 76 |
|
| 77 |
/** |
| 78 |
* Enqueue Admin assets. |
| 79 |
* |
| 80 |
* @param string $page Page ID. |
| 81 |
* @return void |
| 82 |
*/ |
| 83 |
public function enqueue_admin_assets( $page ): void { |
| 84 |
$this->plugin_family->enqueue_admin_assets( $page ); |
| 85 |
} |
| 86 |
|
| 87 |
/** |
| 88 |
* Insert admin footer JS templates. |
| 89 |
* |
| 90 |
* @return void |
| 91 |
*/ |
| 92 |
public function insert_footer_templates(): void { |
| 93 |
$this->plugin_family->insert_footer_templates(); |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Dismiss promote Imagify using the ajax request. |
| 98 |
* |
| 99 |
* @return void |
| 100 |
*/ |
| 101 |
public function dismiss_promote_imagify(): void { |
| 102 |
$this->plugin_family->dismiss_promote_imagify(); |
| 103 |
} |
| 104 |
} |
| 105 |
|