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

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

74 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\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 'Filter_Plugins',
18 'Filter_Get_Started_By_License',
19 'Filter_Sidebar_Promotion_By_License',
20 'Filter_Condition_Introduction_Meta',
21 'Create_Site_Settings_Url',
22 'Filter_Top_Section_By_License',
23 ];
24
25 protected array $home_screen_data;
26
27 protected Wordpress_Adapter $wordpress_adapter;
28
29 protected Plugin_Status_Adapter $plugin_status_adapter;
30
31 protected array $transformation_classes = [];
32
33 public function __construct( $home_screen_data ) {
34 $this->home_screen_data = $home_screen_data;
35 $this->wordpress_adapter = new Wordpress_Adapter();
36 $this->plugin_status_adapter = new Plugin_Status_Adapter( $this->wordpress_adapter );
37 $this->transformation_classes = $this->get_transformation_classes();
38 }
39
40 public function run_transformations(): array {
41 if ( ! empty( self::$cached_data ) ) {
42 return self::$cached_data;
43 }
44
45 $transformations = self::TRANSFORMATIONS;
46
47 foreach ( $transformations as $transformation_id ) {
48 $this->home_screen_data = $this->transformation_classes[ $transformation_id ]->transform( $this->home_screen_data );
49 }
50
51 self::$cached_data = $this->home_screen_data;
52
53 return $this->home_screen_data;
54 }
55
56 private function get_transformation_classes(): array {
57 $classes = [];
58
59 $transformations = self::TRANSFORMATIONS;
60
61 $arguments = [
62 'wordpress_adapter' => $this->wordpress_adapter,
63 'plugin_status_adapter' => $this->plugin_status_adapter,
64 ];
65
66 foreach ( $transformations as $transformation_id ) {
67 $class_name = '\\Elementor\\Modules\\Home\\Transformations\\' . $transformation_id;
68 $classes[ $transformation_id ] = new $class_name( $arguments );
69 }
70
71 return $classes;
72 }
73 }
74