| @@ -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 | |
| @@ -82,14 +89,8 @@ | ||
| 82 | 89 | if ( Conversion_Banner::should_display_banner() ) { |
| 83 | 90 | new Conversion_Banner(); |
| 84 | 91 | } |
| 85 | 92 | |
| 86 | - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] ); | |
| 87 | - | |
| 88 | - if ( Utils::has_pro() ) { | |
| 89 | - return; | |
| 90 | - } | |
| 91 | - | |
| 92 | 93 | add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] ); |
| 93 | 94 | |
| 94 | 95 | add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) { |
| 95 | 96 | $controls_manager->register( new Controls\Promotion_Control() ); |
| @@ -97,23 +98,11 @@ | ||
| 97 | 98 | |
| 98 | 99 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] ); |
| 99 | 100 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] ); |
| 100 | 101 | |
| 101 | - // Add Ally promo | |
| 102 | - Ally_Dashboard_Widget::init(); | |
| 103 | - | |
| 104 | 102 | $this->register_atomic_promotions(); |
| 105 | 103 | } |
| 106 | 104 | |
| 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 | 105 | private function handle_external_redirects() { |
| 117 | 106 | $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); |
| 118 | 107 | if ( empty( $page ) ) { |
| 119 | 108 | return; |
| @@ -118,9 +107,9 @@ | ||
| 118 | 107 | if ( empty( $page ) ) { |
| 119 | 108 | return; |
| 120 | 109 | } |
| 121 | 110 | |
| 122 | - if ( 'go_elementor_pro' === $page ) { | |
| 111 | + if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) { | |
| 123 | 112 | wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect |
| 124 | 113 | die; |
| 125 | 114 | } |
| 126 | 115 | } |
| @@ -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(); |