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

Version Description

  • Fix: use array_merge() to prevent unsupported operand types error.
Download this release

Release Info

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

Code changes from version 4.5.7 to 4.5.8

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, leverage browser cache and speed up WordPress by saving Google Fonts to your server and removing external Google Fonts requests.
7
- * Version: 4.5.7
8
  * Author: Daan from FFW.Press
9
  * Author URI: https://ffw.press
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, leverage browser cache and speed up WordPress by saving Google Fonts to your server and removing external Google Fonts requests.
7
+ * Version: 4.5.8
8
  * Author: Daan from FFW.Press
9
  * Author URI: https://ffw.press
10
  * License: GPL2v2 or later
includes/class-omgf.php CHANGED
@@ -117,9 +117,11 @@ class OMGF
117
 
118
  /**
119
  * If $maybe_add doesn't exist in the cache layer yet, add it.
 
 
120
  */
121
- if (!isset($optimized_fonts[key($maybe_add)])) {
122
- $optimized_fonts = $optimized_fonts + $maybe_add;
123
  }
124
 
125
  return $optimized_fonts;
117
 
118
  /**
119
  * If $maybe_add doesn't exist in the cache layer yet, add it.
120
+ *
121
+ * @since v4.5.7
122
  */
123
+ if (!empty($maybe_add) && !isset($optimized_fonts[key($maybe_add)])) {
124
+ $optimized_fonts = array_merge($optimized_fonts, $maybe_add);
125
  }
126
 
127
  return $optimized_fonts;
includes/class-stylesheet-generator.php CHANGED
@@ -101,7 +101,9 @@ class OMGF_StylesheetGenerator
101
  $font_src_url = [];
102
 
103
  foreach ($file_types as $file_type) {
104
- $font_src_url = $font_src_url + (isset($variant->$file_type) ? [$file_type => urldecode($variant->$file_type)] : []);
 
 
105
  }
106
 
107
  $stylesheet .= $this->build_source_string($font_src_url);
101
  $font_src_url = [];
102
 
103
  foreach ($file_types as $file_type) {
104
+ if (isset($variant->$file_type)) {
105
+ $font_src_url = array_merge($font_src_url, [$file_type => urldecode($variant->$file_type)]);
106
+ }
107
  }
108
 
109
  $stylesheet .= $this->build_source_string($font_src_url);
includes/frontend/class-functions.php CHANGED
@@ -200,11 +200,14 @@ class OMGF_Frontend_Functions
200
  }
201
 
202
  $params = http_build_query(
203
- $query_array + [
204
- 'handle' => $updated_handle,
205
- 'original_handle' => $handle,
206
- '_wpnonce' => wp_create_nonce('wp_rest')
207
- ]
 
 
 
208
  );
209
 
