PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.0-beta1
Elementor Website Builder – more than just a page builder v4.0.0-beta1
4.3.4 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 All 457 releases
← All changes | modules/promotions/module.php +18 -72 4.3.4 → 4.0.0-beta1 View file →
@@ -4,9 +4,8 @@
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;
9 8 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Custom_Code_Menu;
10 9 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Custom_Elements_Menu;
11 10 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Fonts_Menu;
12 11 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Icons_Menu;
@@ -13,19 +12,16 @@
13 12 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Popups_Menu;
14 13 use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Submissions_Menu;
15 14 use Elementor\Modules\Promotions\AdminMenuItems\Go_Pro_Promotion_Item;
16 15 use Elementor\Modules\Promotions\Controls\Atomic_Promotion_Control;
17 -use Elementor\Modules\Promotions\Conversion_Banner;
18 16 use Elementor\Modules\Promotions\Pointers\Birthday;
19 17 use Elementor\Modules\Promotions\Pointers\Black_Friday;
20 18 use Elementor\Modules\Promotions\PropTypes\Promotion_Prop_Type;
21 -use Elementor\Modules\Promotions\Widgets\Atomic_Form_Widget_Promotion;
22 -use Elementor\Modules\Promotions\Widgets\Collection_Loop_Widget_Promotion;
19 +use Elementor\Modules\Promotions\Widgets\Ally_Dashboard_Widget;
23 20 use Elementor\Widgets_Manager;
24 21 use Elementor\Utils;
25 22 use Elementor\Includes\EditorAssetsAPI;
26 23 use Elementor\Plugin;
27 -use Elementor\Modules\EditorOne\Classes\Menu_Config;
28 24 use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider;
29 25
30 26 if ( ! defined( 'ABSPATH' ) ) {
31 27 exit; // Exit if accessed directly.
@@ -37,13 +33,9 @@
37 33
38 34 const ADMIN_MENU_PROMOTIONS_PRIORITY = 120;
39 35
40 36 public static function is_active() {
41 - if ( Utils::has_pro() ) {
42 - return true;
43 - }
44 -
45 - return ! Utils::is_license_active();
37 + return ! Utils::has_pro();
46 38 }
47 39
48 40 public function get_name() {
49 41 return 'promotions';
@@ -51,17 +43,8 @@
51 43
52 44 public function __construct() {
53 45 parent::__construct();
54 46
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 -
64 47 add_action( 'admin_init', function () {
65 48 $this->handle_external_redirects();
66 49 } );
67 50
@@ -68,12 +51,8 @@
68 51 add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) {
69 52 $this->register_editor_one_menu_items( $menu_data_provider );
70 53 } );
71 54
72 - if ( Utils::is_sale_time() ) {
73 - add_filter( 'add_menu_classes', [ $this, 'override_one_menu_upgrade_label_during_sale' ] );
74 - }
75 -
76 55 add_action( 'elementor/widgets/register', function( Widgets_Manager $manager ) {
77 56 foreach ( Api::get_promotion_widgets() as $widget_data ) {
78 57 $manager->register( new Widgets\Pro_Widget_Promotion( [], [
79 58 'widget_name' => $widget_data['name'],
@@ -89,18 +68,12 @@
89 68 if ( Black_Friday::should_display_notice() ) {
90 69 new Black_Friday();
91 70 }
92 71
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 - }
72 + if ( Utils::has_pro() ) {
73 + return;
99 74 }
100 75
101 - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] );
102 -
103 76 add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) {
104 77 $controls_manager->register( new Controls\Promotion_Control() );
105 78 } );
106 79
@@ -105,12 +78,25 @@
105 78 } );
106 79
107 80 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] );
108 81 add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] );
82 + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] );
109 83
84 + // Add Ally promo
85 + Ally_Dashboard_Widget::init();
86 +
110 87 $this->register_atomic_promotions();
111 88 }
112 89
90 + /**
91 + * Get Ally Scanner URL
92 + *
93 + * @return string
94 + */
95 + public static function get_ally_external_scanner_url(): string {
96 + return apply_filters( 'elementor/ally_external_scanner_url', 'https://elementor.com/tools/ally-accessibility-checker/scanner' );
97 + }
98 +
113 99 private function handle_external_redirects() {
114 100 $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS );
115 101 if ( empty( $page ) ) {
116 102 return;
@@ -115,34 +101,14 @@
115 101 if ( empty( $page ) ) {
116 102 return;
117 103 }
118 104
119 - if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) {
105 + if ( 'go_elementor_pro' === $page ) {
120 106 wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect
121 107 die;
122 108 }
123 109 }
124 110
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 -
145 111 private function register_editor_one_menu_items( Menu_Data_Provider $menu_data_provider ) {
146 112 $menu_data_provider->register_menu( new Editor_One_Custom_Elements_Menu() );
147 113 $menu_data_provider->register_menu( new Editor_One_Submissions_Menu() );
148 114 $menu_data_provider->register_menu( new Editor_One_Fonts_Menu() );
@@ -166,9 +132,8 @@
166 132 'react-dom',
167 133 'backbone-marionette',
168 134 'elementor-editor-modules',
169 135 'elementor-v2-ui',
170 - 'elementor-v2-icons',
171 136 ],
172 137 ELEMENTOR_VERSION,
173 138 true
174 139 );
@@ -217,14 +182,8 @@
217 182 EditorAssetsAPI::ASSETS_DATA_KEY => 'free-to-pro-upsell',
218 183 ];
219 184 }
220 185
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 -
227 186 public function add_v4_promotions_data( array $settings ): array {
228 187 if ( ! current_user_can( 'manage_options' ) ) {
229 188 return $settings;
230 189 }
@@ -265,19 +224,9 @@
265 224 ],
266 225 ];
267 226 }
268 227
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 228 private function register_atomic_promotions(): void {
276 - if ( ! $this->should_register_core_atomic_panel_promotions() ) {
277 - return;
278 - }
279 -
280 229 add_action( 'elementor/init', function() {
281 230 if ( ! $this->is_atomic_widgets_active() ) {
282 231 return;
283 232 }
@@ -295,11 +244,8 @@
295 244 2
296 245 );
297 246 }
298 247 } );
299 -
300 - ( new Atomic_Form_Widget_Promotion() )->register();
301 - ( new Collection_Loop_Widget_Promotion() )->register();
302 248 }
303 249
304 250 public function inject_atomic_promotion_props( array $schema ): array {
305 251 foreach ( $this->get_atomic_promotion_configs() as $config ) {