PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.3
Elementor Website Builder – more than just a page builder v4.3.3
4.3.3 4.3.2 4.3.1 4.3.0 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 All 456 releases
← All changes | modules/promotions/module.php +30 -29 4.2.0-beta1 → 4.3.3 View file →
@@ -17,11 +17,9 @@
17 17 use Elementor\Modules\Promotions\Conversion_Banner;
18 18 use Elementor\Modules\Promotions\Pointers\Birthday;
19 19 use Elementor\Modules\Promotions\Pointers\Black_Friday;
20 20 use Elementor\Modules\Promotions\PropTypes\Promotion_Prop_Type;
21 -use Elementor\Modules\Promotions\Widgets\Ally_Dashboard_Widget;
22 21 use Elementor\Modules\Promotions\Widgets\Atomic_Form_Widget_Promotion;
23 -use Elementor\Modules\Promotions\Widgets\Birthday_Easter_Egg_Promotion;
24 22 use Elementor\Modules\Promotions\Widgets\Collection_Loop_Widget_Promotion;
25 23 use Elementor\Widgets_Manager;
26 24 use Elementor\Utils;
27 25 use Elementor\Includes\EditorAssetsAPI;
@@ -39,9 +37,13 @@
39 37
40 38 const ADMIN_MENU_PROMOTIONS_PRIORITY = 120;
41 39
42 40 public static function is_active() {
43 - return ! Utils::has_pro();
41 + if ( Utils::has_pro() ) {
42 + return true;
43 + }
44 +
45 + return ! Utils::is_license_active();
44 46 }
45 47
46 48 public function get_name() {
47 49 return 'promotions';
@@ -49,8 +51,17 @@
49 51
50 52 public function __construct() {
51 53 parent::__construct();
52 54
55 + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] );
56 +
57 + if ( Utils::has_pro() ) {
58 + add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] );
59 + $this->register_atomic_promotions();
60 +
61 + return;
62 + }
63 +
53 64 add_action( 'admin_init', function () {
54 65 $this->handle_external_redirects();
55 66 } );
56 67
@@ -78,16 +89,14 @@
78 89 if ( Black_Friday::should_display_notice() ) {
79 90 new Black_Friday();
80 91 }
81 92
82 - if ( Conversion_Banner::should_display_banner() ) {
83 - new Conversion_Banner();
84 - }
93 + if ( ! Utils::has_pro() ) {
94 + Conversion_Banner::register_cache_invalidation_hooks();
85 95
86 - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] );
87 -
88 - if ( Utils::has_pro() ) {
89 - return;
96 + if ( Conversion_Banner::should_display_banner() ) {
97 + new Conversion_Banner();
98 + }
90 99 }
91 100
92 101 add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] );
93 102
@@ -97,23 +106,11 @@
97 106
98 107 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] );
99 108 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] );
100 109
101 - // Add Ally promo
102 - Ally_Dashboard_Widget::init();
103 -
104 110 $this->register_atomic_promotions();
105 111 }
106 112
107 - /**
108 - * Get Ally Scanner URL
109 - *
110 - * @return string
111 - */
112 - public static function get_ally_external_scanner_url(): string {
113 - return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' );
114 - }
115 -
116 113 private function handle_external_redirects() {
117 114 $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
118 115 if ( empty( $page ) ) {
119 116 return;
@@ -118,9 +115,9 @@
118 115 if ( empty( $page ) ) {
119 116 return;
120 117 }
121 118
122 - if ( 'go_elementor_pro' === $page ) {
119 + if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) {
123 120 wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect
124 121 die;
125 122 }
126 123 }
@@ -221,12 +218,8 @@
221 218 ];
222 219 }
223 220
224 221 public function add_editing_panel_sticky_promotion( array $settings ): array {
225 - if ( ! Plugin::$instance->experiments->is_feature_active( 'e_panel_promotions' ) ) {
226 - return $settings;
227 - }
228 -
229 222 $settings['editingPanelStickyPromotion'] = Filtered_Promotions_Manager::get_editor_panel_sticky_promotion();
230 223
231 224 return $settings;
232 225 }
@@ -272,9 +265,19 @@
272 265 ],
273 266 ];
274 267 }
275 268
269 + private function should_register_core_atomic_panel_promotions(): bool {
270 + // Pro with an active license registers real atomic widgets (or its own panel
271 + // promotion layer). Core stubs caused duplicate panel entries after ED-25600.
272 + return ! Utils::has_pro() || ! Utils::is_license_active();
273 + }
274 +
276 275 private function register_atomic_promotions(): void {
276 + if ( ! $this->should_register_core_atomic_panel_promotions() ) {
277 + return;
278 + }
279 +
277 280 add_action( 'elementor/init', function() {
278 281 if ( ! $this->is_atomic_widgets_active() ) {
279 282 return;
280 283 }
@@ -291,10 +294,8 @@
291 294 $config['priority'],
292 295 2
293 296 );
294 297 }
295 -
296 - ( new Birthday_Easter_Egg_Promotion() )->register();
297 298 } );
298 299
299 300 ( new Atomic_Form_Widget_Promotion() )->register();
300 301 ( new Collection_Loop_Widget_Promotion() )->register();