210
  /**
200
  }
201
 
202
  $params = http_build_query(
203
+ array_merge(
204
+ $query_array,
205
+ [
206
+ 'handle' => $updated_handle,
207
+ 'original_handle' => $handle,
208
+ '_wpnonce' => wp_create_nonce('wp_rest')
209
+ ]
210
+ )
211
  );
212
 
213
  /**
readme.md CHANGED
@@ -20,22 +20,29 @@ When the fonts are downloaded and the stylesheet is generated, it rewrites every
20
  Please keep in mind that, although I try to make the configuration of this plugin as easy as possible, the concept of locally hosting a file or optimizing Google Fonts for *Pagespeed Insights* or *GT Metrix* has proven to be confusing for some people. If you're not sure of what your doing, please consult a SEO expert or Webdeveloper to help you with the configuration of this plugin or [hire me to do it for you](https://ffw.press/wordpress/omgf-expert-configuration/).
21
 
22
  ### Features
23
- - Automatically replace registered/enqueued Google Fonts in `wp_head()` with local copies,
24
- - Automatically remove registered/enqueued Google Fonts from `wp_head()`,
25
  - Manage Optimized Google Fonts,
26
  - Preload above the fold fonts,
27
  - Don't load certain fonts or entire stylesheets.
28
- - Leverage the font-display (swap) option,
29
- - Serve fonts from CDN,
30
- - Use OMGF with *security through obscurity* plugins.
31
 
32
  ### Features in the PRO version
33
  Everything in the free version, plus:
34
- - Automatically remove/replace all Google Fonts throughout the entire HTML document,
35
- - Combine all Google Fonts (made by your theme and/or plugins) requests into one file,
36
- - Deduplicate Google Fonts requests,
 
 
 
 
37
  - Reduce loading time and page size, by forcing the used subset(s) for all Google Fonts requests,
38
- - Remove Resource Hints (preload, preconnect, dns-prefetch) pointing to fonts.googleapis.com or fonts.gstatic.com.
 
 
 
 
 
39
 
40
  **[Documentation](https://ffw.press/docs/omgf-pro/) | [Purchase OMGF Pro](https://ffw.press/wordpress/omgf-pro/)**
41
 
20
  Please keep in mind that, although I try to make the configuration of this plugin as easy as possible, the concept of locally hosting a file or optimizing Google Fonts for *Pagespeed Insights* or *GT Metrix* has proven to be confusing for some people. If you're not sure of what your doing, please consult a SEO expert or Webdeveloper to help you with the configuration of this plugin or [hire me to do it for you](https://ffw.press/wordpress/omgf-expert-configuration/).
21
 
22
  ### Features
23
+ - Automatically replace registered/enqueued Google Fonts in wp_head() with local copies,
24
+ - Automatically remove registered/enqueued Google Fonts from wp_head(),
25
  - Manage Optimized Google Fonts,
26
  - Preload above the fold fonts,
27
  - Don't load certain fonts or entire stylesheets.
28
+ - Leverage the font-display (swap) option.
 
 
29
 
30
  ### Features in the PRO version
31
  Everything in the free version, plus:
32
+ - Specify a Fallback Font Stack for every Google Font, to reduce Cumulative Layout Shift,
33
+ - Automatically remove/replace all Google Fonts throughout the entire document/page,
34
+ - Also supports WebFont Loader (webfont.js), Early Access Google Fonts and requests in stylesheets using @import and @font-face statements.
35
+ - Automatically generate different stylesheets for pages with different Google Fonts configurations.
36
+ - Combine all Google Fonts stylesheets (requested by your theme and/or plugins) into one file,
37
+ - Deduplicate Google Fonts stylesheets,
38
+ - Define file types to include in stylesheet (WOFF, WOFF2, EOT, TTF, SVG),
39
  - Reduce loading time and page size, by forcing the used subset(s) for all Google Fonts requests,
40
+ - Remove Resource Hints (preload, preconnect, dns-prefetch) pointing to fonts.googleapis.com or fonts.gstatic.com,
41
+ - Modify `src` attribute for fonts in stylesheet using the Fonts Source URL option to fully integrate with your configuration,
42
+ - Use this to serve fonts and the stylesheets from your CDN, or
43
+ - To serve fonts from an alternative path (e.g. when you're using Security through Obscurity plugins like WP Hide, etc.), or
44
+ - Anything you like!
45
+ - Proper handling for AMP pages (Fallback to or remove Google Fonts).
46
 
47
  **[Documentation](https://ffw.press/docs/omgf-pro/) | [Purchase OMGF Pro](https://ffw.press/wordpress/omgf-pro/)**
48
 
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.8
6
- Stable tag: 4.5.7
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -128,6 +128,9 @@ No, not yet. But I will definitely try to make it compatible in the future!
128
 
129
  == Changelog ==
130
 
 
 
 
131
  = 4.5.7 | September 29th, 2021 =
132
  * Enhancement: significantly reduced code running frontend.
133
  * Fix: internal requests to OMGF's Download API are no longer treated as 'remote'.
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.8
6
+ Stable tag: 4.5.8
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
128
 
129
  == Changelog ==
130
 
131
+ = 4.5.8 =
132
+ * Fix: use array_merge() to prevent unsupported operand types error.
133
+
134
  = 4.5.7 | September 29th, 2021 =
135
  * Enhancement: significantly reduced code running frontend.
136
  * Fix: internal requests to OMGF's Download API are no longer treated as 'remote'.