Disable and Remove Google Fonts - Version 1.5.1

Version Description

Download this release

Release Info

Developer DannyCooper
Plugin Icon wp plugin Disable and Remove Google Fonts
Version 1.5.1
Comparing to
See all releases

Code changes from version 1.5.0 to 1.5.1

changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 1.5.0 =
2
 
3
  * Admin improvements.
1
+ = 1.5.1 =
2
+
3
+ * Add compatibility for photo-gallery plugin.
4
+
5
  = 1.5.0 =
6
 
7
  * Admin improvements.
disable-remove-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Optimize frontend performance by disabling Google Fonts. GDPR-friendly.
6
  * Author: Fonts Plugin
7
  * Author URI: https://fontsplugin.com
8
- * Version: 1.5.0
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
@@ -31,7 +31,7 @@ if ( ! defined( 'DRGF_PLUGIN_FILE' ) ) {
31
  }
32
 
33
  if ( ! defined( 'DRGF_VERSION' ) ) {
34
- define( 'DRGF_VERSION', '1.5.0' );
35
  }
36
 
37
  if ( ! defined( 'DRGF_DIR_PATH' ) ) {
5
  * Description: Optimize frontend performance by disabling Google Fonts. GDPR-friendly.
6
  * Author: Fonts Plugin
7
  * Author URI: https://fontsplugin.com
8
+ * Version: 1.5.1
9
  * License: GPLv2 or later
10
  * License URI: https://www.gnu.org/licenses/old-licenses/gpl-2.0.txt
11
  *
31
  }
32
 
33
  if ( ! defined( 'DRGF_VERSION' ) ) {
34
+ define( 'DRGF_VERSION', '1.5.1' );
35
  }
36
 
37
  if ( ! defined( 'DRGF_DIR_PATH' ) ) {
inc/remove-google-fonts.php CHANGED
@@ -38,7 +38,6 @@ function drgf_dequeueu_fonts() {
38
  // Dequeue the Jupiter theme font loader.
39
  wp_dequeue_script( 'mk-webfontloader' );
40
 
41
-
42
  global $wp_styles;
43
 
44
  if ( ! ( $wp_styles instanceof WP_Styles ) ) {
@@ -68,16 +67,16 @@ function drgf_dequeueu_fonts() {
68
  */
69
  foreach ( $wp_styles->registered as $style ) {
70
  foreach( $style->deps as $dep ) {
71
- if ( ( strpos( $dep, 'google-fonts' ) !== false ) || ( strpos( $dep, 'google_fonts' ) !== false ) || ( strpos( $dep, 'googlefonts' ) !== false ) ) {
 
72
  $wp_styles->remove( $dep );
73
  $wp_styles->add( $dep, '' );
74
  }
75
  }
76
  }
77
- remove_action( 'wp_head', 'hu_print_gfont_head_link', 2 );
78
 
 
79
  remove_action('wp_head', 'appointment_load_google_font');
80
-
81
  }
82
 
83
  add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', PHP_INT_MAX );
@@ -239,3 +238,15 @@ add_filter( 'kadence_print_google_fonts', '__return_false' );
239
  * Dequeue Google Fonts loaded by X theme.
240
  */
241
  add_filter( 'cs_load_google_fonts', '__return_false' );
 
 
 
 
 
 
 
 
 
 
 
 
38
  // Dequeue the Jupiter theme font loader.
39
  wp_dequeue_script( 'mk-webfontloader' );
40
 
 
41
  global $wp_styles;
42
 
43
  if ( ! ( $wp_styles instanceof WP_Styles ) ) {
67
  */
68
  foreach ( $wp_styles->registered as $style ) {
69
  foreach( $style->deps as $dep ) {
70
+ $strings = ['google-fonts', 'google_fonts', 'googlefonts', 'bookyourtravel-heading-font', 'bookyourtravel-base-font', 'bookyourtravel-font-icon', 'twb-open-sans'];
71
+ if ( drgf_strposa( $dep, $strings ) === true ) {
72
  $wp_styles->remove( $dep );
73
  $wp_styles->add( $dep, '' );
74
  }
75
  }
76
  }
 
77
 
78
+ remove_action( 'wp_head', 'hu_print_gfont_head_link', 2 );
79
  remove_action('wp_head', 'appointment_load_google_font');
 
80
  }
81
 
82
  add_action( 'wp_enqueue_scripts', 'drgf_dequeueu_fonts', PHP_INT_MAX );
238
  * Dequeue Google Fonts loaded by X theme.
239
  */
240
  add_filter( 'cs_load_google_fonts', '__return_false' );
241
+
242
+ /**
243
+ * Helper function to run strpos() using an array as the needle.
244
+ */
245
+ function drgf_strposa( $haystack, $needles, $offset = 0 ) {
246
+ $chr = array();
247
+ foreach( $needles as $needle) {
248
+ $res = strpos( $haystack, $needle, $offset );
249
+ if ( $res !== false ) return true;
250
+ }
251
+ return false;
252
+ }