Файловый менеджер - Редактировать - /var/www/xthruster/html/wp-content/uploads/flags/search.tar
Назад
data/controller.php 0000644 00000000671 14720522725 0010363 0 ustar 00 <?php namespace ElementorPro\Modules\Search\Data; use ElementorPro\Modules\Search\Data\Endpoints\Base; use ElementorPro\Core\Data\Controller as Controller_Base; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Controller extends Controller_Base { public function get_name() { return 'search'; } protected function register_endpoints() { $this->register_endpoint( Endpoints\Refresh_Search::class ); } } data/endpoints/refresh-search.php 0000644 00000005436 14720522725 0013110 0 ustar 00 <?php namespace ElementorPro\Modules\Search\Data\Endpoints; use Elementor\Widget_Base; use ElementorPro\Modules\Search\Module; use ElementorPro\Plugin; use ElementorPro\Core\Data\Endpoints\Refresh_Base; use ElementorPro\Modules\Search\Module as Search_Module; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly. } class Refresh_Search extends Refresh_Base { public function get_name() : string { return 'refresh-search'; } public function get_route() : string { return 'refresh-search'; } public function get_updated_search_widget_markup( \WP_REST_Request $request ): array { $data = $request->get_params(); /** @var Module $search_module */ $search_module = Plugin::instance()->modules_manager->get_modules( 'search' ); if ( $this->is_edit_mode( $data['post_id'] ) ) { $widget_instance = Plugin::elementor()->elements_manager->create_element_instance( $data['widget_model'] ); } else { $widget_instance = $this->create_widget_instance_from_db( $data['post_id'], $data['widget_id'] ); } ob_start(); /** @var Widget_Base $widget_instance */ $widget_instance->set_search_term( $data['search_term'] ); $widget_instance->set_page_number( $data['page_number'] ?? 1 ); $widget_instance->render_results(); $markup = ob_get_clean(); $widget_instance->set_search_term( '' ); ob_start(); $widget_instance->render_pagination(); $pagination = ob_get_clean(); return [ 'data' => $markup, 'pagination' => $pagination, ]; } protected function register() { register_rest_route( $this->controller->get_namespace(), $this->get_route(), [ [ 'args' => [ 'post_id' => [ 'description' => 'The post ID of the page containing the loop.', 'type' => 'integer', 'required' => true, 'validate_callback' => function ( $param ) { return ! empty( $param ) && is_numeric( $param ); }, ], 'widget_id' => [ 'description' => 'The ID of the loop widget.', 'type' => 'string', 'required' => true, 'validate_callback' => function ( $param ) { return $this->is_widget_id_valid( $param ); }, ], 'widget_model' => [ 'description' => 'The model of the loop widget. In Editor mode only.', 'type' => 'object', 'required' => false, 'validate_callback' => function ( $param, $request ) { $params = $request->get_params(); if ( ! $this->is_edit_mode( $params['post_id'] ) ) { return false; } return $this->is_widget_model_valid( $param ); }, ], ], 'methods' => \WP_REST_Server::CREATABLE, 'callback' => [ $this, 'get_updated_search_widget_markup' ], 'permission_callback' => function ( $request ) { return $this->permission_callback( $request, Search_Module::FEATURE_ID ); }, ], ] ); } } module.php 0000644 00000005247 14720522725 0006560 0 ustar 00 <?php namespace ElementorPro\Modules\Search; use Elementor\Utils; use ElementorPro\Core\Utils as Pro_Utils; use ElementorPro\Base\Module_Base; use ElementorPro\Modules\Search\Data\Controller; use ElementorPro\Modules\QueryControl\Classes\Elementor_Post_Query; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } class Module extends Module_Base { const FEATURE_ID = 'search'; public function __construct() { parent::__construct(); add_action( 'elementor/frontend/after_register_styles', [ $this, 'register_styles' ] ); add_action( 'pre_get_posts', [ $this, 'set_query' ] ); add_filter( 'elementor_pro/editor/localize_settings', [ $this, 'add_localize_data' ] ); new Controller(); } public function get_name() { return self::FEATURE_ID; } protected function get_widgets() { return [ 'Search' ]; } /** * Get the base URL for assets. * * @return string */ public function get_assets_base_url(): string { return ELEMENTOR_PRO_URL; } /** * Register styles. * * At build time, Elementor compiles `/modules/search/assets/scss/frontend.scss` * to `/assets/css/widget-search.min.css`. * * @return void */ public function register_styles() { wp_register_style( 'widget-search', $this->get_css_assets_url( 'widget-search', null, true, true ), [ 'elementor-frontend' ], ELEMENTOR_PRO_VERSION ); } public function add_localize_data( $config ) { $config['eSearch'] = [ 'nonce' => wp_create_nonce( 'wp_rest' ), ]; return $config; } public function set_query( $query ) { $e_search_props = Utils::get_super_global_value( $_GET, 'e_search_props' ); $e_search_query_vars = json_decode( stripcslashes( Utils::get_super_global_value( $_GET, 'e_search_query' ) ?? '' ), true ) ?? null; $search_term = Utils::get_super_global_value( $_GET, 's' ); if ( ( empty( $e_search_props ) && ! $e_search_query_vars ) || ! isset( $search_term ) || is_admin() || ! $query->is_main_query() ) { return; } $formatted_query_vars = empty( $e_search_props ) ? $e_search_query_vars : $this->get_query_based_on_widget_props( $e_search_props ); if ( ! $formatted_query_vars ) { return; } foreach ( $formatted_query_vars as $key => $value ) { $query->set( $key, $value ); } } private function get_query_based_on_widget_props( $e_search_props ) { list( $widget_id, $post_id ) = explode( '-', $e_search_props ); $widget_instance = Pro_Utils::create_widget_instance_from_db( $post_id, $widget_id ); if ( ! $widget_instance ) { return null; } $query_vars = ( new Elementor_Post_Query( $widget_instance, 'search_query' ) )->get_query_args(); $query_vars['posts_per_page'] = -1; return $query_vars; } } widgets/search.php 0000644 00000157574 14720522725 0010221 0 ustar 00 <?php namespace ElementorPro\Modules\Search\Widgets; if ( ! defined( 'ABSPATH' ) ) { exit; // Exit if accessed directly } use Elementor\Controls_Manager; use Elementor\Core\Kits\Documents\Tabs\Global_Colors; use Elementor\Core\Kits\Documents\Tabs\Global_Typography; use Elementor\Group_Control_Box_Shadow; use Elementor\Group_Control_Border; use Elementor\Group_Control_Text_Shadow; use Elementor\Group_Control_Text_Stroke; use Elementor\Group_Control_Typography; use Elementor\Group_Control_Background; use Elementor\Icons_Manager; use Elementor\Utils; use ElementorPro\Core\Utils\Collection; use ElementorPro\Core\Utils as Pro_Utils; use ElementorPro\Modules\QueryControl\Controls\Group_Control_Query; use ElementorPro\Modules\QueryControl\Module as Module_Query; use ElementorPro\Plugin; use ElementorPro\Base\Base_Widget; use ElementorPro\Modules\QueryControl\Controls\Template_Query; use ElementorPro\Modules\QueryControl\Module as QueryControlModule; use Elementor\Core\Base\Document; use ElementorPro\Modules\LoopBuilder\Documents\Loop as LoopDocument; use ElementorPro\Modules\LoopBuilder\Files\Css\Loop_Css_Trait; class Search extends Base_Widget { use Loop_Css_Trait; protected $query = null; protected $search_term = ''; protected $page_number = 1; private $element_attribute_ids = [ 'search_wrapper' => 'search_wrapper', 'form' => 'form', 'label' => 'label', 'label_text' => 'label_text', 'input' => 'input', 'input_wrapper' => 'input_wrapper', 'submit_button' => 'submit_button', 'submit_text' => 'submit_text', 'results_wrapper' => 'results_wrapper', 'widget_props' => 'widget_props', 'pagination' => 'pagination', 'nav' => 'nav', ]; public function set_search_term( string $search_term ) { $this->search_term = $search_term; } public function set_page_number( int $page_number ) { $this->page_number = $page_number; } public function get_name() { return 'search'; } public function get_title() { return esc_html__( 'Search', 'elementor-pro' ); } public function get_icon() { return 'eicon-site-search'; } public function get_keywords() { return [ 'search' ]; } public function get_categories() { return [ 'pro-elements' ]; } /** * Get style dependencies. * * Retrieve the list of style dependencies the widget requires. * * @since 3.24.0 * @access public * * @return array Widget style dependencies. */ public function get_style_depends(): array { return [ 'widget-search' ]; } public function get_query() { if ( null === $this->query ) { $this->query_posts(); } return $this->query; } public function get_query_args() { /** @var Module_Query $elementor_query */ $elementor_query = Module_Query::instance(); $settings = $this->get_settings_for_display(); $query_args = [ 'posts_per_page' => $settings['number_of_items'] ?? -1, 'paged' => $this->page_number, ]; if ( ! empty( $this->search_term ) ) { $query_args['s'] = $this->search_term; } return $elementor_query->get_query( $this, $this->get_property_key_prefix(), $query_args, [] ); } protected function register_controls() { $this->register_content_tab(); $this->register_style_tab(); } protected function register_content_tab() { $this->register_content_section_search_field(); $this->register_content_section_results(); $this->register_content_section_query(); $this->register_content_section_additional_settings(); } protected function register_content_section_search_field() { $this->start_controls_section( 'content_section_search_field', [ 'label' => esc_html__( 'Search Field', 'elementor-pro' ), ] ); $this->add_control( 'heading_input', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Input', 'elementor-pro' ), ] ); $this->add_control( 'search_input_placeholder_text', [ 'label' => esc_html__( 'Placeholder', 'elementor-pro' ), 'label_block' => true, 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Type to start searching...', 'elementor-pro' ), 'dynamic' => [ 'active' => true, ], 'ai' => [ 'active' => false, ], ] ); $this->add_control( 'icon_search', [ 'label' => esc_html__( 'Icon', 'elementor-pro' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'skin' => 'inline', 'label_block' => false, ] ); $this->add_control( 'autocomplete', [ 'type' => Controls_Manager::SWITCHER, 'label' => esc_html__( 'Autocomplete', 'elementor-pro' ), 'label_on' => esc_html__( 'Show', 'elementor-pro' ), 'label_off' => esc_html__( 'Hide', 'elementor-pro' ), 'separator' => 'before', 'return_value' => 'yes', ] ); $this->add_control( 'heading_clear', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Clear', 'elementor-pro' ), 'separator' => 'before', ] ); $this->add_control( 'icon_clear', [ 'label' => esc_html__( 'Icon', 'elementor-pro' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'skin' => 'inline', 'skin_settings' => [ 'inline' => [ 'icon' => [ 'icon' => 'eicon-close', ], ], ], 'label_block' => false, 'default' => [ 'value' => 'fas fa-times', 'library' => 'fa-solid', ], ] ); $this->add_control( 'heading_submit', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Submit', 'elementor-pro' ), 'separator' => 'before', ] ); $this->add_control( 'submit_trigger', [ 'label' => esc_html__( 'Trigger', 'elementor-pro' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'click_submit' => esc_html__( 'Submit button', 'elementor-pro' ), 'key_enter' => esc_html__( 'Enter key', 'elementor-pro' ), 'both' => esc_html__( 'Both', 'elementor-pro' ), ], 'default' => 'click_submit', 'frontend_available' => true, ] ); $this->add_control( 'submit_button_text', [ 'label' => esc_html__( 'Text', 'elementor-pro' ), 'type' => Controls_Manager::TEXT, 'default' => esc_html__( 'Search', 'elementor-pro' ), 'placeholder' => esc_html__( 'Search', 'elementor-pro' ), 'condition' => [ 'submit_trigger!' => 'key_enter', ], 'dynamic' => [ 'active' => true, ], 'ai' => [ 'active' => false, ], ] ); $this->add_control( 'icon_submit', [ 'label' => esc_html__( 'Icon', 'elementor-pro' ), 'type' => Controls_Manager::ICONS, 'fa4compatibility' => 'icon', 'skin' => 'inline', 'label_block' => false, 'condition' => [ 'submit_trigger!' => 'key_enter', ], ] ); $this->end_controls_section(); } protected function register_content_section_results() { $this->start_controls_section( 'content_section_results', [ 'label' => esc_html__( 'Results', 'elementor-pro' ), ] ); $this->add_control( 'live_results', [ 'label' => esc_html__( 'Live Results', 'elementor-pro' ), 'type' => Controls_Manager::SWITCHER, 'label_off' => esc_html__( 'Hide', 'elementor-pro' ), 'label_on' => esc_html__( 'Show', 'elementor-pro' ), 'default' => '', 'frontend_available' => true, ] ); $this->add_control( 'template_id', [ 'label' => esc_html__( 'Choose a template', 'elementor-pro' ), 'type' => Template_Query::CONTROL_ID, 'label_block' => true, 'autocomplete' => [ 'object' => QueryControlModule::QUERY_OBJECT_LIBRARY_TEMPLATE, 'query' => [ 'post_status' => Document::STATUS_PUBLISH, 'meta_query' => [ [ 'key' => Document::TYPE_META_KEY, 'value' => LoopDocument::get_type(), 'compare' => 'IN', ], ], ], ], 'actions' => [ 'new' => [ 'visible' => true, 'document_config' => [ 'type' => LoopDocument::get_type(), ], 'after_action' => 'redirect', ], 'edit' => [ 'visible' => true, 'after_action' => 'redirect', ], ], 'condition' => [ 'live_results' => 'yes', ], 'frontend_available' => true, ] ); $this->add_control( 'minimum_search_characters', [ 'label' => esc_html__( 'Minimum search characters', 'elementor-pro' ), 'type' => Controls_Manager::NUMBER, 'default' => 3, 'min' => 1, 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', ], 'frontend_available' => true, ] ); $this->add_responsive_control( 'number_of_columns', [ 'label' => esc_html__( 'Columns', 'elementor-pro' ), 'type' => Controls_Manager::NUMBER, 'default' => 1, 'min' => 1, 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-columns: {{VALUE}}', ], 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', ], ] ); $this->add_responsive_control( 'number_of_items', [ 'label' => esc_html__( 'Items', 'elementor-pro' ), 'type' => Controls_Manager::NUMBER, 'default' => 6, 'min' => 1, 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', ], ] ); $this->add_control( 'equal_height', [ 'label' => esc_html__( 'Equal Height', 'elementor-pro' ), 'type' => Controls_Manager::SWITCHER, 'label_off' => esc_html__( 'Off', 'elementor-pro' ), 'label_on' => esc_html__( 'On', 'elementor-pro' ), 'default' => '', 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-grid-auto-rows: 1fr; --e-search-loop-item-equal-height: 100%', ], ] ); $this->add_control( 'enable_loader', [ 'label' => esc_html__( 'Loader', 'elementor-pro' ), 'type' => Controls_Manager::SWITCHER, 'label_off' => esc_html__( 'Hide', 'elementor-pro' ), 'label_on' => esc_html__( 'Show', 'elementor-pro' ), 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', ], 'separator' => 'before', ] ); $this->add_control( 'enable_nothing_found_message', [ 'label' => esc_html__( 'Nothing Found Message', 'elementor-pro' ), 'type' => Controls_Manager::SWITCHER, 'label_off' => esc_html__( 'Hide', 'elementor-pro' ), 'label_on' => esc_html__( 'Show', 'elementor-pro' ), 'default' => 'yes', 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', ], 'separator' => 'before', ] ); $this->add_control( 'nothing_found_message_description', [ 'type' => Controls_Manager::RAW_HTML, 'raw' => esc_html__( 'This appears when the search yields no results.', 'elementor-pro' ), 'content_classes' => 'elementor-descriptor', 'condition' => $this->get_nothing_found_conditions(), ] ); $this->add_control( 'nothing_found_message_text', [ 'type' => Controls_Manager::TEXTAREA, 'dynamic' => [ 'active' => true, ], 'condition' => $this->get_nothing_found_conditions(), 'default' => esc_html__( 'It seems we can’t find what you’re looking for.', 'elementor-pro' ), ] ); $this->add_control( 'nothing_found_message_html_tag', [ 'label' => esc_html__( 'HTML Tag', 'elementor-pro' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'h1' => 'H1', 'h2' => 'H2', 'h3' => 'H3', 'h4' => 'H4', 'h5' => 'H5', 'h6' => 'H6', 'div' => 'div', 'span' => 'span', ], 'default' => 'div', 'condition' => $this->get_nothing_found_conditions(), ] ); $this->end_controls_section(); } protected function register_content_section_query() { $this->start_controls_section( 'content_section_query', [ 'label' => esc_html__( 'Query', 'elementor-pro' ), ] ); $this->add_group_control( Group_Control_Query::get_type(), [ 'name' => 'search_query', 'presets' => [ 'full' ], 'fields_options' => [ 'post_type' => [ 'default' => 'any', 'options' => $this->get_supported_post_types(), ], 'exclude' => [ 'options' => [ 'terms' => esc_html__( 'Term', 'elementor-pro' ), 'authors' => esc_html__( 'Author', 'elementor-pro' ), 'manual_selection' => esc_html__( 'Manual Selection', 'elementor-pro' ), ], ], ], 'exclude' => [ 'avoid_duplicates', 'offset', 'posts_per_page', ], ] ); $this->end_controls_section(); } protected function register_content_section_additional_settings() { $this->start_controls_section( 'content_section_additional_settings', [ 'label' => esc_html__( 'Additional Settings', 'elementor-pro' ), ] ); $this->add_control( 'heading_pagination', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Pagination', 'elementor-pro' ), ] ); $this->add_control( 'pagination_type_options', [ 'label' => esc_html__( 'Type', 'elementor-pro' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'none' => esc_html__( 'None', 'elementor-pro' ), 'numbers' => esc_html__( 'Numbers', 'elementor-pro' ), 'previous_next' => esc_html__( 'Previous/Next', 'elementor-pro' ), 'numbers_previous_next' => esc_html__( 'Numbers + Previous/Next', 'elementor-pro' ), ], 'default' => 'none', 'frontend_available' => true, ] ); $this->add_control( 'pagination_prev_label', [ 'label' => esc_html__( 'Previous Label', 'elementor-pro' ), 'dynamic' => [ 'active' => true, ], 'default' => esc_html__( 'Previous', 'elementor-pro' ), 'condition' => [ 'pagination_type_options' => [ 'previous_next', 'numbers_previous_next', ], ], ] ); $this->add_control( 'pagination_next_label', [ 'label' => esc_html__( 'Next Label', 'elementor-pro' ), 'default' => esc_html__( 'Next', 'elementor-pro' ), 'condition' => [ 'pagination_type_options' => [ 'previous_next', 'numbers_previous_next', ], ], 'dynamic' => [ 'active' => true, ], ] ); $this->add_control( 'page_limit_settings', [ 'label' => esc_html__( 'Page Limit', 'elementor-pro' ), 'type' => Controls_Manager::NUMBER, 'default' => 5, 'frontend_available' => true, 'condition' => [ 'pagination_type_options' => [ 'numbers_previous_next', 'numbers', 'previous_next', ], ], ] ); $this->add_control( 'pagination_shorten_settings', [ 'type' => Controls_Manager::SWITCHER, 'label' => esc_html__( 'Shorten', 'elementor-pro' ), 'label_on' => esc_html__( 'Yes', 'elementor-pro' ), 'label_off' => esc_html__( 'No', 'elementor-pro' ), 'return_value' => 'yes', 'condition' => [ 'pagination_type_options' => [ 'numbers_previous_next', 'numbers', ], ], ] ); $this->end_controls_section(); } protected function get_nothing_found_conditions() { return [ 'enable_nothing_found_message' => 'yes', 'live_results' => 'yes', 'template_id!' => '', ]; } protected function register_style_tab() { $this->register_style_section_search_field(); $this->register_style_section_clear(); $this->register_style_section_submit(); $this->register_style_section_results(); $this->register_style_section_additional_settings(); $this->register_style_section_nothing_found_message(); } protected function register_style_section_search_field() { $this->start_controls_section( 'section_search_field_style', [ 'label' => esc_html__( 'Search Field', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'search_field_typography', 'selector' => '{{WRAPPER}} .e-search-input', ] ); $this->add_control( 'placeholder_color', [ 'label' => esc_html__( 'Placeholder Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--e-search-placeholder-color: {{VALUE}};', ], ] ); $this->start_controls_tabs( 'search_field_tabs' ); $this->start_controls_tab( 'search_field_tab_input_normal', [ 'label' => esc_html__( 'Normal', 'elementor-pro' ), ] ); $this->register_search_field_style_tabs( 'normal' ); $this->end_controls_tab(); $this->start_controls_tab( 'search_field_tab_input_focus', [ 'label' => esc_html__( 'Focus', 'elementor-pro' ), ] ); $this->register_search_field_style_tabs( 'focus' ); $this->add_control( 'search_field_search_input_transition', [ 'label' => esc_html__( 'Transition Duration', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 's', 'ms', 'custom' ], 'default' => [ 'unit' => 's', ], 'range' => [ 's' => [ 'max' => 5, ], 'ms' => [ 'max' => 5000, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-input-transition: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'search_field_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}} .e-search-input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'search_field_padding', [ 'label' => esc_html__( 'Padding', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-input-padding-block-start: {{TOP}}{{UNIT}}; --e-search-input-padding-inline-start: {{LEFT}}{{UNIT}}; --e-search-input-padding-block-end: {{BOTTOM}}{{UNIT}}; --e-search-input-padding-inline-end: {{RIGHT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'search_field_icon_label_size', [ 'label' => esc_html__( 'Icon Size', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-icon-label-size: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', 'condition' => [ 'icon_search[value]!' => '', ], ] ); $this->add_responsive_control( 'search_field_icon_gap', [ 'label' => esc_html__( 'Gap between text and icon', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw' ], 'range' => [ 'px' => [ 'max' => 50, ], 'em' => [ 'max' => 5, ], 'rem' => [ 'max' => 5, ], 'vw' => [ 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-input-gap: {{SIZE}}{{UNIT}}', ], 'condition' => [ 'icon_search[value]!' => '', ], ] ); $this->add_responsive_control( 'search_field_submit_gap', [ 'label' => esc_html__( 'Gap between input and button', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw' ], 'range' => [ 'px' => [ 'max' => 50, ], 'em' => [ 'max' => 5, ], 'rem' => [ 'max' => 5, ], 'vw' => [ 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-submit-margin-inline-start: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_section(); } protected function register_search_field_style_tabs( $tab_id ) { $is_normal = 'normal' === $tab_id; $selector_suffix = $is_normal ? '' : '.e-focus'; $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => "search_field_background_$tab_id", 'types' => [ 'classic', 'gradient' ], 'exclude' => [ 'image' ], 'selector' => "{{WRAPPER}}$selector_suffix .e-search-input", 'fields_options' => [ 'color' => [ 'label' => esc_html__( 'Background', 'elementor-pro' ), ], ], ] ); $this->add_control( "search_field_input_text_color_$tab_id", [ 'label' => esc_html__( 'Text Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'global' => [ 'default' => Global_Colors::COLOR_TEXT, ], 'selectors' => [ "{{WRAPPER}}$selector_suffix" => '--e-search-input-color: {{VALUE}}', ], ] ); $this->add_control( "search_field_icon_search_normal_color_$tab_id", [ 'label' => esc_html__( 'Icon Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ "{{WRAPPER}}$selector_suffix" => '--e-search-icon-label-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => "search_field_border_$tab_id", 'selector' => "{{WRAPPER}}$selector_suffix .e-search-input", ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => "search_field_box_shadow__$tab_id", 'selector' => "{{WRAPPER}}$selector_suffix .e-search-input", ] ); } protected function register_style_section_clear() { $this->start_controls_section( 'style_section_clear', [ 'label' => esc_html__( 'Clear', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'icon_clear[value]!' => '', ], ] ); $this->add_responsive_control( 'icon_clear_size', [ 'label' => esc_html__( 'Icon Size', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], 'range' => [ 'px' => [ 'max' => 50, ], 'em' => [ 'max' => 5, ], 'rem' => [ 'max' => 5, ], 'vw' => [ 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-icon-clear-size: {{SIZE}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'icon_clear_color_tabs', ); $this->start_controls_tab( 'icon_clear_normal_tab', [ 'label' => esc_html__( 'Normal', 'elementor-pro' ), ] ); $this->add_control( 'icon_clear_normal_color', [ 'label' => esc_html__( 'Icon Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--e-search-icon-clear-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'icon_clear_hover_tab', [ 'label' => esc_html__( 'Hover', 'elementor-pro' ), ] ); $this->add_control( 'icon_clear_hover_color', [ 'label' => esc_html__( 'Icon Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .e-search-input-wrapper > svg:hover' => '--e-search-icon-clear-color: {{VALUE}};', '{{WRAPPER}} .e-search-input-wrapper > i:hover' => '--e-search-icon-clear-color: {{VALUE}};', ], ] ); $this->add_control( 'icon_clear_hover_transition', [ 'label' => esc_html__( 'Transition Duration', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 's', 'ms', 'custom' ], 'default' => [ 'unit' => 's', ], 'range' => [ 's' => [ 'max' => 5, ], 'ms' => [ 'max' => 5000, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-icon-clear-transition: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->end_controls_section(); } protected function register_style_section_additional_settings() { $this->start_controls_section( 'style_additional_settings', [ 'label' => esc_html__( 'Additional Settings', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'pagination_type_options' => [ 'numbers_previous_next', 'previous_next', 'numbers', ], ], ] ); $this->add_control( 'heading_style_additional_settings', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Pagination', 'elementor-pro' ), ] ); $this->add_control( 'style_additional_settings_alignment', [ 'label' => esc_html__( 'Alignment', 'elementor-pro' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'flex-start' => [ 'title' => esc_html__( 'Start', 'elementor-pro' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => esc_html__( 'Middle', 'elementor-pro' ), 'icon' => 'eicon-h-align-center', ], 'flex-end' => [ 'title' => esc_html__( 'End', 'elementor-pro' ), 'icon' => 'eicon-h-align-right', ], ], 'toggle' => true, 'selectors' => [ '{{WRAPPER}}' => '--e-search-pagination-justify-content: {{VALUE}};', ], ] ); $this->add_control( 'style_additional_settings_vertical_position', [ 'label' => esc_html__( 'Vertical Position', 'elementor-pro' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'top' => [ 'title' => esc_html__( 'Top', 'elementor-pro' ), 'icon' => 'eicon-v-align-top', ], 'bottom' => [ 'title' => esc_html__( 'Bottom', 'elementor-pro' ), 'icon' => 'eicon-v-align-bottom', ], ], 'selectors' => [ '{{WRAPPER}}' => '{{VALUE}}', ], 'selectors_dictionary' => [ 'top' => '--e-search-pagination-vertical-position: column-reverse', 'bottom' => '--e-search-pagination-vertical-position: column', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'typography_title', 'global' => [ 'default' => Global_Typography::TYPOGRAPHY_PRIMARY, ], 'selector' => '{{WRAPPER}} .elementor-pagination', ] ); $this->add_control( 'heading_style_additional_settings_colors', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Colors', 'elementor-pro' ), 'separator' => 'before', ] ); $this->start_controls_tabs( 'style_additional_settings_color_tabs', ); $this->start_controls_tab( 'style_additional_settings_normal_tab', [ 'label' => esc_html__( 'Normal', 'elementor-pro' ), ] ); $this->add_control( 'style_additional_settings_normal_color', [ 'label' => esc_html__( 'Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--e-search-pagination-color: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'style_additional_settings_hover_tab', [ 'label' => esc_html__( 'Hover', 'elementor-pro' ), ] ); $this->add_control( 'style_additional_settings_hover_color', [ 'label' => esc_html__( 'Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--e-search-pagination-hover: {{VALUE}};', ], ] ); $this->end_controls_tab(); $this->start_controls_tab( 'style_button_color_tabs_active', [ 'label' => esc_html__( 'Active', 'elementor-pro' ), ] ); $this->add_control( 'style_button_color_icon_active', [ 'label' => esc_html__( 'Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--e-search-pagination-current: {{VALUE}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'page_numbers_space_between', [ 'label' => esc_html__( 'Space Between', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-pagination-page-numbers-gap: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'top_spacing', [ 'label' => esc_html__( 'Top Spacing', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'range' => [ 'px' => [ 'max' => 200, ], 'em' => [ 'max' => 20, ], 'rem' => [ 'max' => 20, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-pagination-block-start-spacing: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'bottom_spacing', [ 'label' => esc_html__( 'Bottom Spacing', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'range' => [ 'px' => [ 'max' => 200, ], 'em' => [ 'max' => 20, ], 'rem' => [ 'max' => 20, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-pagination-block-end-spacing: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_section(); } protected function register_style_section_submit() { $this->start_controls_section( 'style_section_submit', [ 'label' => esc_html__( 'Submit Button', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'submit_trigger!' => 'key_enter', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'submit_typography', 'selector' => '{{WRAPPER}} .e-search-submit span', ] ); $this->add_responsive_control( 'icon_submit_position', [ 'label' => esc_html__( 'Icon Position', 'elementor-pro' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => esc_html__( 'Start (before)', 'elementor-pro' ), 'icon' => 'eicon-h-align-left', ], 'end' => [ 'title' => esc_html__( 'End (after)', 'elementor-pro' ), 'icon' => 'eicon-h-align-right', ], ], 'condition' => [ 'icon_submit[value]!' => '', ], 'selectors' => [ '{{WRAPPER}}' => '{{VALUE}}', ], 'selectors_dictionary' => [ 'start' => '--e-search-submit-button-flex-direction: row; --e-search-submit-icon-margin-inline-start: 0px; --e-search-submit-icon-margin-inline-end: var(--e-search-submit-icon-gap);', 'end' => '--e-search-submit-button-flex-direction: row-reverse; --e-search-submit-icon-margin-inline-start: var(--e-search-submit-icon-gap); --e-search-submit-icon-margin-inline-end: 0px;', ], ] ); $this->add_responsive_control( 'icon_submit_size', [ 'label' => esc_html__( 'Icon Size', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], 'range' => [ 'px' => [ 'max' => 50, ], 'em' => [ 'max' => 5, ], 'rem' => [ 'max' => 5, ], 'vw' => [ 'max' => 50, ], ], 'condition' => [ 'icon_submit[value]!' => '', ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-icon-submit-size: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'icon_submit_gap', [ 'label' => esc_html__( 'Gap between text and icon', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], 'range' => [ 'px' => [ 'max' => 50, ], 'em' => [ 'max' => 5, ], 'rem' => [ 'max' => 5, ], 'vw' => [ 'max' => 50, ], ], 'condition' => [ 'icon_submit[value]!' => '', ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-submit-icon-gap: {{SIZE}}{{UNIT}};', ], ] ); $this->start_controls_tabs( 'submit_style_tabs', ); $this->start_controls_tab( 'submit_style_normal_tab', [ 'label' => esc_html__( 'Normal', 'elementor-pro' ), ] ); $this->register_submit_style_tabs( 'normal' ); $this->end_controls_tab(); $this->start_controls_tab( 'submit_style_hover_tab', [ 'label' => esc_html__( 'Hover', 'elementor-pro' ), ] ); $this->register_submit_style_tabs( 'hover' ); $this->add_control( 'submit_hover_animation', [ 'label' => esc_html__( 'Hover animation', 'elementor-pro' ), 'type' => Controls_Manager::HOVER_ANIMATION, ] ); $this->add_control( 'submit_hover_transition', [ 'label' => esc_html__( 'Transition Duration', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 's', 'ms', 'custom' ], 'default' => [ 'unit' => 's', ], 'range' => [ 's' => [ 'max' => 5, ], 'ms' => [ 'max' => 5000, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-submit-hover-transition: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_tab(); $this->end_controls_tabs(); $this->add_responsive_control( 'submit_border_radius', [ 'label' => esc_html__( 'Radius', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-submit-border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'submit_padding', [ 'label' => esc_html__( 'Padding', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-submit-padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->end_controls_section(); } /** * Registers the controls of the submit section style for normal/hover state tabs. * * @param string $tab_id Accepts 'normal' or 'hover' as value. */ protected function register_submit_style_tabs( $tab_id ) { $is_normal = 'normal' === $tab_id; $state_suffix = $is_normal ? '' : ":$tab_id"; $selector_suffix = $is_normal ? '' : " .e-search-submit$state_suffix"; $this->add_control( "submit_text_color_$tab_id", [ 'label' => esc_html__( 'Text Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ "{{WRAPPER}}$selector_suffix" => '--e-search-submit-color: {{VALUE}};', ], ] ); $this->add_control( "submit_icon_color_$tab_id", [ 'label' => esc_html__( 'Icon Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'icon_submit[value]!' => '', ], 'selectors' => [ "{{WRAPPER}}$selector_suffix" => '--e-search-icon-submit-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => "submit_background_$tab_id", 'types' => [ 'classic', 'gradient' ], 'exclude' => [ 'image' ], 'selector' => "{{WRAPPER}} .e-search-submit$state_suffix", ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => "submit_border_$tab_id", 'selector' => "{{WRAPPER}} .e-search-submit$state_suffix", ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => "submit_box_shadow_$tab_id", 'selector' => "{{WRAPPER}} .e-search-submit$state_suffix", ] ); } protected function register_style_section_results() { $this->start_controls_section( 'style_section_results', [ 'label' => esc_html__( 'Results', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => [ 'live_results' => 'yes', ], ] ); $this->add_group_control( Group_Control_Background::get_type(), [ 'name' => 'results_background', 'types' => [ 'classic', 'gradient' ], 'exclude' => [ 'image' ], 'selector' => '{{WRAPPER}} .e-search-results-container', ] ); $this->add_group_control( Group_Control_Border::get_type(), [ 'name' => 'results_border_type', 'selector' => '{{WRAPPER}} .e-search-results-container > div', ] ); $this->add_group_control( Group_Control_Box_Shadow::get_type(), [ 'name' => 'results_box_shadow', 'selector' => '{{WRAPPER}} .e-search-results-container > div', ] ); $this->add_responsive_control( 'results_border_radius', [ 'label' => esc_html__( 'Border Radius', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'results_padding', [ 'label' => esc_html__( 'Padding', 'elementor-pro' ), 'type' => Controls_Manager::DIMENSIONS, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'results_distance_from_search_field', [ 'label' => esc_html__( 'Distance from search field', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], 'range' => [ 'px' => [ 'max' => 50, ], 'em' => [ 'max' => 5, ], 'rem' => [ 'max' => 5, ], 'vw' => [ 'max' => 10, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-input-and-results-gap: {{SIZE}}{{UNIT}};', ], 'separator' => 'before', ] ); $this->add_control( 'results_is_dropdown_width', [ 'label' => esc_html__( 'Dropdown Width', 'elementor-pro' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'search_field' => esc_html__( 'Search Field', 'elementor-pro' ), 'widget_width' => esc_html__( 'Widget Width', 'elementor-pro' ), ], 'default' => 'search_field', 'separator' => 'before', 'frontend_available' => true, ], ); $this->add_control( 'results_is_custom_width', [ 'label' => esc_html__( 'Custom Width', 'elementor-pro' ), 'type' => Controls_Manager::SWITCHER, 'label_off' => esc_html__( 'On', 'elementor-pro' ), 'label_on' => esc_html__( 'Off', 'elementor-pro' ), 'default' => '', ] ); $this->add_responsive_control( 'results_custom_width', [ 'label' => esc_html__( 'Width', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'range' => [ 'px' => [ 'max' => 1000, ], 'em' => [ 'max' => 100, ], 'rem' => [ 'max' => 100, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-width: {{SIZE}}{{UNIT}};', ], 'condition' => [ 'results_is_custom_width' => 'yes', ], ] ); $this->add_responsive_control( 'results_max_height', [ 'label' => esc_html__( 'Max height', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'vw', 'custom' ], 'range' => [ 'px' => [ 'max' => 500, ], '%' => [ 'max' => 50, ], 'em' => [ 'max' => 50, ], 'rem' => [ 'max' => 50, ], 'vw' => [ 'max' => 50, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-max-height: {{SIZE}}{{UNIT}};', ], ] ); $this->add_responsive_control( 'results_alignment', [ 'label' => esc_html__( 'Alignment', 'elementor-pro' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => esc_html__( 'Start', 'elementor-pro' ), 'icon' => 'eicon-h-align-left', ], 'center' => [ 'title' => esc_html__( 'Middle', 'elementor-pro' ), 'icon' => 'eicon-h-align-center', ], 'end' => [ 'title' => esc_html__( 'End', 'elementor-pro' ), 'icon' => 'eicon-h-align-right', ], ], 'toggle' => true, 'condition' => [ 'results_is_custom_width' => 'yes', ], 'selectors' => [ '{{WRAPPER}}' => '{{VALUE}}', ], 'selectors_dictionary' => [ 'start' => '--e-search-results-inset-inline-start: 0; --e-search-results-inset-inline-end: initial; --e-search-results-transform: initial;', 'center' => '--e-search-results-inset-inline-start: 50%; --e-search-results-inset-inline-end: initial; --e-search-results-transform: translateX(-50%);', 'end' => '--e-search-results-inset-inline-start: initial; --e-search-results-inset-inline-end: 0; --e-search-results-transform: initial;', ], ] ); $this->add_responsive_control( 'search_result_column_gap', [ 'label' => esc_html__( 'Gap between columns', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-column-gap: {{SIZE}}{{UNIT}}', ], 'separator' => 'before', ] ); $this->add_responsive_control( 'search_result_row_gap', [ 'label' => esc_html__( 'Gap between rows', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'custom' ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-results-row-gap: {{SIZE}}{{UNIT}}', ], ] ); $this->add_control( 'heading_search_reasult_loader', [ 'type' => Controls_Manager::HEADING, 'label' => esc_html__( 'Loader', 'elementor-pro' ), 'separator' => 'before', 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', 'enable_loader' => 'yes', ], ] ); $this->add_control( 'search_result_loader_icon_color', [ 'label' => esc_html__( 'Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', 'enable_loader' => 'yes', ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-loader-icon-color: {{VALUE}};', ], ] ); $this->add_responsive_control( 'search_result_loader_icon_size', [ 'label' => esc_html__( 'Icon Size', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', 'em', 'rem', 'vw', 'custom' ], 'condition' => [ 'live_results' => 'yes', 'template_id!' => '', 'enable_loader' => 'yes', ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-loader-icon-size: {{SIZE}}{{UNIT}}', ], ] ); $this->end_controls_section(); } protected function register_style_section_nothing_found_message() { $this->start_controls_section( 'style_section_nothing_found_message', [ 'label' => esc_html__( 'Nothing Found Message', 'elementor-pro' ), 'tab' => Controls_Manager::TAB_STYLE, 'condition' => $this->get_nothing_found_conditions(), ] ); $this->add_responsive_control( 'nothing_found_message_space_from_top', [ 'label' => esc_html__( 'Space from top', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'range' => [ 'px' => [ 'max' => 200, ], 'em' => [ 'max' => 20, ], 'rem' => [ 'max' => 20, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-nothing-found-padding-block-start: {{SIZE}}{{UNIT}}', ], ] ); $this->add_responsive_control( 'nothing_found_message_space_from_bottom', [ 'label' => esc_html__( 'Space from bottom', 'elementor-pro' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px', '%', 'em', 'rem', 'custom' ], 'range' => [ 'px' => [ 'max' => 200, ], 'em' => [ 'max' => 20, ], 'rem' => [ 'max' => 20, ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-nothing-found-padding-block-end: {{SIZE}}{{UNIT}}', ], ] ); $this->add_responsive_control( 'nothing_found_message_alignment', [ 'label' => esc_html__( 'Alignment', 'elementor-pro' ), 'type' => Controls_Manager::CHOOSE, 'options' => [ 'start' => [ 'title' => esc_html__( 'Start', 'elementor-pro' ), 'icon' => 'eicon-text-align-left', ], 'center' => [ 'title' => esc_html__( 'Middle', 'elementor-pro' ), 'icon' => 'eicon-text-align-center', ], 'end' => [ 'title' => esc_html__( 'End', 'elementor-pro' ), 'icon' => 'eicon-text-align-right', ], ], 'selectors' => [ '{{WRAPPER}}' => '--e-search-nothing-found-message-alignment: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Typography::get_type(), [ 'name' => 'nothing_found_message_typography', 'selector' => '{{WRAPPER}} .e-search-nothing-found-message', 'separator' => 'before', ] ); $this->add_control( 'nothing_found_message_color', [ 'label' => esc_html__( 'Color', 'elementor-pro' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}}' => '--e-search-nothing-found-message-color: {{VALUE}};', ], ] ); $this->add_group_control( Group_Control_Text_Shadow::get_type(), [ 'name' => 'nothing_found_message_text_shadow', 'selector' => '{{WRAPPER}} .e-search-nothing-found-message', ] ); $this->add_group_control( Group_Control_Text_Stroke::get_type(), [ 'name' => 'nothing_found_message_text_stroke', 'selector' => '{{WRAPPER}} .e-search-nothing-found-message', ] ); $this->end_controls_section(); } public function render_results() { $this->query_posts(); /** @var \WP_Query $query */ $query = $this->get_query(); if ( ! $query->found_posts ) { $this->handle_no_posts_found(); return; } while ( $query->have_posts() ) { $query->the_post(); $this->render_post(); } wp_reset_postdata(); } public function render_pagination() { $parent_settings = $this->get_settings_for_display(); $pagination_types = $parent_settings['pagination_type_options']; $this->add_render_attibutes_pagination(); if ( 'none' === $pagination_types ) { return; } if ( 1 >= $this->get_query()->max_num_pages ) { return; } $total = $parent_settings['page_limit_settings'] > $this->get_query()->max_num_pages ? $this->get_query()->max_num_pages : $parent_settings['page_limit_settings']; $paginate_args = [ 'type' => 'array', 'current' => $this->page_number, 'total' => $total, 'prev_next' => 'numbers' !== $pagination_types, 'next_text' => $parent_settings['pagination_next_label'], 'prev_text' => $parent_settings['pagination_prev_label'], 'show_all' => 'yes' !== $parent_settings['pagination_shorten_settings'], 'before_page_number' => '<span class="elementor-screen-only">' . esc_html__( 'Page', 'elementor-pro' ) . '</span>', ]; $paginate_args = $this->get_paginate_args_for_rest_request( $paginate_args ); $links = []; $links = paginate_links( $paginate_args ); if ( 1 === $this->page_number && 'numbers' !== $pagination_types ) { $prev = '<span class="prev page-numbers inactive">' . $parent_settings['pagination_prev_label'] . '</span>'; array_unshift( $links, $prev ); } if ( $this->page_number === $total && 'numbers' !== $pagination_types ) { $next = '<span class="next page-numbers inactive">' . $parent_settings['pagination_next_label'] . '</span>'; $links[] = $next; } $links = $this->add_nofollow_to_links( $links ); echo implode( PHP_EOL, $links ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped } protected function add_nofollow_to_links( $content ) { $content = str_replace( '<a ', '<a rel="nofollow" ', $content ); return $content; } protected function get_paginate_args_for_rest_request( $paginate_args ) { $link_unescaped = wp_get_referer(); $url_components = wp_parse_url( $link_unescaped ); $add_args = []; if ( isset( $url_components['query'] ) ) { wp_parse_str( $url_components['query'], $add_args ); } $url_to_post_id = url_to_postid( $link_unescaped ); $pagination_base_url = get_permalink( $url_to_post_id ); $paginate_args['base'] = trailingslashit( $pagination_base_url ) . '%_%'; $paginate_args['format'] = '?e-search-page=%#%'; $paginate_args['add_args'] = $add_args; if ( 0 === $url_to_post_id ) { unset( $paginate_args['format'] ); } return $paginate_args; } protected function handle_no_posts_found() { $settings = $this->get_settings_for_display(); if ( 'yes' !== $settings['enable_nothing_found_message'] ) { return; } $nothing_found_message_html_tag = Utils::validate_html_tag( $settings['nothing_found_message_html_tag'] ); ?> <<?php Utils::print_validated_html_tag( $nothing_found_message_html_tag ); ?> class="e-search-nothing-found-message"> <?php echo wp_kses_post( $settings['nothing_found_message_text'] ); ?> </<?php Utils::print_validated_html_tag( $nothing_found_message_html_tag ); ?>> <?php } protected function render_post() { $settings = $this->get_settings_for_display(); $template_id = $settings['template_id'] ?? 0; $post_id = get_the_ID(); /** @var LoopDocument $document */ $document = Plugin::elementor()->documents->get( $template_id ); if ( ! $document ) { return; } $this->print_dynamic_css( $post_id, $template_id ); $document->print_content(); } protected function render_loader( $settings ) { if ( isset( $settings['enable_loader'] ) && 'yes' === $settings['enable_loader'] ) { ?> <div class="e-search-loader"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 28 28"> <path fill-rule="evenodd" d="M14 .188c.587 0 1.063.475 1.063 1.062V5.5a1.063 1.063 0 0 1-2.126 0V1.25c0-.587.476-1.063 1.063-1.063ZM4.182 4.181a1.063 1.063 0 0 1 1.503 0L8.73 7.228A1.062 1.062 0 1 1 7.228 8.73L4.182 5.685a1.063 1.063 0 0 1 0-1.503Zm19.636 0a1.063 1.063 0 0 1 0 1.503L20.772 8.73a1.062 1.062 0 1 1-1.502-1.502l3.045-3.046a1.063 1.063 0 0 1 1.503 0ZM.188 14c0-.587.475-1.063 1.062-1.063H5.5a1.063 1.063 0 0 1 0 2.126H1.25A1.063 1.063 0 0 1 .187 14Zm21.25 0c0-.587.475-1.063 1.062-1.063h4.25a1.063 1.063 0 0 1 0 2.126H22.5A1.063 1.063 0 0 1 21.437 14ZM8.73 19.27a1.062 1.062 0 0 1 0 1.502l-3.045 3.046a1.063 1.063 0 0 1-1.503-1.503l3.046-3.046a1.063 1.063 0 0 1 1.502 0Zm10.54 0a1.063 1.063 0 0 1 1.502 0l3.046 3.045a1.063 1.063 0 0 1-1.503 1.503l-3.046-3.046a1.063 1.063 0 0 1 0-1.502ZM14 21.438c.587 0 1.063.475 1.063 1.062v4.25a1.063 1.063 0 0 1-2.126 0V22.5c0-.587.476-1.063 1.063-1.063Z"/> </svg> </div> <?php } } protected function render() { $settings = $this->get_settings_for_display(); $attribute_ids = $this->element_attribute_ids; $this->add_render_attibutes(); ?> <search <?php $this->print_render_attribute_string( $attribute_ids['search_wrapper'] ); ?>> <form <?php $this->print_render_attribute_string( $attribute_ids['form'] ); ?>> <?php do_action( 'elementor_pro/search/before_input', $this ); ?> <label <?php $this->print_render_attribute_string( $attribute_ids['label'] ); ?>> <span <?php $this->print_render_attribute_string( $attribute_ids['label_text'] ); ?>> <?php esc_html_e( 'Search', 'elementor-pro' ); ?> </span> <?php $this->maybe_render_icon( 'icon_search' ); ?> </label> <div <?php $this->print_render_attribute_string( $attribute_ids['input_wrapper'] ); ?>> <input <?php $this->print_render_attribute_string( $attribute_ids['input'] ); ?>> <?php $this->maybe_render_icon( 'icon_clear' ); ?> <?php if ( ! $this->get_dropdown_width() ) : ?> <output <?php $this->print_render_attribute_string( $attribute_ids['results_wrapper'] ); ?>> <div class="e-search-results"></div> <?php $this->render_loader( $settings ); ?> </output> <?php endif; ?> </div> <?php if ( $this->get_dropdown_width() ) : ?> <output <?php $this->print_render_attribute_string( $attribute_ids['results_wrapper'] ); ?>> <div class="e-search-results"></div> <?php $this->render_loader( $settings ); ?> </output> <?php endif; ?> <?php do_action( 'elementor_pro/search/after_input', $this ); ?> <button <?php $this->print_render_attribute_string( $attribute_ids['submit_button'] ); ?>> <?php $this->maybe_render_icon( 'icon_submit' ); ?> <span <?php $this->print_render_attribute_string( $attribute_ids['submit_text'] ); ?>> <?php echo esc_html( $settings['submit_button_text'] ); ?> </span> </button> <input <?php $this->print_render_attribute_string( $attribute_ids['widget_props'] ); ?>> </form> </search> <?php } public function query_posts() { $this->query = $this->get_query_args(); } public function get_query_name() { return $this->get_name(); } private function add_render_attibutes_pagination() { $pagination_class = 'elementor-pagination'; $this->add_render_attribute( $this->element_attribute_ids['nav'], [ 'class' => $pagination_class, ] ); } private function add_render_attibutes() { $id = $this->get_id(); $settings = $this->get_settings_for_display(); $screen_only_class = 'elementor-screen-only'; $this->add_render_attribute( $this->element_attribute_ids['search_wrapper'], [ 'class' => [ 'e-search', 'hidden' ], 'role' => 'search', ] ); if ( 'previous_next' === $settings['pagination_type_options'] ) { $this->add_render_attribute( $this->element_attribute_ids['results_wrapper'], [ 'class' => 'hide-pagination-numbers', ] ); } $this->add_render_attribute( $this->element_attribute_ids['form'], [ 'class' => 'e-search-form', 'action' => esc_url( home_url() ), 'method' => 'get', ] ); $this->add_render_attribute( $this->element_attribute_ids['label'], [ 'class' => 'e-search-label', 'for' => "search-$id", ] ); $this->add_render_attribute( $this->element_attribute_ids['label_text'], [ 'class' => $screen_only_class, ] ); $this->add_render_attribute( $this->element_attribute_ids['input_wrapper'], [ 'class' => 'e-search-input-wrapper', ] ); $this->add_render_attribute( $this->element_attribute_ids['input'], [ 'id' => "search-$id", 'placeholder' => esc_attr( $settings['search_input_placeholder_text'] ), 'class' => 'e-search-input', 'type' => 'search', 'name' => 's', 'value' => '', 'autocomplete' => $this->get_autocomplete_state(), 'role' => 'combobox', 'aria-autocomplete' => 'list', 'aria-expanded' => 'false', 'aria-controls' => "results-$id", 'aria-haspopup' => 'listbox', ] ); $this->add_render_attribute( $this->element_attribute_ids['submit_button'], [ 'class' => [ 'e-search-submit', $this->is_submit_button_shown() ? '' : $screen_only_class, $settings['submit_hover_animation'] ? 'elementor-animation-' . $settings['submit_hover_animation'] : '', ], 'type' => 'submit', ] ); $this->add_render_attribute( $this->element_attribute_ids['submit_text'], [ 'class' => $this->is_submit_button_shown() ? '' : $screen_only_class, ] ); $this->add_render_attribute( $this->element_attribute_ids['results_wrapper'], [ 'id' => "results-$id", 'class' => 'e-search-results-container hide-loader', 'aria-live' => 'polite', 'aria-atomic' => 'true', 'aria-label' => 'Results for search', 'tabindex' => '0', ] ); $this->add_render_attribute( $this->element_attribute_ids['widget_props'], [ 'type' => 'hidden', 'name' => 'e_search_props', 'value' => $this->get_id() . '-' . Pro_Utils::get_current_post_id(), ] ); } private function is_submit_button_shown() { return 'key_enter' !== $this->get_settings_for_display( 'submit_trigger' ); } private function get_autocomplete_state() { return 'yes' !== $this->get_settings_for_display( 'autocomplete' ) ? 'off' : 'on'; } private function get_dropdown_width() { return 'widget_width' === $this->get_settings_for_display( 'results_is_dropdown_width' ); } private function maybe_render_icon( $target ) { $icon_settings = $this->get_settings_for_display( $target ) ?? [ 'library' => '', 'value' => '', ]; Icons_Manager::render_icon( $icon_settings ?? [ '', '' ], [ 'aria-hidden' => 'true' ], 'i' ); } private function get_supported_post_types() { $supported_post_types = [ 'any' => esc_html__( 'All', 'elementor-pro' ), 'product' => esc_html__( 'Products', 'elementor-pro' ), 'post' => esc_html__( 'Posts', 'elementor-pro' ), 'page' => esc_html__( 'Pages', 'elementor-pro' ), ]; $cpts = $this->get_supported_cpts(); return array_merge( $supported_post_types, $cpts ); } private function get_supported_cpts() { $cpts = new Collection( get_post_types( [ 'public' => true, '_builtin' => false, ], 'objects' ) ); return $cpts->except( [ 'product', 'related_products', 'elementor_library' ] ) ->map_with_keys( function ( $item, $post_type ) { return [ $post_type => $item->label ?? null ]; } ) ->filter() ->all(); } private function get_property_key_prefix() { return $this->get_query_name() . '_query'; } } class-wp-rest-post-search-handler.php 0000644 00000013651 14721713173 0013636 0 ustar 00 <?php /** * REST API: WP_REST_Post_Search_Handler class * * @package WordPress * @subpackage REST_API * @since 5.0.0 */ /** * Core class representing a search handler for posts in the REST API. * * @since 5.0.0 * * @see WP_REST_Search_Handler */ class WP_REST_Post_Search_Handler extends WP_REST_Search_Handler { /** * Constructor. * * @since 5.0.0 */ public function __construct() { $this->type = 'post'; // Support all public post types except attachments. $this->subtypes = array_diff( array_values( get_post_types( array( 'public' => true, 'show_in_rest' => true, ), 'names' ) ), array( 'attachment' ) ); } /** * Searches posts for a given search request. * * @since 5.0.0 * * @param WP_REST_Request $request Full REST request. * @return array { * Associative array containing found IDs and total count for the matching search results. * * @type int[] $ids Array containing the matching post IDs. * @type int $total Total count for the matching search results. * } */ public function search_items( WP_REST_Request $request ) { // Get the post types to search for the current request. $post_types = $request[ WP_REST_Search_Controller::PROP_SUBTYPE ]; if ( in_array( WP_REST_Search_Controller::TYPE_ANY, $post_types, true ) ) { $post_types = $this->subtypes; } $query_args = array( 'post_type' => $post_types, 'post_status' => 'publish', 'paged' => (int) $request['page'], 'posts_per_page' => (int) $request['per_page'], 'ignore_sticky_posts' => true, ); if ( ! empty( $request['search'] ) ) { $query_args['s'] = $request['search']; } if ( ! empty( $request['exclude'] ) ) { $query_args['post__not_in'] = $request['exclude']; } if ( ! empty( $request['include'] ) ) { $query_args['post__in'] = $request['include']; } /** * Filters the query arguments for a REST API post search request. * * Enables adding extra arguments or setting defaults for a post search request. * * @since 5.1.0 * * @param array $query_args Key value array of query var to query value. * @param WP_REST_Request $request The request used. */ $query_args = apply_filters( 'rest_post_search_query', $query_args, $request ); $query = new WP_Query(); $posts = $query->query( $query_args ); // Querying the whole post object will warm the object cache, avoiding an extra query per result. $found_ids = wp_list_pluck( $posts, 'ID' ); $total = $query->found_posts; return array( self::RESULT_IDS => $found_ids, self::RESULT_TOTAL => $total, ); } /** * Prepares the search result for a given post ID. * * @since 5.0.0 * * @param int $id Post ID. * @param array $fields Fields to include for the post. * @return array { * Associative array containing fields for the post based on the `$fields` parameter. * * @type int $id Optional. Post ID. * @type string $title Optional. Post title. * @type string $url Optional. Post permalink URL. * @type string $type Optional. Post type. * } */ public function prepare_item( $id, array $fields ) { $post = get_post( $id ); $data = array(); if ( in_array( WP_REST_Search_Controller::PROP_ID, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_ID ] = (int) $post->ID; } if ( in_array( WP_REST_Search_Controller::PROP_TITLE, $fields, true ) ) { if ( post_type_supports( $post->post_type, 'title' ) ) { add_filter( 'protected_title_format', array( $this, 'protected_title_format' ) ); add_filter( 'private_title_format', array( $this, 'protected_title_format' ) ); $data[ WP_REST_Search_Controller::PROP_TITLE ] = get_the_title( $post->ID ); remove_filter( 'protected_title_format', array( $this, 'protected_title_format' ) ); remove_filter( 'private_title_format', array( $this, 'protected_title_format' ) ); } else { $data[ WP_REST_Search_Controller::PROP_TITLE ] = ''; } } if ( in_array( WP_REST_Search_Controller::PROP_URL, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_URL ] = get_permalink( $post->ID ); } if ( in_array( WP_REST_Search_Controller::PROP_TYPE, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_TYPE ] = $this->type; } if ( in_array( WP_REST_Search_Controller::PROP_SUBTYPE, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_SUBTYPE ] = $post->post_type; } return $data; } /** * Prepares links for the search result of a given ID. * * @since 5.0.0 * * @param int $id Item ID. * @return array Links for the given item. */ public function prepare_item_links( $id ) { $post = get_post( $id ); $links = array(); $item_route = rest_get_route_for_post( $post ); if ( ! empty( $item_route ) ) { $links['self'] = array( 'href' => rest_url( $item_route ), 'embeddable' => true, ); } $links['about'] = array( 'href' => rest_url( 'wp/v2/types/' . $post->post_type ), ); return $links; } /** * Overwrites the default protected and private title format. * * By default, WordPress will show password protected or private posts with a title of * "Protected: %s" or "Private: %s", as the REST API communicates the status of a post * in a machine-readable format, we remove the prefix. * * @since 5.0.0 * * @return string Title format. */ public function protected_title_format() { return '%s'; } /** * Attempts to detect the route to access a single item. * * @since 5.0.0 * @deprecated 5.5.0 Use rest_get_route_for_post() * @see rest_get_route_for_post() * * @param WP_Post $post Post object. * @return string REST route relative to the REST base URI, or empty string if unknown. */ protected function detect_rest_item_route( $post ) { _deprecated_function( __METHOD__, '5.5.0', 'rest_get_route_for_post()' ); return rest_get_route_for_post( $post ); } } class-wp-rest-post-format-search-handler.php 0000644 00000007532 14721713173 0015125 0 ustar 00 <?php /** * REST API: WP_REST_Post_Format_Search_Handler class * * @package WordPress * @subpackage REST_API * @since 5.6.0 */ /** * Core class representing a search handler for post formats in the REST API. * * @since 5.6.0 * * @see WP_REST_Search_Handler */ class WP_REST_Post_Format_Search_Handler extends WP_REST_Search_Handler { /** * Constructor. * * @since 5.6.0 */ public function __construct() { $this->type = 'post-format'; } /** * Searches the post formats for a given search request. * * @since 5.6.0 * * @param WP_REST_Request $request Full REST request. * @return array { * Associative array containing found IDs and total count for the matching search results. * * @type string[] $ids Array containing slugs for the matching post formats. * @type int $total Total count for the matching search results. * } */ public function search_items( WP_REST_Request $request ) { $format_strings = get_post_format_strings(); $format_slugs = array_keys( $format_strings ); $query_args = array(); if ( ! empty( $request['search'] ) ) { $query_args['search'] = $request['search']; } /** * Filters the query arguments for a REST API post format search request. * * Enables adding extra arguments or setting defaults for a post format search request. * * @since 5.6.0 * * @param array $query_args Key value array of query var to query value. * @param WP_REST_Request $request The request used. */ $query_args = apply_filters( 'rest_post_format_search_query', $query_args, $request ); $found_ids = array(); foreach ( $format_slugs as $format_slug ) { if ( ! empty( $query_args['search'] ) ) { $format_string = get_post_format_string( $format_slug ); $format_slug_match = stripos( $format_slug, $query_args['search'] ) !== false; $format_string_match = stripos( $format_string, $query_args['search'] ) !== false; if ( ! $format_slug_match && ! $format_string_match ) { continue; } } $format_link = get_post_format_link( $format_slug ); if ( $format_link ) { $found_ids[] = $format_slug; } } $page = (int) $request['page']; $per_page = (int) $request['per_page']; return array( self::RESULT_IDS => array_slice( $found_ids, ( $page - 1 ) * $per_page, $per_page ), self::RESULT_TOTAL => count( $found_ids ), ); } /** * Prepares the search result for a given post format. * * @since 5.6.0 * * @param string $id Item ID, the post format slug. * @param array $fields Fields to include for the item. * @return array { * Associative array containing fields for the post format based on the `$fields` parameter. * * @type string $id Optional. Post format slug. * @type string $title Optional. Post format name. * @type string $url Optional. Post format permalink URL. * @type string $type Optional. String 'post-format'. *} */ public function prepare_item( $id, array $fields ) { $data = array(); if ( in_array( WP_REST_Search_Controller::PROP_ID, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_ID ] = $id; } if ( in_array( WP_REST_Search_Controller::PROP_TITLE, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_TITLE ] = get_post_format_string( $id ); } if ( in_array( WP_REST_Search_Controller::PROP_URL, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_URL ] = get_post_format_link( $id ); } if ( in_array( WP_REST_Search_Controller::PROP_TYPE, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_TYPE ] = $this->type; } return $data; } /** * Prepares links for the search result. * * @since 5.6.0 * * @param string $id Item ID, the post format slug. * @return array Links for the given item. */ public function prepare_item_links( $id ) { return array(); } } class-wp-rest-term-search-handler.php 0000644 00000011032 14721713173 0013607 0 ustar 00 <?php /** * REST API: WP_REST_Term_Search_Handler class * * @package WordPress * @subpackage REST_API * @since 5.6.0 */ /** * Core class representing a search handler for terms in the REST API. * * @since 5.6.0 * * @see WP_REST_Search_Handler */ class WP_REST_Term_Search_Handler extends WP_REST_Search_Handler { /** * Constructor. * * @since 5.6.0 */ public function __construct() { $this->type = 'term'; $this->subtypes = array_values( get_taxonomies( array( 'public' => true, 'show_in_rest' => true, ), 'names' ) ); } /** * Searches terms for a given search request. * * @since 5.6.0 * * @param WP_REST_Request $request Full REST request. * @return array { * Associative array containing found IDs and total count for the matching search results. * * @type int[] $ids Found term IDs. * @type string|int|WP_Error $total Numeric string containing the number of terms in that * taxonomy, 0 if there are no results, or WP_Error if * the requested taxonomy does not exist. * } */ public function search_items( WP_REST_Request $request ) { $taxonomies = $request[ WP_REST_Search_Controller::PROP_SUBTYPE ]; if ( in_array( WP_REST_Search_Controller::TYPE_ANY, $taxonomies, true ) ) { $taxonomies = $this->subtypes; } $page = (int) $request['page']; $per_page = (int) $request['per_page']; $query_args = array( 'taxonomy' => $taxonomies, 'hide_empty' => false, 'offset' => ( $page - 1 ) * $per_page, 'number' => $per_page, ); if ( ! empty( $request['search'] ) ) { $query_args['search'] = $request['search']; } if ( ! empty( $request['exclude'] ) ) { $query_args['exclude'] = $request['exclude']; } if ( ! empty( $request['include'] ) ) { $query_args['include'] = $request['include']; } /** * Filters the query arguments for a REST API term search request. * * Enables adding extra arguments or setting defaults for a term search request. * * @since 5.6.0 * * @param array $query_args Key value array of query var to query value. * @param WP_REST_Request $request The request used. */ $query_args = apply_filters( 'rest_term_search_query', $query_args, $request ); $query = new WP_Term_Query(); $found_terms = $query->query( $query_args ); $found_ids = wp_list_pluck( $found_terms, 'term_id' ); unset( $query_args['offset'], $query_args['number'] ); $total = wp_count_terms( $query_args ); // wp_count_terms() can return a falsey value when the term has no children. if ( ! $total ) { $total = 0; } return array( self::RESULT_IDS => $found_ids, self::RESULT_TOTAL => $total, ); } /** * Prepares the search result for a given term ID. * * @since 5.6.0 * * @param int $id Term ID. * @param array $fields Fields to include for the term. * @return array { * Associative array containing fields for the term based on the `$fields` parameter. * * @type int $id Optional. Term ID. * @type string $title Optional. Term name. * @type string $url Optional. Term permalink URL. * @type string $type Optional. Term taxonomy name. * } */ public function prepare_item( $id, array $fields ) { $term = get_term( $id ); $data = array(); if ( in_array( WP_REST_Search_Controller::PROP_ID, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_ID ] = (int) $id; } if ( in_array( WP_REST_Search_Controller::PROP_TITLE, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_TITLE ] = $term->name; } if ( in_array( WP_REST_Search_Controller::PROP_URL, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_URL ] = get_term_link( $id ); } if ( in_array( WP_REST_Search_Controller::PROP_TYPE, $fields, true ) ) { $data[ WP_REST_Search_Controller::PROP_TYPE ] = $term->taxonomy; } return $data; } /** * Prepares links for the search result of a given ID. * * @since 5.6.0 * * @param int $id Item ID. * @return array[] Array of link arrays for the given item. */ public function prepare_item_links( $id ) { $term = get_term( $id ); $links = array(); $item_route = rest_get_route_for_term( $term ); if ( $item_route ) { $links['self'] = array( 'href' => rest_url( $item_route ), 'embeddable' => true, ); } $links['about'] = array( 'href' => rest_url( sprintf( 'wp/v2/taxonomies/%s', $term->taxonomy ) ), ); return $links; } } class-wp-rest-search-handler.php 0000644 00000004367 14721713173 0012657 0 ustar 00 <?php /** * REST API: WP_REST_Search_Handler class * * @package WordPress * @subpackage REST_API * @since 5.0.0 */ /** * Core base class representing a search handler for an object type in the REST API. * * @since 5.0.0 */ #[AllowDynamicProperties] abstract class WP_REST_Search_Handler { /** * Field containing the IDs in the search result. */ const RESULT_IDS = 'ids'; /** * Field containing the total count in the search result. */ const RESULT_TOTAL = 'total'; /** * Object type managed by this search handler. * * @since 5.0.0 * @var string */ protected $type = ''; /** * Object subtypes managed by this search handler. * * @since 5.0.0 * @var string[] */ protected $subtypes = array(); /** * Gets the object type managed by this search handler. * * @since 5.0.0 * * @return string Object type identifier. */ public function get_type() { return $this->type; } /** * Gets the object subtypes managed by this search handler. * * @since 5.0.0 * * @return string[] Array of object subtype identifiers. */ public function get_subtypes() { return $this->subtypes; } /** * Searches the object type content for a given search request. * * @since 5.0.0 * * @param WP_REST_Request $request Full REST request. * @return array Associative array containing an `WP_REST_Search_Handler::RESULT_IDS` containing * an array of found IDs and `WP_REST_Search_Handler::RESULT_TOTAL` containing the * total count for the matching search results. */ abstract public function search_items( WP_REST_Request $request ); /** * Prepares the search result for a given ID. * * @since 5.0.0 * @since 5.6.0 The `$id` parameter can accept a string. * * @param int|string $id Item ID. * @param array $fields Fields to include for the item. * @return array Associative array containing all fields for the item. */ abstract public function prepare_item( $id, array $fields ); /** * Prepares links for the search result of a given ID. * * @since 5.0.0 * @since 5.6.0 The `$id` parameter can accept a string. * * @param int|string $id Item ID. * @return array Links for the given item. */ abstract public function prepare_item_links( $id ); } editor-rtl.min.css 0000644 00000000506 14721732070 0010131 0 ustar 00 .wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search :where(.wp-block-search__button){align-items:center;border-radius:initial;display:flex;height:auto;justify-content:center;text-align:center}.wp-block-search__inspector-controls .components-base-control{margin-bottom:0} block.json 0000644 00000003744 14721732070 0006544 0 ustar 00 { "$schema": "https://schemas.wp.org/trunk/block.json", "apiVersion": 3, "name": "core/search", "title": "Search", "category": "widgets", "description": "Help visitors find your content.", "keywords": [ "find" ], "textdomain": "default", "attributes": { "label": { "type": "string", "role": "content" }, "showLabel": { "type": "boolean", "default": true }, "placeholder": { "type": "string", "default": "", "role": "content" }, "width": { "type": "number" }, "widthUnit": { "type": "string" }, "buttonText": { "type": "string", "role": "content" }, "buttonPosition": { "type": "string", "default": "button-outside" }, "buttonUseIcon": { "type": "boolean", "default": false }, "query": { "type": "object", "default": {} }, "isSearchFieldHidden": { "type": "boolean", "default": false } }, "supports": { "align": [ "left", "center", "right" ], "color": { "gradients": true, "__experimentalSkipSerialization": true, "__experimentalDefaultControls": { "background": true, "text": true } }, "interactivity": true, "typography": { "__experimentalSkipSerialization": true, "__experimentalSelector": ".wp-block-search__label, .wp-block-search__input, .wp-block-search__button", "fontSize": true, "lineHeight": true, "__experimentalFontFamily": true, "__experimentalFontWeight": true, "__experimentalFontStyle": true, "__experimentalTextTransform": true, "__experimentalTextDecoration": true, "__experimentalLetterSpacing": true, "__experimentalDefaultControls": { "fontSize": true } }, "__experimentalBorder": { "color": true, "radius": true, "width": true, "__experimentalSkipSerialization": true, "__experimentalDefaultControls": { "color": true, "radius": true, "width": true } }, "spacing": { "margin": true }, "html": false }, "editorStyle": "wp-block-search-editor", "style": "wp-block-search" } view.min.js 0000644 00000002437 14721732070 0006647 0 ustar 00 import*as e from"@wordpress/interactivity";var t={d:(e,n)=>{for(var r in n)t.o(n,r)&&!t.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:n[r]})},o:(e,t)=>Object.prototype.hasOwnProperty.call(e,t)};const n=(e=>{var n={};return t.d(n,e),n})({getContext:()=>e.getContext,getElement:()=>e.getElement,store:()=>e.store}),{actions:r}=(0,n.store)("core/search",{state:{get ariaLabel(){const{isSearchInputVisible:e,ariaLabelCollapsed:t,ariaLabelExpanded:r}=(0,n.getContext)();return e?r:t},get ariaControls(){const{isSearchInputVisible:e,inputId:t}=(0,n.getContext)();return e?null:t},get type(){const{isSearchInputVisible:e}=(0,n.getContext)();return e?"submit":"button"},get tabindex(){const{isSearchInputVisible:e}=(0,n.getContext)();return e?"0":"-1"}},actions:{openSearchInput(e){const t=(0,n.getContext)(),{ref:r}=(0,n.getElement)();t.isSearchInputVisible||(e.preventDefault(),t.isSearchInputVisible=!0,r.parentElement.querySelector("input").focus())},closeSearchInput(){(0,n.getContext)().isSearchInputVisible=!1},handleSearchKeydown(e){const{ref:t}=(0,n.getElement)();"Escape"===e?.key&&(r.closeSearchInput(),t.querySelector("button").focus())},handleSearchFocusout(e){const{ref:t}=(0,n.getElement)();t.contains(e.relatedTarget)||e.target===window.document.activeElement||r.closeSearchInput()}}},{lock:!0}); view.asset.php 0000644 00000000124 14721732070 0007345 0 ustar 00 <?php return array('dependencies' => array(), 'version' => '2a0784014283afdd3c25'); editor.min.css 0000644 00000000506 14721732070 0007332 0 ustar 00 .wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{margin:auto}.wp-block-search :where(.wp-block-search__button){align-items:center;border-radius:initial;display:flex;height:auto;justify-content:center;text-align:center}.wp-block-search__inspector-controls .components-base-control{margin-bottom:0} style-rtl.min.css 0000644 00000004626 14721732070 0010012 0 ustar 00 .wp-block-search__button{margin-right:10px;word-break:normal}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{height:1.25em;min-height:24px;min-width:24px;width:1.25em;fill:currentColor;vertical-align:text-bottom}:where(.wp-block-search__button){border:1px solid #ccc;padding:6px 10px}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{appearance:none;border:1px solid #949494;flex-grow:1;margin-left:0;margin-right:0;min-width:3rem;padding:8px;text-decoration:unset!important}.wp-block-search.wp-block-search__button-only .wp-block-search__button{flex-shrink:0;margin-right:0;max-width:100%}.wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{max-width:calc(100% - 100px)}.wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{min-width:0!important;transition-property:width}.wp-block-search.wp-block-search__button-only .wp-block-search__input{flex-basis:100%;transition-duration:.3s}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{overflow:hidden}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{border-left-width:0!important;border-right-width:0!important;flex-basis:0;flex-grow:0;margin:0;min-width:0!important;padding-left:0!important;padding-right:0!important;width:0!important}:where(.wp-block-search__input){font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-transform:inherit}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){border:1px solid #949494;box-sizing:border-box;padding:4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{border:none;border-radius:0;padding:0 4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{outline:none}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){padding:4px 8px}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{float:left} theme.min.css 0000644 00000000176 14721732070 0007151 0 ustar 00 .wp-block-search .wp-block-search__label{font-weight:700}.wp-block-search__button{border:1px solid #ccc;padding:.375em .625em} theme-rtl.min.css 0000644 00000000176 14721732070 0007750 0 ustar 00 .wp-block-search .wp-block-search__label{font-weight:700}.wp-block-search__button{border:1px solid #ccc;padding:.375em .625em} theme-rtl.css 0000644 00000000215 14721732070 0007160 0 ustar 00 .wp-block-search .wp-block-search__label{ font-weight:700; } .wp-block-search__button{ border:1px solid #ccc; padding:.375em .625em; } style-rtl.css 0000644 00000005223 14721732070 0007222 0 ustar 00 .wp-block-search__button{ margin-right:10px; word-break:normal; } .wp-block-search__button.has-icon{ line-height:0; } .wp-block-search__button svg{ height:1.25em; min-height:24px; min-width:24px; width:1.25em; fill:currentColor; vertical-align:text-bottom; } :where(.wp-block-search__button){ border:1px solid #ccc; padding:6px 10px; } .wp-block-search__inside-wrapper{ display:flex; flex:auto; flex-wrap:nowrap; max-width:100%; } .wp-block-search__label{ width:100%; } .wp-block-search__input{ appearance:none; border:1px solid #949494; flex-grow:1; margin-left:0; margin-right:0; min-width:3rem; padding:8px; text-decoration:unset !important; } .wp-block-search.wp-block-search__button-only .wp-block-search__button{ flex-shrink:0; margin-right:0; max-width:100%; } .wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{ max-width:calc(100% - 100px); } .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ min-width:0 !important; transition-property:width; } .wp-block-search.wp-block-search__button-only .wp-block-search__input{ flex-basis:100%; transition-duration:.3s; } .wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{ overflow:hidden; } .wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{ border-left-width:0 !important; border-right-width:0 !important; flex-basis:0; flex-grow:0; margin:0; min-width:0 !important; padding-left:0 !important; padding-right:0 !important; width:0 !important; } :where(.wp-block-search__input){ font-family:inherit; font-size:inherit; font-style:inherit; font-weight:inherit; letter-spacing:inherit; line-height:inherit; text-transform:inherit; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){ border:1px solid #949494; box-sizing:border-box; padding:4px; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{ border:none; border-radius:0; padding:0 4px; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{ outline:none; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){ padding:4px 8px; } .wp-block-search.aligncenter .wp-block-search__inside-wrapper{ margin:auto; } .wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ float:left; } editor-rtl.css 0000644 00000000550 14721732070 0007346 0 ustar 00 .wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{ margin:auto; } .wp-block-search :where(.wp-block-search__button){ align-items:center; border-radius:initial; display:flex; height:auto; justify-content:center; text-align:center; } .wp-block-search__inspector-controls .components-base-control{ margin-bottom:0; } view.js 0000644 00000007611 14721732070 0006064 0 ustar 00 import * as __WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__ from "@wordpress/interactivity"; /******/ // The require scope /******/ var __webpack_require__ = {}; /******/ /************************************************************************/ /******/ /* webpack/runtime/define property getters */ /******/ (() => { /******/ // define getter functions for harmony exports /******/ __webpack_require__.d = (exports, definition) => { /******/ for(var key in definition) { /******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) { /******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] }); /******/ } /******/ } /******/ }; /******/ })(); /******/ /******/ /* webpack/runtime/hasOwnProperty shorthand */ /******/ (() => { /******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop)) /******/ })(); /******/ /************************************************************************/ var __webpack_exports__ = {}; ;// CONCATENATED MODULE: external "@wordpress/interactivity" var x = (y) => { var x = {}; __webpack_require__.d(x, y); return x } var y = (x) => (() => (x)) const interactivity_namespaceObject = x({ ["getContext"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getContext), ["getElement"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.getElement), ["store"]: () => (__WEBPACK_EXTERNAL_MODULE__wordpress_interactivity_8e89b257__.store) }); ;// CONCATENATED MODULE: ./node_modules/@wordpress/block-library/build-module/search/view.js /** * WordPress dependencies */ const { actions } = (0,interactivity_namespaceObject.store)('core/search', { state: { get ariaLabel() { const { isSearchInputVisible, ariaLabelCollapsed, ariaLabelExpanded } = (0,interactivity_namespaceObject.getContext)(); return isSearchInputVisible ? ariaLabelExpanded : ariaLabelCollapsed; }, get ariaControls() { const { isSearchInputVisible, inputId } = (0,interactivity_namespaceObject.getContext)(); return isSearchInputVisible ? null : inputId; }, get type() { const { isSearchInputVisible } = (0,interactivity_namespaceObject.getContext)(); return isSearchInputVisible ? 'submit' : 'button'; }, get tabindex() { const { isSearchInputVisible } = (0,interactivity_namespaceObject.getContext)(); return isSearchInputVisible ? '0' : '-1'; } }, actions: { openSearchInput(event) { const ctx = (0,interactivity_namespaceObject.getContext)(); const { ref } = (0,interactivity_namespaceObject.getElement)(); if (!ctx.isSearchInputVisible) { event.preventDefault(); ctx.isSearchInputVisible = true; ref.parentElement.querySelector('input').focus(); } }, closeSearchInput() { const ctx = (0,interactivity_namespaceObject.getContext)(); ctx.isSearchInputVisible = false; }, handleSearchKeydown(event) { const { ref } = (0,interactivity_namespaceObject.getElement)(); // If Escape close the menu. if (event?.key === 'Escape') { actions.closeSearchInput(); ref.querySelector('button').focus(); } }, handleSearchFocusout(event) { const { ref } = (0,interactivity_namespaceObject.getElement)(); // If focus is outside search form, and in the document, close menu // event.target === The element losing focus // event.relatedTarget === The element receiving focus (if any) // When focusout is outside the document, // `window.document.activeElement` doesn't change. if (!ref.contains(event.relatedTarget) && event.target !== window.document.activeElement) { actions.closeSearchInput(); } } } }, { lock: true }); view.min.asset.php 0000644 00000000124 14721732070 0010127 0 ustar 00 <?php return array('dependencies' => array(), 'version' => '765a40956d200c79d99e'); theme.css 0000644 00000000215 14721732070 0006361 0 ustar 00 .wp-block-search .wp-block-search__label{ font-weight:700; } .wp-block-search__button{ border:1px solid #ccc; padding:.375em .625em; } editor.css 0000644 00000000550 14721732070 0006547 0 ustar 00 .wp-block[data-align=center] .wp-block-search .wp-block-search__inside-wrapper{ margin:auto; } .wp-block-search :where(.wp-block-search__button){ align-items:center; border-radius:initial; display:flex; height:auto; justify-content:center; text-align:center; } .wp-block-search__inspector-controls .components-base-control{ margin-bottom:0; } style.css 0000644 00000005222 14721732070 0006422 0 ustar 00 .wp-block-search__button{ margin-left:10px; word-break:normal; } .wp-block-search__button.has-icon{ line-height:0; } .wp-block-search__button svg{ height:1.25em; min-height:24px; min-width:24px; width:1.25em; fill:currentColor; vertical-align:text-bottom; } :where(.wp-block-search__button){ border:1px solid #ccc; padding:6px 10px; } .wp-block-search__inside-wrapper{ display:flex; flex:auto; flex-wrap:nowrap; max-width:100%; } .wp-block-search__label{ width:100%; } .wp-block-search__input{ appearance:none; border:1px solid #949494; flex-grow:1; margin-left:0; margin-right:0; min-width:3rem; padding:8px; text-decoration:unset !important; } .wp-block-search.wp-block-search__button-only .wp-block-search__button{ flex-shrink:0; margin-left:0; max-width:100%; } .wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{ max-width:calc(100% - 100px); } .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ min-width:0 !important; transition-property:width; } .wp-block-search.wp-block-search__button-only .wp-block-search__input{ flex-basis:100%; transition-duration:.3s; } .wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{ overflow:hidden; } .wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{ border-left-width:0 !important; border-right-width:0 !important; flex-basis:0; flex-grow:0; margin:0; min-width:0 !important; padding-left:0 !important; padding-right:0 !important; width:0 !important; } :where(.wp-block-search__input){ font-family:inherit; font-size:inherit; font-style:inherit; font-weight:inherit; letter-spacing:inherit; line-height:inherit; text-transform:inherit; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){ border:1px solid #949494; box-sizing:border-box; padding:4px; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{ border:none; border-radius:0; padding:0 4px; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{ outline:none; } :where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){ padding:4px 8px; } .wp-block-search.aligncenter .wp-block-search__inside-wrapper{ margin:auto; } .wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{ float:right; } style.min.css 0000644 00000004625 14721732070 0007212 0 ustar 00 .wp-block-search__button{margin-left:10px;word-break:normal}.wp-block-search__button.has-icon{line-height:0}.wp-block-search__button svg{height:1.25em;min-height:24px;min-width:24px;width:1.25em;fill:currentColor;vertical-align:text-bottom}:where(.wp-block-search__button){border:1px solid #ccc;padding:6px 10px}.wp-block-search__inside-wrapper{display:flex;flex:auto;flex-wrap:nowrap;max-width:100%}.wp-block-search__label{width:100%}.wp-block-search__input{appearance:none;border:1px solid #949494;flex-grow:1;margin-left:0;margin-right:0;min-width:3rem;padding:8px;text-decoration:unset!important}.wp-block-search.wp-block-search__button-only .wp-block-search__button{flex-shrink:0;margin-left:0;max-width:100%}.wp-block-search.wp-block-search__button-only .wp-block-search__button[aria-expanded=true]{max-width:calc(100% - 100px)}.wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{min-width:0!important;transition-property:width}.wp-block-search.wp-block-search__button-only .wp-block-search__input{flex-basis:100%;transition-duration:.3s}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden,.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__inside-wrapper{overflow:hidden}.wp-block-search.wp-block-search__button-only.wp-block-search__searchfield-hidden .wp-block-search__input{border-left-width:0!important;border-right-width:0!important;flex-basis:0;flex-grow:0;margin:0;min-width:0!important;padding-left:0!important;padding-right:0!important;width:0!important}:where(.wp-block-search__input){font-family:inherit;font-size:inherit;font-style:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;text-transform:inherit}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper){border:1px solid #949494;box-sizing:border-box;padding:4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input{border:none;border-radius:0;padding:0 4px}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) .wp-block-search__input:focus{outline:none}:where(.wp-block-search__button-inside .wp-block-search__inside-wrapper) :where(.wp-block-search__button){padding:4px 8px}.wp-block-search.aligncenter .wp-block-search__inside-wrapper{margin:auto}.wp-block[data-align=right] .wp-block-search.wp-block-search__button-only .wp-block-search__inside-wrapper{float:right}
| ver. 1.4 |
Github
|
.
| PHP 7.4.3-4ubuntu2.24 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка