PluginProbe ʕ •ᴥ•ʔ
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor / 4.0.0
ElementsKit Elementor Addons – Advanced Widgets & Templates Addons for Elementor v4.0.0
4.0.2 4.0.1 4.0.0 3.10.02 3.10.01 3.9.10 3.9.9 3.9.8 3.9.7 3.9.5 3.9.6 3.9.3 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.3.0 2.3.1 2.3.1.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.4.0 2.5.0 2.5.1 2.5.10 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.8.5 2.8.6 2.8.7 2.8.8 2.9.0 2.9.1 2.9.2 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.6.0 3.6.1 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.8.1 3.8.2 3.9.0 3.9.1 3.9.2 trunk 1.2.6 1.2.7 1.2.9 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.10 1.5.11 1.5.12 1.5.2 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.13 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.0.9 2.0.9.1 2.0.9.2 2.0.9.3
elementskit-lite / libs / framework / classes / plugin-status.php
elementskit-lite / libs / framework / classes Last commit date
ajax.php 3 weeks ago install-notice.php 3 weeks ago install-tracker.php 3 weeks ago onboard-status.php 3 weeks ago plugin-data-sender.php 1 year ago plugin-installer.php 3 weeks ago plugin-skin.php 1 year ago plugin-status.php 4 years ago utils.php 1 year ago
plugin-status.php
128 lines
1 <?php
2
3 namespace ElementsKit_Lite\Libs\Framework\Classes;
4
5 defined( 'ABSPATH' ) || exit;
6
7 class Plugin_Status {
8 private static $instance;
9 private $installedPlugins = array();
10 private $activatedPlugins = array();
11
12 public function __construct() {
13 $this->collect_installed_plugins();
14 $this->collect_activated_plugins();
15 }
16
17 private function collect_installed_plugins() {
18 foreach ( get_plugins() as $key => $plugin ) {
19 array_push( $this->installedPlugins, $key );
20 }
21 }
22
23 private function collect_activated_plugins() {
24 foreach ( apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) as $plugin ) {
25 array_push( $this->activatedPlugins, $plugin );
26 }
27 }
28
29 public static function instance() {
30 if ( ! static::$instance ) {
31 static::$instance = new static();
32 }
33
34 return static::$instance;
35 }
36
37 public function get_installed_plugins() {
38 return $this->installedPlugins;
39 }
40
41 public function get_activated_plugins() {
42 return $this->activatedPlugins;
43 }
44
45 public function get_status( $name ) {
46 $data = array(
47 'url' => '',
48 'activation_url' => '',
49 'installation_url' => '',
50 'title' => '',
51 'status' => '',
52 );
53
54 if ( $this->check_installed_plugin( $name ) ) {
55 if ( $this->check_activated_plugin( $name ) ) {
56 $data['title'] = __( 'Activated', 'elementskit-lite' );
57 $data['status'] = 'activated';
58 } else {
59 $data['title'] = __( 'Activate Now', 'elementskit-lite' );
60 $data['status'] = 'installed';
61 $data['activation_url'] = $this->activation_url( $name );
62 }
63 } else {
64 $data['title'] = __( 'Install Now', 'elementskit-lite' );
65 $data['status'] = 'not_installed';
66 $data['installation_url'] = $this->installation_url( $name );
67 $data['activation_url'] = $this->activation_url( $name );
68 }
69
70 return $data;
71 }
72
73 public function check_installed_plugin( $name ) {
74 return in_array( $name, $this->installedPlugins );
75 }
76
77 public function check_activated_plugin( $name ) {
78 return in_array( $name, $this->activatedPlugins );
79 }
80
81 public function activation_url( $pluginName ) {
82
83 return wp_nonce_url(
84 add_query_arg(
85 array(
86 'action' => 'activate',
87 'plugin' => $pluginName,
88 'plugin_status' => 'all',
89 'paged' => '1&s',
90 ),
91 admin_url( 'plugins.php' )
92 ),
93 'activate-plugin_' . $pluginName
94 );
95 }
96
97 public function installation_url( $pluginName ) {
98 $action = 'install-plugin';
99 $pluginSlug = $this->get_plugin_slug( $pluginName );
100
101 return wp_nonce_url(
102 add_query_arg(
103 array(
104 'action' => $action,
105 'plugin' => $pluginSlug,
106 ),
107 admin_url( 'update.php' )
108 ),
109 $action . '_' . $pluginSlug
110 );
111 }
112
113 public function get_plugin_slug( $name ) {
114 $split = explode( '/', $name );
115
116 return isset( $split[0] ) ? $split[0] : null;
117 }
118
119 public function activated_url( $pluginName ) {
120 return add_query_arg(
121 array(
122 'page' => $this->get_plugin_slug( $pluginName ),
123 ),
124 admin_url( 'admin.php' )
125 );
126 }
127 }
128