PluginProbe
Elementor Website Builder – more than just a page builder / 3.1.0-dev2
Elementor Website Builder – more than just a page builder v3.1.0-dev2
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
← All changes | core/common/modules/connect/module.php +16 -115 4.1.33.1.0-dev2 View file →
@@ -2,34 +2,18 @@
2 2 namespace Elementor\Core\Common\Modules\Connect;
3 3
4 4 use Elementor\Core\Base\Module as BaseModule;
5 5 use Elementor\Core\Common\Modules\Connect\Apps\Base_App;
6 -use Elementor\Core\Common\Modules\Connect\Apps\Common_App;
7 6 use Elementor\Core\Common\Modules\Connect\Apps\Connect;
8 -use Elementor\Core\Common\Modules\Connect\Apps\Feedback;
9 7 use Elementor\Core\Common\Modules\Connect\Apps\Library;
10 8 use Elementor\Plugin;
11 -use Elementor\Utils;
12 -use WP_User_Query;
13 -use Elementor\Core\Common\Modules\Connect\Rest\Rest_Api;
14 9
15 10 if ( ! defined( 'ABSPATH' ) ) {
16 - exit; // Exit if accessed directly.
11 + exit; // Exit if accessed directly
17 12 }
18 13
19 14 class Module extends BaseModule {
20 - const ACCESS_LEVEL_CORE = 0;
21 - const ACCESS_LEVEL_PRO = 1;
22 - const ACCESS_LEVEL_EXPERT = 20;
23 15
24 - const ACCESS_TIER_FREE = 'free';
25 - const ACCESS_TIER_ESSENTIAL = 'essential';
26 - const ACCESS_TIER_ESSENTIAL_OCT_2023 = 'essential-oct2023';
27 - const ACCESS_TIER_ADVANCED = 'advanced';
28 - const ACCESS_TIER_EXPERT = 'expert';
29 - const ACCESS_TIER_AGENCY = 'agency';
30 - const ACCESS_TIER_PRO_LEGACY = 'pro';
31 -
32 16 /**
33 17 * @since 2.3.0
34 18 * @access public
35 19 */
@@ -75,25 +59,12 @@
75 59 public function __construct() {
76 60 $this->registered_apps = [
77 61 'connect' => Connect::get_class_name(),
78 62 'library' => Library::get_class_name(),
79 - 'feedback' => Feedback::get_class_name(),
80 63 ];
81 64
82 - // When using REST API the parent module is construct after the action 'elementor/init'
83 - // so this part of code make sure to register the module "apps".
84 - if ( did_action( 'elementor/init' ) ) {
85 - $this->init();
86 - } else {
87 - // Note: The priority 11 is for allowing plugins to add their register callback on elementor init.
88 - add_action( 'elementor/init', [ $this, 'init' ], 11 );
89 - }
90 -
91 - add_action( 'rest_api_init', [ $this, 'register_rest_routes' ] );
92 -
93 - add_filter( 'elementor/tracker/send_tracking_data_params', function ( $params ) {
94 - return $this->add_tracking_data( $params );
95 - } );
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 );
96 67 }
97 68
98 69 /**
99 70 * Register default apps.
@@ -124,8 +95,17 @@
124 95 }
125 96 }
126 97
127 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 + /**
128 108 * Register app.
129 109 *
130 110 * Registers an app.
131 111 *
@@ -131,15 +111,15 @@
131 111 *
132 112 * @since 2.3.0
133 113 * @access public
134 114 *
135 - * @param string $slug App slug.
136 - * @param string $class_name App full class name.
115 + * @param string $slug App slug.
116 + * @param string $class App full class name.
137 117 *
138 118 * @return self The updated apps manager instance.
139 119 */
140 - public function register_app( $slug, $class_name ) {
141 - $this->registered_apps[ $slug ] = $class_name;
120 + public function register_app( $slug, $class ) {
121 + $this->registered_apps[ $slug ] = $class;
142 122
143 123 return $this;
144 124 }
145 125
@@ -188,84 +168,5 @@
188 168 public function get_categories() {
189 169 return $this->categories;
190 170 }
191 171
192 - /**
193 - * @param string $context Where this subscription plan should be shown.
194 - *
195 - * @return array
196 - */
197 - public function get_subscription_plans( $context = '' ) {
198 - $base_url = Utils::has_pro() ? 'https://my.elementor.com/upgrade-subscription' : 'https://elementor.com/pro';
199 - $promotion_url = $base_url . '/?utm_source=' . $context . '&utm_medium=wp-dash&utm_campaign=gopro';
200 -
201 - return [
202 - static::ACCESS_TIER_FREE => [
203 - 'label' => null,
204 - 'promotion_url' => null,
205 - 'color' => null,
206 - ],
207 - static::ACCESS_TIER_ESSENTIAL => [
208 - 'label' => 'Pro',
209 - 'promotion_url' => $promotion_url,
210 - 'color' => '#92003B',
211 - ],
212 - static::ACCESS_TIER_ESSENTIAL_OCT_2023 => [
213 - 'label' => 'Advanced', // Should be the same label as "Advanced".
214 - 'promotion_url' => $promotion_url,
215 - 'color' => '#92003B',
216 - ],
217 - static::ACCESS_TIER_ADVANCED => [
218 - 'label' => 'Advanced',
219 - 'promotion_url' => $promotion_url,
220 - 'color' => '#92003B',
221 - ],
222 - static::ACCESS_TIER_EXPERT => [
223 - 'label' => 'Expert',
224 - 'promotion_url' => $promotion_url,
225 - 'color' => '#92003B',
226 - ],
227 - static::ACCESS_TIER_AGENCY => [
228 - 'label' => 'Agency',
229 - 'promotion_url' => $promotion_url,
230 - 'color' => '#92003B',
231 - ],
232 - ];
233 - }
234 -
235 - private function add_tracking_data( $params ) {
236 - $users = [];
237 -
238 - $users_query = new WP_User_Query( [
239 - 'count_total' => false, // Disable SQL_CALC_FOUND_ROWS.
240 - 'meta_query' => [
241 - 'key' => Common_App::OPTION_CONNECT_COMMON_DATA_KEY,
242 - 'compare' => 'EXISTS',
243 - ],
244 - ] );
245 -
246 - foreach ( $users_query->get_results() as $user ) {
247 - $connect_common_data = get_user_option( Common_App::OPTION_CONNECT_COMMON_DATA_KEY, $user->ID );
248 -
249 - if ( $connect_common_data ) {
250 - $users [] = [
251 - 'id' => $user->ID,
252 - 'email' => $connect_common_data['user']->email,
253 - 'roles' => implode( ', ', $user->roles ),
254 - ];
255 - }
256 - }
257 -
258 - $params['usages'][ $this->get_name() ] = [
259 - 'site_key' => get_option( Base_App::OPTION_CONNECT_SITE_KEY ),
260 - 'count' => count( $users ),
261 - 'users' => $users,
262 - ];
263 -
264 - return $params;
265 - }
266 -
267 - public function register_rest_routes() {
268 - $rest_api = new Rest_Api();
269 - $rest_api->register_routes();
270 - }
271 172 }