PluginProbe
Elementor Website Builder – more than just a page builder / 3.2.5
Elementor Website Builder – more than just a page builder v3.2.5
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.2.5, at core/common/modules/connect/module.php

202 lines 3.8 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\Utils;
5 use Elementor\Core\Base\Module as BaseModule;
6 use Elementor\Core\Common\Modules\Connect\Apps\Base_App;
7 use Elementor\Core\Common\Modules\Connect\Apps\Connect;
8 use Elementor\Core\Common\Modules\Connect\Apps\Library;
9 use Elementor\Plugin;
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit; // Exit if accessed directly
13 }
14
15 class Module extends BaseModule {
16 const ACCESS_LEVEL_CORE = 0;
17 const ACCESS_LEVEL_PRO = 1;
18 const ACCESS_LEVEL_EXPERT = 20;
19
20 /**
21 * @since 2.3.0
22 * @access public
23 */
24 public function get_name() {
25 return 'connect';
26 }
27
28 /**
29 * @var array
30 */
31 protected $registered_apps = [];
32
33 /**
34 * Apps Instances.
35 *
36 * Holds the list of all the apps instances.
37 *
38 * @since 2.3.0
39 * @access protected
40 *
41 * @var Base_App[]
42 */
43 protected $apps = [];
44
45 /**
46 * Registered apps categories.
47 *
48 * Holds the list of all the registered apps categories.
49 *
50 * @since 2.3.0
51 * @access protected
52 *
53 * @var array
54 */
55 protected $categories = [];
56
57 protected $admin_page;
58
59 /**
60 * @since 2.3.0
61 * @access public
62 */
63 public function __construct() {
64 $this->registered_apps = [
65 'connect' => Connect::get_class_name(),
66 'library' => Library::get_class_name(),
67 ];
68
69 // Note: The priority 11 is for allowing plugins to add their register callback on elementor init.
70 add_action( 'elementor/init', [ $this, 'init' ], 11 );
71 }
72
73 /**
74 * Register default apps.
75 *
76 * Registers the default apps.
77 *
78 * @since 2.3.0
79 * @access public
80 */
81 public function init() {
82 if ( is_admin() ) {
83 $this->admin_page = new Admin();
84 }
85
86 /**
87 * Register Elementor apps.
88 *
89 * Fires after Elementor registers the default apps.
90 *
91 * @since 2.3.0
92 *
93 * @param self $this The apps manager instance.
94 */
95 do_action( 'elementor/connect/apps/register', $this );
96
97 foreach ( $this->registered_apps as $slug => $class ) {
98 $this->apps[ $slug ] = new $class();
99 }
100 }
101
102 /**
103 * @deprecated 3.1.0
104 */
105 public function localize_settings() {
106 Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0' );
107
108 return [];
109 }
110
111 /**
112 * Register app.
113 *
114 * Registers an app.
115 *
116 * @since 2.3.0
117 * @access public
118 *
119 * @param string $slug App slug.
120 * @param string $class App full class name.
121 *
122 * @return self The updated apps manager instance.
123 */
124 public function register_app( $slug, $class ) {
125 $this->registered_apps[ $slug ] = $class;
126
127 return $this;
128 }
129
130 /**
131 * Get app instance.
132 *
133 * Retrieve the app instance.
134 *
135 * @since 2.3.0
136 * @access public
137 *
138 * @param $slug
139 *
140 * @return Base_App|null
141 */
142 public function get_app( $slug ) {
143 if ( isset( $this->apps[ $slug ] ) ) {
144 return $this->apps[ $slug ];
145 }
146
147 return null;
148 }
149
150 /**
151 * @since 2.3.0
152 * @access public
153 * @return Base_App[]
154 */
155 public function get_apps() {
156 return $this->apps;
157 }
158
159 /**
160 * @since 2.3.0
161 * @access public
162 */
163 public function register_category( $slug, $args ) {
164 $this->categories[ $slug ] = $args;
165 return $this;
166 }
167
168 /**
169 * @since 2.3.0
170 * @access public
171 */
172 public function get_categories() {
173 return $this->categories;
174 }
175
176 /**
177 * @param $context
178 *
179 * @return array
180 */
181 public function get_subscription_plans( $context ) {
182 return [
183 static::ACCESS_LEVEL_CORE => [
184 'label' => null,
185 'promotion_url' => null,
186 'color' => null,
187 ],
188 static::ACCESS_LEVEL_PRO => [
189 'label' => 'Pro',
190 'promotion_url' => Utils::get_pro_link( "https://elementor.com/pro/?utm_source={$context}&utm_medium=wp-dash&utm_campaign=gopro" ),
191 'color' => '#92003B',
192 ],
193 static::ACCESS_LEVEL_EXPERT => [
194 'label' => 'Expert',
195 'promotion_url' => Utils::get_pro_link( "https://elementor.com/pro/?utm_source={$context}&utm_medium=wp-dash&utm_campaign=goexpert" ),
196 'color' => '#010051',
197 ],
198 ];
199 }
200
201 }
202