← All changes
|
modules/home/transformations/base/transformations-abstract.php
+6
-39
4.2.4
→
3.27.4
View file →
| @@ -1,52 +1,19 @@ | ||
| 1 | 1 | <?php |
| 2 | 2 | namespace Elementor\Modules\Home\Transformations\Base; |
| 3 | 3 | |
| 4 | 4 | if ( ! defined( 'ABSPATH' ) ) { |
| 5 | - exit; // Exit if accessed directly. | |
| 5 | + exit; // Exit if accessed directly | |
| 6 | 6 | } |
| 7 | 7 | |
| 8 | -use Elementor\Core\Isolation\Elementor_Adapter; | |
| 9 | -use Elementor\Core\Isolation\Elementor_Adapter_Interface; | |
| 10 | -use Elementor\Core\Isolation\Plugin_Status_Adapter; | |
| 11 | -use Elementor\Core\Isolation\Plugin_Status_Adapter_Interface; | |
| 12 | -use Elementor\Core\Isolation\Wordpress_Adapter; | |
| 13 | -use Elementor\Core\Isolation\Wordpress_Adapter_Interface; | |
| 14 | - | |
| 15 | 8 | abstract class Transformations_Abstract { |
| 16 | 9 | |
| 17 | - protected const USER_TIER_FREE = 'free'; | |
| 18 | - protected const USER_TIER_PRO = 'pro'; | |
| 19 | - protected const USER_TIER_AGENCY = 'agency'; | |
| 20 | - protected const USER_TIER_ONE = 'one'; | |
| 10 | + protected $wordpress_adapter; | |
| 11 | + protected $plugin_status_adapter; | |
| 21 | 12 | |
| 22 | - protected Wordpress_Adapter_Interface $wordpress_adapter; | |
| 23 | - protected Plugin_Status_Adapter_Interface $plugin_status_adapter; | |
| 24 | - protected Elementor_Adapter_Interface $elementor_adapter; | |
| 25 | - | |
| 26 | - /** | |
| 27 | - * @param $args ?array{ | |
| 28 | - * wordpress_adapter: Wordpress_Adapter_Interface, | |
| 29 | - * plugin_status_adapter: Plugin_Status_Adapter_Interface, | |
| 30 | - * elementor_adapter: Elementor_Adapter_Interface, | |
| 31 | - * } the adapters to use in the transformations | |
| 32 | - */ | |
| 33 | - public function __construct( array $args = [] ) { | |
| 34 | - $this->wordpress_adapter = $args['wordpress_adapter'] ?? new Wordpress_Adapter(); | |
| 35 | - $this->plugin_status_adapter = $args['plugin_status_adapter'] ?? new Plugin_Status_Adapter( $this->wordpress_adapter ); | |
| 36 | - $this->elementor_adapter = $args['elementor_adapter'] ?? new Elementor_Adapter(); | |
| 37 | - } | |
| 38 | - | |
| 39 | - protected function get_tier() { | |
| 40 | - $tier = $this->elementor_adapter->get_tier(); | |
| 41 | - | |
| 42 | - $filtered_tier = apply_filters( 'elementor/admin/homescreen_promotion_tier', $tier ) ?? $tier; | |
| 43 | - | |
| 44 | - return $this->normalize_tier( $filtered_tier ); | |
| 45 | - } | |
| 46 | - | |
| 47 | - private function normalize_tier( string $tier ): string { | |
| 48 | - return self::USER_TIER_AGENCY === $tier ? self::USER_TIER_ONE : $tier; | |
| 13 | + public function __construct( $args ) { | |
| 14 | + $this->wordpress_adapter = $args['wordpress_adapter'] ?? null; | |
| 15 | + $this->plugin_status_adapter = $args['plugin_status_adapter'] ?? null; | |
| 49 | 16 | } |
| 50 | 17 | |
| 51 | 18 | abstract public function transform( array $home_screen_data ): array; |
| 52 | 19 | } |