PluginProbe
Elementor Website Builder – more than just a page builder / 3.0.6
Elementor Website Builder – more than just a page builder v3.0.6
4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 All 452 releases
elementor / modules / system-info / reporters / plugins.php

plugins.php in Elementor Website Builder – more than just a page builder 3.0.6, at modules/system-info/reporters/plugins.php

118 lines 2.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\System_Info\Reporters;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
7
8 /**
9 * Elementor active plugins report.
10 *
11 * Elementor system report handler class responsible for generating a report for
12 * active plugins.
13 *
14 * @since 1.0.0
15 */
16 class Plugins extends Base {
17
18 /**
19 * Active plugins.
20 *
21 * Holds the sites active plugins list.
22 *
23 * @since 1.0.0
24 * @access private
25 *
26 * @var array
27 */
28 private $plugins;
29
30 /**
31 * Get active plugins.
32 *
33 * Retrieve the active plugins from the list of all the installed plugins.
34 *
35 * @since 2.0.0
36 * @access private
37 *
38 * @return array Active plugins.
39 */
40 private function get_plugins() {
41 if ( ! $this->plugins ) {
42 // Ensure get_plugins function is loaded
43 if ( ! function_exists( 'get_plugins' ) ) {
44 include ABSPATH . '/wp-admin/includes/plugin.php';
45 }
46
47 $active_plugins = get_option( 'active_plugins' );
48 $this->plugins = array_intersect_key( get_plugins(), array_flip( $active_plugins ) );
49 }
50
51 return $this->plugins;
52 }
53
54 /**
55 * Get active plugins reporter title.
56 *
57 * Retrieve active plugins reporter title.
58 *
59 * @since 1.0.0
60 * @access public
61 *
62 * @return string Reporter title.
63 */
64 public function get_title() {
65 return 'Active Plugins';
66 }
67
68 /**
69 * Is enabled.
70 *
71 * Whether there are active plugins or not.
72 *
73 * @since 1.0.0
74 * @access public
75 *
76 * @return bool True if the site has active plugins, False otherwise.
77 */
78 public function is_enabled() {
79 return ! ! $this->get_plugins();
80 }
81
82 /**
83 * Get active plugins report fields.
84 *
85 * Retrieve the required fields for the active plugins report.
86 *
87 * @since 1.0.0
88 * @access public
89 *
90 * @return array Required report fields with field ID and field label.
91 */
92 public function get_fields() {
93 return [
94 'active_plugins' => 'Active Plugins',
95 ];
96 }
97
98 /**
99 * Get active plugins.
100 *
101 * Retrieve the sites active plugins.
102 *
103 * @since 1.0.0
104 * @access public
105 *
106 * @return array {
107 * Report data.
108 *
109 * @type string $value The active plugins list.
110 * }
111 */
112 public function get_active_plugins() {
113 return [
114 'value' => $this->get_plugins(),
115 ];
116 }
117 }
118