PluginProbe
Elementor Website Builder – more than just a page builder / 3.1.1
Elementor Website Builder – more than just a page builder v3.1.1
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 4.0.7 All 451 releases
elementor / core / common / modules / connect / module.php

module.php in Elementor Website Builder – more than just a page builder 3.1.1, at core/common/modules/connect/module.php

173 lines 3.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Core\Common\Modules\Connect;
3
4 use Elementor\Core\Base\Module as BaseModule;
5 use Elementor\Core\Common\Modules\Connect\Apps\Base_App;
6 use Elementor\Core\Common\Modules\Connect\Apps\Connect;
7 use Elementor\Core\Common\Modules\Connect\Apps\Library;
8 use Elementor\Plugin;
9
10 if ( ! defined( 'ABSPATH' ) ) {
11 exit; // Exit if accessed directly
12 }
13
14 class Module extends BaseModule {
15
16 /**
17 * @since 2.3.0
18 * @access public
19 */
20 public function get_name() {
21 return 'connect';
22 }
23
24 /**
25 * @var array
26 */
27 protected $registered_apps = [];
28
29 /**
30 * Apps Instances.
31 *
32 * Holds the list of all the apps instances.
33 *
34 * @since 2.3.0
35 * @access protected
36 *
37 * @var Base_App[]
38 */
39 protected $apps = [];
40
41 /**
42 * Registered apps categories.
43 *
44 * Holds the list of all the registered apps categories.
45 *
46 * @since 2.3.0
47 * @access protected
48 *
49 * @var array
50 */
51 protected $categories = [];
52
53 protected $admin_page;
54
55 /**
56 * @since 2.3.0
57 * @access public
58 */
59 public function __construct() {
60 $this->registered_apps = [
61 'connect' => Connect::get_class_name(),
62 'library' => Library::get_class_name(),
63 ];
64
65 // Note: The priority 11 is for allowing plugins to add their register callback on elementor init.
66 add_action( 'elementor/init', [ $this, 'init' ], 11 );
67 }
68
69 /**
70 * Register default apps.
71 *
72 * Registers the default apps.
73 *
74 * @since 2.3.0
75 * @access public
76 */
77 public function init() {
78 if ( is_admin() ) {
79 $this->admin_page = new Admin();
80 }
81
82 /**
83 * Register Elementor apps.
84 *
85 * Fires after Elementor registers the default apps.
86 *
87 * @since 2.3.0
88 *
89 * @param self $this The apps manager instance.
90 */
91 do_action( 'elementor/connect/apps/register', $this );
92
93 foreach ( $this->registered_apps as $slug => $class ) {
94 $this->apps[ $slug ] = new $class();
95 }
96 }
97
98 /**
99 * @deprecated 3.1.0
100 */
101 public function localize_settings() {
102 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0' );
103
104 return [];
105 }
106
107 /**
108 * Register app.
109 *
110 * Registers an app.
111 *
112 * @since 2.3.0
113 * @access public
114 *
115 * @param string $slug App slug.
116 * @param string $class App full class name.
117 *
118 * @return self The updated apps manager instance.
119 */
120 public function register_app( $slug, $class ) {
121 $this->registered_apps[ $slug ] = $class;
122
123 return $this;
124 }
125
126 /**
127 * Get app instance.
128 *
129 * Retrieve the app instance.
130 *
131 * @since 2.3.0
132 * @access public
133 *
134 * @param $slug
135 *
136 * @return Base_App|null
137 */
138 public function get_app( $slug ) {
139 if ( isset( $this->apps[ $slug ] ) ) {
140 return $this->apps[ $slug ];
141 }
142
143 return null;
144 }
145
146 /**
147 * @since 2.3.0
148 * @access public
149 * @return Base_App[]
150 */
151 public function get_apps() {
152 return $this->apps;
153 }
154
155 /**
156 * @since 2.3.0
157 * @access public
158 */
159 public function register_category( $slug, $args ) {
160 $this->categories[ $slug ] = $args;
161 return $this;
162 }
163
164 /**
165 * @since 2.3.0
166 * @access public
167 */
168 public function get_categories() {
169 return $this->categories;
170 }
171
172 }
173