PluginProbe
Elementor Website Builder – more than just a page builder / 3.3.0
Elementor Website Builder – more than just a page builder v3.3.0
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 +31 -83 4.2.23.3.0 View file →
@@ -1,20 +1,16 @@
1 1 <?php
2 2 namespace Elementor\Core\Common\Modules\Connect;
3 3
4 +use Elementor\Utils;
4 5 use Elementor\Core\Base\Module as BaseModule;
5 6 use Elementor\Core\Common\Modules\Connect\Apps\Base_App;
6 -use Elementor\Core\Common\Modules\Connect\Apps\Common_App;
7 7 use Elementor\Core\Common\Modules\Connect\Apps\Connect;
8 -use Elementor\Core\Common\Modules\Connect\Apps\Feedback;
9 8 use Elementor\Core\Common\Modules\Connect\Apps\Library;
10 9 use Elementor\Plugin;
11 -use Elementor\Utils;
12 -use WP_User_Query;
13 -use Elementor\Core\Common\Modules\Connect\Rest\Rest_Api;
14 10
15 11 if ( ! defined( 'ABSPATH' ) ) {
16 - exit; // Exit if accessed directly.
12 + exit; // Exit if accessed directly
17 13 }
18 14
19 15 class Module extends BaseModule {
20 16 const ACCESS_LEVEL_CORE = 0;
@@ -20,16 +16,8 @@
20 16 const ACCESS_LEVEL_CORE = 0;
21 17 const ACCESS_LEVEL_PRO = 1;
22 18 const ACCESS_LEVEL_EXPERT = 20;
23 19
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 20 /**
33 21 * @since 2.3.0
34 22 * @access public
35 23 */
@@ -75,9 +63,8 @@
75 63 public function __construct() {
76 64 $this->registered_apps = [
77 65 'connect' => Connect::get_class_name(),
78 66 'library' => Library::get_class_name(),
79 - 'feedback' => Feedback::get_class_name(),
80 67 ];
81 68
82 69 // When using REST API the parent module is construct after the action 'elementor/init'
83 70 // so this part of code make sure to register the module "apps".
@@ -86,14 +73,8 @@
86 73 } else {
87 74 // Note: The priority 11 is for allowing plugins to add their register callback on elementor init.
88 75 add_action( 'elementor/init', [ $this, 'init' ], 11 );
89 76 }
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 - } );
96 77 }
97 78
98 79 /**
99 80 * Register default apps.
@@ -124,8 +105,17 @@
124 105 }
125 106 }
126 107
127 108 /**
109 + * @deprecated 3.1.0
110 + */
111 + public function localize_settings() {
112 + Plugin::$instance->modules_manager->get_modules( 'dev-tools' )->deprecation->deprecated_function( __METHOD__, '3.1.0' );
113 +
114 + return [];
115 + }
116 +
117 + /**
128 118 * Register app.
129 119 *
130 120 * Registers an app.
131 121 *
@@ -131,15 +121,15 @@
131 121 *
132 122 * @since 2.3.0
133 123 * @access public
134 124 *
135 - * @param string $slug App slug.
136 - * @param string $class_name App full class name.
125 + * @param string $slug App slug.
126 + * @param string $class App full class name.
137 127 *
138 128 * @return self The updated apps manager instance.
139 129 */
140 - public function register_app( $slug, $class_name ) {
141 - $this->registered_apps[ $slug ] = $class_name;
130 + public function register_app( $slug, $class ) {
131 + $this->registered_apps[ $slug ] = $class;
142 132
143 133 return $this;
144 134 }
145 135
@@ -189,83 +179,41 @@
189 179 return $this->categories;
190 180 }
191 181
192 182 /**
193 - * @param string $context Where this subscription plan should be shown.
183 + * @param $context
194 184 *
195 185 * @return array
196 186 */
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 -
187 + public function get_subscription_plans( $context ) {
201 188 return [
202 - static::ACCESS_TIER_FREE => [
189 + static::ACCESS_LEVEL_CORE => [
203 190 'label' => null,
204 191 'promotion_url' => null,
205 192 'color' => null,
206 193 ],
207 - static::ACCESS_TIER_ESSENTIAL => [
194 + static::ACCESS_LEVEL_PRO => [
208 195 'label' => 'Pro',
209 - 'promotion_url' => $promotion_url,
196 + 'promotion_url' => Utils::get_pro_link( "https://elementor.com/pro/?utm_source={$context}&utm_medium=wp-dash&utm_campaign=gopro" ),
210 197 'color' => '#92003B',
211 198 ],
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 => [
199 + static::ACCESS_LEVEL_EXPERT => [
223 200 'label' => 'Expert',
224 - 'promotion_url' => $promotion_url,
225 - 'color' => '#92003B',
201 + 'promotion_url' => Utils::get_pro_link( "https://elementor.com/pro/?utm_source={$context}&utm_medium=wp-dash&utm_campaign=goexpert" ),
202 + 'color' => '#010051',
226 203 ],
227 - static::ACCESS_TIER_AGENCY => [
228 - 'label' => 'Agency',
229 - 'promotion_url' => $promotion_url,
230 - 'color' => '#92003B',
231 - ],
232 204 ];
233 205 }
234 206
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 - }
207 + protected function get_init_settings() {
208 + /** @var Connect $connect */
209 + $connect = $this->get_app( 'library' );
210 + if ( ! $connect ) {
211 + return [];
256 212 }
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,
213 + return [
214 + 'is_user_connected' => $connect->is_connected(),
215 + 'connect_url' => $connect->get_admin_url( 'authorize' ),
262 216 ];
263 -
264 - return $params;
265 217 }
266 218
267 - public function register_rest_routes() {
268 - $rest_api = new Rest_Api();
269 - $rest_api->register_routes();
270 - }
271 219 }