| @@ -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; |
| @@ -19,9 +18,9 @@ | ||
| 19 | 18 | use Elementor\Modules\Promotions\Pointers\Black_Friday; |
| 20 | 19 | use Elementor\Modules\Promotions\PropTypes\Promotion_Prop_Type; |
| 21 | 20 | 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\Collection_Loop_Widget_Promotion; | |
| 22 | +use Elementor\Modules\Promotions\Widgets\Birthday_Easter_Egg_Promotion; | |
| 24 | 23 | use Elementor\Widgets_Manager; |
| 25 | 24 | use Elementor\Utils; |
| 26 | 25 | use Elementor\Includes\EditorAssetsAPI; |
| 27 | 26 | use Elementor\Plugin; |
| @@ -38,9 +37,9 @@ | ||
| 38 | 37 | |
| 39 | 38 | const ADMIN_MENU_PROMOTIONS_PRIORITY = 120; |
| 40 | 39 | |
| 41 | 40 | public static function is_active() { |
| 42 | - return ! Utils::has_pro() || ! Utils::is_license_active(); | |
| 41 | + return ! Utils::has_pro(); | |
| 43 | 42 | } |
| 44 | 43 | |
| 45 | 44 | public function get_name() { |
| 46 | 45 | return 'promotions'; |
| @@ -48,17 +47,8 @@ | ||
| 48 | 47 | |
| 49 | 48 | public function __construct() { |
| 50 | 49 | parent::__construct(); |
| 51 | 50 | |
| 52 | - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] ); | |
| 53 | - | |
| 54 | - if ( Utils::has_pro() ) { | |
| 55 | - add_action( 'elementor/editor/before_enqueue_scripts', [ $this, 'enqueue_react_data' ] ); | |
| 56 | - $this->register_atomic_promotions(); | |
| 57 | - | |
| 58 | - return; | |
| 59 | - } | |
| 60 | - | |
| 61 | 51 | add_action( 'admin_init', function () { |
| 62 | 52 | $this->handle_external_redirects(); |
| 63 | 53 | } ); |
| 64 | 54 | |
| @@ -90,10 +80,14 @@ | ||
| 90 | 80 | if ( Conversion_Banner::should_display_banner() ) { |
| 91 | 81 | new Conversion_Banner(); |
| 92 | 82 | } |
| 93 | 83 | |
| 94 | - add_filter( 'elementor/editor/localize_settings', [ $this, 'add_editing_panel_sticky_promotion' ] ); | |
| 84 | + add_filter( 'elementor/editor/localize_settings', [ $this, 'add_v4_promotions_data' ] ); | |
| 95 | 85 | |
| 86 | + if ( Utils::has_pro() ) { | |
| 87 | + return; | |
| 88 | + } | |
| 89 | + | |
| 96 | 90 | add_action( 'elementor/controls/register', function ( Controls_Manager $controls_manager ) { |
| 97 | 91 | $controls_manager->register( new Controls\Promotion_Control() ); |
| 98 | 92 | } ); |
| 99 | 93 | |
| @@ -120,9 +114,9 @@ | ||
| 120 | 114 | if ( empty( $page ) ) { |
| 121 | 115 | return; |
| 122 | 116 | } |
| 123 | 117 | |
| 124 | - if ( in_array( $page, [ 'go_elementor_pro', 'elementor-one-upgrade' ], true ) ) { | |
| 118 | + if ( 'go_elementor_pro' === $page ) { | |
| 125 | 119 | wp_redirect( Go_Pro_Promotion_Item::get_url() ); // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect |
| 126 | 120 | die; |
| 127 | 121 | } |
| 128 | 122 | } |
| @@ -171,9 +165,8 @@ | ||
| 171 | 165 | 'react-dom', |
| 172 | 166 | 'backbone-marionette', |
| 173 | 167 | 'elementor-editor-modules', |
| 174 | 168 | 'elementor-v2-ui', |
| 175 | - 'elementor-v2-icons', | |
| 176 | 169 | ], |
| 177 | 170 | ELEMENTOR_VERSION, |
| 178 | 171 | true |
| 179 | 172 | ); |
| @@ -222,18 +215,8 @@ | ||
| 222 | 215 | EditorAssetsAPI::ASSETS_DATA_KEY => 'free-to-pro-upsell', |
| 223 | 216 | ]; |
| 224 | 217 | } |
| 225 | 218 | |
| 226 | - public function add_editing_panel_sticky_promotion( array $settings ): array { | |
| 227 | - if ( ! Plugin::$instance->experiments->is_feature_active( 'e_panel_promotions' ) ) { | |
| 228 | - return $settings; | |
| 229 | - } | |
| 230 | - | |
| 231 | - $settings['editingPanelStickyPromotion'] = Filtered_Promotions_Manager::get_editor_panel_sticky_promotion(); | |
| 232 | - | |
| 233 | - return $settings; | |
| 234 | - } | |
| 235 | - | |
| 236 | 219 | public function add_v4_promotions_data( array $settings ): array { |
| 237 | 220 | if ( ! current_user_can( 'manage_options' ) ) { |
| 238 | 221 | return $settings; |
| 239 | 222 | } |
| @@ -293,12 +276,13 @@ | ||
| 293 | 276 | $config['priority'], |
| 294 | 277 | 2 |
| 295 | 278 | ); |
| 296 | 279 | } |
| 280 | + | |
| 281 | + ( new Birthday_Easter_Egg_Promotion() )->register(); | |
| 297 | 282 | } ); |
| 298 | 283 | |
| 299 | 284 | ( new Atomic_Form_Widget_Promotion() )->register(); |
| 300 | - ( new Collection_Loop_Widget_Promotion() )->register(); | |
| 301 | 285 | } |
| 302 | 286 | |
| 303 | 287 | public function inject_atomic_promotion_props( array $schema ): array { |
| 304 | 288 | foreach ( $this->get_atomic_promotion_configs() as $config ) { |