文件操作 - search.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/Total/inc/header/menu/search.php
编辑文件内容
<?php namespace TotalTheme\Header\Menu; \defined( 'ABSPATH' ) || exit; /** * Header Menu. */ class Search { /** * Check if enabled or not. */ protected static $is_enabled; /** * The style. */ protected static $style; /** * Static-only class. */ private function __construct() {} /** * Checks if the header menu is currently supported. */ public static function is_supported(): bool { if ( ! \totaltheme_call_static( 'Header\Core', 'is_enabled' ) ) { return false; } $check = true; /** * Filters whether the header menu supports a search form or not. * * @param bool $check */ $check = \apply_filters( 'totaltheme/header/menu/search/is_supported', $check ); /*** deprecated ***/ $check = \apply_filters( 'wpex_has_menu_search', $check ); return (bool) $check; } /** * Returns header menu search style. */ public static function is_enabled(): bool { $check = \get_theme_mod( 'menu_search_enable', true ); $style = self::style(); if ( \wp_validate_boolean( $check ) && $style && 'disabled' !== $style ) { $check = true; } /** * Filters whether the header menu search is enabled. * * @param bool $check */ $check = \apply_filters( 'totaltheme/header/menu/search/is_enabled', $check ); return (bool) $check; } /** * Returns header menu search style. */ public static function style(): ?string { if ( ! \is_null( self::$style ) ) { return self::$style; } if ( ! \wpex_header_menu_supports_search() ) { return null; } // Get style as set in the customizer. $style = \get_theme_mod( 'menu_search_style', 'drop_down' ); // Convert old disabled theme_mod. if ( 'disabled' === $style ) { \remove_theme_mod( 'menu_search_style' ); \set_theme_mod( 'menu_search_enable', false ); } /** * Filters the header menu search style * * @param string $style */ $style = \apply_filters( 'totaltheme/header/menu/search/style', $style ); /*** deprecated ***/ $style = \apply_filters( 'wpex_menu_search_style', $style ); if ( ! $style ) { $style = 'drop_down'; // style must never be empty. } self::$style = (string) $style; return self::$style; } /** * Returns header menu search form placeholder text. */ public static function get_placeholder_text(): string { $placeholder = \wpex_get_translated_theme_mod( 'menu_search_placeholder' ); if ( ! $placeholder ) { $placeholder = \esc_html__( 'Search', 'total' ); $style = self::style(); if ( 'overlay' === $style || 'header_replace' === $style ) { $placeholder = \esc_html__( 'Type then hit enter to search…', 'total' ); } } /** * Filters the header menu searchform placeholder text. * * @param string $placeholder */ $placeholder = \apply_filters( 'totaltheme/header/menu/search/placeholder', $placeholder ); /*** deprecated ***/ $placeholder = \apply_filters( 'wpex_get_header_menu_search_form_placeholder', $placeholder ); return (string) $placeholder; } /** * Renders the dropdown widget classes. */ public static function drop_widget_class(): void { $class = [ 'header-searchform-wrap', ]; $widget_class = \wpex_get_header_drop_widget_class(); if ( $widget_class ) { $class = \array_merge( $class, $widget_class ); } $class[] = 'wpex-p-15'; if ( $class ) { echo 'class="' . \esc_attr( \implode( ' ', $class ) ) . '"'; } } /** * Returns header menu search form. */ public static function get_form( array $args = [] ): string { $defaults = [ 'echo' => false, ]; $args = \wp_parse_args( $args, $defaults ); /** * Filters the header search form args. */ $args = \apply_filters( 'totaltheme/header/menu/search/form_args', $args ); // Get the searchform. $form = \get_search_form( (array) $args ); /** * Filters the header menu search form output. * * @param string $form Search form html. * @param array $args Search form arguments. */ $form = \apply_filters( 'totaltheme/header/menu/search/form', $form, $args ); /*** deprecated ***/ $form = \apply_filters( 'wpex_get_header_menu_search_form', $form ); return (string) $form; } /** * Returns header menu search icon choices. */ public static function icon_choices(): array { $choices = [ 'search', 'material/search', 'ionicons/search', 'ionicons/search-outline', 'ionicons/search-sharp', ]; /** * Filters the header menu search icon choices. * * @param array $choices */ $choices = \apply_filters( 'totaltheme/header/menu/search/icon_choices', $choices ); /*** deprecated **/ $choices = \apply_filters( 'wpex_header_menu_icon_choices', $choices ); return (array) $choices; } /** * Returns header menu search icon html. */ protected static function get_icon_html(): string { $icon = \get_theme_mod( 'menu_search_icon' ) ?: 'search'; return \wpex_get_theme_icon_html( $icon, 'wpex-menu-search-icon' ) ?: ''; } /** * Inserts the header menu search icon into the menu. */ public static function insert_icon( $items, $args ) { if ( totaltheme_call_static( 'Header\Core', 'has_flex_container' ) || ! self::is_enabled() ) { return $items; } $aria_controls = ''; /*** deprecated ***/ $search_icon_theme_locations = (array) \apply_filters( 'wpex_menu_search_icon_theme_locations', [ 'main_menu' ] ); // Check menu location. if ( ! \in_array( $args->theme_location, $search_icon_theme_locations ) ) { return $items; } // Get search style. $search_style = self::style(); // Get header style. $header_style = totaltheme_call_static( 'Header\Core', 'style' ); // Define classes. $li_classes = 'search-toggle-li menu-item wpex-menu-extra'; $a_classes = 'site-search-toggle'; // Remove icon margin. if ( 'six' !== $header_style ) { $li_classes .= ' no-icon-margin'; } // Define vars based on search style. switch ( $search_style ) { case 'overlay': $a_classes .= ' search-overlay-toggle'; $aria_controls = 'wpex-searchform-overlay'; break; case 'drop_down': $a_classes .= ' search-dropdown-toggle'; $aria_controls = 'searchform-dropdown'; break; case 'header_replace': $a_classes .= ' search-header-replace-toggle'; $aria_controls = 'searchform-header-replace'; break; } // Ubermenu integration. if ( \class_exists( 'UberMenu' ) && \apply_filters( 'wpex_add_search_toggle_ubermenu_classes', true ) ) { $li_classes .= ' ubermenu-item-level-0 ubermenu-item'; $a_classes .= ' ubermenu-target ubermenu-item-layout-default ubermenu-item-layout-text_only'; } // Max Mega Menu integration. if ( \function_exists( 'max_mega_menu_is_enabled' ) && \max_mega_menu_is_enabled( $args->theme_location ) ) { $li_classes .= ' mega-menu-item'; $a_classes .= ' mega-menu-link'; } // Add search icon and dropdown style. $menu_search = ''; $menu_search .= '<li class="' . \esc_attr( $li_classes ) . '">'; $a_attributes = [ 'href' => '#', 'class' => \esc_attr( $a_classes ), 'role' => 'button', 'aria-expanded' => 'false', 'aria-controls' => $aria_controls, ]; if ( 'custom_link' === $search_style && $custom_link = \get_theme_mod( 'menu_search_custom_link' ) ) { if ( \str_starts_with( $custom_link, '/' ) ) { $custom_link = \home_url( $custom_link ); } $a_attributes['href'] = $custom_link; } if ( $a_aria = \wpex_get_aria_label( 'search' ) ) { $a_attributes['aria-label'] = $a_aria; } $menu_search .= '<a ' . \wpex_parse_attrs( $a_attributes ) . '>'; $menu_search .= '<span class="link-inner">'; $text = \esc_html__( 'Search', 'total' ); /** * Filters the header search icon text. * * @param string $text */ $text = (string) \apply_filters( 'totaltheme/header/menu/search/icon_label', $text ); /*** deprecated ***/ $text = (string) \apply_filters( 'wpex_header_search_text', $text ); $icon = self::get_icon_html(); if ( 'six' === $header_style ) { $menu_search .= $icon . '<span class="wpex-menu-search-text wpex-hidden">' . \esc_html( $text ) . '</span>'; } else { $menu_search .= '<span class="wpex-menu-search-text wpex-hidden">' . \esc_html( $text ) . '</span>' . $icon; } $menu_search .= '</span>'; $menu_search .= '</a>'; if ( 'drop_down' === $search_style && true === \wpex_maybe_add_header_drop_widget_inline( 'search' ) ) { \ob_start(); \wpex_get_template_part( 'header_search_dropdown' ); $menu_search .= \ob_get_clean(); } $menu_search .= '</li>'; /** * Filters the header menu search icon position. * * @param $position | options: start or end. */ $menu_search_position = \apply_filters( 'wpex_header_menu_search_position', 'end' ); switch ( $menu_search_position ) { case 'start': $items = $menu_search . $items; break; case 'end': default; $items = $items . $menu_search; break; } return $items; } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件