PluginProbe
Elementor Website Builder – more than just a page builder / 4.0.5
Elementor Website Builder – more than just a page builder v4.0.5
4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
elementor / modules / home / transformations / base / transformations-abstract.php

transformations-abstract.php in Elementor Website Builder – more than just a page builder 4.0.5, at modules/home/transformations/base/transformations-abstract.php

53 lines 1.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace Elementor\Modules\Home\Transformations\Base;
3
4 if ( ! defined( 'ABSPATH' ) ) {
5 exit; // Exit if accessed directly.
6 }
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 abstract class Transformations_Abstract {
16
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';
21
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;
49 }
50
51 abstract public function transform( array $home_screen_data ): array;
52 }
53