dvadf
File manager - Edit - /home/centroca/public_html/home.tar
Back
transformations/base/transformations-abstract.php 0000644 00000003563 15252521340 0016460 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations\Base; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } use Elementor\Core\Isolation\Elementor_Adapter; use Elementor\Core\Isolation\Elementor_Adapter_Interface; use Elementor\Core\Isolation\Plugin_Status_Adapter; use Elementor\Core\Isolation\Plugin_Status_Adapter_Interface; use Elementor\Core\Isolation\Wordpress_Adapter; use Elementor\Core\Isolation\Wordpress_Adapter_Interface; abstract class Transformations_Abstract { protected const USER_TIER_FREE = 'free'; protected const USER_TIER_PRO = 'pro'; protected const USER_TIER_AGENCY = 'agency'; protected const USER_TIER_ONE = 'one'; protected Wordpress_Adapter_Interface $wordpress_adapter; protected Plugin_Status_Adapter_Interface $plugin_status_adapter; protected Elementor_Adapter_Interface $elementor_adapter; /** * @param $args ?array{ * wordpress_adapter: Wordpress_Adapter_Interface, * plugin_status_adapter: Plugin_Status_Adapter_Interface, * elementor_adapter: Elementor_Adapter_Interface, * } the adapters to use in the transformations */ public function __construct( array $args = [] ) { $this->wordpress_adapter = $args['wordpress_adapter'] ?? new Wordpress_Adapter(); $this->plugin_status_adapter = $args['plugin_status_adapter'] ?? new Plugin_Status_Adapter( $this->wordpress_adapter ); $this->elementor_adapter = $args['elementor_adapter'] ?? new Elementor_Adapter(); } protected function get_tier() { $tier = $this->elementor_adapter->get_tier(); $filtered_tier = apply_filters( 'elementor/admin/homescreen_promotion_tier', $tier ) ?? $tier; return $this->normalize_tier( $filtered_tier ); } private function normalize_tier( string $tier ): string { return self::USER_TIER_AGENCY === $tier ? self::USER_TIER_ONE : $tier; } abstract public function transform( array $home_screen_data ): array; } transformations/create-site-settings-url.php 0000644 00000002323 15252521340 0015350 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Core\DocumentTypes\Page; use Elementor\Includes\EditorAssetsAPI; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Create_Site_Settings_Url extends Base\Transformations_Abstract { const SITE_SETTINGS_ITEMS = [ 'Site Settings', 'Site Logo', 'Global Colors', 'Global Fonts' ]; public function transform( array $home_screen_data ): array { if ( ! EditorAssetsAPI::has_valid_nested_array( $home_screen_data, [ 'get_started', 'repeater' ] ) ) { return $home_screen_data; } $site_settings_url_config = Page::get_site_settings_url_config(); $home_screen_data['get_started']['repeater'] = array_map( function( $repeater_item ) use ( $site_settings_url_config ) { if ( ! in_array( $repeater_item['title'], static::SITE_SETTINGS_ITEMS, true ) ) { return $repeater_item; } if ( ! empty( $repeater_item['tab_id'] ) ) { $site_settings_url_config['url'] = add_query_arg( [ 'active-tab' => $repeater_item['tab_id'] ], $site_settings_url_config['url'] ); } return array_merge( $repeater_item, $site_settings_url_config ); }, $home_screen_data['get_started']['repeater'] ); return $home_screen_data; } } transformations/filter-get-started-by-license.php 0000644 00000003204 15252521340 0016242 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Includes\EditorAssetsAPI; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Filter_Get_Started_By_License extends Transformations_Abstract { public bool $has_pro; private array $supported_tiers; public function __construct( $args ) { parent::__construct( $args ); $this->has_pro = Utils::has_pro(); $this->supported_tiers = [ self::USER_TIER_FREE, self::USER_TIER_PRO, self::USER_TIER_ONE, ]; } private function is_valid_item( $item ) { $user_tier = $this->get_tier(); if ( ! $this->has_pro && self::USER_TIER_FREE === $item['license'][0] ) { return true; } if ( $user_tier === $item['license'][0] ) { return true; } return $this->is_fallback_for_unsupported_licenses( $item['license'][0], $user_tier ); } private function is_fallback_for_unsupported_licenses( $item_tier, $user_tier ): bool { $is_supported_user_tier = in_array( $user_tier, $this->supported_tiers, true ); return ! $is_supported_user_tier && self::USER_TIER_PRO === $item_tier; } public function transform( array $home_screen_data ): array { if ( ! EditorAssetsAPI::has_valid_nested_array( $home_screen_data, [ 'get_started' ] ) ) { return $home_screen_data; } $new_get_started = []; foreach ( $home_screen_data['get_started'] as $index => $item ) { if ( $this->is_valid_item( $item ) ) { $new_get_started[] = $item; } } $home_screen_data['get_started'] = reset( $new_get_started ); return $home_screen_data; } } transformations/create-new-page-url.php 0000644 00000000752 15252521340 0014255 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Create_New_Page_Url extends Transformations_Abstract { public function transform( array $home_screen_data ): array { $home_screen_data['button_cta_url'] = Plugin::$instance->documents->get_create_new_post_url( 'page' ); return $home_screen_data; } } transformations/create-edit-website-url.php 0000644 00000001003 15252521340 0015125 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; } class Create_Edit_Website_Url extends Transformations_Abstract { public function transform( array $home_screen_data ): array { $home_screen_data['edit_website_url'] = wp_nonce_url( admin_url( 'admin.php?action=elementor_edit_website_redirect' ), 'elementor_action_edit_website' ); return $home_screen_data; } } transformations/filter-sidebar-promotion-by-license.php 0000644 00000002435 15252521340 0017461 0 ustar 00 <?php namespace elementor\modules\home\transformations; use Elementor\Includes\EditorAssetsAPI; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Filter_Sidebar_Promotion_By_License extends Transformations_Abstract { public function transform( array $home_screen_data ): array { if ( ! EditorAssetsAPI::has_valid_nested_array( $home_screen_data, [ 'sidebar_promotion_variants' ] ) ) { return $home_screen_data; } $user_tier = $this->get_tier(); $new_sidebar_promotion = array_filter( $home_screen_data['sidebar_promotion_variants'], function( $item ) use ( $user_tier ) { return $this->is_enabled( $item ) && $this->is_tier_acceptable( $item, $user_tier ); }); if ( empty( $new_sidebar_promotion ) ) { unset( $home_screen_data['sidebar_promotion_variants'] ); return $home_screen_data; } $home_screen_data['sidebar_promotion_variants'] = reset( $new_sidebar_promotion ); return $home_screen_data; } private function is_enabled( $item ) { return ! empty( $item['is_enabled'] ) && 'true' === $item['is_enabled']; } private function is_tier_acceptable( $item, $user_tier ) { return ! empty( $item['license'] ) && in_array( $user_tier, $item['license'] ); } } transformations/site-builder-config.php 0000644 00000010103 15252521340 0014333 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Site_Builder_Config extends Transformations_Abstract { const ASSETS_BASE_URL = 'https://assets.elementor.com/'; const SITE_BUILDER_URL = '/wp-admin/admin.php?page=elementor-app#site-builder'; const PLANNER_STEPS = [ 'INIT' => 0, 'CHAT' => 1, 'SITEMAP' => 2, 'WIREFRAMES' => 3, 'DEPLOYING' => 4, 'DEPLOYED_TO_PLUGIN' => 6, ]; public function transform( array $home_screen_data ): array { $site_builder = Plugin::$instance->app->get_component( 'site-builder' ); if ( ! $site_builder ) { unset( $home_screen_data['site_builder'] ); return $home_screen_data; } $site_builder_config = $site_builder->get_config(); if ( ! is_array( $site_builder_config ) ) { unset( $home_screen_data['site_builder'] ); return $home_screen_data; } $step_config = isset( $home_screen_data['site_builder'] ) && is_array( $home_screen_data['site_builder'] ) ? $home_screen_data['site_builder'] : []; $validated_step_config = $this->validate_and_sanitize_step_config( $step_config ); $snapshot = $this->wordpress_adapter->get_option( 'elementor_site_builder_snapshot' ); $home_screen_data['site_builder'] = array_merge( $site_builder_config, [ 'siteBuilderUrl' => self::SITE_BUILDER_URL, 'stepImages' => [ self::PLANNER_STEPS['INIT'] => self::ASSETS_BASE_URL . 'home-screen/v1/images/site-builder-start.png', self::PLANNER_STEPS['CHAT'] => self::ASSETS_BASE_URL . 'home-screen/v1/images/site-builder-start.png', self::PLANNER_STEPS['SITEMAP'] => self::ASSETS_BASE_URL . 'home-screen/v1/images/site-builder-sitemap.png', self::PLANNER_STEPS['WIREFRAMES'] => self::ASSETS_BASE_URL . 'home-screen/v1/images/site-builder-design.png', self::PLANNER_STEPS['DEPLOYING'] => self::ASSETS_BASE_URL . 'home-screen/v1/images/site-builder-expand.png', self::PLANNER_STEPS['DEPLOYED_TO_PLUGIN'] => self::ASSETS_BASE_URL . 'home-screen/v1/images/site-builder-expand.png', ], 'bgImage' => self::ASSETS_BASE_URL . 'home-screen/v1/images/site-planner-bg.jpg', 'plannerSteps' => self::PLANNER_STEPS, 'stepConfig' => $validated_step_config, 'site_builder_snapshot' => is_array( $snapshot ) ? $snapshot : [], ] ); return $home_screen_data; } private function validate_and_sanitize_step_config( array $step_config ): array { $validated = []; $valid_steps = array_values( self::PLANNER_STEPS ); foreach ( $step_config as $step_key => $step_data ) { if ( ! is_numeric( $step_key ) || ! in_array( (int) $step_key, $valid_steps, true ) ) { continue; } if ( ! is_array( $step_data ) ) { continue; } $validated_step = []; if ( isset( $step_data['hasInput'] ) ) { $validated_step['hasInput'] = (bool) $step_data['hasInput']; } if ( isset( $step_data['title'] ) && is_string( $step_data['title'] ) ) { $sanitized_title = sanitize_text_field( $step_data['title'] ); $validated_step['title'] = mb_substr( $sanitized_title, 0, 200 ); } if ( isset( $step_data['buttonLabel'] ) && is_string( $step_data['buttonLabel'] ) ) { $sanitized_label = sanitize_text_field( $step_data['buttonLabel'] ); $validated_step['buttonLabel'] = mb_substr( $sanitized_label, 0, 100 ); } $has_input = $validated_step['hasInput'] ?? false; if ( $has_input && isset( $step_data['placeholder'] ) && is_string( $step_data['placeholder'] ) ) { $sanitized_placeholder = sanitize_text_field( $step_data['placeholder'] ); $validated_step['placeholder'] = mb_substr( $sanitized_placeholder, 0, 200 ); } if ( ! $has_input && isset( $step_data['text'] ) && is_string( $step_data['text'] ) ) { $sanitized_text = sanitize_text_field( $step_data['text'] ); $validated_step['text'] = mb_substr( $sanitized_text, 0, 300 ); } if ( ! empty( $validated_step ) ) { $validated[ $step_key ] = $validated_step; } } return $validated; } } transformations/filter-top-section-by-license.php 0000644 00000003626 15252521340 0016273 0 ustar 00 <?php namespace elementor\modules\home\transformations; use Elementor\Core\Common\Modules\Connect\Module as ConnectModule; use Elementor\Includes\EditorAssetsAPI; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Filter_Top_Section_By_License extends Transformations_Abstract { public bool $has_pro; private array $supported_tiers; public function __construct( array $args = [] ) { parent::__construct( $args ); $this->has_pro = Utils::has_pro(); $this->supported_tiers = [ ConnectModule::ACCESS_TIER_FREE, ConnectModule::ACCESS_TIER_PRO_LEGACY, self::USER_TIER_ONE, ]; } private function is_valid_item( $item ) { if ( isset( $item['license'] ) ) { $item_tier = $item['license'][0]; $user_tier = $this->get_tier(); return $this->validate_tier( $item_tier, $user_tier ); } return false; } private function validate_tier( $item_tier, $user_tier ): bool { if ( $user_tier === $item_tier ) { return true; } $is_user_tier_supported = in_array( $user_tier, $this->supported_tiers, true ); if ( $is_user_tier_supported ) { return false; } $is_item_tier_free = ConnectModule::ACCESS_TIER_FREE === $item_tier; $is_valid = $this->has_pro !== $is_item_tier_free; $is_supported_item_tier = in_array( $item_tier, $this->supported_tiers, true ); return $is_valid && $is_supported_item_tier; } public function transform( array $home_screen_data ): array { if ( ! EditorAssetsAPI::has_valid_nested_array( $home_screen_data, [ 'top_with_licences' ] ) ) { return $home_screen_data; } $new_top = []; foreach ( $home_screen_data['top_with_licences'] as $index => $item ) { if ( $this->is_valid_item( $item ) ) { $new_top = $item; break; } } $home_screen_data['top_with_licences'] = $new_top; return $home_screen_data; } } classes/transformations-manager.php 0000644 00000004106 15252521340 0013553 0 ustar 00 <?php namespace Elementor\Modules\Home\Classes; use Elementor\Core\Isolation\Wordpress_Adapter; use Elementor\Core\Isolation\Plugin_Status_Adapter; use Elementor\Includes\EditorAssetsAPI; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Transformations_Manager { private static $cached_data = []; private const TRANSFORMATIONS = [ 'Create_New_Page_Url', 'Create_Edit_Website_Url', 'Filter_Get_Started_By_License', 'Filter_Sidebar_Promotion_By_License', 'Create_Site_Settings_Url', 'Filter_Top_Section_By_License', 'Site_Builder_Config', ]; protected array $home_screen_data; protected Wordpress_Adapter $wordpress_adapter; protected Plugin_Status_Adapter $plugin_status_adapter; protected array $transformation_classes = []; public function __construct( $home_screen_data ) { $this->home_screen_data = $home_screen_data; $this->wordpress_adapter = new Wordpress_Adapter(); $this->plugin_status_adapter = new Plugin_Status_Adapter( $this->wordpress_adapter ); $this->transformation_classes = $this->get_transformation_classes(); } public function run_transformations(): array { if ( ! EditorAssetsAPI::is_valid_data( $this->home_screen_data ) ) { return []; } if ( ! empty( self::$cached_data ) ) { return self::$cached_data; } $transformations = self::TRANSFORMATIONS; foreach ( $transformations as $transformation_id ) { $this->home_screen_data = $this->transformation_classes[ $transformation_id ]->transform( $this->home_screen_data ); } self::$cached_data = $this->home_screen_data; return $this->home_screen_data; } private function get_transformation_classes(): array { $classes = []; $transformations = self::TRANSFORMATIONS; $arguments = [ 'wordpress_adapter' => $this->wordpress_adapter, 'plugin_status_adapter' => $this->plugin_status_adapter, ]; foreach ( $transformations as $transformation_id ) { $class_name = '\\Elementor\\Modules\\Home\\Transformations\\' . $transformation_id; $classes[ $transformation_id ] = new $class_name( $arguments ); } return $classes; } } module.php 0000644 00000005066 15252521340 0006550 0 ustar 00 <?php namespace Elementor\Modules\Home; use Elementor\Core\Base\App as BaseApp; use Elementor\Includes\EditorAssetsAPI; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Module extends BaseApp { const PAGE_ID = 'home_screen'; public function get_name(): string { return 'home'; } public function __construct() { parent::__construct(); add_filter( 'elementor/document/urls/edit', [ $this, 'add_active_document_to_edit_link' ] ); } public function enqueue_fonts(): void { wp_enqueue_style( 'elementor-home-screen-fonts', 'https://fonts.googleapis.com/css2?family=Poppins:wght@400&display=swap', [], ELEMENTOR_VERSION ); } public function enqueue_home_screen_scripts(): void { if ( ! current_user_can( 'manage_options' ) ) { return; } $this->enqueue_fonts(); $min_suffix = Utils::is_script_debug() ? '' : '.min'; wp_enqueue_script( 'e-home-screen', ELEMENTOR_ASSETS_URL . 'js/e-home-screen' . $min_suffix . '.js', [ 'react', 'react-dom', 'elementor-common', 'elementor-v2-ui', ], ELEMENTOR_VERSION, true ); wp_set_script_translations( 'e-home-screen', 'elementor' ); wp_localize_script( 'e-home-screen', 'elementorHomeScreenData', $this->get_app_js_config() ); wp_enqueue_style( 'e-home-screen', $this->get_css_assets_url( 'modules/home/e-home-screen' ), [], ELEMENTOR_VERSION ); } public function add_active_document_to_edit_link( $edit_link ) { $active_document = Utils::get_super_global_value( $_GET, 'active-document' ) ?? null; $active_tab = Utils::get_super_global_value( $_GET, 'active-tab' ) ?? null; if ( $active_document ) { $edit_link = add_query_arg( 'active-document', $active_document, $edit_link ); } if ( $active_tab ) { $edit_link = add_query_arg( 'active-tab', $active_tab, $edit_link ); } return $edit_link; } private function get_app_js_config(): array { $editor_assets_api = new EditorAssetsAPI( $this->get_api_config() ); $api = new API( $editor_assets_api ); $config = $api->get_home_screen_items(); $config['wpRestNonce'] = wp_create_nonce( 'wp_rest' ); return $config; } private function get_api_config(): array { return [ EditorAssetsAPI::ASSETS_DATA_URL => 'https://assets.elementor.com/home-screen/v1/home-screen.json', EditorAssetsAPI::ASSETS_DATA_TRANSIENT_KEY => '_elementor_home_screen_data', EditorAssetsAPI::ASSETS_DATA_KEY => 'home-screen', ]; } public static function get_elementor_settings_page_id(): string { return 'elementor-settings'; } } api.php 0000644 00000001447 15252521340 0006033 0 ustar 00 <?php namespace Elementor\Modules\Home; use Elementor\Includes\EditorAssetsAPI; use Elementor\Modules\Home\Classes\Transformations_Manager; class API { protected EditorAssetsAPI $editor_assets_api; public function __construct( EditorAssetsAPI $editor_assets_api ) { $this->editor_assets_api = $editor_assets_api; } public function get_home_screen_items( $force_request = false ): array { $assets_data = $this->editor_assets_api->get_assets_data( $force_request ); $assets_data = apply_filters( 'elementor/core/admin/homescreen', $assets_data ); return $this->transform_home_screen_data( $assets_data ); } private function transform_home_screen_data( $json_data ): array { $transformers = new Transformations_Manager( $json_data ); return $transformers->run_transformations(); } }
dvadf
dvadf
| ver. 1.4 |
Github
|
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings