Файловый менеджер - Редактировать - /var/www/xthruster/html/wp-content/uploads/flags/kits.tar
Назад
manager.php 0000644 00000032533 14721525343 0006703 0 ustar 00 <?php namespace Elementor\Core\Kits; use Elementor\Core\Base\Document; use Elementor\Core\Kits\Controls\Repeater; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; use Elementor\Plugin; use Elementor\Core\Files\CSS\Post as Post_CSS; use Elementor\Core\Files\CSS\Post_Preview as Post_Preview; use Elementor\Core\Documents_Manager; use Elementor\Core\Kits\Documents\Kit; use Elementor\TemplateLibrary\Source_Local; use Elementor\Utils; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Manager { const OPTION_ACTIVE = 'elementor_active_kit'; const OPTION_PREVIOUS = 'elementor_previous_kit'; const E_HASH_COMMAND_OPEN_SITE_SETTINGS = 'e:run:panel/global/open'; private $should_skip_trash_kit_confirmation = false; public function get_active_id() { return get_option( self::OPTION_ACTIVE ); } public function get_previous_id() { return get_option( self::OPTION_PREVIOUS ); } public function get_kit( $kit_id ) { $kit = Plugin::$instance->documents->get( $kit_id ); if ( ! $this->is_valid_kit( $kit ) ) { return $this->get_empty_kit_instance(); } return $kit; } public function get_active_kit() { return $this->get_kit( $this->get_active_id() ); } public function get_active_kit_for_frontend() { $kit = Plugin::$instance->documents->get_doc_for_frontend( $this->get_active_id() ); if ( ! $this->is_valid_kit( $kit ) ) { return $this->get_empty_kit_instance(); } return $kit; } /** * @param $kit * * @return bool */ private function is_valid_kit( $kit ) { return $kit && $kit instanceof Kit && 'trash' !== $kit->get_main_post()->post_status; } /** * Returns an empty kit for situation when there is no kit in the site. * * @return Kit * @throws \Exception */ private function get_empty_kit_instance() { return new Kit( [ 'settings' => [], 'post_id' => 0, ] ); } /** * Checks if specific post is a kit. * * @param $post_id * * @return bool */ public function is_kit( $post_id ) { $document = Plugin::$instance->documents->get( $post_id ); return $document && $document instanceof Kit && ! $document->is_revision(); } /** * Init kit controls. * * A temp solution in order to avoid init kit group control from within another group control. * * After moving the `default_font` to the kit, the Typography group control cause initialize the kit controls at: https://github.com/elementor/elementor/blob/e6e1db9eddef7e3c1a5b2ba0c2338e2af2a3bfe3/includes/controls/groups/typography.php#L91 * and because the group control is a singleton, its args are changed to the last kit group control. */ public function init_kit_controls() { $this->get_active_kit_for_frontend()->get_settings(); } public function get_current_settings( $setting = null ) { $kit = $this->get_active_kit_for_frontend(); if ( ! $kit ) { return ''; } return $kit->get_settings( $setting ); } public function create( array $kit_data = [], array $kit_meta_data = [] ) { $default_kit_data = [ 'post_status' => 'publish', ]; $kit_data = array_merge( $default_kit_data, $kit_data ); $kit_data['post_type'] = Source_Local::CPT; $kit = Plugin::$instance->documents->create( 'kit', $kit_data, $kit_meta_data ); if ( isset( $kit_data['settings'] ) ) { $kit->save( [ 'settings' => $kit_data['settings'] ] ); } return $kit->get_id(); } public function create_new_kit( $kit_name = '', $settings = [], $active = true ) { $kit_name = $kit_name ? $kit_name : esc_html__( 'Custom', 'elementor' ); $id = $this->create( [ 'post_title' => $kit_name, 'settings' => $settings, ] ); if ( $active ) { update_option( self::OPTION_PREVIOUS, $this->get_active_id() ); update_option( self::OPTION_ACTIVE, $id ); } return $id; } public function create_default() { return $this->create( [ 'post_title' => esc_html__( 'Default Kit', 'elementor' ), ] ); } /** * Create a default kit if needed. * * This action runs on activation hook, all the Plugin components do not exists and * the Document manager and Kits manager instances cannot be used. * * @return int|void|\WP_Error */ public static function create_default_kit() { if ( get_option( self::OPTION_ACTIVE ) ) { return; } $id = wp_insert_post( [ 'post_title' => esc_html__( 'Default Kit', 'elementor' ), 'post_type' => Source_Local::CPT, 'post_status' => 'publish', 'meta_input' => [ '_elementor_edit_mode' => 'builder', Document::TYPE_META_KEY => 'kit', ], ] ); update_option( self::OPTION_ACTIVE, $id ); return $id; } /** * @param $imported_kit_id int The id of the imported kit that should be deleted. * @param $active_kit_id int The id of the kit that should set as 'active_kit' after the deletion. * @param $previous_kit_id int The id of the kit that should set as 'previous_kit' after the deletion. * @return void */ public function revert( int $imported_kit_id, int $active_kit_id, int $previous_kit_id ) { // If the kit that should set as active is not a valid kit then abort the revert. if ( ! $this->is_kit( $active_kit_id ) ) { return; } // This a hacky solution to avoid from the revert process to be interrupted by the `trash_kit_confirmation`. $this->should_skip_trash_kit_confirmation = true; $kit = $this->get_kit( $imported_kit_id ); $kit->force_delete(); $this->should_skip_trash_kit_confirmation = false; update_option( self::OPTION_ACTIVE, $active_kit_id ); if ( $this->is_kit( $previous_kit_id ) ) { update_option( self::OPTION_PREVIOUS, $previous_kit_id ); } } /** * @param Documents_Manager $documents_manager */ public function register_document( $documents_manager ) { $documents_manager->register_document_type( 'kit', Kit::get_class_full_name() ); } public function localize_settings( $settings ) { $kit = $this->get_active_kit(); $kit_controls = $kit->get_controls(); $design_system_controls = [ 'colors' => $kit_controls['system_colors']['fields'], 'typography' => $kit_controls['system_typography']['fields'], ]; $settings = array_replace_recursive( $settings, [ 'kit_id' => $kit->get_main_id(), 'kit_config' => [ 'typography_prefix' => Global_Typography::TYPOGRAPHY_GROUP_PREFIX, 'design_system_controls' => $design_system_controls, ], 'user' => [ 'can_edit_kit' => $kit->is_editable_by_current_user(), ], ] ); return $settings; } public function preview_enqueue_styles() { $kit = $this->get_kit_for_frontend(); if ( $kit ) { // On preview, the global style is not enqueued. $this->frontend_before_enqueue_styles(); Plugin::$instance->frontend->print_fonts_links(); } } public function frontend_before_enqueue_styles() { $kit = $this->get_kit_for_frontend(); if ( $kit ) { if ( $kit->is_autosave() ) { $css_file = Post_Preview::create( $kit->get_id() ); } else { $css_file = Post_CSS::create( $kit->get_id() ); } $css_file->enqueue(); } } public function render_panel_html() { require __DIR__ . '/views/panel.php'; } public function get_kit_for_frontend() { $kit = false; $active_kit = $this->get_active_kit(); $is_kit_preview = is_preview() && isset( $_GET['preview_id'] ) && $active_kit->get_main_id() === (int) $_GET['preview_id']; if ( $is_kit_preview ) { $kit = Plugin::$instance->documents->get_doc_or_auto_save( $active_kit->get_main_id(), get_current_user_id() ); } elseif ( null !== $active_kit->get_main_post() && 'publish' === $active_kit->get_main_post()->post_status ) { $kit = $active_kit; } return $kit; } public function update_kit_settings_based_on_option( $key, $value ) { /** @var Kit $active_kit */ $active_kit = $this->get_active_kit(); if ( $active_kit->is_saving() ) { return; } $active_kit->update_settings( [ $key => $value ] ); } /** * Map Scheme To Global * * Convert a given scheme value to its corresponding default global value * * @param string $type 'color'/'typography' * @param $value * @return mixed */ private function map_scheme_to_global( $type, $value ) { $schemes_to_globals_map = [ 'color' => [ '1' => Global_Colors::COLOR_PRIMARY, '2' => Global_Colors::COLOR_SECONDARY, '3' => Global_Colors::COLOR_TEXT, '4' => Global_Colors::COLOR_ACCENT, ], 'typography' => [ '1' => Global_Typography::TYPOGRAPHY_PRIMARY, '2' => Global_Typography::TYPOGRAPHY_SECONDARY, '3' => Global_Typography::TYPOGRAPHY_TEXT, '4' => Global_Typography::TYPOGRAPHY_ACCENT, ], ]; return $schemes_to_globals_map[ $type ][ $value ]; } /** * Convert Scheme to Default Global * * If a control has a scheme property, convert it to a default Global. * * @param $scheme - Control scheme property * @return array - Control/group control args * @since 3.0.0 * @access public */ public function convert_scheme_to_global( $scheme ) { if ( isset( $scheme['type'] ) && isset( $scheme['value'] ) ) { //_deprecated_argument( $args['scheme'], '3.0.0', 'Schemes are now deprecated - use $args[\'global\'] instead.' ); return $this->map_scheme_to_global( $scheme['type'], $scheme['value'] ); } // Typography control 'scheme' properties usually only include the string with the typography value ('1'-'4'). return $this->map_scheme_to_global( 'typography', $scheme ); } public function register_controls() { $controls_manager = Plugin::$instance->controls_manager; $controls_manager->register( new Repeater() ); } public function is_custom_colors_enabled() { return ! get_option( 'elementor_disable_color_schemes' ); } public function is_custom_typography_enabled() { return ! get_option( 'elementor_disable_typography_schemes' ); } /** * Add kit wrapper body class. * * It should be added even for non Elementor pages, * in order to support embedded templates. */ private function add_body_class() { $kit = $this->get_kit_for_frontend(); if ( $kit ) { Plugin::$instance->frontend->add_body_class( 'elementor-kit-' . $kit->get_main_id() ); } } /** * Send a confirm message before move a kit to trash, or if delete permanently not for trash. * * @param $post_id * @param false $is_permanently_delete */ private function before_delete_kit( $post_id, $is_permanently_delete = false ) { if ( $this->should_skip_trash_kit_confirmation ) { return; } $document = Plugin::$instance->documents->get( $post_id ); if ( ! $document || ! $this->is_kit( $post_id ) || isset( $_GET['force_delete_kit'] ) || // phpcs:ignore -- nonce validation is not require here. ( $is_permanently_delete && $document->is_trash() ) ) { return; } ob_start(); require __DIR__ . '/views/trash-kit-confirmation.php'; $confirmation_content = ob_get_clean(); // PHPCS - the content does not contain user input value. wp_die( new \WP_Error( 'cant_delete_kit', $confirmation_content ) ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } /** * Add 'Edit with elementor -> Site Settings' in admin bar. * * @param [] $admin_bar_config * * @return array $admin_bar_config */ private function add_menu_in_admin_bar( $admin_bar_config ) { $document = Plugin::$instance->documents->get( get_the_ID() ); if ( ! $document || ! $document->is_built_with_elementor() ) { $recent_edited_post = Utils::get_recently_edited_posts_query( [ 'posts_per_page' => 1, ] ); if ( $recent_edited_post->post_count ) { $posts = $recent_edited_post->get_posts(); $document = Plugin::$instance->documents->get( reset( $posts )->ID ); } } if ( $document ) { $document_edit_url = add_query_arg( [ 'active-document' => $this->get_active_id(), ], $document->get_edit_url() ); $admin_bar_config['elementor_edit_page']['children'][] = [ 'id' => 'elementor_site_settings', 'title' => esc_html__( 'Site Settings', 'elementor' ), 'sub_title' => esc_html__( 'Site', 'elementor' ), 'href' => $document_edit_url, 'class' => 'elementor-site-settings', 'parent_class' => 'elementor-second-section', ]; } return $admin_bar_config; } public function __construct() { add_action( 'elementor/documents/register', [ $this, 'register_document' ] ); add_filter( 'elementor/editor/localize_settings', [ $this, 'localize_settings' ] ); add_filter( 'elementor/editor/footer', [ $this, 'render_panel_html' ] ); add_action( 'elementor/frontend/after_enqueue_styles', [ $this, 'frontend_before_enqueue_styles' ], 0 ); add_action( 'elementor/preview/enqueue_styles', [ $this, 'preview_enqueue_styles' ], 0 ); add_action( 'elementor/controls/register', [ $this, 'register_controls' ] ); add_action( 'wp_trash_post', function ( $post_id ) { $this->before_delete_kit( $post_id ); } ); add_action( 'before_delete_post', function ( $post_id ) { $this->before_delete_kit( $post_id, true ); } ); add_action( 'update_option_blogname', function ( $old_value, $value ) { $this->update_kit_settings_based_on_option( 'site_name', $value ); }, 10, 2 ); add_action( 'update_option_blogdescription', function ( $old_value, $value ) { $this->update_kit_settings_based_on_option( 'site_description', $value ); }, 10, 2 ); add_action( 'wp_head', function() { $this->add_body_class(); } ); add_filter( 'elementor/frontend/admin_bar/settings', function ( $admin_bar_config ) { return $this->add_menu_in_admin_bar( $admin_bar_config ); }, 9 /* Before site-editor (theme-builder) */ ); } } views/trash-kit-confirmation.php 0000644 00000003157 14721525343 0013022 0 ustar 00 <?php if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } /** * @var int $post_id * @var boolean $is_permanently_delete */ $config_url = add_query_arg( [ 'force_delete_kit' => '1' ], get_delete_post_link( $post_id, '', $is_permanently_delete ) ); ?> <h4> <?php echo esc_html__( 'Are you sure you want to delete your Site Settings?', 'elementor' ); ?> </h4> <p> <?php echo esc_html__( 'By removing this template you will delete your entire Site Settings. If this template is deleted, all associated settings: Global Colors & Fonts, Theme Style, Layout, Background, and Lightbox settings will be removed from your existing site. This action can not be undone.', 'elementor' ); ?> </p> <br/> <a class="btn btn-danger" href="<?php // PHPCS - the link is generated by WordPress. echo $config_url; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>"> <?php echo esc_html__( 'Delete', 'elementor' ); ?> </a> <a class="btn btn-primary" href="javascript:history.back()"> <?php echo esc_html__( 'Keep my settings', 'elementor' ); ?> </a> <style> /* In WordPress "die" screen there is very basic style, so the current css is required for basic button styles. */ .btn { text-decoration: none; padding: 9px 20px; font-weight: 500; border-radius: 3px; } .btn-danger { display: inline-block; color: #a00; } .btn-danger:hover, .btn-danger:focus, .btn-danger:active { color: #dc3232; } .btn-primary { color: #fff; background-color: #007cba; margin: 0 10px; } .btn-primary:hover, .btn-primary:focus, .btn-primary:active { background-color: #0071a1; color: #fff; } </style> views/panel.php 0000644 00000003213 14721525343 0007516 0 ustar 00 <script type="text/template" id="tmpl-elementor-kit-panel"> <main id="elementor-kit__panel-content__wrapper" class="elementor-panel-content-wrapper"></main> </script> <script type="text/template" id="tmpl-elementor-kit-panel-content"> <div id="elementor-kit-panel-content-controls"></div> <# const tabConfig = $e.components.get( 'panel/global' ).getActiveTabConfig(); if ( tabConfig.helpUrl ) { #> <div id="elementor-panel__editor__help"> <a id="elementor-panel__editor__help__link" href="{{ tabConfig.helpUrl }}" target="_blank"> <?php echo esc_html__( 'Need Help', 'elementor' ); ?> <i class="eicon-help-o"></i> </a> </div> <# } if ( tabConfig.additionalContent ) { #> {{{ tabConfig.additionalContent }}} <# } #> </script> <script type="text/template" id="tmpl-elementor-global-style-repeater-row"> <# let removeClass = 'remove', removeIcon = 'eicon-trash-o'; if ( ! itemActions.remove ) { removeClass += '--disabled'; removeIcon = 'eicon-disable-trash-o' } #> <# if ( itemActions.sort ) { #> <button class="elementor-repeater-row-tool elementor-repeater-row-tools elementor-repeater-tool-sort"> <i class="eicon-cursor-move" aria-hidden="true"></i> <span class="elementor-screen-only"><?php echo esc_html__( 'Reorder', 'elementor' ); ?></span> </button> <# } #> <button class="elementor-repeater-row-tool elementor-repeater-tool-{{{ removeClass }}}"> <i class="{{{ removeIcon }}}" aria-hidden="true"></i> <# if ( itemActions.remove ) { #> <span class="elementor-screen-only"><?php echo esc_html__( 'Remove', 'elementor' ); ?></span> <# } #> </button> <div class="elementor-repeater-row-controls"></div> </script> controls/repeater.php 0000644 00000003142 14721525343 0010735 0 ustar 00 <?php namespace Elementor\Core\Kits\Controls; use Elementor\Control_Repeater; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Repeater extends Control_Repeater { const CONTROL_TYPE = 'global-style-repeater'; /** * Get control type. * * Retrieve the control type, in this case `global-style-repeater`. * * @since 3.0.0 * @access public * * @return string Control type. */ public function get_type() { return self::CONTROL_TYPE; } /** * Get repeater control default settings. * * Retrieve the default settings of the repeater control. Used to return the * default settings while initializing the repeater control. * * @since 3.0.0 * @access protected * * @return array Control default settings. */ protected function get_default_settings() { $settings = parent::get_default_settings(); $settings['item_actions']['duplicate'] = false; return $settings; } /** * Render repeater control output in the editor. * * Used to generate the control HTML in the editor using Underscore JS * template. The variables for the class are available using `data` JS * object. * * @since 3.0.0 * @access public */ public function content_template() { ?> <div class="elementor-repeater-fields-wrapper"></div> <# if ( itemActions.add ) { #> <div class="elementor-button-wrapper"> <button class="elementor-button elementor-repeater-add" type="button"> <i class="eicon-plus" aria-hidden="true"></i> <span class="elementor-repeater__add-button__text">{{{ addButtonText }}}</span> </button> </div> <# } #> <?php } } documents/kit.php 0000644 00000012613 14721525343 0010056 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents; use Elementor\Core\DocumentTypes\PageBase; use Elementor\Core\Files\CSS\Post as Post_CSS; use Elementor\Core\Kits\Documents\Tabs; use Elementor\Core\Settings\Manager as SettingsManager; use Elementor\Core\Settings\Page\Manager as PageManager; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Kit extends PageBase { /** * @var Tabs\Tab_Base[] */ private $tabs; public function __construct( array $data = [] ) { parent::__construct( $data ); $this->register_tabs(); } public static function get_properties() { $properties = parent::get_properties(); $properties['has_elements'] = false; $properties['show_in_finder'] = false; $properties['show_on_admin_bar'] = false; $properties['edit_capability'] = 'edit_theme_options'; $properties['support_kit'] = true; return $properties; } public static function get_type() { return 'kit'; } public static function get_title() { return esc_html__( 'Kit', 'elementor' ); } /** * @return Tabs\Tab_Base[] */ public function get_tabs() { return $this->tabs; } /** * Retrieve a tab by ID. * * @param $id * * @return Tabs\Tab_Base */ public function get_tab( $id ) { return self::get_items( $this->get_tabs(), $id ); } protected function get_have_a_look_url() { return ''; } public static function get_editor_panel_config() { $config = parent::get_editor_panel_config(); $config['default_route'] = 'panel/global/menu'; $config['needHelpUrl'] = 'https://go.elementor.com/global-settings/'; return $config; } public function get_css_wrapper_selector() { return '.elementor-kit-' . $this->get_main_id(); } public function save( $data ) { foreach ( $this->tabs as $tab ) { $data = $tab->before_save( $data ); } $saved = parent::save( $data ); if ( ! $saved ) { return false; } // Should set is_saving to true, to avoid infinite loop when updating // settings like: 'site_name" or "site_description". $this->set_is_saving( true ); foreach ( $this->tabs as $tab ) { $tab->on_save( $data ); } $this->set_is_saving( false ); // When deleting a global color or typo, the css variable still exists in the frontend // but without any value and it makes the element to be un styled even if there is a default style for the base element, // for that reason this method removes css files of the entire site. Plugin::instance()->files_manager->clear_cache(); return $saved; } /** * Register a kit settings menu. * * @param $id * @param $class */ public function register_tab( $id, $class ) { $this->tabs[ $id ] = new $class( $this ); } /** * @inheritDoc */ protected function get_initial_config() { $config = parent::get_initial_config(); foreach ( $this->tabs as $id => $tab ) { $config['tabs'][ $id ] = [ 'id' => $id, 'title' => $tab->get_title(), 'icon' => $tab->get_icon(), 'group' => $tab->get_group(), 'helpUrl' => $tab->get_help_url(), 'additionalContent' => $tab->get_additional_tab_content(), ]; } return $config; } /** * @since 3.1.0 * @access protected */ protected function register_controls() { $this->register_document_controls(); foreach ( $this->tabs as $tab ) { $tab->register_controls(); } } protected function get_post_statuses() { return [ 'draft' => sprintf( '%s (%s)', esc_html__( 'Disabled', 'elementor' ), esc_html__( 'Draft', 'elementor' ) ), 'publish' => esc_html__( 'Published', 'elementor' ), ]; } public function add_repeater_row( $control_id, $item ) { $meta_key = PageManager::META_KEY; $document_settings = $this->get_meta( $meta_key ); if ( ! $document_settings ) { $document_settings = []; } if ( ! isset( $document_settings[ $control_id ] ) ) { $document_settings[ $control_id ] = []; } $document_settings[ $control_id ][] = $item; $page_settings_manager = SettingsManager::get_settings_managers( 'page' ); $page_settings_manager->save_settings( $document_settings, $this->get_id() ); /** @var Kit $autosave **/ $autosave = $this->get_autosave(); if ( $autosave ) { $autosave->add_repeater_row( $control_id, $item ); } // Remove Post CSS. $post_css = Post_CSS::create( $this->post->ID ); $post_css->delete(); // Refresh Cache. Plugin::$instance->documents->get( $this->post->ID, false ); $post_css = Post_CSS::create( $this->post->ID ); $post_css->enqueue(); } /** * Register default tabs (menu pages) for site settings. */ private function register_tabs() { $tabs = [ 'global-colors' => Tabs\Global_Colors::class, 'global-typography' => Tabs\Global_Typography::class, 'theme-style-typography' => Tabs\Theme_Style_Typography::class, 'theme-style-buttons' => Tabs\Theme_Style_Buttons::class, 'theme-style-images' => Tabs\Theme_Style_Images::class, 'theme-style-form-fields' => Tabs\Theme_Style_Form_Fields::class, 'settings-site-identity' => Tabs\Settings_Site_Identity::class, 'settings-background' => Tabs\Settings_Background::class, 'settings-layout' => Tabs\Settings_Layout::class, 'settings-lightbox' => Tabs\Settings_Lightbox::class, 'settings-page-transitions' => Tabs\Settings_Page_Transitions::class, 'settings-custom-css' => Tabs\Settings_Custom_CSS::class, ]; foreach ( $tabs as $id => $class ) { $this->register_tab( $id, $class ); } do_action( 'elementor/kit/register_tabs', $this ); } } documents/tabs/global-colors.php 0000644 00000005371 14721525343 0012762 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Core\Kits\Controls\Repeater as Global_Style_Repeater; use Elementor\Repeater; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Global_Colors extends Tab_Base { const COLOR_PRIMARY = 'globals/colors?id=primary'; const COLOR_SECONDARY = 'globals/colors?id=secondary'; const COLOR_TEXT = 'globals/colors?id=text'; const COLOR_ACCENT = 'globals/colors?id=accent'; public function get_id() { return 'global-colors'; } public function get_title() { return esc_html__( 'Global Colors', 'elementor' ); } public function get_group() { return 'global'; } public function get_icon() { return 'eicon-global-colors'; } public function get_help_url() { return 'https://go.elementor.com/global-colors/'; } protected function register_tab_controls() { $this->start_controls_section( 'section_global_colors', [ 'label' => esc_html__( 'Global Colors', 'elementor' ), 'tab' => $this->get_id(), ] ); $repeater = new Repeater(); $repeater->add_control( 'title', [ 'type' => Controls_Manager::TEXT, 'label_block' => true, 'required' => true, ] ); // Color Value $repeater->add_control( 'color', [ 'type' => Controls_Manager::COLOR, 'label_block' => true, 'selectors' => [ '{{WRAPPER}}' => '--e-global-color-{{_id.VALUE}}: {{VALUE}}', ], 'global' => [ 'active' => false, ], ] ); $default_colors = [ [ '_id' => 'primary', 'title' => esc_html__( 'Primary', 'elementor' ), 'color' => '#6EC1E4', ], [ '_id' => 'secondary', 'title' => esc_html__( 'Secondary', 'elementor' ), 'color' => '#54595F', ], [ '_id' => 'text', 'title' => esc_html__( 'Text', 'elementor' ), 'color' => '#7A7A7A', ], [ '_id' => 'accent', 'title' => esc_html__( 'Accent', 'elementor' ), 'color' => '#61CE70', ], ]; $this->add_control( 'heading_system_colors', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'System Colors', 'elementor' ), ] ); $this->add_control( 'system_colors', [ 'type' => Global_Style_Repeater::CONTROL_TYPE, 'fields' => $repeater->get_controls(), 'default' => $default_colors, 'item_actions' => [ 'add' => false, 'remove' => false, ], 'separator' => 'after', ] ); $this->add_control( 'heading_custom_colors', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Custom Colors', 'elementor' ), ] ); $this->add_control( 'custom_colors', [ 'type' => Global_Style_Repeater::CONTROL_TYPE, 'fields' => $repeater->get_controls(), ] ); $this->end_controls_section(); } } documents/tabs/theme-style-images.php 0000644 00000011017 14721525343 0013720 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Css_Filter; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Theme_Style_Images extends Tab_Base { public function get_id() { return 'theme-style-images'; } public function get_title() { return esc_html__( 'Images', 'elementor' ); } public function get_group() { return 'theme-style'; } public function get_icon() { return 'eicon-image'; } public function get_help_url() { return 'https://go.elementor.com/global-theme-style-images/'; } protected function register_tab_controls() { $image_selectors = [ '{{WRAPPER}} img', ]; $image_hover_selectors = [ '{{WRAPPER}} img:hover', ]; $image_selectors = implode( ',', $image_selectors ); $image_hover_selectors = implode( ',', $image_hover_selectors ); $this->start_controls_section( 'section_images', [ 'label' => esc_html__( 'Images', 'elementor' ), 'tab' => $this->get_id(), ] ); $this->add_default_globals_notice(); $this->start_controls_tabs( 'tabs_image_style' ); $this->start_controls_tab( 'tab_image_normal', [ 'label' => esc_html__( 'Normal', 'elementor' ), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_border', 'selector' => $image_selectors, 'fields_options' => [ 'color' => [ 'dynamic' => [], ], ], ] ); $this->add_responsive_control( 'image_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ $image_selectors => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'image_opacity', [ 'label' => esc_html__( 'Opacity', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ $image_selectors => 'opacity: {{SIZE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_box_shadow', 'exclude' => [ 'box_shadow_position', ], 'selector' => $image_selectors, ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_css_filters', 'selector' => '{{WRAPPER}} img', ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_image_hover', [ 'label' => esc_html__( 'Hover', 'elementor' ), ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'image_hover_border', 'selector' => '{{WRAPPER}} img:hover', 'fields_options' => [ 'color' => [ 'dynamic' => [], ], ], ] ); $this->add_responsive_control( 'image_hover_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ $image_hover_selectors => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_control( 'image_hover_opacity', [ 'label' => esc_html__( 'Opacity', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'max' => 1, 'min' => 0.10, 'step' => 0.01, ], ], 'selectors' => [ $image_hover_selectors => 'opacity: {{SIZE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'image_hover_box_shadow', 'exclude' => [ 'box_shadow_position', ], 'selector' => $image_hover_selectors, ] ); $this->add_group_control( Group_Control_Css_Filter::get_type(), [ 'name' => 'image_hover_css_filters', 'selector' => $image_hover_selectors, ] ); $this->add_control( 'image_hover_transition', [ 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (s)', 'type' => Controls_Manager::SLIDER, 'range' => [ 'px' => [ 'min' => 0, 'max' => 3, 'step' => 0.1, ], ], 'selectors' => [ $image_selectors => 'transition-duration: {{SIZE}}s', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } } documents/tabs/global-typography.php 0000644 00000012343 14721525343 0013664 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Core\Kits\Controls\Repeater as Global_Style_Repeater; use Elementor\Group_Control_Typography; use Elementor\Repeater; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Global_Typography extends Tab_Base { const TYPOGRAPHY_PRIMARY = 'globals/typography?id=primary'; const TYPOGRAPHY_SECONDARY = 'globals/typography?id=secondary'; const TYPOGRAPHY_TEXT = 'globals/typography?id=text'; const TYPOGRAPHY_ACCENT = 'globals/typography?id=accent'; const TYPOGRAPHY_NAME = 'typography'; const TYPOGRAPHY_GROUP_PREFIX = self::TYPOGRAPHY_NAME . '_'; public function get_id() { return 'global-typography'; } public function get_title() { return esc_html__( 'Global Fonts', 'elementor' ); } public function get_group() { return 'global'; } public function get_icon() { return 'eicon-t-letter'; } public function get_help_url() { return 'https://go.elementor.com/global-fonts/'; } protected function register_tab_controls() { $this->start_controls_section( 'section_text_style', [ 'label' => esc_html__( 'Global Fonts', 'elementor' ), 'tab' => $this->get_id(), ] ); $repeater = new Repeater(); $repeater->add_control( 'title', [ 'type' => Controls_Manager::TEXT, 'label_block' => true, 'required' => true, ] ); $repeater->add_group_control( Group_Control_Typography::get_type(), [ 'name' => self::TYPOGRAPHY_NAME, 'label' => '', 'global' => [ 'active' => false, ], 'fields_options' => [ 'font_family' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-font-family: "{{VALUE}}"', ], ], 'font_size' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-font-size: {{SIZE}}{{UNIT}}', ], ], 'font_weight' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-font-weight: {{VALUE}}', ], ], 'text_transform' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-text-transform: {{VALUE}}', ], ], 'font_style' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-font-style: {{VALUE}}', ], ], 'text_decoration' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-text-decoration: {{VALUE}}', ], ], 'line_height' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-line-height: {{SIZE}}{{UNIT}}', ], ], 'letter_spacing' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-letter-spacing: {{SIZE}}{{UNIT}}', ], ], 'word_spacing' => [ 'selectors' => [ '{{SELECTOR}}' => '--e-global-typography-{{external._id.VALUE}}-word-spacing: {{SIZE}}{{UNIT}}', ], ], ], ] ); $typography_key = self::TYPOGRAPHY_GROUP_PREFIX . 'typography'; $font_family_key = self::TYPOGRAPHY_GROUP_PREFIX . 'font_family'; $font_weight_key = self::TYPOGRAPHY_GROUP_PREFIX . 'font_weight'; $default_typography = [ [ '_id' => 'primary', 'title' => esc_html__( 'Primary', 'elementor' ), $typography_key => 'custom', $font_family_key => 'Roboto', $font_weight_key => '600', ], [ '_id' => 'secondary', 'title' => esc_html__( 'Secondary', 'elementor' ), $typography_key => 'custom', $font_family_key => 'Roboto Slab', $font_weight_key => '400', ], [ '_id' => 'text', 'title' => esc_html__( 'Text', 'elementor' ), $typography_key => 'custom', $font_family_key => 'Roboto', $font_weight_key => '400', ], [ '_id' => 'accent', 'title' => esc_html__( 'Accent', 'elementor' ), $typography_key => 'custom', $font_family_key => 'Roboto', $font_weight_key => '500', ], ]; $this->add_control( 'heading_system_typography', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'System Fonts', 'elementor' ), ] ); $this->add_control( 'system_typography', [ 'type' => Global_Style_Repeater::CONTROL_TYPE, 'fields' => $repeater->get_controls(), 'default' => $default_typography, 'item_actions' => [ 'add' => false, 'remove' => false, ], 'separator' => 'after', ] ); $this->add_control( 'heading_custom_typography', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Custom Fonts', 'elementor' ), ] ); $this->add_control( 'custom_typography', [ 'type' => Global_Style_Repeater::CONTROL_TYPE, 'fields' => $repeater->get_controls(), ] ); $this->add_control( 'default_generic_fonts', [ 'label' => esc_html__( 'Fallback Font Family', 'elementor' ), 'type' => Controls_Manager::TEXT, 'default' => 'Sans-serif', 'description' => esc_html__( 'The list of fonts used if the chosen font is not available.', 'elementor' ), 'label_block' => true, 'separator' => 'before', 'ai' => [ 'active' => false, ], ] ); $this->end_controls_section(); } } documents/tabs/settings-custom-css.php 0000644 00000001300 14721525343 0014145 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Settings_Custom_CSS extends Tab_Base { public function get_id() { return 'settings-custom-css'; } public function get_title() { return esc_html__( 'Custom CSS', 'elementor' ); } public function get_group() { return 'settings'; } public function get_icon() { return 'eicon-custom-css'; } public function get_help_url() { return 'https://go.elementor.com/global-custom-css/'; } protected function register_tab_controls() { Plugin::$instance->controls_manager->add_custom_css_controls( $this->parent, $this->get_id() ); } } documents/tabs/settings-page-transitions.php 0000644 00000001373 14721525343 0015346 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Plugin; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Settings_Page_Transitions extends Tab_Base { const TAB_ID = 'settings-page-transitions'; public function get_id() { return self::TAB_ID; } public function get_title() { return esc_html__( 'Page Transitions', 'elementor' ); } public function get_group() { return 'settings'; } public function get_icon() { return 'eicon-page-transition'; } public function get_help_url() { return 'https://go.elementor.com/page-transitions/'; } protected function register_tab_controls() { Plugin::$instance->controls_manager->add_page_transitions_controls( $this->parent, $this->get_id() ); } } documents/tabs/theme-style-buttons.php 0000644 00000013121 14721525343 0014147 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Group_Control_Background; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Typography; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Theme_Style_Buttons extends Tab_Base { public function get_id() { return 'theme-style-buttons'; } public function get_title() { return esc_html__( 'Buttons', 'elementor' ); } public function get_group() { return 'theme-style'; } public function get_icon() { return 'eicon-button'; } public function get_help_url() { return 'https://go.elementor.com/global-theme-style-buttons/'; } protected function register_tab_controls() { $button_selectors = [ '{{WRAPPER}} button', '{{WRAPPER}} input[type="button"]', '{{WRAPPER}} input[type="submit"]', '{{WRAPPER}} .elementor-button', ]; $button_hover_selectors = [ '{{WRAPPER}} button:hover', '{{WRAPPER}} button:focus', '{{WRAPPER}} input[type="button"]:hover', '{{WRAPPER}} input[type="button"]:focus', '{{WRAPPER}} input[type="submit"]:hover', '{{WRAPPER}} input[type="submit"]:focus', '{{WRAPPER}} .elementor-button:hover', '{{WRAPPER}} .elementor-button:focus', ]; $button_selector = implode( ',', $button_selectors ); $button_hover_selector = implode( ',', $button_hover_selectors ); $this->start_controls_section( 'section_buttons', [ 'label' => esc_html__( 'Buttons', 'elementor' ), 'tab' => $this->get_id(), ] ); $this->add_default_globals_notice(); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'button_typography', 'selector' => $button_selector, ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'button_text_shadow', 'selector' => $button_selector, ] ); $this->start_controls_tabs( 'tabs_button_style' ); $this->start_controls_tab( 'tab_button_normal', [ 'label' => esc_html__( 'Normal', 'elementor' ), ] ); $this->add_control( 'button_text_color', [ 'label' => esc_html__( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $button_selector => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'button_background', 'types' => [ 'classic', 'gradient' ], 'exclude' => [ 'image' ], 'selector' => $button_selector, 'fields_options' => [ 'background' => [ 'default' => 'classic', ], 'color' => [ 'dynamic' => [], ], 'color_b' => [ 'dynamic' => [], ], ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_box_shadow', 'selector' => $button_selector, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_border', 'selector' => $button_selector, 'fields_options' => [ 'color' => [ 'dynamic' => [], ], ], ] ); $this->add_control( 'button_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ $button_selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_button_hover', [ 'label' => esc_html__( 'Hover', 'elementor' ), ] ); $this->add_control( 'button_hover_text_color', [ 'label' => esc_html__( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $button_hover_selector => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'button_hover_background', 'types' => [ 'classic', 'gradient' ], 'exclude' => [ 'image' ], 'selector' => $button_hover_selector, 'fields_options' => [ 'background' => [ 'default' => 'classic', ], 'color' => [ 'dynamic' => [], ], 'color_b' => [ 'dynamic' => [], ], ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'button_hover_box_shadow', 'selector' => $button_hover_selector, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'button_hover_border', 'selector' => $button_hover_selector, 'fields_options' => [ 'color' => [ 'dynamic' => [], ], ], ] ); $this->add_control( 'button_hover_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ $button_hover_selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'button_padding', [ 'label' => esc_html__( 'Padding', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'selectors' => [ $button_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->end_controls_section(); } } documents/tabs/theme-style-form-fields.php 0000644 00000012470 14721525343 0014666 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Group_Control_Border; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Typography; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Theme_Style_Form_Fields extends Tab_Base { public function get_id() { return 'theme-style-form-fields'; } public function get_title() { return esc_html__( 'Form Fields', 'elementor' ); } public function get_group() { return 'theme-style'; } public function get_icon() { return 'eicon-form-horizontal'; } public function get_help_url() { return 'https://go.elementor.com/global-theme-style-form-fields/'; } protected function register_tab_controls() { $label_selectors = [ '{{WRAPPER}} label', ]; $input_selectors = [ '{{WRAPPER}} input:not([type="button"]):not([type="submit"])', '{{WRAPPER}} textarea', '{{WRAPPER}} .elementor-field-textual', ]; $input_focus_selectors = [ '{{WRAPPER}} input:focus:not([type="button"]):not([type="submit"])', '{{WRAPPER}} textarea:focus', '{{WRAPPER}} .elementor-field-textual:focus', ]; $label_selector = implode( ',', $label_selectors ); $input_selector = implode( ',', $input_selectors ); $input_focus_selector = implode( ',', $input_focus_selectors ); $this->start_controls_section( 'section_form_fields', [ 'label' => esc_html__( 'Form Fields', 'elementor' ), 'tab' => $this->get_id(), ] ); $this->add_default_globals_notice(); $this->add_control( 'form_label_heading', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Label', 'elementor' ), ] ); $this->add_control( 'form_label_color', [ 'label' => esc_html__( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $label_selector => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'form_label_typography', 'selector' => $label_selector, ] ); $this->add_control( 'form_field_heading', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Field', 'elementor' ), 'separator' => 'before', ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'form_field_typography', 'selector' => $input_selector, ] ); $this->start_controls_tabs( 'tabs_form_field_style' ); $this->start_controls_tab( 'tab_form_field_normal', [ 'label' => esc_html__( 'Normal', 'elementor' ), ] ); $this->add_form_field_state_tab_controls( 'form_field', $input_selector ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_form_field_focus', [ 'label' => esc_html__( 'Focus', 'elementor' ), ] ); $this->add_form_field_state_tab_controls( 'form_field_focus', $input_focus_selector ); $this->add_control( 'form_field_focus_transition_duration', [ 'label' => esc_html__( 'Transition Duration', 'elementor' ) . ' (ms)', 'type' => Controls_Manager::SLIDER, 'selectors' => [ $input_selector => 'transition: {{SIZE}}ms', ], 'range' => [ 'px' => [ 'min' => 0, 'max' => 3000, 'step' => 100, ], ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'form_field_padding', [ 'label' => esc_html__( 'Padding', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'selectors' => [ $input_selector => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->end_controls_section(); } private function add_form_field_state_tab_controls( $prefix, $selector ) { $this->add_control( $prefix . '_text_color', [ 'label' => esc_html__( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $selector => 'color: {{VALUE}};', ], ] ); $this->add_control( $prefix . '_accent_color', [ 'label' => esc_html__( 'Accent Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $selector => 'accent-color: {{VALUE}};', ], ] ); $this->add_control( $prefix . '_background_color', [ 'label' => esc_html__( 'Background Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $selector => 'background-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => $prefix . '_box_shadow', 'selector' => $selector, ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => $prefix . '_border', 'selector' => $selector, 'fields_options' => [ 'color' => [ 'dynamic' => [], ], ], ] ); $this->add_control( $prefix . '_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ $selector => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); } } documents/tabs/settings-lightbox.php 0000644 00000011400 14721525343 0013667 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Settings_Lightbox extends Tab_Base { public function get_id() { return 'settings-lightbox'; } public function get_title() { return esc_html__( 'Lightbox', 'elementor' ); } public function get_group() { return 'settings'; } public function get_icon() { return 'eicon-lightbox-expand'; } public function get_help_url() { return 'https://go.elementor.com/global-lightbox/'; } protected function register_tab_controls() { $this->start_controls_section( 'section_' . $this->get_id(), [ 'label' => $this->get_title(), 'tab' => $this->get_id(), ] ); $this->add_control( 'global_image_lightbox', [ 'label' => esc_html__( 'Image Lightbox', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'description' => esc_html__( 'Open all image links in a lightbox popup window. The lightbox will automatically work on any link that leads to an image file.', 'elementor' ), 'frontend_available' => true, ] ); $this->add_control( 'lightbox_enable_counter', [ 'label' => esc_html__( 'Counter', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'lightbox_enable_fullscreen', [ 'label' => esc_html__( 'Fullscreen', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'lightbox_enable_zoom', [ 'label' => esc_html__( 'Zoom', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'lightbox_enable_share', [ 'label' => esc_html__( 'Share', 'elementor' ), 'type' => Controls_Manager::SWITCHER, 'default' => 'yes', 'frontend_available' => true, ] ); $this->add_control( 'lightbox_title_src', [ 'label' => esc_html__( 'Title', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'None', 'elementor' ), 'title' => esc_html__( 'Title', 'elementor' ), 'caption' => esc_html__( 'Caption', 'elementor' ), 'alt' => esc_html__( 'Alt', 'elementor' ), 'description' => esc_html__( 'Description', 'elementor' ), ], 'default' => 'title', 'frontend_available' => true, ] ); $this->add_control( 'lightbox_description_src', [ 'label' => esc_html__( 'Description', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'None', 'elementor' ), 'title' => esc_html__( 'Title', 'elementor' ), 'caption' => esc_html__( 'Caption', 'elementor' ), 'alt' => esc_html__( 'Alt', 'elementor' ), 'description' => esc_html__( 'Description', 'elementor' ), ], 'default' => 'description', 'frontend_available' => true, ] ); $this->add_control( 'lightbox_color', [ 'label' => esc_html__( 'Background Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.elementor-lightbox' => 'background-color: {{VALUE}}', ], ] ); $this->add_control( 'lightbox_ui_color', [ 'label' => esc_html__( 'UI Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.elementor-lightbox' => '--lightbox-ui-color: {{VALUE}}', ], ] ); $this->add_control( 'lightbox_ui_color_hover', [ 'label' => esc_html__( 'UI Hover Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.elementor-lightbox' => '--lightbox-ui-color-hover: {{VALUE}}', ], ] ); $this->add_control( 'lightbox_text_color', [ 'label' => esc_html__( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '.elementor-lightbox' => '--lightbox-text-color: {{VALUE}}', ], ] ); $this->add_control( 'lightbox_icons_size', [ 'label' => esc_html__( 'Toolbar Icons Size', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], 'selectors' => [ '.elementor-lightbox' => '--lightbox-header-icons-size: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', ] ); $this->add_control( 'lightbox_slider_icons_size', [ 'label' => esc_html__( 'Navigation Icons Size', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], 'selectors' => [ '.elementor-lightbox' => '--lightbox-navigation-icons-size: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', ] ); $this->end_controls_section(); } } documents/tabs/settings-background.php 0000644 00000004045 14721525343 0014175 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Group_Control_Background; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Settings_Background extends Tab_Base { public function get_id() { return 'settings-background'; } public function get_title() { return esc_html__( 'Background', 'elementor' ); } public function get_group() { return 'settings'; } public function get_icon() { return 'eicon-background'; } public function get_help_url() { return 'https://go.elementor.com/global-background/'; } protected function register_tab_controls() { $this->start_controls_section( 'section_background', [ 'label' => $this->get_title(), 'tab' => $this->get_id(), ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'body_background', 'types' => [ 'classic', 'gradient' ], 'selector' => '{{WRAPPER}}', 'fields_options' => [ 'background' => [ 'frontend_available' => true, ], 'color' => [ 'dynamic' => [], ], 'color_b' => [ 'dynamic' => [], ], ], ] ); $this->add_control( 'mobile_browser_background', [ 'label' => esc_html__( 'Mobile Browser Background', 'elementor' ), 'type' => Controls_Manager::COLOR, 'description' => esc_html__( 'The `theme-color` meta tag will only be available in supported browsers and devices.', 'elementor' ), 'separator' => 'before', ] ); $this->add_control( 'body_overscroll_behavior', [ 'label' => esc_html__( 'Overscroll Behavior', 'elementor' ), 'type' => Controls_Manager::SELECT, 'options' => [ '' => esc_html__( 'Default', 'elementor' ), 'none' => esc_html__( 'None', 'elementor' ), 'auto' => esc_html__( 'Auto', 'elementor' ), 'contain' => esc_html__( 'Contain', 'elementor' ), ], 'separator' => 'before', 'selectors' => [ '{{WRAPPER}}' => 'overscroll-behavior: {{VALUE}};', ], ] ); $this->end_controls_section(); } } documents/tabs/settings-layout.php 0000644 00000027561 14721525343 0013403 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Core\Breakpoints\Breakpoint; use Elementor\Core\Breakpoints\Manager as Breakpoints_Manager; use Elementor\Plugin; use Elementor\Controls_Manager; use Elementor\Core\Base\Document; use Elementor\Modules\PageTemplates\Module as PageTemplatesModule; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Settings_Layout extends Tab_Base { const ACTIVE_BREAKPOINTS_CONTROL_ID = 'active_breakpoints'; public function get_id() { return 'settings-layout'; } public function get_title() { return esc_html__( 'Layout', 'elementor' ); } public function get_group() { return 'settings'; } public function get_icon() { return 'eicon-layout-settings'; } public function get_help_url() { return 'https://go.elementor.com/global-layout/'; } protected function register_tab_controls() { $breakpoints_default_config = Breakpoints_Manager::get_default_config(); $breakpoint_key_mobile = Breakpoints_Manager::BREAKPOINT_KEY_MOBILE; $breakpoint_key_tablet = Breakpoints_Manager::BREAKPOINT_KEY_TABLET; $this->start_controls_section( 'section_' . $this->get_id(), [ 'label' => esc_html__( 'Layout Settings', 'elementor' ), 'tab' => $this->get_id(), ] ); $this->add_responsive_control( 'container_width', [ 'label' => esc_html__( 'Content Width', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'default' => [ 'size' => 1140, ], 'tablet_default' => [ 'size' => $breakpoints_default_config[ $breakpoint_key_tablet ]['default_value'], ], 'mobile_default' => [ 'size' => $breakpoints_default_config[ $breakpoint_key_mobile ]['default_value'], ], 'range' => [ 'px' => [ 'min' => 300, 'max' => 1500, 'step' => 10, ], ], 'description' => esc_html__( 'Sets the default width of the content area (Default: 1140px)', 'elementor' ), 'selectors' => [ '.elementor-section.elementor-section-boxed > .elementor-container' => 'max-width: {{SIZE}}{{UNIT}}', '.e-con' => '--container-max-width: {{SIZE}}{{UNIT}}', ], ] ); $is_container_active = Plugin::instance()->experiments->is_feature_active( 'container' ); if ( $is_container_active ) { $this->add_responsive_control( 'container_padding', [ 'label' => esc_html__( 'Container Padding', 'elementor' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'description' => esc_html__( 'Sets the default space inside the container (Default is 10px)', 'elementor' ), 'selectors' => [ '.e-con' => '--container-default-padding-top: {{TOP}}{{UNIT}}; --container-default-padding-right: {{RIGHT}}{{UNIT}}; --container-default-padding-bottom: {{BOTTOM}}{{UNIT}}; --container-default-padding-left: {{LEFT}}{{UNIT}};', ], ] ); } $widgets_space_label = $is_container_active ? esc_html__( 'Gaps', 'elementor' ) : esc_html__( 'Widgets Space', 'elementor' ); $this->add_control( 'space_between_widgets', [ 'label' => $widgets_space_label, 'type' => Controls_Manager::GAPS, 'default' => [ 'row' => '20', 'column' => '20', 'unit' => 'px', ], 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'placeholder' => [ 'row' => '20', 'column' => '20', ], 'description' => esc_html__( 'Sets the default space between widgets (Default: 20px)', 'elementor' ), 'selectors' => [ '.elementor-widget:not(:last-child)' => 'margin-block-end: {{ROW}}{{UNIT}}', '.elementor-element' => '--widgets-spacing: {{ROW}}{{UNIT}} {{COLUMN}}{{UNIT}}', ], 'conversion_map' => [ 'old_key' => 'size', 'new_key' => 'column', ], 'upgrade_conversion_map' => [ 'old_key' => 'size', 'new_keys' => [ 'column', 'row' ], ], 'validators' => [ 'Number' => [ 'min' => 0, ], ], ] ); $this->add_control( 'page_title_selector', [ 'label' => esc_html__( 'Page Title Selector', 'elementor' ), 'type' => Controls_Manager::TEXT, 'default' => 'h1.entry-title', 'placeholder' => 'h1.entry-title', 'description' => esc_html__( 'Elementor lets you hide the page title. This works for themes that have "h1.entry-title" selector. If your theme\'s selector is different, please enter it above.', 'elementor' ), 'label_block' => true, 'ai' => [ 'active' => false, ], 'selectors' => [ // Hack to convert the value into a CSS selector. '' => '}{{VALUE}}{display: var(--page-title-display)', ], ] ); $this->add_control( 'stretched_section_container', [ 'label' => esc_html__( 'Stretched Section Fit To', 'elementor' ), 'type' => Controls_Manager::TEXT, 'placeholder' => 'body', 'description' => esc_html__( 'Enter parent element selector to which stretched sections will fit to (e.g. #primary / .wrapper / main etc). Leave blank to fit to page width.', 'elementor' ), 'label_block' => true, 'frontend_available' => true, 'ai' => [ 'active' => false, ], ] ); /** * @var PageTemplatesModule $page_templates_module */ $page_templates_module = Plugin::$instance->modules_manager->get_modules( 'page-templates' ); $page_templates = $page_templates_module->add_page_templates( [], null, null ); // Removes the Theme option from the templates because 'default' is already handled. unset( $page_templates[ PageTemplatesModule::TEMPLATE_THEME ] ); $page_template_control_options = [ 'label' => esc_html__( 'Default Page Layout', 'elementor' ), 'options' => [ // This is here because the "Theme" string is different than the default option's string. 'default' => esc_html__( 'Theme', 'elementor' ), ] + $page_templates, ]; $page_templates_module->add_template_controls( $this->parent, 'default_page_template', $page_template_control_options ); $this->end_controls_section(); $this->start_controls_section( 'section_breakpoints', [ 'label' => esc_html__( 'Breakpoints', 'elementor' ), 'tab' => $this->get_id(), ] ); $prefix = Breakpoints_Manager::BREAKPOINT_SETTING_PREFIX; $options = []; foreach ( $breakpoints_default_config as $breakpoint_key => $breakpoint ) { $options[ $prefix . $breakpoint_key ] = $breakpoint['label']; } if ( Plugin::$instance->experiments->is_feature_active( 'additional_custom_breakpoints' ) ) { $active_breakpoints_control_type = Controls_Manager::SELECT2; } else { $active_breakpoints_control_type = Controls_Manager::HIDDEN; } $this->add_control( self::ACTIVE_BREAKPOINTS_CONTROL_ID, [ 'label' => esc_html__( 'Active Breakpoints', 'elementor' ), 'type' => $active_breakpoints_control_type, 'description' => esc_html__( 'Mobile and Tablet options cannot be deleted.', 'elementor' ), 'options' => $options, 'default' => [ $prefix . $breakpoint_key_mobile, $prefix . $breakpoint_key_tablet, ], 'select2options' => [ 'allowClear' => false, ], 'lockedOptions' => [ $prefix . $breakpoint_key_mobile, $prefix . $breakpoint_key_tablet, ], 'label_block' => true, 'render_type' => 'none', 'frontend_available' => true, 'multiple' => true, ] ); $this->add_breakpoints_controls(); // Include the old mobile and tablet breakpoint controls as hidden for backwards compatibility. $this->add_control( 'viewport_md', [ 'type' => Controls_Manager::HIDDEN ] ); $this->add_control( 'viewport_lg', [ 'type' => Controls_Manager::HIDDEN ] ); $this->end_controls_section(); } /** * Before Save * * Runs Before the Kit document is saved. * * For backwards compatibility, when the mobile and tablet breakpoints are updated, we also update the * old breakpoint settings ('viewport_md', 'viewport_lg' ) with the saved values + 1px. The reason 1px * is added is because the old breakpoints system was min-width based, and the new system introduced in * Elementor v3.2.0 is max-width based. * * @since 3.2.0 * * @param array $data * @return array $data */ public function before_save( array $data ) { // When creating a default kit, $data['settings'] is empty and should remain empty, so settings. if ( empty( $data['settings'] ) ) { return $data; } $prefix = Breakpoints_Manager::BREAKPOINT_SETTING_PREFIX; $mobile_breakpoint_key = $prefix . Breakpoints_Manager::BREAKPOINT_KEY_MOBILE; $tablet_breakpoint_key = $prefix . Breakpoints_Manager::BREAKPOINT_KEY_TABLET; $default_breakpoint_config = Breakpoints_Manager::get_default_config(); // Update the old mobile breakpoint. If the setting is empty, use the default value. $data['settings'][ $prefix . 'md' ] = empty( $data['settings'][ $mobile_breakpoint_key ] ) ? $default_breakpoint_config[ Breakpoints_Manager::BREAKPOINT_KEY_MOBILE ]['default_value'] + 1 : $data['settings'][ $mobile_breakpoint_key ] + 1; // Update the old tablet breakpoint. If the setting is empty, use the default value. $data['settings'][ $prefix . 'lg' ] = empty( $data['settings'][ $tablet_breakpoint_key ] ) ? $default_breakpoint_config[ Breakpoints_Manager::BREAKPOINT_KEY_TABLET ]['default_value'] + 1 : $data['settings'][ $tablet_breakpoint_key ] + 1; return $data; } public function on_save( $data ) { if ( ! isset( $data['settings'] ) || ( isset( $data['settings']['post_status'] ) && Document::STATUS_PUBLISH !== $data['settings']['post_status'] ) ) { return; } $should_compile_css = false; $breakpoints_default_config = Breakpoints_Manager::get_default_config(); foreach ( $breakpoints_default_config as $breakpoint_key => $default_config ) { $breakpoint_setting_key = Breakpoints_Manager::BREAKPOINT_SETTING_PREFIX . $breakpoint_key; if ( isset( $data['settings'][ $breakpoint_setting_key ] ) ) { $should_compile_css = true; } } if ( $should_compile_css ) { Breakpoints_Manager::compile_stylesheet_templates(); } } private function add_breakpoints_controls() { $default_breakpoints_config = Breakpoints_Manager::get_default_config(); $prefix = Breakpoints_Manager::BREAKPOINT_SETTING_PREFIX; // If the ACB experiment is inactive, only add the mobile and tablet controls. if ( ! Plugin::$instance->experiments->is_feature_active( 'additional_custom_breakpoints' ) ) { $default_breakpoints_config = array_intersect_key( $default_breakpoints_config, array_flip( [ Breakpoints_Manager::BREAKPOINT_KEY_MOBILE, Breakpoints_Manager::BREAKPOINT_KEY_TABLET ] ) ); } // Add a control for each of the **default** breakpoints. foreach ( $default_breakpoints_config as $breakpoint_key => $default_breakpoint_config ) { $this->add_control( 'breakpoint_' . $breakpoint_key . '_heading', [ 'label' => $default_breakpoint_config['label'], 'type' => Controls_Manager::HEADING, 'separator' => 'before', 'conditions' => [ 'terms' => [ [ 'name' => 'active_breakpoints', 'operator' => 'contains', 'value' => $prefix . $breakpoint_key, ], ], ], ] ); $control_config = [ 'label' => esc_html__( 'Breakpoint', 'elementor' ) . ' (px)', 'type' => Controls_Manager::NUMBER, 'placeholder' => $default_breakpoint_config['default_value'], 'frontend_available' => true, 'validators' => [ 'Breakpoint' => [ 'breakpointName' => $breakpoint_key, ], ], 'conditions' => [ 'terms' => [ [ 'name' => 'active_breakpoints', 'operator' => 'contains', 'value' => $prefix . $breakpoint_key, ], ], ], ]; if ( Breakpoints_Manager::BREAKPOINT_KEY_WIDESCREEN === $breakpoint_key ) { $control_config['description'] = esc_html__( 'Widescreen breakpoint settings will apply from the selected value and up.', 'elementor' ); } // Add the breakpoint Control itself. $this->add_control( $prefix . $breakpoint_key, $control_config ); } } } documents/tabs/tab-base.php 0000644 00000004224 14721525343 0011675 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Core\Kits\Documents\Kit; use Elementor\Core\Kits\Manager; use Elementor\Plugin; use Elementor\Settings; use Elementor\Sub_Controls_Stack; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } abstract class Tab_Base extends Sub_Controls_Stack { /** * @var Kit */ protected $parent; abstract protected function register_tab_controls(); public function get_group() { return 'settings'; } public function get_icon() { return ''; } public function get_help_url() { return ''; } public function get_additional_tab_content() { return ''; } public function register_controls() { $this->register_tab(); $this->register_tab_controls(); } public function on_save( $data ) {} /** * Before Save * * Allows for modifying the kit data before it is saved to the database. * * @param array $data * @return array */ public function before_save( array $data ) { return $data; } protected function register_tab() { Controls_Manager::add_tab( $this->get_id(), $this->get_title() ); } protected function add_default_globals_notice() { // Get the current section config (array - section id and tab) to use for creating a unique control ID and name $current_section = $this->parent->get_current_section(); /** @var Manager $module */ $kits_manager = Plugin::$instance->kits_manager; if ( $kits_manager->is_custom_colors_enabled() || $kits_manager->is_custom_typography_enabled() ) { $this->add_control( $current_section['section'] . '_schemes_notice', [ 'name' => $current_section['section'] . '_schemes_notice', 'type' => Controls_Manager::ALERT, 'alert_type' => 'warning', 'content' => sprintf( /* translators: 1: Link open tag, 2: Link close tag. */ esc_html__( 'In order for Theme Style to affect all relevant Elementor elements, please disable Default Colors and Fonts from the %1$sSettings Page%2$s.', 'elementor' ), '<a href="' . Settings::get_settings_tab_url( 'general' ) . '" target="_blank">', '</a>' ), 'render_type' => 'ui', ] ); } } } documents/tabs/theme-style-typography.php 0000644 00000010676 14721525343 0014673 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Group_Control_Typography; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Theme_Style_Typography extends Tab_Base { public function get_id() { return 'theme-style-typography'; } public function get_title() { return esc_html__( 'Typography', 'elementor' ); } public function get_group() { return 'theme-style'; } public function get_icon() { return 'eicon-typography-1'; } public function get_help_url() { return 'https://go.elementor.com/global-theme-style-typography/'; } public function register_tab_controls() { $this->start_controls_section( 'section_typography', [ 'label' => esc_html__( 'Typography', 'elementor' ), 'tab' => $this->get_id(), ] ); $this->add_default_globals_notice(); $this->add_control( 'body_heading', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Body', 'elementor' ), ] ); $this->add_control( 'body_color', [ 'label' => esc_html__( 'Text Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ '{{WRAPPER}}' => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'body_typography', 'selector' => '{{WRAPPER}}', ] ); $this->add_responsive_control( 'paragraph_spacing', [ 'label' => esc_html__( 'Paragraph Spacing', 'elementor' ), 'type' => Controls_Manager::SLIDER, 'selectors' => [ '{{WRAPPER}} p' => 'margin-bottom: {{SIZE}}{{UNIT}}', ], 'range' => [ 'px' => [ 'max' => 100, ], 'em' => [ 'min' => 0.1, 'max' => 20, ], ], 'size_units' => [ 'px', 'em', 'rem', 'vh', 'custom' ], ] ); //Link Selectors $link_selectors = [ '{{WRAPPER}} a', ]; $link_hover_selectors = [ '{{WRAPPER}} a:hover', ]; $link_selectors = implode( ',', $link_selectors ); $link_hover_selectors = implode( ',', $link_hover_selectors ); $this->add_control( 'link_heading', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Link', 'elementor' ), 'separator' => 'before', ] ); $this->start_controls_tabs( 'tabs_link_style' ); $this->start_controls_tab( 'tab_link_normal', [ 'label' => esc_html__( 'Normal', 'elementor' ), ] ); $this->add_control( 'link_normal_color', [ 'label' => esc_html__( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $link_selectors => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'link_normal_typography', 'selector' => $link_selectors, ] ); $this->end_controls_tab(); $this->start_controls_tab( 'tab_link_hover', [ 'label' => esc_html__( 'Hover', 'elementor' ), ] ); $this->add_control( 'link_hover_color', [ 'label' => esc_html__( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $link_hover_selectors => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'link_hover_typography', 'selector' => $link_hover_selectors, ] ); $this->end_controls_tab(); $this->end_controls_tabs(); // Headings. $this->add_element_controls( 'H1', 'h1', '{{WRAPPER}} h1' ); $this->add_element_controls( 'H2', 'h2', '{{WRAPPER}} h2' ); $this->add_element_controls( 'H3', 'h3', '{{WRAPPER}} h3' ); $this->add_element_controls( 'H4', 'h4', '{{WRAPPER}} h4' ); $this->add_element_controls( 'H5', 'h5', '{{WRAPPER}} h5' ); $this->add_element_controls( 'H6', 'h6', '{{WRAPPER}} h6' ); $this->end_controls_section(); } private function add_element_controls( $label, $prefix, $selector ) { $this->add_control( $prefix . '_heading', [ 'type' => Controls_Manager::HEADING, 'label' => $label, 'separator' => 'before', ] ); $this->add_control( $prefix . '_color', [ 'label' => esc_html__( 'Color', 'elementor' ), 'type' => Controls_Manager::COLOR, 'dynamic' => [], 'selectors' => [ $selector => 'color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => $prefix . '_typography', 'selector' => $selector, ] ); } } documents/tabs/settings-site-identity.php 0000644 00000010421 14721525343 0014644 0 ustar 00 <?php namespace Elementor\Core\Kits\Documents\Tabs; use Elementor\Controls_Manager; use Elementor\Core\Base\Document; use Elementor\Core\Files\Uploads_Manager; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Settings_Site_Identity extends Tab_Base { public function get_id() { return 'settings-site-identity'; } public function get_title() { return esc_html__( 'Site Identity', 'elementor' ); } public function get_group() { return 'settings'; } public function get_icon() { return 'eicon-site-identity'; } public function get_help_url() { return 'https://go.elementor.com/global-site-identity/'; } protected function register_tab_controls() { $custom_logo_id = get_theme_mod( 'custom_logo' ); $custom_logo_src = wp_get_attachment_image_src( $custom_logo_id, 'full' ); $site_icon_id = get_option( 'site_icon' ); $site_icon_src = wp_get_attachment_image_src( $site_icon_id, 'full' ); // If CANNOT upload svg normally, it will add a custom inline option to force svg upload if requested. (in logo and favicon) $should_include_svg_inline_option = ! Uploads_Manager::are_unfiltered_uploads_enabled(); $this->start_controls_section( 'section_' . $this->get_id(), [ 'label' => $this->get_title(), 'tab' => $this->get_id(), ] ); $this->add_control( $this->get_id() . '_refresh_notice', [ 'type' => Controls_Manager::ALERT, 'alert_type' => 'info', 'content' => sprintf( /* translators: 1: Link open tag, 2: Link open tag, 3: Link close tag. */ esc_html__( 'Changes will be reflected only after %1$s saving %3$s and %2$s reloading %3$s preview.', 'elementor' ), '<a href="javascript: $e.run( \'document/save/default\' )">', '<a href="javascript: $e.run( \'preview/reload\' )">', '</a>' ), ] ); $this->add_control( 'site_name', [ 'label' => esc_html__( 'Site Name', 'elementor' ), 'default' => get_option( 'blogname' ), 'placeholder' => esc_html__( 'Choose name', 'elementor' ), 'label_block' => true, 'export' => false, ] ); $this->add_control( 'site_description', [ 'label' => esc_html__( 'Site Description', 'elementor' ), 'default' => get_option( 'blogdescription' ), 'placeholder' => esc_html__( 'Choose description', 'elementor' ), 'label_block' => true, 'export' => false, ] ); $this->add_control( 'site_logo', [ 'label' => esc_html__( 'Site Logo', 'elementor' ), 'type' => Controls_Manager::MEDIA, 'should_include_svg_inline_option' => $should_include_svg_inline_option, 'default' => [ 'id' => $custom_logo_id, 'url' => $custom_logo_src ? $custom_logo_src[0] : '', ], 'description' => sprintf( /* translators: 1: Width number pixel, 2: Height number pixel. */ esc_html__( 'Suggested image dimensions: %1$s × %2$s pixels.', 'elementor' ), '350', '100' ), 'export' => false, ] ); $this->add_control( 'site_favicon', [ 'label' => esc_html__( 'Site Favicon', 'elementor' ), 'type' => Controls_Manager::MEDIA, 'should_include_svg_inline_option' => $should_include_svg_inline_option, 'default' => [ 'id' => $site_icon_id, 'url' => $site_icon_src ? $site_icon_src[0] : '', ], 'description' => esc_html__( 'Suggested favicon dimensions: 512 × 512 pixels.', 'elementor' ), 'export' => false, ] ); $this->end_controls_section(); } public function on_save( $data ) { if ( ! isset( $data['settings']['post_status'] ) || Document::STATUS_PUBLISH !== $data['settings']['post_status'] || // Should check for the current action to avoid infinite loop // when updating options like: "blogname" and "blogdescription". strpos( current_action(), 'update_option_' ) === 0 ) { return; } if ( isset( $data['settings']['site_name'] ) ) { update_option( 'blogname', $data['settings']['site_name'] ); } if ( isset( $data['settings']['site_description'] ) ) { update_option( 'blogdescription', $data['settings']['site_description'] ); } if ( isset( $data['settings']['site_logo'] ) ) { set_theme_mod( 'custom_logo', $data['settings']['site_logo']['id'] ); } if ( isset( $data['settings']['site_favicon'] ) ) { update_option( 'site_icon', $data['settings']['site_favicon']['id'] ); } } }
| ver. 1.4 |
Github
|
.
| PHP 7.4.3-4ubuntu2.24 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка