| @@ -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; |
| @@ -17,10 +16,11 @@ | ||
| 17 | 16 | use Elementor\Modules\Promotions\Conversion_Banner; |
| 18 | 17 | use Elementor\Modules\Promotions\Pointers\Birthday; |
| 19 | 18 | use Elementor\Modules\Promotions\Pointers\Black_Friday; |
| 20 | 19 | use Elementor\Modules\Promotions\PropTypes\Promotion_Prop_Type; |
| 20 | +use Elementor\Modules\Promotions\Widgets\Ally_Dashboard_Widget; | |
| 21 | 21 | use Elementor\Modules\Promotions\Widgets\Atomic_Form_Widget_Promotion; |
| 22 | -use Elementor\Modules\Promotions\Widgets\Collection_Loop_Widget_Promotion; | |
| 22 | +use Elementor\Modules\Promotions\Widgets\Birthday_Easter_Egg_Promotion; | |
| 23 | 23 | use Elementor\Widgets_Manager; |
| 24 | 24 | use Elementor\Utils; |
| 25 | 25 | use Elementor\Includes\EditorAssetsAPI; |
| 26 | 26 | use Elementor\Plugin; |
| @@ -37,9 +37,9 @@ | ||
| 37 | 37 | |
| 38 | 38 | const ADMIN_MENU_PROMOTIONS_PRIORITY = 120; |
| 39 | 39 | |
| 40 | 40 | public static function is_active() { |
| 41 | - return ! Utils::has_pro() || ! Utils::is_license_active(); | |
| 41 | + return ! Utils::has_pro(); | |
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | public function get_name() { |
| 45 | 45 | return 'promotions'; |
| @@ -47,17 +47,8 @@ | ||
| 47 | 47 | |
| 48 | 48 | public function __construct() { |
| 49 | 49 | parent::__construct(); |
| 50 | 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 | - | |
| 60 | 51 | add_action( 'admin_init', function () { |
| 61 | 52 | $this->handle_external_redirects(); |
| 62 | 53 | } ); |
| 63 | 54 | |
| @@ -85,18 +76,18 @@ | ||
| 85 | 76 | if ( Black_Friday::should_display_notice() ) { |
| 86 | 77 | new Black_Friday(); |
| 87 | 78 | } |
| 88 | 79 | |
| 89 | - if ( ! Utils::has_pro() ) { | |
| 90 | - Conversion_Banner::register_cache_invalidation_hooks(); | |
| 80 | + if ( Conversion_Banner::should_display_banner() ) { | |
| 81 | + new Conversion_Banner(); | |
| 82 | + } | |
| 91 | 83 | |
| 92 | - if ( Conversion_Banner::should_display_banner() ) { | |
| 93 | - new Conversion_Banner(); | |
| 94 | - } | |
| 84 | + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] ); | |
| 85 | + | |
| 86 | + if ( Utils::has_pro() ) { | |
| 87 | + return; | |
| 95 | 88 | } |
| 96 | 89 | |
| 97 | - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] ); | |
| 98 | - | |
| 99 | 90 | add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) { |
| 100 | 91 | $controls_manager->register( new Controls\Promotion_Control() ); |
| 101 | 92 | } ); |
| 102 | 93 | |
| @@ -102,11 +93,23 @@ | ||
| 102 | 93 | |
| 103 | 94 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] ); |
| 104 | 95 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] ); |
| 105 | 96 | |
| 97 | + // Add Ally promo | |
| 98 | + Ally_Dashboard_Widget::init(); | |
| 99 | + | |
| 106 | 100 | $this->register_atomic_promotions(); |
| 107 | 101 | } |
| 108 | 102 | |
| 103 | + /** | |
| 104 | + * Get Ally Scanner URL | |
| 105 | + * | |
| 106 | + * @return string | |
| 107 | + */ | |
| 108 | + public static function get_ally_external_scanner_url(): string { | |
| 109 | + return apply_filters( 'elementor/ally_external_scanner_url', 'https://go.elementor.com/acc-checker-dashboard-plg' ); | |
| 110 | + } | |
| 111 | + | |
| 109 | 112 | private function handle_external_redirects() { |
| 110 | 113 | $page = filter_input( INPUT_GET, 'page', FILTER_SANITIZE_FULL_SPECIAL_CHARS ); |
| 111 | 114 | if ( empty( $page ) ) { |
| 112 | 115 | return; |
| @@ -111,9 +114,9 @@ | ||
| 111 | 114 | if ( empty( $page ) ) { |
| 112 | 115 | return; |
| 113 | 116 | } |
| 114 | 117 | |
| 115 | - if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) { | |
| 118 | + if ( 'go_elementor_pro' === $page ) { | |
| 116 | 119 | wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect |
| 117 | 120 | die; |
| 118 | 121 | } |
| 119 | 122 | } |
| @@ -162,9 +165,8 @@ | ||
| 162 | 165 | 'react-dom', |
| 163 | 166 | 'backbone-marionette', |
| 164 | 167 | 'elementor-editor-modules', |
| 165 | 168 | 'elementor-v2-ui', |
| 166 | - 'elementor-v2-icons', | |
| 167 | 169 | ], |
| 168 | 170 | ELEMENTOR_VERSION, |
| 169 | 171 | true |
| 170 | 172 | ); |
| @@ -213,14 +215,8 @@ | ||
| 213 | 215 | EditorAssetsAPI::ASSETS_DATA_KEY => 'free-to-pro-upsell', |
| 214 | 216 | ]; |
| 215 | 217 | } |
| 216 | 218 | |
| 217 | - public function add_editing_panel_sticky_promotion( array $settings ): array { | |
| 218 | - $settings['editingPanelStickyPromotion'] = Filtered_Promotions_Manager::get_editor_panel_sticky_promotion(); | |
| 219 | - | |
| 220 | - return $settings; | |
| 221 | - } | |
| 222 | - | |
| 223 | 219 | public function add_v4_promotions_data( array $settings ): array { |
| 224 | 220 | if ( ! current_user_can( 'manage_options' ) ) { |
| 225 | 221 | return $settings; |
| 226 | 222 | } |
| @@ -280,12 +276,13 @@ | ||
| 280 | 276 | $config['priority'], |
| 281 | 277 | 2 |
| 282 | 278 | ); |
| 283 | 279 | } |
| 280 | + | |
| 281 | + ( new Birthday_Easter_Egg_Promotion() )->register(); | |
| 284 | 282 | } ); |
| 285 | 283 | |
| 286 | 284 | ( new Atomic_Form_Widget_Promotion() )->register(); |
| 287 | - ( new Collection_Loop_Widget_Promotion() )->register(); | |
| 288 | 285 | } |
| 289 | 286 | |
| 290 | 287 | public function inject_atomic_promotion_props( array $schema ): array { |
| 291 | 288 | foreach ( $this->get_atomic_promotion_configs() as $config ) { |