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 +68 -18 4.1.0-beta2 → 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,14 +89,18 @@
69 89 if ( Black_Friday::should_display_notice() ) {
70 90 new Black_Friday();
71 91 }
72 92
73 - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] );
93 + if ( ! Utils::has_pro() ) {
94 + Conversion_Banner::register_cache_invalidation_hooks();
74 95
75 - if ( Utils::has_pro() ) {
76 - return;
96 + if ( Conversion_Banner::should_display_banner() ) {
97 + new Conversion_Banner();
98 + }
77 99 }
78 100
101 + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] );
102 +
79 103 add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) {
80 104 $controls_manager->register( new Controls\Promotion_Control() );
81 105 } );
82 106
@@ -82,23 +106,11 @@
82 106
83 107 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] );
84 108 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] );
85 109
86 - // Add Ally promo
87 - Ally_Dashboard_Widget::init();
88 -
89 110 $this->register_atomic_promotions();
90 111 }
91 112
92 - /**
93 - * Get Ally Scanner URL
94 - *
95 - * @return string
96 - */
97 - public static function get_ally_external_scanner_url(): string {
98 - return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' );
99 - }
100 -
101 113 private function handle_external_redirects() {
102 114 $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
103 115 if ( empty( $page ) ) {
104 116 return;
@@ -103,14 +115,34 @@
103 115 if ( empty( $page ) ) {
104 116 return;
105 117 }
106 118
107 - if ( 'go_elementor_pro' === $page ) {
119 + if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) {
108 120 wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect
109 121 die;
110 122 }
111 123 }
112 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 +
113 145 private function register_editor_one_menu_items( Menu_Data_Provider $menu_data_provider ) {
114 146 $menu_data_provider->register_menu( new Editor_One_Custom_Elements_Menu() );
115 147 $menu_data_provider->register_menu( new Editor_One_Submissions_Menu() );
116 148 $menu_data_provider->register_menu( new Editor_One_Fonts_Menu() );
@@ -134,8 +166,9 @@
134 166 'react-dom',
135 167 'backbone-marionette',
136 168 'elementor-editor-modules',
137 169 'elementor-v2-ui',
170 + 'elementor-v2-icons',
138 171 ],
139 172 ELEMENTOR_VERSION,
140 173 true
141 174 );
@@ -184,8 +217,14 @@
184 217 EditorAssetsAPI::ASSETS_DATA_KEY => 'free-to-pro-upsell',
185 218 ];
186 219 }
187 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 +
188 227 public function add_v4_promotions_data( array $settings ): array {
189 228 if ( ! current_user_can( 'manage_options' ) ) {
190 229 return $settings;
191 230 }
@@ -226,9 +265,19 @@
226 265 ],
227 266 ];
228 267 }
229 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 +
230 275 private function register_atomic_promotions(): void {
276 + if ( ! $this->should_register_core_atomic_panel_promotions() ) {
277 + return;
278 + }
279 +
231 280 add_action( 'elementor/init', function() {
232 281 if ( ! $this->is_atomic_widgets_active() ) {
233 282 return;
234 283 }
@@ -248,8 +297,9 @@
248 297 }
249 298 } );
250 299
251 300 ( new Atomic_Form_Widget_Promotion() )->register();
301 + ( new Collection_Loop_Widget_Promotion() )->register();
252 302 }
253 303
254 304 public function inject_atomic_promotion_props( array $schema ): array {
255 305 foreach ( $this->get_atomic_promotion_configs() as $config ) {