| @@ -12,17 +12,20 @@ | ||
| 12 | 12 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Popups_Menu; |
| 13 | 13 | use Elementor\Modules\Promotions\AdminMenuItems\Editor_One_Submissions_Menu; |
| 14 | 14 | use Elementor\Modules\Promotions\AdminMenuItems\Go_Pro_Promotion_Item; |
| 15 | 15 | use Elementor\Modules\Promotions\Controls\Atomic_Promotion_Control; |
| 16 | +use Elementor\Modules\Promotions\Conversion_Banner; | |
| 16 | 17 | use Elementor\Modules\Promotions\Pointers\Birthday; |
| 17 | 18 | use Elementor\Modules\Promotions\Pointers\Black_Friday; |
| 18 | 19 | use Elementor\Modules\Promotions\PropTypes\Promotion_Prop_Type; |
| 19 | 20 | use Elementor\Modules\Promotions\Widgets\Ally_Dashboard_Widget; |
| 20 | 21 | use Elementor\Modules\Promotions\Widgets\Atomic_Form_Widget_Promotion; |
| 22 | +use Elementor\Modules\Promotions\Widgets\Birthday_Easter_Egg_Promotion; | |
| 21 | 23 | use Elementor\Widgets_Manager; |
| 22 | 24 | use Elementor\Utils; |
| 23 | 25 | use Elementor\Includes\EditorAssetsAPI; |
| 24 | 26 | use Elementor\Plugin; |
| 27 | +use Elementor\Modules\EditorOne\Classes\Menu_Config; | |
| 25 | 28 | use Elementor\Modules\EditorOne\Classes\Menu_Data_Provider; |
| 26 | 29 | |
| 27 | 30 | if ( ! defined( 'ABSPATH' ) ) { |
| 28 | 31 | exit; // Exit if accessed directly. |
| @@ -52,8 +55,12 @@ | ||
| 52 | 55 | add_action( 'elementor/editor-one/menu/register', function ( Menu_Data_Provider $menu_data_provider ) { |
| 53 | 56 | $this->register_editor_one_menu_items( $menu_data_provider ); |
| 54 | 57 | } ); |
| 55 | 58 | |
| 59 | + if ( Utils::is_sale_time() ) { | |
| 60 | + add_filter( 'add_menu_classes', [ $this, 'override_one_menu_upgrade_label_during_sale' ] ); | |
| 61 | + } | |
| 62 | + | |
| 56 | 63 | add_action( 'elementor/widgets/register', function( Widgets_Manager $manager ) { |
| 57 | 64 | foreach ( Api::get_promotion_widgets() as $widget_data ) { |
| 58 | 65 | $manager->register( new Widgets\Pro_Widget_Promotion( [], [ |
| 59 | 66 | 'widget_name' => $widget_data['name'], |
| @@ -69,8 +76,14 @@ | ||
| 69 | 76 | if ( Black_Friday::should_display_notice() ) { |
| 70 | 77 | new Black_Friday(); |
| 71 | 78 | } |
| 72 | 79 | |
| 80 | + if ( Conversion_Banner::should_display_banner() ) { | |
| 81 | + new Conversion_Banner(); | |
| 82 | + } | |
| 83 | + | |
| 84 | + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] ); | |
| 85 | + | |
| 73 | 86 | if ( Utils::has_pro() ) { |
| 74 | 87 | return; |
| 75 | 88 | } |
| 76 | 89 | |
| @@ -79,9 +92,8 @@ | ||
| 79 | 92 | } ); |
| 80 | 93 | |
| 81 | 94 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] ); |
| 82 | 95 | add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_editor_v4_alphachip' ] ); |
| 83 | - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] ); | |
| 84 | 96 | |
| 85 | 97 | // Add Ally promo |
| 86 | 98 | Ally_Dashboard_Widget::init(); |
| 87 | 99 | |
| @@ -108,8 +120,28 @@ | ||
| 108 | 120 | die; |
| 109 | 121 | } |
| 110 | 122 | } |
| 111 | 123 | |
| 124 | + public function override_one_menu_upgrade_label_during_sale( $menu ) { | |
| 125 | + global $submenu; | |
| 126 | + | |
| 127 | + $parent_slug = Menu_Config::ELEMENTOR_HOME_MENU_SLUG; | |
| 128 | + $upgrade_slug = 'elementor-one-upgrade'; | |
| 129 | + | |
| 130 | + if ( empty( $submenu[ $parent_slug ] ) ) { | |
| 131 | + return $menu; | |
| 132 | + } | |
| 133 | + | |
| 134 | + foreach ( $submenu[ $parent_slug ] as &$item ) { | |
| 135 | + if ( isset( $item[2] ) && $upgrade_slug === $item[2] ) { | |
| 136 | + $item[0] = esc_html__( 'Sale!', 'elementor' ) . '<br />' . esc_html__( 'Upgrade Now', 'elementor' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited | |
| 137 | + break; | |
| 138 | + } | |
| 139 | + } | |
| 140 | + | |
| 141 | + return $menu; | |
| 142 | + } | |
| 143 | + | |
| 112 | 144 | private function register_editor_one_menu_items( Menu_Data_Provider $menu_data_provider ) { |
| 113 | 145 | $menu_data_provider->register_menu( new Editor_One_Custom_Elements_Menu() ); |
| 114 | 146 | $menu_data_provider->register_menu( new Editor_One_Submissions_Menu() ); |
| 115 | 147 | $menu_data_provider->register_menu( new Editor_One_Fonts_Menu() ); |
| @@ -244,8 +276,10 @@ | ||
| 244 | 276 | $config['priority'], |
| 245 | 277 | 2 |
| 246 | 278 | ); |
| 247 | 279 | } |
| 280 | + | |
| 281 | + ( new Birthday_Easter_Egg_Promotion() )->register(); | |
| 248 | 282 | } ); |
| 249 | 283 | |
| 250 | 284 | ( new Atomic_Form_Widget_Promotion() )->register(); |
| 251 | 285 | } |