OMGF | GDPR/DSVGO Compliant, Faster Google Fonts. Easy. - Version 3.8.1

Version Description

| August 27th, 2020 = * Bugfix: if Auto Remove was enabled, but no stylesheet was yet generated, this would break some themes' stylesheet.

Download this release

Release Info

Developer DaanvandenBergh
Plugin Icon 128x128 OMGF | GDPR/DSVGO Compliant, Faster Google Fonts. Easy.
Version 3.8.1
Comparing to
See all releases

Code changes from version 3.8.0 to 3.8.1

host-webfonts-local.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
6
  * Description: Minimize DNS requests and leverage browser cache by easily saving Google Fonts to your server and removing the external Google Fonts.
7
- * Version: 3.8.0
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
6
  * Description: Minimize DNS requests and leverage browser cache by easily saving Google Fonts to your server and removing the external Google Fonts.
7
+ * Version: 3.8.1
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
includes/frontend/class-functions.php CHANGED
@@ -103,15 +103,13 @@ class OMGF_Frontend_Functions
103
 
104
  global $wp_styles;
105
 
106
- $registered = $wp_styles->registered;
107
-
108
- $fonts = $this->detect_registered_google_fonts($registered);
109
-
110
  $dependencies = array_filter(
111
  $registered, function ($contents) use ($fonts) {
112
  return !empty(array_intersect(array_keys($fonts), $contents->deps))
113
  && $contents->handle !== 'wp-block-editor';
114
- }
115
  );
116
 
117
  foreach ($fonts as $font) {
@@ -120,12 +118,16 @@ class OMGF_Frontend_Functions
120
  }
121
 
122
  foreach ($dependencies as $dependency) {
123
- $deps = array_diff($dependency->deps, array_keys($fonts));
 
 
 
 
124
  wp_deregister_style($dependency->handle);
125
  wp_dequeue_style($dependency->handle);
126
 
127
- wp_register_style($dependency->handle, $dependency->src, $deps + [ 'omgf-fonts' ]);
128
- wp_enqueue_style($dependency->handle, $dependency->src, $deps + [ 'omgf-fonts' ]);
129
  }
130
  }
131
 
103
 
104
  global $wp_styles;
105
 
106
+ $registered = $wp_styles->registered;
107
+ $fonts = $this->detect_registered_google_fonts($registered);
 
 
108
  $dependencies = array_filter(
109
  $registered, function ($contents) use ($fonts) {
110
  return !empty(array_intersect(array_keys($fonts), $contents->deps))
111
  && $contents->handle !== 'wp-block-editor';
112
+ }
113
  );
114
 
115
  foreach ($fonts as $font) {
118
  }
119
 
120
  foreach ($dependencies as $dependency) {
121
+ /**
122
+ * If Remove Google Fonts is enabled, but no stylesheet is generated, there's no need to add OMGF's stylesheet
123
+ * as a dependency.
124
+ */
125
+ $deps = array_diff($dependency->deps, array_keys($fonts)) + ($registered['omgf-fonts'] ?? []);
126
  wp_deregister_style($dependency->handle);
127
  wp_dequeue_style($dependency->handle);
128
 
129
+ wp_register_style($dependency->handle, $dependency->src, $deps);
130
+ wp_enqueue_style($dependency->handle, $dependency->src, $deps);
131
  }
132
  }
133
 
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: DaanvandenBergh
3
  Tags: google, fonts, gdpr, cache, speed, preload, font-display, webfonts, subsets, remove, minimize, external, requests
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
- Stable tag: 3.8.0
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -112,6 +112,9 @@ N/A
112
 
113
  == Changelog ==
114
 
 
 
 
115
  = 3.8.0 | August 16th, 2020 =
116
  * Tested with WP 5.5.
117
  * Cleaned up the sidebar.
3
  Tags: google, fonts, gdpr, cache, speed, preload, font-display, webfonts, subsets, remove, minimize, external, requests
4
  Requires at least: 4.6
5
  Tested up to: 5.5
6
+ Stable tag: 3.8.1
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
112
 
113
  == Changelog ==
114
 
115
+ = 3.8.1 | August 27th, 2020 =
116
+ * Bugfix: if Auto Remove was enabled, but no stylesheet was yet generated, this would break some themes' stylesheet.
117
+
118
  = 3.8.0 | August 16th, 2020 =
119
  * Tested with WP 5.5.
120
  * Cleaned up the sidebar.