| @@ -17,9 +17,8 @@ | ||
| 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 | 22 | use Elementor\Modules\Promotions\Widgets\Collection_Loop_Widget_Promotion; |
| 24 | 23 | use Elementor\Widgets_Manager; |
| 25 | 24 | use Elementor\Utils; |
| @@ -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() || ! Utils::is_license_active(); | |
| 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'; |
| @@ -86,10 +89,14 @@ | ||
| 86 | 89 | if ( Black_Friday::should_display_notice() ) { |
| 87 | 90 | new Black_Friday(); |
| 88 | 91 | } |
| 89 | 92 | |
| 90 | - if ( Conversion_Banner::should_display_banner() ) { | |
| 91 | - new Conversion_Banner(); | |
| 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 | + } | |
| 92 | 99 | } |
| 93 | 100 | |
| 94 | 101 | add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] ); |
| 95 | 102 | |
| @@ -99,23 +106,11 @@ | ||
| 99 | 106 | |
| 100 | 107 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] ); |
| 101 | 108 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] ); |
| 102 | 109 | |
| 103 | - // Add Ally promo | |
| 104 | - Ally_Dashboard_Widget::init(); | |
| 105 | - | |
| 106 | 110 | $this->register_atomic_promotions(); |
| 107 | 111 | } |
| 108 | 112 | |
| 109 | - /** | |
| 110 | - * Get Ally Scanner URL | |
| 111 | - * | |
| 112 | - * @return string | |
| 113 | - */ | |
| 114 | - public static function get_ally_external_scanner_url(): string { | |
| 115 | - return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' ); | |
| 116 | - } | |
| 117 | - | |
| 118 | 113 | private function handle_external_redirects() { |
| 119 | 114 | $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); |
| 120 | 115 | if ( empty( $page ) ) { |
| 121 | 116 | return; |
| @@ -223,12 +218,8 @@ | ||
| 223 | 218 | ]; |
| 224 | 219 | } |
| 225 | 220 | |
| 226 | 221 | public function add_editing_panel_sticky_promotion( array $settings ): array { |
| 227 | - if ( ! Plugin::$instance->experiments->is_feature_active( 'e_panel_promotions' ) ) { | |
| 228 | - return $settings; | |
| 229 | - } | |
| 230 | - | |
| 231 | 222 | $settings['editingPanelStickyPromotion'] = Filtered_Promotions_Manager::get_editor_panel_sticky_promotion(); |
| 232 | 223 | |
| 233 | 224 | return $settings; |
| 234 | 225 | } |
| @@ -274,9 +265,19 @@ | ||
| 274 | 265 | ], |
| 275 | 266 | ]; |
| 276 | 267 | } |
| 277 | 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 | + | |
| 278 | 275 | private function register_atomic_promotions(): void { |
| 276 | + if ( ! $this->should_register_core_atomic_panel_promotions() ) { | |
| 277 | + return; | |
| 278 | + } | |
| 279 | + | |
| 279 | 280 | add_action( 'elementor/init', function() { |
| 280 | 281 | if ( ! $this->is_atomic_widgets_active() ) { |
| 281 | 282 | return; |
| 282 | 283 | } |