Server : Apache System : Linux server.lienzindia.com 4.18.0-348.7.1.el8_5.x86_64 #1 SMP Wed Dec 22 13:25:12 UTC 2021 x86_64 User : plutus ( 1007) PHP Version : 7.4.33 Disable Function : NONE Directory : /home/plutus/public_html/wp-content/themes/vrm/inc/ |
Upload File : |
<?php namespace TotalTheme; \defined( 'ABSPATH' ) || exit; /** * Adds custom CSS to the site from Customizer settings. */ class Inline_CSS { /** * Instance. */ private static $instance; /** * Create or retrieve the instance of our class. */ public static function instance() { if ( is_null( static::$instance ) ) { static::$instance = new self(); static::$instance->init_hooks(); } return static::$instance; } /** * Hook into actions and filters. */ public function init_hooks() { $is_minify_enabled = (bool) \apply_filters( 'wpex_minify_inline_css', true ); // Add custom CSS to head tag. \add_action( 'wp_head', [ $this, 'render' ], 9999 ); // Minify custom CSS on front-end only. // Note: Can't minify on backend or messes up the Custom CSS panel. if ( ! \is_admin() && ! \is_customize_preview() && $is_minify_enabled ) { \add_filter( 'wp_get_custom_css', 'wpex_minify_css' ); } } /** * Add all custom CSS into the WP Header. */ public function render(): void { $css = ''; /** * Hook: totaltheme/inline_css * * @todo Update all functions that hook into "wpex_head_css" filter to instead hook into here. */ if ( \has_action( 'totaltheme/inline_css' ) ) { \ob_start(); \do_action( 'totaltheme/inline_css' ); $css_action = \ob_get_clean(); if ( $css_action && \is_string( $css_action ) ) { $css .= $css . \trim( $css_action ); } } /** * Filters the CSS added to the site head. * * @param string $css * @todo deprecate */ $css = (string) \apply_filters( 'wpex_head_css', $css ); // Custom CSS panel => Add last after all filters to make sure it always overrides. // Deprecated in 4.0 - the theme now uses native WP additional css function for the custom css. if ( $custom_css = (string) \get_theme_mod( 'custom_css', null ) ) { $css .= "/*CUSTOM CSS*/{$custom_css}"; } // Minify and output CSS in the wp_head. if ( ! empty( $css ) ) { // Sanitize output | important don't use esc_attr because it breaks quotes in custom fonts. $css = (string) \wp_strip_all_tags( \wpex_minify_css( $css ) ); // Echo output. // Don't rename #wpex-css or things will break !!! Important !!! if ( $css ) { echo '<style data-type="wpex-css" id="wpex-css">' . \trim( $css ) . '</style>'; } } } }