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 +69 -18 4.0.9 → 4.3.3 View file →
@@ -4,8 +4,9 @@
4 4
5 5 use Elementor\Api;
6 6 use Elementor\Controls_Manager;
7 7 use Elementor\Core\Base\Module as Base_Module;
8 +use Elementor\Core\Utils\Promotions\Filtered_Promotions_Manager;
8 9 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Custom_Code_Menu;
9 10 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Custom_Elements_Menu;
10 11 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Fonts_Menu;
11 12 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Icons_Menu;
@@ -12,17 +13,19 @@
12 13 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Popups_Menu;
13 14 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Submissions_Menu;
14 15 use Elementor\Modules\Promotions\AdminMenuItems\Go_Pro_Promotion_Item;
15 16 use Elementor\Modules\Promotions\Controls\Atomic_Promotion_Control;
17 +use Elementor\Modules\Promotions\Conversion_Banner;
16 18 use Elementor\Modules\Promotions\Pointers\Birthday;
17 19 use Elementor\Modules\Promotions\Pointers\Black_Friday;
18 20 use Elementor\Modules\Promotions\PropTypes\Promotion_Prop_Type;
19 -use Elementor\Modules\Promotions\Widgets\Ally_Dashboard_Widget;
20 21 use Elementor\Modules\Promotions\Widgets\Atomic_Form_Widget_Promotion;
22 +use Elementor\Modules\Promotions\Widgets\Collection_Loop_Widget_Promotion;
21 23 use Elementor\Widgets_Manager;
22 24 use Elementor\Utils;
23 25 use Elementor\Includes\EditorAssetsAPI;
24 26 use Elementor\Plugin;
27 +use Elementor\Modules\EditorOne\Classes\Menu_Config;
25 28 use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
26 29
27 30 if ( ! defined( 'ABSPATH' ) ) {
28 31 exit; // Exit if accessed directly.
@@ -34,9 +37,13 @@
34 37
35 38 const ADMIN_MENU_PROMOTIONS_PRIORITY = 120;
36 39
37 40 public static function is_active() {
38 - return ! Utils::has_pro();
41 + if ( Utils::has_pro() ) {
42 + return true;
43 + }
44 +
45 + return ! Utils::is_license_active();
39 46 }
40 47
41 48 public function get_name() {
42 49 return 'promotions';
@@ -44,8 +51,17 @@
44 51
45 52 public function __construct() {
46 53 parent::__construct();
47 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 +
48 64 add_action( 'admin_init', function () {
49 65 $this->handle_external_redirects();
50 66 } );
51 67
@@ -52,8 +68,12 @@
52 68 add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
53 69 $this->register_editor_one_menu_items( $menu_data_provider );
54 70 } );
55 71
72 + if ( Utils::is_sale_time() ) {
73 + add_filter( 'add_menu_classes', [ $this, 'override_one_menu_upgrade_label_during_sale' ] );
74 + }
75 +
56 76 add_action( 'elementor/widgets/register', function( Widgets_Manager $manager ) {
57 77 foreach ( Api::get_promotion_widgets() as $widget_data ) {
58 78 $manager->register( new Widgets\Pro_Widget_Promotion( [], [
59 79 'widget_name' => $widget_data['name'],
@@ -69,12 +89,18 @@
69 89 if ( Black_Friday::should_display_notice() ) {
70 90 new Black_Friday();
71 91 }
72 92
73 - if ( Utils::has_pro() ) {
74 - return;
93 + if ( ! Utils::has_pro() ) {
94 + Conversion_Banner::register_cache_invalidation_hooks();
95 +
96 + if ( Conversion_Banner::should_display_banner() ) {
97 + new Conversion_Banner();
98 + }
75 99 }
76 100
101 + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] );
102 +
77 103 add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) {
78 104 $controls_manager->register( new Controls\Promotion_Control() );
79 105 } );
80 106
@@ -79,25 +105,12 @@
79 105 } );
80 106
81 107 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] );
82 108 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] );
83 - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] );
84 109
85 - // Add Ally promo
86 - Ally_Dashboard_Widget::init();
87 -
88 110 $this->register_atomic_promotions();
89 111 }
90 112
91 - /**
92 - * Get Ally Scanner URL
93 - *
94 - * @return string
95 - */
96 - public static function get_ally_external_scanner_url(): string {
97 - return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' );
98 - }
99 -
100 113 private function handle_external_redirects() {
101 114 $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
102 115 if ( empty( $page ) ) {
103 116 return;
@@ -102,14 +115,34 @@
102 115 if ( empty( $page ) ) {
103 116 return;
104 117 }
105 118
106 - if ( 'go_elementor_pro' === $page ) {
119 + if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) {
107 120 wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect
108 121 die;
109 122 }
110 123 }
111 124
125 + public function override_one_menu_upgrade_label_during_sale( $menu ) {
126 + global $submenu;
127 +
128 + $parent_slug = Menu_Config::ELEMENTOR_HOME_MENU_SLUG;
129 + $upgrade_slug = 'elementor-one-upgrade';
130 +
131 + if ( empty( $submenu[ $parent_slug ] ) ) {
132 + return $menu;
133 + }
134 +
135 + foreach ( $submenu[ $parent_slug ] as &$item ) {
136 + if ( isset( $item[2] ) && $upgrade_slug === $item[2] ) {
137 + $item[0] = esc_html__( 'Sale!', 'elementor' ) . '<br />' . esc_html__( 'Upgrade Now', 'elementor' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
138 + break;
139 + }
140 + }
141 +
142 + return $menu;
143 + }
144 +
112 145 private function register_editor_one_menu_items( Menu_Data_Provider $menu_data_provider ) {
113 146 $menu_data_provider->register_menu( new Editor_One_Custom_Elements_Menu() );
114 147 $menu_data_provider->register_menu( new Editor_One_Submissions_Menu() );
115 148 $menu_data_provider->register_menu( new Editor_One_Fonts_Menu() );
@@ -133,8 +166,9 @@
133 166 'react-dom',
134 167 'backbone-marionette',
135 168 'elementor-editor-modules',
136 169 'elementor-v2-ui',
170 + 'elementor-v2-icons',
137 171 ],
138 172 ELEMENTOR_VERSION,
139 173 true
140 174 );
@@ -183,8 +217,14 @@
183 217 EditorAssetsAPI::ASSETS_DATA_KEY => 'free-to-pro-upsell',
184 218 ];
185 219 }
186 220
221 + public function add_editing_panel_sticky_promotion( array $settings ): array {
222 + $settings['editingPanelStickyPromotion'] = Filtered_Promotions_Manager::get_editor_panel_sticky_promotion();
223 +
224 + return $settings;
225 + }
226 +
187 227 public function add_v4_promotions_data( array $settings ): array {
188 228 if ( ! current_user_can( 'manage_options' ) ) {
189 229 return $settings;
190 230 }
@@ -225,9 +265,19 @@
225 265 ],
226 266 ];
227 267 }
228 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 +
229 275 private function register_atomic_promotions(): void {
276 + if ( ! $this->should_register_core_atomic_panel_promotions() ) {
277 + return;
278 + }
279 +
230 280 add_action( 'elementor/init', function() {
231 281 if ( ! $this->is_atomic_widgets_active() ) {
232 282 return;
233 283 }
@@ -247,8 +297,9 @@
247 297 }
248 298 } );
249 299
250 300 ( new Atomic_Form_Widget_Promotion() )->register();
301 + ( new Collection_Loop_Widget_Promotion() )->register();
251 302 }
252 303
253 304 public function inject_atomic_promotion_props( array $schema ): array {
254 305 foreach ( $this->get_atomic_promotion_configs() as $config ) {