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 +32 -29 4.1.4 → 4.3.3 View file →
@@ -17,11 +17,10 @@
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;
22 +use Elementor\Modules\Promotions\Widgets\Collection_Loop_Widget_Promotion;
24 23 use Elementor\Widgets_Manager;
25 24 use Elementor\Utils;
26 25 use Elementor\Includes\EditorAssetsAPI;
27 26 use Elementor\Plugin;
@@ -38,9 +37,13 @@
38 37
39 38 const ADMIN_MENU_PROMOTIONS_PRIORITY = 120;
40 39
41 40 public static function is_active() {
42 - return ! Utils::has_pro();
41 + if ( Utils::has_pro() ) {
42 + return true;
43 + }
44 +
45 + return ! Utils::is_license_active();
43 46 }
44 47
45 48 public function get_name() {
46 49 return 'promotions';
@@ -48,8 +51,17 @@
48 51
49 52 public function __construct() {
50 53 parent::__construct();
51 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 +
52 64 add_action( 'admin_init', function () {
53 65 $this->handle_external_redirects();
54 66 } );
55 67
@@ -77,16 +89,14 @@
77 89 if ( Black_Friday::should_display_notice() ) {
78 90 new Black_Friday();
79 91 }
80 92
81 - if ( Conversion_Banner::should_display_banner() ) {
82 - new Conversion_Banner();
83 - }
93 + if ( ! Utils::has_pro() ) {
94 + Conversion_Banner::register_cache_invalidation_hooks();
84 95
85 - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] );
86 -
87 - if ( Utils::has_pro() ) {
88 - return;
96 + if ( Conversion_Banner::should_display_banner() ) {
97 + new Conversion_Banner();
98 + }
89 99 }
90 100
91 101 add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] );
92 102
@@ -96,23 +106,11 @@
96 106
97 107 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] );
98 108 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] );
99 109
100 - // Add Ally promo
101 - Ally_Dashboard_Widget::init();
102 -
103 110 $this->register_atomic_promotions();
104 111 }
105 112
106 - /**
107 - * Get Ally Scanner URL
108 - *
109 - * @return string
110 - */
111 - public static function get_ally_external_scanner_url(): string {
112 - return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' );
113 - }
114 -
115 113 private function handle_external_redirects() {
116 114 $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
117 115 if ( empty( $page ) ) {
118 116 return;
@@ -117,9 +115,9 @@
117 115 if ( empty( $page ) ) {
118 116 return;
119 117 }
120 118
121 - if ( 'go_elementor_pro' === $page ) {
119 + if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) {
122 120 wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect
123 121 die;
124 122 }
125 123 }
@@ -220,12 +218,8 @@
220 218 ];
221 219 }
222 220
223 221 public function add_editing_panel_sticky_promotion( array $settings ): array {
224 - if ( ! Plugin::$instance->experiments->is_feature_active( 'e_panel_promotions' ) ) {
225 - return $settings;
226 - }
227 -
228 222 $settings['editingPanelStickyPromotion'] = Filtered_Promotions_Manager::get_editor_panel_sticky_promotion();
229 223
230 224 return $settings;
231 225 }
@@ -271,9 +265,19 @@
271 265 ],
272 266 ];
273 267 }
274 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 +
275 275 private function register_atomic_promotions(): void {
276 + if ( ! $this->should_register_core_atomic_panel_promotions() ) {
277 + return;
278 + }
279 +
276 280 add_action( 'elementor/init', function() {
277 281 if ( ! $this->is_atomic_widgets_active() ) {
278 282 return;
279 283 }
@@ -290,13 +294,12 @@
290 294 $config['priority'],
291 295 2
292 296 );
293 297 }
294 -
295 - ( new Birthday_Easter_Egg_Promotion() )->register();
296 298 } );
297 299
298 300 ( new Atomic_Form_Widget_Promotion() )->register();
301 + ( new Collection_Loop_Widget_Promotion() )->register();
299 302 }
300 303
301 304 public function inject_atomic_promotion_props( array $schema ): array {
302 305 foreach ( $this->get_atomic_promotion_configs() as $config ) {