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

Version Description

  • 'Optimize fonts for logged in users?' should be on by default, cause it causes to much confusion.
  • Fixed bug where Auto Detect would fail if no font styles were specified in the Google Font URL.
Download this release

Release Info

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

Code changes from version 3.4.0 to 3.4.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.4.0
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
@@ -19,7 +19,7 @@ defined('ABSPATH') || exit;
19
  */
20
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
21
  define('OMGF_PLUGIN_FILE', __FILE__);
22
- define('OMGF_DB_VERSION', '3.0.0');
23
  define('OMGF_STATIC_VERSION', '3.4.0');
24
  define('OMGF_WEB_FONT_LOADER_VERSION', '1.6.26');
25
 
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.4.1
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
19
  */
20
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
21
  define('OMGF_PLUGIN_FILE', __FILE__);
22
+ define('OMGF_DB_VERSION', '3.0.0'); // Legacy
23
  define('OMGF_STATIC_VERSION', '3.4.0');
24
  define('OMGF_WEB_FONT_LOADER_VERSION', '1.6.26');
25
 
includes/admin/class-auto-detect.php CHANGED
@@ -174,6 +174,12 @@ class OMGF_Admin_AutoDetect
174
  private function process_used_styles($used_styles, $available_styles)
175
  {
176
  foreach ($used_styles as &$style) {
 
 
 
 
 
 
177
  $fontWeight = preg_replace('/[^0-9]/', '', $style);
178
  $fontStyle = preg_replace('/[^a-zA-Z]/', '', $style);
179
 
@@ -193,4 +199,23 @@ class OMGF_Admin_AutoDetect
193
  }
194
  );
195
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
196
  }
174
  private function process_used_styles($used_styles, $available_styles)
175
  {
176
  foreach ($used_styles as &$style) {
177
+ if (empty($style)) {
178
+ $used_styles = $this->process_available_styles($available_styles);
179
+
180
+ break;
181
+ }
182
+
183
  $fontWeight = preg_replace('/[^0-9]/', '', $style);
184
  $fontStyle = preg_replace('/[^a-zA-Z]/', '', $style);
185
 
199
  }
200
  );
201
  }
202
+
203
+ /**
204
+ * Some themes requests font families without specifying font styles. While this is inadvisable, OMGF should be able
205
+ * to deal with this. That's why, when no font styles are detected, all available font styles are returned.
206
+ *
207
+ * @param array $styles
208
+ *
209
+ * @return array
210
+ */
211
+ private function process_available_styles(array $styles)
212
+ {
213
+ foreach ($styles as $style) {
214
+ $font_style = $style['font_style'] !== 'normal' ? $style['font_style'] : '';
215
+
216
+ $used_styles[] = $style['font_weight'] . $font_style;
217
+ }
218
+
219
+ return $used_styles;
220
+ }
221
  }
includes/class-omgf.php CHANGED
@@ -68,7 +68,7 @@ class OMGF
68
  define('OMGF_REMOVE_GFONTS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_REMOVE_GOOGLE_FONTS)));
69
  define('OMGF_PRELOAD', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_ENABLE_PRELOAD)));
70
  define('OMGF_ENQUEUE_ORDER', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_ENQUEUE_ORDER, 10)));
71
- define('OMGF_OPTIMIZE_EDIT_ROLES', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_OPTIMIZE_EDIT_ROLES)));
72
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL)));
73
  }
74
 
68
  define('OMGF_REMOVE_GFONTS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_REMOVE_GOOGLE_FONTS)));
69
  define('OMGF_PRELOAD', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_ENABLE_PRELOAD)));
70
  define('OMGF_ENQUEUE_ORDER', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_ENQUEUE_ORDER, 10)));
71
+ define('OMGF_OPTIMIZE_EDIT_ROLES', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_OPTIMIZE_EDIT_ROLES, 'on')));
72
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL)));
73
  }
74
 
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.4
6
- Stable tag: 3.4.0
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -108,6 +108,10 @@ N/A
108
 
109
  == Changelog ==
110
 
 
 
 
 
111
  = 3.4.0 =
112
  * Added 'Downloaded' indicator in 'Generate Stylesheet' tab.
113
  * Added 'Also optimize fonts for logged in users?' option. This means that all users with editor
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.4
6
+ Stable tag: 3.4.1
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
108
 
109
  == Changelog ==
110
 
111
+ = 3.4.1 =
112
+ * 'Optimize fonts for logged in users?' should be on by default, cause it causes to much confusion.
113
+ * Fixed bug where Auto Detect would fail if no font styles were specified in the Google Font URL.
114
+
115
  = 3.4.0 =
116
  * Added 'Downloaded' indicator in 'Generate Stylesheet' tab.
117
  * Added 'Also optimize fonts for logged in users?' option. This means that all users with editor