PluginProbe
QuadMenu – Mega Menu / 3.3.8
QuadMenu – Mega Menu v3.3.8
3.3.8 3.3.7 3.3.6 trunk 1.8.4 1.8.5 1.8.7 1.8.8 1.8.9 1.9.0 1.9.2 1.9.3 1.9.4 1.9.5 1.9.6 1.9.7 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 88 releases
quadmenu / vendor / franmastromarino / wp-plugin-feedback / src / Load.php

Load.php in QuadMenu – Mega Menu 3.3.8, at vendor/franmastromarino/wp-plugin-feedback/src/Load.php

56 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace QuadLayers\PluginFeedback;
4
5 class Load
6 {
7
8 public static $instance;
9 public static $plugins = array();
10 public static $options = array();
11
12 private function __construct()
13 {
14 add_action('admin_init', [self::class, 'ajax']);
15 add_action('plugins_loaded', [self::class, 'scripts']);
16 }
17
18 public static function instance()
19 {
20 if (is_null(self::$instance)) {
21 self::$instance = new self();
22 }
23 return self::$instance;
24 }
25
26 public function add(string $plugin_file, array $options = []): void
27 {
28 $pluginBasename = plugin_basename($plugin_file);
29
30 // Check if the plugin is already in the list
31 if (in_array($pluginBasename, self::$plugins)) {
32 return;
33 }
34
35 // Check if the plugin transient exists
36 if (get_transient('ql_plugin_feedback_' . $pluginBasename)) {
37 return;
38 }
39
40 self::$plugins[] = $pluginBasename;
41 self::$options[$pluginBasename] = $options;
42 }
43
44 public static function scripts(): void
45 {
46 // Enqueue the scripts for the deactivation survey
47 Scripts::instance(self::$plugins, self::$options);
48 }
49
50 public static function ajax(): void
51 {
52 // Register AJAX actions
53 AjaxHandler::instance();
54 }
55 }
56