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; /** * Disable Google Services. */ class Disable_Google_Services { /** * Instance. */ private static $instance; /** * Create or retrieve the instance of this class. */ public static function instance() { if ( \is_null( static::$instance ) ) { static::$instance = new self(); static::$instance->init_hooks(); } return static::$instance; } /** * Add hooks. */ public function init_hooks() { \add_filter( 'wpex_google_fonts_array', '__return_empty_array' ); \add_filter( 'vc_google_fonts_render_filter', '__return_false' ); \add_filter( 'vc_google_fonts_get_fonts_filter', '__return_false' ); \add_action( 'wp_print_scripts', [ $this, 'remove_scripts' ], 10 ); \add_action( 'wp_enqueue_scripts', [ $this, 'remove_scripts' ], 10 ); \add_action( 'wp_footer', [ $this, 'remove_inline_scripts' ], 10 ); } /** * Remove scripts. */ public function remove_scripts() { \wp_dequeue_script( 'webfont' ); \wp_dequeue_style( 'rs-roboto' ); } /** * Remove footer scripts. */ public function remove_inline_scripts() { global $wp_styles; if ( $wp_styles ) { foreach ( $wp_styles->registered as $handle => $data ) { if ( is_string( $handle ) ) { self::maybe_dequeue_style( $handle ); } } } } /** * Checks to see if a specific style should be removed. */ private function maybe_dequeue_style( string $handle ) { if ( \str_starts_with( $handle, 'vc_google_fonts_' ) ) { \wp_deregister_style( $handle ); \wp_dequeue_style( $handle ); } } }