文件操作 - core.php
返回文件管理
返回主菜单
删除本文件
文件: /storage/v12552/jimbrandstatter/public_html/wp-content/themes/Total/inc/header/core.php
编辑文件内容
<?php namespace TotalTheme\Header; \defined( 'ABSPATH' ) || exit; /** * Core header methods. */ class Core { /** * Header is enabled or not. */ protected static $is_enabled; /** * Header is custom, aka using the header builder. */ protected static $is_custom; /** * The header style. */ protected static $style; /** * Static-only class. */ private function __construct() {} /** * Checks if the header is enabled or not. */ public static function is_enabled(): bool { if ( ! \is_null( self::$is_enabled ) ) { return self::$is_enabled; } if ( \is_page_template( [ 'templates/landing-page.php', 'templates/blank.php' ] ) ) { $check = false; } else { $post_id = \wpex_get_current_post_id(); if ( self::is_custom() || \wpex_elementor_location_exists( 'header' ) ) { $check = true; } else { $check = \get_theme_mod( 'enable_header', true ); } if ( $post_id && $meta = \get_post_meta( $post_id, 'wpex_disable_header', true ) ) { switch ( $meta ) { case 'on': $check = false; break; case 'enable': $check = true; break; } } } /** * Filters whether the site has the header enabled. * * @param bool $check */ $check = \apply_filters( 'totaltheme/header/is_enabled', $check ); /*** deprecated ***/ $check = \apply_filters( 'wpex_display_header', $check ); self::$is_enabled = (bool) $check; return self::$is_enabled; } /** * Checks if the header is custom or not. */ public static function is_custom(): bool { if ( ! \is_null( self::$is_custom ) ) { return self::$is_custom; } self::$is_custom = false; if ( ! empty( \wpex_header_builder_id() ) ) { self::$is_custom = true; } return self::$is_custom; } /** * Returns an array of style choices for the header. */ public static function style_choices(): array { $choices = [ 'one' => '1. ' . \esc_html__( 'Default: Left Logo & Right Menu','total' ), 'two' => '2. ' . \esc_html__( 'Bottom Menu','total' ), 'three' => '3. ' . \esc_html__( 'Bottom Menu Centered','total' ), 'four' => '4. ' . \esc_html__( 'Top Menu Centered','total' ), 'five' => '5. ' . \esc_html__( 'Centered Logo Inside Menu','total' ), 'six' => '6. ' . \esc_html__( 'Vertical','total' ), 'seven' => '7. ' . \esc_html__( 'Flex: Centered Menu','total' ), 'eight' => '8. ' . \esc_html__( 'Flex: Left Menu','total' ), 'nine' => '9. ' . \esc_html__( 'Flex: Right Menu','total' ), 'ten' => '10. ' . \esc_html__( 'Flex: Centered Logo','total' ), 'dev' => '11. ' . \esc_html__( 'Dev (No Styling)','total' ), ]; /** * Filters the header style choices. * * @param array $choices */ $choices = \apply_filters( 'totaltheme/header/style_choices', $choices ); /*** deprecated ***/ $choices = \apply_filters( 'wpex_header_styles', $choices ); return (array) $choices; } /** * Returns the header style. */ public static function style(): string { if ( ! \is_null( self::$style ) ) { return self::$style; } if ( ! self::is_enabled() ) { self::$style = 'disabled'; return self::$style; } // Check if builder is enabled. if ( self::is_custom() ) { self::$style = 'builder'; return self::$style; } // Get header style from customizer setting. $style = \get_theme_mod( 'header_style', 'one' ); /** * Filters the list of header styles excluded for the overlay header. * * @param array $excluded_headers */ $excluded_overlay_header_styles = (array) \apply_filters( 'wpex_overlay_header_excluded_header_styles', [] ); if ( \in_array( $style, $excluded_overlay_header_styles ) && totaltheme_call_static( 'Header\Overlay', 'is_enabled' ) ) { $style = 'one'; } $post_id = \wpex_get_current_post_id(); // Check for custom header style defined in meta options => Overrides all. if ( 'dev' !== $style && $post_id && $meta = \get_post_meta( $post_id, 'wpex_header_style', true ) ) { $style = $meta; } if ( ! $style ) { $style = 'one'; } /** * Filters the site header style. * * @param string $style */ $style = \apply_filters( 'totaltheme/header/style', $style ); /*** deprecated ***/ $style = \apply_filters( 'wpex_header_style', $style ); self::$style = (string) $style; return self::$style; } /** * Checks if the header is full width. */ public static function is_full_width(): bool { return ( 'full-width' === \wpex_site_layout() && \get_theme_mod( 'full_width_header' ) ); } /** * Checks if the header has a fixed height. */ public static function has_fixed_height(): bool { $check = false; $header_style = self::style(); if ( \in_array( $header_style, [ 'seven', 'eight', 'nine', 'ten' ] ) ) { $check = true; } /** * Filters whether the site header header has a fixed height. * * @param bool $check * @param string $header_style */ $check = \apply_filters( 'totaltheme/header/has_fixed_height', $check, $header_style ); /*** deprecated ***/ $check = \apply_filters( 'wpex_header_has_fixed_height', $check, $header_style ); return (bool) $check; } /** * Checks if the header has a flex container or not. */ public static function has_flex_container(): bool { $check = false; $header_style = self::style(); if ( \in_array( $header_style, [ 'seven', 'eight', 'nine', 'ten' ] ) ) { $check = true; } /** * Filters whether the site header has a flex header container. * * @param bool $check * @param string $header_style */ $check = \apply_filters( 'totaltheme/header/has_flex_container', $check, $header_style ); /*** deprecated ***/ $check = \apply_filters( 'wpex_has_flex_header', $check, $header_style ); return (bool) $check; } /** * Returns header image background image url. */ public static function get_background_image_url(): string { $image = \get_theme_mod( 'header_background_image' ); /** * Filters the header background image. * * @param int|string $image */ $image = \apply_filters( 'totaltheme/header/background_image', $image ); /*** deprecated ***/ $image = \apply_filters( 'wpex_header_background_image', $image ); $post_id = wpex_get_current_post_id(); if ( $post_id && $meta_image = \get_post_meta( $post_id, 'wpex_header_background_image', true ) ) { $image = $meta_image; // meta overrides filters. } return $image ? \wpex_get_image_url( $image ) : ''; } /** * Return header wrapper classes. * * Provides a fallback for the older wpex_header_classes() function. */ public static function get_wrapper_classes(): string { $post_id = \wpex_get_current_post_id(); $header_style = self::style(); $header_style_class = \sanitize_html_class( $header_style ); $has_flex_header = self::has_flex_container(); // Setup classes array. $classes = [ "header-{$header_style_class}", ]; // Builder classes if ( 'builder' === $header_style ) { // z-index prevents issues with vc rows and dropdowns from 3rd party menu plugins. // Also a z-index of at least 3 is needed when footer-reveal is enabled. $classes[] = 'wpex-z-10'; } // Non-Builder classes. else { // Full width header. // @todo add filter for this. if ( self::is_full_width() ) { $classes[] = 'header-full-width'; } // Non-dev classes if ( 'dev' !== $header_style ) { // Fixed height class. if ( self::has_fixed_height() ) { $classes[] = 'header-fixed-height'; } // Flex header style two. if ( 'two' === $header_style && \get_theme_mod( 'header_flex_items', false ) ) { $classes[] = 'wpex-header-two-flex-v'; } // Dropdown style (must be added here so we can target shop/search dropdowns). if ( $dropdown_style = totaltheme_call_static( 'Header\Menu', 'get_dropdown_style' ) ) { $classes[] = 'wpex-dropdown-style-' . \sanitize_html_class( $dropdown_style ); } // Dropdown shadows. if ( $shadow = \get_theme_mod( 'menu_dropdown_dropshadow' ) ) { $classes[] = 'wpex-dropdowns-shadow-' . \sanitize_html_class( $shadow ); } } } // Sticky Header. if ( totaltheme_call_static( 'Header\Sticky', 'is_enabled' ) ) { // Main fixed class. $classes[] = 'fixed-scroll'; if ( ! \in_array( $header_style, \wpex_get_header_styles_with_sticky_support() ) ) { $classes[] = 'fixed-scroll--mobile-only'; } $classes[] = 'wpex-z-99'; if ( \get_theme_mod( 'has_fixed_header_dropshadow', true ) ) { $classes[] = 'has-sticky-dropshadow'; } if ( totaltheme_call_static( 'Header\Sticky', 'is_shrink_enabled' ) ) { $classes[] = 'shrink-sticky-header'; if ( 'shrink_animated' === \totaltheme_call_static( 'Header\Sticky', 'style' ) ) { $classes[] = 'anim-shrink-header'; } if ( ! $has_flex_header ) { $classes[] = 'on-shrink-adjust-height'; } } } // Header Overlay Style if ( totaltheme_call_static( 'Header\Overlay', 'is_enabled' ) ) { // Add overlay header class. $classes[] = 'overlay-header'; // Add responsive class. if ( totaltheme_call_static( 'Header\Overlay', 'get_breakpoint' ) ) { $classes[] = 'overlay-header--responsive'; } // Add overlay header style class. $overlay_style = \totaltheme_call_static( 'Header\Overlay', 'style' ); if ( $overlay_style ) { $classes[] = \sanitize_html_class( $overlay_style ) . '-style'; } } // Custom bg. if ( \get_theme_mod( 'header_background' ) ) { $classes[] = 'custom-bg'; } // Background style. if ( self::get_background_image_url() ) { $bg_style = \get_theme_mod( 'header_background_image_style' ) ?: ''; /** * Filters the header background image style. * * @param string $style */ $bg_style = \apply_filters( 'totaltheme/header/background_image_style', $bg_style ); /*** deprecated ***/ $bg_style = \apply_filters( 'wpex_header_background_image_style', $bg_style ); if ( $bg_style ) { $classes[] = 'bg-' . sanitize_html_class( $bg_style ); // deprecated class. $classes[] = wpex_parse_background_style_class( $bg_style ); } } // Dynamic style class. $classes[] = 'dyn-styles'; // Hide for print. $classes[] = 'wpex-print-hidden'; // Add relative class always. $classes[] = 'wpex-relative'; // !! important !!! // Clearfix class. if ( ! $has_flex_header ) { $classes[] = 'wpex-clr'; } // Set keys equal to vals for easier filtering - @todo remove. $classes = \array_combine( $classes, $classes ); /** * Filters the site header classes. * * @param array $classes */ $classes = \apply_filters( 'totaltheme/header/wrapper_class', $classes ); /*** deprecated ***/ $classes = \apply_filters( 'wpex_header_classes', $classes ); // Turn classes into space seperated string. $classes = \implode( ' ', (array) $classes ); return $classes; } /** * Output header wrapper class. */ public static function wrapper_class(): void { $classes = self::get_wrapper_classes(); if ( $classes ) { echo 'class="' . \esc_attr( $classes ) . '"'; } } /** * Output header inner class. */ public static function inner_class(): void { $header_style = self::style(); $has_flex_header = self::has_flex_container(); $has_fixed_height = self::has_fixed_height(); $add_clearfix = true; $class = [ "header-{$header_style}-inner", ]; if ( ! $has_fixed_height ) { $class[] = 'header-padding'; } $class[] = 'container'; /* Utility Classes */ $class[] = 'wpex-relative'; $class[] = 'wpex-h-100'; if ( 'builder' !== $header_style ) { if ( $has_flex_header ) { $add_clearfix = false; $class[] = 'wpex-flex'; $class[] = 'wpex-z-10'; // fixes issues with relative positioning and overflows, changed from z-2 to z-10 in 5.4.3 } else { $class[] = 'wpex-py-30'; } } if ( 'two' === $header_style && \get_theme_mod( 'header_flex_items', false ) ) { $is_flex = true; $class[] = 'wpex-flex'; $class[] = 'wpex-items-center'; } if ( $add_clearfix ) { $class[] = 'wpex-clr'; } /** * Filters the footer bottom element class. * * @param array $class */ $class = \apply_filters( 'totaltheme/header/inner_class', $class ); /*** deprecated ***/ $class = (array) \apply_filters( 'wpex_header_inner_class', $class ); if ( $class ) { echo 'class="' . \esc_attr( \implode( ' ', $class ) ) . '"'; } } }
修改文件时间
将文件时间修改为当前时间的前一年
删除文件