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