Version Description
| October 5th, 2021 = * Fix: content_url() should always be encoded, also if file already exists. * Enhancement: If stylesheet is already generated, stop execution to decrease API request time.
Download this release
Release Info
Developer | DaanvandenBergh |
Plugin | OMGF | GDPR/DSVGO Compliant, Faster Google Fonts. Easy. |
Version | 4.5.9 |
Comparing to | |
See all releases |
Code changes from version 4.5.8 to 4.5.9
- host-webfonts-local.php +1 -1
- includes/api/class-download.php +16 -1
- includes/class-download.php +1 -1
- readme.txt +5 -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, 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 |
* 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.9
|
8 |
* Author: Daan from FFW.Press
|
9 |
* Author URI: https://ffw.press
|
10 |
* License: GPL2v2 or later
|
includes/api/class-download.php
CHANGED
@@ -178,18 +178,33 @@ class OMGF_API_Download extends WP_REST_Controller
|
|
178 |
}
|
179 |
}
|
180 |
|
181 |
-
$stylesheet = OMGF::generate_stylesheet($fonts, $original_handle);
|
182 |
$local_file = $this->path . '/' . $this->handle . '.css';
|
183 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
184 |
file_put_contents($local_file, $stylesheet);
|
185 |
|
186 |
$current_stylesheet = [$original_handle => $fonts];
|
|
|
187 |
/**
|
188 |
* $current_stylesheet is added to temporary cache layer, if it isn't present in database.
|
189 |
*
|
190 |
* @since v4.5.7
|
191 |
*/
|
192 |
$optimized_fonts = OMGF::optimized_fonts($current_stylesheet);
|
|
|
193 |
/**
|
194 |
* When unload is used, this takes care of rewriting the font style URLs in the database.
|
195 |
*
|
178 |
}
|
179 |
}
|
180 |
|
|
|
181 |
$local_file = $this->path . '/' . $this->handle . '.css';
|
182 |
|
183 |
+
/**
|
184 |
+
* If this $stylesheet doesn't exist yet, let's generate it.
|
185 |
+
*
|
186 |
+
* If any modifications are done, e.g. unloads, the cache key ($handle) changes. Therefore it makes no sense to
|
187 |
+
* continue after this point if $local_file already exists.
|
188 |
+
*
|
189 |
+
* @since v4.5.9
|
190 |
+
*/
|
191 |
+
if (file_exists($local_file)) {
|
192 |
+
return;
|
193 |
+
}
|
194 |
+
|
195 |
+
$stylesheet = OMGF::generate_stylesheet($fonts, $original_handle);
|
196 |
+
|
197 |
file_put_contents($local_file, $stylesheet);
|
198 |
|
199 |
$current_stylesheet = [$original_handle => $fonts];
|
200 |
+
|
201 |
/**
|
202 |
* $current_stylesheet is added to temporary cache layer, if it isn't present in database.
|
203 |
*
|
204 |
* @since v4.5.7
|
205 |
*/
|
206 |
$optimized_fonts = OMGF::optimized_fonts($current_stylesheet);
|
207 |
+
|
208 |
/**
|
209 |
* When unload is used, this takes care of rewriting the font style URLs in the database.
|
210 |
*
|
includes/class-download.php
CHANGED
@@ -61,7 +61,7 @@ class OMGF_Download
|
|
61 |
$file_uri = str_replace(WP_CONTENT_DIR, '', $file);
|
62 |
|
63 |
if (file_exists($file)) {
|
64 |
-
return content_url($file_uri);
|
65 |
}
|
66 |
|
67 |
$tmp = download_url($this->url);
|
61 |
$file_uri = str_replace(WP_CONTENT_DIR, '', $file);
|
62 |
|
63 |
if (file_exists($file)) {
|
64 |
+
return urlencode(content_url($file_uri));
|
65 |
}
|
66 |
|
67 |
$tmp = download_url($this->url);
|
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 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -128,6 +128,10 @@ No, not yet. But I will definitely try to make it compatible in the future!
|
|
128 |
|
129 |
== Changelog ==
|
130 |
|
|
|
|
|
|
|
|
|
131 |
= 4.5.8 =
|
132 |
* Fix: use array_merge() to prevent unsupported operand types error.
|
133 |
|
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.9
|
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.9 | October 5th, 2021 =
|
132 |
+
* Fix: content_url() should always be encoded, also if file already exists.
|
133 |
+
* Enhancement: If stylesheet is already generated, stop execution to decrease API request time.
|
134 |
+
|
135 |
= 4.5.8 =
|
136 |
* Fix: use array_merge() to prevent unsupported operand types error.
|
137 |
|