PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.3
Elementor Website Builder – more than just a page builder v3.34.3
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 / classes / transformations-manager.php

transformations-manager.php in Elementor Website Builder – more than just a page builder 3.34.3, at modules/home/classes/transformations-manager.php

76 lines 2.0 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\Classes;
3
4 use Elementor\Core\Isolation\Wordpress_Adapter;
5 use Elementor\Core\Isolation\Plugin_Status_Adapter;
6
7 if ( ! defined( 'ABSPATH' ) ) {
8 exit; // Exit if accessed directly.
9 }
10
11 class Transformations_Manager {
12
13 private static $cached_data = [];
14
15 private const TRANSFORMATIONS = [
16 'Create_New_Page_Url',
17 'Create_Edit_Website_Url',
18 'Filter_Plugins',
19 'Filter_Get_Started_By_License',
20 'Filter_Sidebar_Promotion_By_License',
21 'Filter_Condition_Introduction_Meta',
22 'Create_Site_Settings_Url',
23 'Filter_Top_Section_By_License',
24 'Filter_Add_Ons_By_License',
25 ];
26
27 protected array $home_screen_data;
28
29 protected Wordpress_Adapter $wordpress_adapter;
30
31 protected Plugin_Status_Adapter $plugin_status_adapter;
32
33 protected array $transformation_classes = [];
34
35 public function __construct( $home_screen_data ) {
36 $this->home_screen_data = $home_screen_data;
37 $this->wordpress_adapter = new Wordpress_Adapter();
38 $this->plugin_status_adapter = new Plugin_Status_Adapter( $this->wordpress_adapter );
39 $this->transformation_classes = $this->get_transformation_classes();
40 }
41
42 public function run_transformations(): array {
43 if ( ! empty( self::$cached_data ) ) {
44 return self::$cached_data;
45 }
46
47 $transformations = self::TRANSFORMATIONS;
48
49 foreach ( $transformations as $transformation_id ) {
50 $this->home_screen_data = $this->transformation_classes[ $transformation_id ]->transform( $this->home_screen_data );
51 }
52
53 self::$cached_data = $this->home_screen_data;
54
55 return $this->home_screen_data;
56 }
57
58 private function get_transformation_classes(): array {
59 $classes = [];
60
61 $transformations = self::TRANSFORMATIONS;
62
63 $arguments = [
64 'wordpress_adapter' => $this->wordpress_adapter,
65 'plugin_status_adapter' => $this->plugin_status_adapter,
66 ];
67
68 foreach ( $transformations as $transformation_id ) {
69 $class_name = '\\Elementor\\Modules\\Home\\Transformations\\' . $transformation_id;
70 $classes[ $transformation_id ] = new $class_name( $arguments );
71 }
72
73 return $classes;
74 }
75 }
76