| @@ -17,10 +17,11 @@ | ||
| 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; | |
| 21 | 22 | use Elementor\Modules\Promotions\Widgets\Atomic_Form_Widget_Promotion; |
| 22 | -use Elementor\Modules\Promotions\Widgets\Collection_Loop_Widget_Promotion; | |
| 23 | +use Elementor\Modules\Promotions\Widgets\Birthday_Easter_Egg_Promotion; | |
| 23 | 24 | use Elementor\Widgets_Manager; |
| 24 | 25 | use Elementor\Utils; |
| 25 | 26 | use Elementor\Includes\EditorAssetsAPI; |
| 26 | 27 | use Elementor\Plugin; |
| @@ -37,9 +38,9 @@ | ||
| 37 | 38 | |
| 38 | 39 | const ADMIN_MENU_PROMOTIONS_PRIORITY = 120; |
| 39 | 40 | |
| 40 | 41 | public static function is_active() { |
| 41 | - return ! Utils::has_pro() || ! Utils::is_license_active(); | |
| 42 | + return ! Utils::has_pro(); | |
| 42 | 43 | } |
| 43 | 44 | |
| 44 | 45 | public function get_name() { |
| 45 | 46 | return 'promotions'; |
| @@ -47,17 +48,8 @@ | ||
| 47 | 48 | |
| 48 | 49 | public function __construct() { |
| 49 | 50 | parent::__construct(); |
| 50 | 51 | |
| 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 | - | |
| 60 | 52 | add_action( 'admin_init', function () { |
| 61 | 53 | $this->handle_external_redirects(); |
| 62 | 54 | } ); |
| 63 | 55 | |
| @@ -89,8 +81,14 @@ | ||
| 89 | 81 | if ( Conversion_Banner::should_display_banner() ) { |
| 90 | 82 | new Conversion_Banner(); |
| 91 | 83 | } |
| 92 | 84 | |
| 85 | + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] ); | |
| 86 | + | |
| 87 | + if ( Utils::has_pro() ) { | |
| 88 | + return; | |
| 89 | + } | |
| 90 | + | |
| 93 | 91 | add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] ); |
| 94 | 92 | |
| 95 | 93 | add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) { |
| 96 | 94 | $controls_manager->register( new Controls\Promotion_Control() ); |
| @@ -98,11 +96,23 @@ | ||
| 98 | 96 | |
| 99 | 97 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] ); |
| 100 | 98 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] ); |
| 101 | 99 | |
| 100 | + // Add Ally promo | |
| 101 | + Ally_Dashboard_Widget::init(); | |
| 102 | + | |
| 102 | 103 | $this->register_atomic_promotions(); |
| 103 | 104 | } |
| 104 | 105 | |
| 106 | + /** | |
| 107 | + * Get Ally Scanner URL | |
| 108 | + * | |
| 109 | + * @return string | |
| 110 | + */ | |
| 111 | + public static function get_ally_external_scanner_url(): string { | |
| 112 | + return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' ); | |
| 113 | + } | |
| 114 | + | |
| 105 | 115 | private function handle_external_redirects() { |
| 106 | 116 | $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); |
| 107 | 117 | if ( empty( $page ) ) { |
| 108 | 118 | return; |
| @@ -107,9 +117,9 @@ | ||
| 107 | 117 | if ( empty( $page ) ) { |
| 108 | 118 | return; |
| 109 | 119 | } |
| 110 | 120 | |
| 111 | - if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) { | |
| 121 | + if ( 'go_elementor_pro' === $page ) { | |
| 112 | 122 | wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect |
| 113 | 123 | die; |
| 114 | 124 | } |
| 115 | 125 | } |
| @@ -280,12 +290,13 @@ | ||
| 280 | 290 | $config['priority'], |
| 281 | 291 | 2 |
| 282 | 292 | ); |
| 283 | 293 | } |
| 294 | + | |
| 295 | + ( new Birthday_Easter_Egg_Promotion() )->register(); | |
| 284 | 296 | } ); |
| 285 | 297 | |
| 286 | 298 | ( new Atomic_Form_Widget_Promotion() )->register(); |
| 287 | - ( new Collection_Loop_Widget_Promotion() )->register(); | |
| 288 | 299 | } |
| 289 | 300 | |
| 290 | 301 | public function inject_atomic_promotion_props( array $schema ): array { |
| 291 | 302 | foreach ( $this->get_atomic_promotion_configs() as $config ) { |