class-ecs-legacy-module.php
69 lines
| 1 | <?php |
| 2 | /** |
| 3 | * ECS Legacy Module |
| 4 | * |
| 5 | * Wraps the original Ele Custom Skin 3.x functionality (custom loop skin, |
| 6 | * loop item widget, Ajax pagination, dynamic style, admin bar menu). |
| 7 | * |
| 8 | * This module is active by default only when updating from ECS 3.x. |
| 9 | * New installs start with it disabled. It is marked as deprecated and |
| 10 | * will be removed in a future major version. |
| 11 | * |
| 12 | * @deprecated since ECS 4.0.0 |
| 13 | */ |
| 14 | |
| 15 | if ( ! defined( 'ABSPATH' ) ) { |
| 16 | exit; |
| 17 | } |
| 18 | |
| 19 | class ECS_Legacy_Module extends ECS_Module_Base { |
| 20 | |
| 21 | public function get_id(): string { |
| 22 | return 'legacy'; |
| 23 | } |
| 24 | |
| 25 | public function get_title(): string { |
| 26 | return __( 'ECS Legacy (Loop Skin)', 'ele-custom-skin' ); |
| 27 | } |
| 28 | |
| 29 | public function get_description(): string { |
| 30 | return __( 'Original ECS custom skin for Posts/Archive widgets, Loop Item widget, and Ajax pagination.', 'ele-custom-skin' ); |
| 31 | } |
| 32 | |
| 33 | public function is_deprecated(): bool { |
| 34 | return true; |
| 35 | } |
| 36 | |
| 37 | public function get_deprecated_notice(): string { |
| 38 | return __( 'Features from this module are being moved to dedicated modules in ECS Free. Keep it active to preserve your existing site, and switch to the new modules when ready.', 'ele-custom-skin' ); |
| 39 | } |
| 40 | |
| 41 | public function boot(): void { |
| 42 | // Always load: enqueue styles, pro-features notices, dynamic style fix. |
| 43 | require_once ELECS_DIR . 'includes/enqueue-styles.php'; |
| 44 | require_once ELECS_DIR . 'includes/pro-features.php'; |
| 45 | require_once ELECS_DIR . 'includes/dynamic-style.php'; |
| 46 | require_once ELECS_DIR . 'includes/ajax-pagination.php'; |
| 47 | |
| 48 | // Elementor Pro-dependent features (skin + theme builder + loop item). |
| 49 | if ( ecs_dependencies() ) { |
| 50 | add_action( 'elementor_pro/init', [ $this, 'boot_pro_features' ] ); |
| 51 | add_action( 'init', 'ecs_check_for_notification' ); |
| 52 | } |
| 53 | } |
| 54 | |
| 55 | public function boot_pro_features(): void { |
| 56 | require_once ELECS_DIR . 'includes/admin-bar-menu.php'; |
| 57 | require_once ELECS_DIR . 'theme-builder/init.php'; |
| 58 | require_once ELECS_DIR . 'modules/loop-item/module.php'; |
| 59 | } |
| 60 | |
| 61 | public function register_widgets( $widgets_manager ): void { |
| 62 | // The skin registers itself via elementor/widgets/register. |
| 63 | // We hook it here when the legacy module is active. |
| 64 | if ( ecs_dependencies() ) { |
| 65 | require_once ELECS_DIR . 'skins/skin-custom.php'; |
| 66 | } |
| 67 | } |
| 68 | } |
| 69 |