File manager - Edit - /home/palg2351/public_html/klanaobsesiindonesia.com/wp-includes/Text/Diff/Engine/home.tar
Back
api.php 0000644 00000001447 15172765647 0006060 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(); } } module.php 0000644 00000006301 15172765647 0006566 0 ustar 00 <?php namespace Elementor\Modules\Home; use Elementor\Core\Admin\Menu\Admin_Menu_Manager; use Elementor\Core\Base\App as BaseApp; use Elementor\Core\Experiments\Manager as Experiments_Manager; use Elementor\Includes\EditorAssetsAPI; use Elementor\Settings; use Elementor\Plugin; 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(); if ( ! $this->is_experiment_active() ) { return; } add_action( 'elementor/admin/menu/after_register', function ( Admin_Menu_Manager $admin_menu, array $hooks ) { $hook_suffix = 'toplevel_page_elementor'; add_action( "admin_print_scripts-{$hook_suffix}", [ $this, 'enqueue_home_screen_scripts' ] ); }, 10, 2 ); add_filter( 'elementor/document/urls/edit', [ $this, 'add_active_document_to_edit_link' ] ); } public function enqueue_home_screen_scripts(): void { if ( ! current_user_can( 'manage_options' ) ) { return; } $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() ); } public function is_experiment_active(): bool { return Plugin::$instance->experiments->is_feature_active( self::PAGE_ID ); } 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; } public static function get_experimental_data(): array { return [ 'name' => static::PAGE_ID, 'title' => esc_html__( 'Elementor Home Screen', 'elementor' ), 'description' => esc_html__( 'Default Elementor menu page.', 'elementor' ), 'hidden' => true, 'release_status' => Experiments_Manager::RELEASE_STATUS_STABLE, 'default' => Experiments_Manager::STATE_ACTIVE, ]; } private function get_app_js_config(): array { $editor_assets_api = new EditorAssetsAPI( $this->get_api_config() ); $api = new API( $editor_assets_api ); return $api->get_home_screen_items(); } 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 Plugin::$instance->experiments->is_feature_active( self::PAGE_ID ) ? 'elementor-settings' : Settings::PAGE_ID; } } classes/transformations-manager.php 0000644 00000004361 15172765647 0013603 0 ustar 00 <?php namespace Elementor\Modules\Home\Classes; use Elementor\Core\Isolation\Wordpress_Adapter; use Elementor\Core\Isolation\Plugin_Status_Adapter; use Elementor\Core\Isolation\Wordpress_Adapter_Interface; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Transformations_Manager { private static $cached_data = []; private const TRANSFORMATIONS = [ 'Create_New_Page_Url', 'Filter_Plugins', 'Filter_Get_Started_By_License', 'Filter_Sidebar_Promotion_By_License', 'Filter_Condition_Introduction_Meta', 'Create_Site_Settings_Url', 'Filter_Top_Section_By_License', ]; protected array $home_screen_data; protected Wordpress_Adapter_Interface $wordpress_adapter; protected Plugin_Status_Adapter $plugin_status_adapter; protected array $transformation_classes = []; public function __construct( $home_screen_data ) { $container = Plugin::$instance->elementor_container(); if ( $container->has( Wordpress_Adapter::class ) ) { $this->wordpress_adapter = $container->get( Wordpress_Adapter::class ); } else { $this->wordpress_adapter = new Wordpress_Adapter(); } $this->home_screen_data = $home_screen_data; $this->plugin_status_adapter = new Plugin_Status_Adapter( $this->wordpress_adapter ); $this->transformation_classes = $this->get_transformation_classes(); } public function run_transformations(): array { 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; } } transformations/create-site-settings-url.php 0000644 00000002170 15172765647 0015375 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Core\DocumentTypes\Page; 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 ( empty( $home_screen_data['get_started'] ) ) { 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-top-section-by-license.php 0000644 00000003016 15172765647 0016311 0 ustar 00 <?php namespace elementor\modules\home\transformations; use Elementor\Core\Common\Modules\Connect\Module as ConnectModule; 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, ]; } 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_item_tier_free = ConnectModule::ACCESS_TIER_FREE === $item_tier; $is_valid = $this->has_pro !== $is_item_tier_free; return $is_valid && in_array( $item_tier, $this->supported_tiers, true ); } public function transform( array $home_screen_data ): array { $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; } } transformations/filter-plugins.php 0000644 00000005210 15172765647 0013474 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Filter_Plugins extends Transformations_Abstract { const PLUGIN_IS_NOT_INSTALLED_FROM_WPORG = 'not-installed-wporg'; const PLUGIN_IS_NOT_INSTALLED_NOT_FROM_WPORG = 'not-installed-not-wporg'; const PLUGIN_IS_INSTALLED_NOT_ACTIVATED = 'installed-not-activated'; const PLUGIN_IS_ACTIVATED = 'activated'; public function transform( array $home_screen_data ): array { $home_screen_data['add_ons']['repeater'] = $this->get_add_ons_installation_status( $home_screen_data['add_ons']['repeater'] ); return $home_screen_data; } private function is_plugin( $add_on ): bool { return 'link' !== $add_on['type']; } private function get_add_ons_installation_status( array $add_ons ): array { $transformed_add_ons = []; foreach ( $add_ons as $add_on ) { if ( $this->is_plugin( $add_on ) ) { $this->handle_plugin_add_on( $add_on, $transformed_add_ons ); } else { $transformed_add_ons[] = $add_on; } } return $transformed_add_ons; } private function get_plugin_installation_status( $add_on ): string { $plugin_path = $add_on['file_path']; if ( ! $this->plugin_status_adapter->is_plugin_installed( $plugin_path ) ) { if ( 'wporg' === $add_on['type'] ) { return self::PLUGIN_IS_NOT_INSTALLED_FROM_WPORG; } return self::PLUGIN_IS_NOT_INSTALLED_NOT_FROM_WPORG; } if ( $this->wordpress_adapter->is_plugin_active( $plugin_path ) ) { return self::PLUGIN_IS_ACTIVATED; } return self::PLUGIN_IS_INSTALLED_NOT_ACTIVATED; } private function handle_plugin_add_on( array $add_on, array &$transformed_add_ons ): void { $installation_status = $this->get_plugin_installation_status( $add_on ); if ( self::PLUGIN_IS_ACTIVATED === $installation_status ) { return; } switch ( $this->get_plugin_installation_status( $add_on ) ) { case self::PLUGIN_IS_NOT_INSTALLED_NOT_FROM_WPORG: break; case self::PLUGIN_IS_NOT_INSTALLED_FROM_WPORG: $installation_url = $this->plugin_status_adapter->get_install_plugin_url( $add_on['file_path'] ); $add_on['url'] = html_entity_decode( $installation_url ); $add_on['target'] = '_self'; break; case self::PLUGIN_IS_INSTALLED_NOT_ACTIVATED: $activation_url = $this->plugin_status_adapter->get_activate_plugin_url( $add_on['file_path'] ); $add_on['url'] = html_entity_decode( $activation_url ); $add_on['button_label'] = esc_html__( 'Activate', 'elementor' ); $add_on['target'] = '_self'; break; } $transformed_add_ons[] = $add_on; } } transformations/filter-sidebar-promotion-by-license.php 0000644 00000002147 15172765647 0017506 0 ustar 00 <?php namespace elementor\modules\home\transformations; 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 { $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/create-new-page-url.php 0000644 00000000752 15172765647 0014302 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/filter-condition-introduction-meta.php 0000644 00000003620 15172765647 0017447 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; use Elementor\Modules\Home\Transformations\Base\Transformations_Abstract; use Elementor\User; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Filter_Condition_Introduction_Meta extends Transformations_Abstract { public array $introduction_meta_data; public function __construct( $args ) { parent::__construct( $args ); $this->introduction_meta_data = User::get_introduction_meta() ?? []; } public function transform( array $home_screen_data ): array { $introduction_meta_conditions = $this->get_introduction_meta_conditions( $home_screen_data ); $active_addons = $this->get_activated_addons( $introduction_meta_conditions ); $home_screen_data['add_ons']['repeater'] = $this->get_inactive_addons( $home_screen_data, $active_addons ); return $home_screen_data; } private function get_introduction_meta_conditions( $home_screen_data ): array { $add_ons = $home_screen_data['add_ons']['repeater']; $conditions = []; foreach ( $add_ons as $add_on ) { if ( array_key_exists( 'condition', $add_on ) && 'introduction_meta' === $add_on['condition']['key'] ) { $conditions[ $add_on['title'] ] = $add_on['condition']['value']; } } return $conditions; } private function get_activated_addons( $conditions ): array { $active_addons = []; foreach ( $conditions as $add_on_title => $introduction_meta_value ) { if ( ! empty( $this->introduction_meta_data[ $introduction_meta_value ] ) ) { $active_addons[] = $add_on_title; } } return $active_addons; } private function get_inactive_addons( $home_screen_data, $active_addons ): array { $add_ons = $home_screen_data['add_ons']['repeater']; $inactive_add_ons = []; foreach ( $add_ons as $add_on ) { if ( ! in_array( $add_on['title'], $active_addons ) ) { $inactive_add_ons[] = $add_on; } } return $inactive_add_ons; } } transformations/filter-get-started-by-license.php 0000644 00000002016 15172765647 0016267 0 ustar 00 <?php namespace Elementor\Modules\Home\Transformations; 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; public function __construct( $args ) { parent::__construct( $args ); $this->has_pro = Utils::has_pro(); } private function is_valid_item( $item ) { $has_pro_json_not_free = $this->has_pro && 'pro' === $item['license'][0]; $is_not_pro_json_not_pro = ! $this->has_pro && 'free' === $item['license'][0]; return $has_pro_json_not_free || $is_not_pro_json_not_pro; } public function transform( array $home_screen_data ): array { $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/base/transformations-abstract.php 0000644 00000003005 15172765647 0016474 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 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(); return apply_filters( 'elementor/admin/homescreen_promotion_tier', $tier ) ?? $tier; } abstract public function transform( array $home_screen_data ): array; }
| ver. 1.4 |
Github
|
.
| PHP 8.3.30 | Generation time: 0.19 |
proxy
|
phpinfo
|
Settings