| @@ -2,12 +2,13 @@ | ||
| 2 | 2 | namespace Elementor\Modules\Home\Classes; |
| 3 | 3 | |
| 4 | 4 | use Elementor\Core\Isolation\Wordpress_Adapter; |
| 5 | 5 | use Elementor\Core\Isolation\Plugin_Status_Adapter; |
| 6 | -use Elementor\Includes\EditorAssetsAPI; | |
| 6 | +use Elementor\Core\Isolation\Wordpress_Adapter_Interface; | |
| 7 | +use Elementor\Plugin; | |
| 7 | 8 | |
| 8 | 9 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | - exit; // Exit if accessed directly. | |
| 10 | + exit; // Exit if accessed directly | |
| 10 | 11 | } |
| 11 | 12 | |
| 12 | 13 | class Transformations_Manager { |
| 13 | 14 | |
| @@ -14,19 +15,19 @@ | ||
| 14 | 15 | private static $cached_data = []; |
| 15 | 16 | |
| 16 | 17 | private const TRANSFORMATIONS = [ |
| 17 | 18 | 'Create_New_Page_Url', |
| 18 | - 'Create_Edit_Website_Url', | |
| 19 | + 'Filter_Plugins', | |
| 19 | 20 | 'Filter_Get_Started_By_License', |
| 20 | - 'Filter_Sidebar_Promotion_By_License', | |
| 21 | + 'Filter_Sidebar_Upgrade_By_License', | |
| 22 | + 'Filter_Condition_Introduction_Meta', | |
| 21 | 23 | 'Create_Site_Settings_Url', |
| 22 | 24 | 'Filter_Top_Section_By_License', |
| 23 | - 'Site_Builder_Config', | |
| 24 | 25 | ]; |
| 25 | 26 | |
| 26 | 27 | protected array $home_screen_data; |
| 27 | 28 | |
| 28 | - protected Wordpress_Adapter $wordpress_adapter; | |
| 29 | + protected Wordpress_Adapter_Interface $wordpress_adapter; | |
| 29 | 30 | |
| 30 | 31 | protected Plugin_Status_Adapter $plugin_status_adapter; |
| 31 | 32 | |
| 32 | 33 | protected array $transformation_classes = []; |
| @@ -31,19 +32,22 @@ | ||
| 31 | 32 | |
| 32 | 33 | protected array $transformation_classes = []; |
| 33 | 34 | |
| 34 | 35 | public function __construct( $home_screen_data ) { |
| 36 | + $container = Plugin::$instance->elementor_container(); | |
| 37 | + | |
| 38 | + if ( $container->has( Wordpress_Adapter::class ) ) { | |
| 39 | + $this->wordpress_adapter = $container->get( Wordpress_Adapter::class ); | |
| 40 | + } else { | |
| 41 | + $this->wordpress_adapter = new Wordpress_Adapter(); | |
| 42 | + } | |
| 43 | + | |
| 35 | 44 | $this->home_screen_data = $home_screen_data; |
| 36 | - $this->wordpress_adapter = new Wordpress_Adapter(); | |
| 37 | 45 | $this->plugin_status_adapter = new Plugin_Status_Adapter( $this->wordpress_adapter ); |
| 38 | 46 | $this->transformation_classes = $this->get_transformation_classes(); |
| 39 | 47 | } |
| 40 | 48 | |
| 41 | 49 | public function run_transformations(): array { |
| 42 | - if ( ! EditorAssetsAPI::is_valid_data( $this->home_screen_data ) ) { | |
| 43 | - return []; | |
| 44 | - } | |
| 45 | - | |
| 46 | 50 | if ( ! empty( self::$cached_data ) ) { |
| 47 | 51 | return self::$cached_data; |
| 48 | 52 | } |
| 49 | 53 | |