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

Version Description

  • Fixed a few warnings/notices.
  • Re-worded some options and option descriptions.
Download this release

Release Info

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

Code changes from version 4.4.2 to 4.4.3

host-webfonts-local.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: OMGF
6
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
7
  * Description: Minimize DNS requests, leverage browser cache and speed up WordPress by saving Google Fonts to your server and removing external Google Fonts requests.
8
- * Version: 4.4.2
9
  * Author: Daan from FFW.Press
10
  * Author URI: https://ffw.press
11
  * License: GPL2v2 or later
5
  * Plugin Name: OMGF
6
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
7
  * Description: Minimize DNS requests, leverage browser cache and speed up WordPress by saving Google Fonts to your server and removing external Google Fonts requests.
8
+ * Version: 4.4.3
9
  * Author: Daan from FFW.Press
10
  * Author URI: https://ffw.press
11
  * License: GPL2v2 or later
includes/admin/settings/class-advanced.php CHANGED
@@ -33,6 +33,7 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
33
  add_filter('omgf_advanced_settings_content', [$this, 'do_before'], 20);
34
 
35
  // Settings
 
36
  add_filter('omgf_advanced_settings_content', [$this, 'do_cache_dir'], 70);
37
  add_filter('omgf_advanced_settings_content', [$this, 'do_cdn_url'], 80);
38
  add_filter('omgf_advanced_settings_content', [$this, 'do_cache_uri'], 90);
@@ -55,17 +56,34 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
55
  <?php
56
  }
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  *
60
  */
61
  public function do_cache_dir()
62
  {
63
  $this->do_text(
64
- __('Save font files to...', $this->plugin_text_domain),
65
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_PATH,
66
  __('e.g. /uploads/omgf', $this->plugin_text_domain),
67
  OMGF_CACHE_PATH,
68
- __("The folder (inside <code>wp-content</code>) where font files should be stored. Give each site a unique value if you're using Multisite. Defaults to <code>/uploads/omgf</code>. After changing this setting, the folder will be created if it doesn't exist and existing files will be moved automatically.", $this->plugin_text_domain)
69
  );
70
  }
71
 
@@ -75,7 +93,7 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
75
  public function do_cdn_url()
76
  {
77
  $this->do_text(
78
- __('Serve fonts from CDN', $this->plugin_text_domain),
79
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CDN_URL,
80
  __('e.g. https://cdn.mydomain.com', $this->plugin_text_domain),
81
  OMGF_CDN_URL,
@@ -89,11 +107,11 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
89
  public function do_cache_uri()
90
  {
91
  $this->do_text(
92
- __('Serve font files from...', $this->plugin_text_domain),
93
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_URI,
94
  __('e.g. /app/uploads/omgf', $this->plugin_text_domain),
95
  OMGF_CACHE_URI,
96
- __('The relative path to serve font files from. Useful for when you\'re using security through obscurity plugins, such as WP Hide. If left empty, the cache directory specified in <strong>Save font files to...</strong> will be used.', $this->plugin_text_domain)
97
  );
98
  }
99
 
@@ -103,10 +121,10 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
103
  public function do_relative_url()
104
  {
105
  $this->do_checkbox(
106
- __('Use Relative URLs?', $this->plugin_text_domain),
107
  OMGF_Admin_Settings::OMGF_ADV_SETTING_RELATIVE_URL,
108
  OMGF_RELATIVE_URL,
109
- __('Use relative instead of absolute (full) URLs to generate the stylesheet.', $this->plugin_text_domain)
110
  );
111
  }
112
 
@@ -116,7 +134,7 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
116
  public function do_uninstall()
117
  {
118
  $this->do_checkbox(
119
- __('Remove settings and files at uninstall?', $this->plugin_text_domain),
120
  OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL,
121
  OMGF_UNINSTALL,
122
  __('Warning! This will remove all settings and cached fonts upon plugin deletion.', $this->plugin_text_domain)
33
  add_filter('omgf_advanced_settings_content', [$this, 'do_before'], 20);
34
 
35
  // Settings
36
+ add_filter('omgf_advanced_settings_content', [$this, 'do_exclude_posts'], 50);
37
  add_filter('omgf_advanced_settings_content', [$this, 'do_cache_dir'], 70);
38
  add_filter('omgf_advanced_settings_content', [$this, 'do_cdn_url'], 80);
39
  add_filter('omgf_advanced_settings_content', [$this, 'do_cache_uri'], 90);
56
  <?php
57
  }
58
 
59
+ /**
60
+ * Excluded Post/Page IDs (Pro)
61
+ *
62
+ * @return void
63
+ */
64
+ public function do_exclude_posts()
65
+ {
66
+ $this->do_text(
67
+ __('Excluded Post/Page IDs (Pro)', $this->plugin_text_domain),
68
+ 'omgf_pro_excluded_ids',
69
+ __('e.g. 1,2,5,21,443'),
70
+ defined('OMGF_PRO_EXCLUDED_IDS') ? OMGF_PRO_EXCLUDED_IDS : '',
71
+ __('A comma separated list of post/page IDs where OMGF Pro shouldn\'t run.', $this->plugin_text_domain),
72
+ true
73
+ );
74
+ }
75
+
76
  /**
77
  *
78
  */
79
  public function do_cache_dir()
80
  {
81
  $this->do_text(
82
+ __('Fonts Cache Directory', $this->plugin_text_domain),
83
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_PATH,
84
  __('e.g. /uploads/omgf', $this->plugin_text_domain),
85
  OMGF_CACHE_PATH,
86
+ __("The directory (inside <code>wp-content</code>) where font files should be stored. Give each site a unique value if you're using Multisite. Defaults to <code>/uploads/omgf</code>. After changing this setting, the directory will be created if it doesn't exist and existing files will be moved automatically.", $this->plugin_text_domain)
87
  );
88
  }
89
 
93
  public function do_cdn_url()
94
  {
95
  $this->do_text(
96
+ __('CDN URL', $this->plugin_text_domain),
97
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CDN_URL,
98
  __('e.g. https://cdn.mydomain.com', $this->plugin_text_domain),
99
  OMGF_CDN_URL,
107
  public function do_cache_uri()
108
  {
109
  $this->do_text(
110
+ __('Alternative Relative Path', $this->plugin_text_domain),
111
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_URI,
112
  __('e.g. /app/uploads/omgf', $this->plugin_text_domain),
113
  OMGF_CACHE_URI,
114
+ __('An alternative elative path to serve font files from. Useful for when you\'re using security through obscurity plugins, such as WP Hide. If left empty, the <strong>Fonts Cache Directory</strong> will be used.', $this->plugin_text_domain)
115
  );
116
  }
117
 
121
  public function do_relative_url()
122
  {
123
  $this->do_checkbox(
124
+ __('Use Relative URLs', $this->plugin_text_domain),
125
  OMGF_Admin_Settings::OMGF_ADV_SETTING_RELATIVE_URL,
126
  OMGF_RELATIVE_URL,
127
+ __('Use relative instead of absolute (full) URLs to generate the stylesheet. <em><strong>Warning!</strong> This will disable the CDN URL.</em>', $this->plugin_text_domain)
128
  );
129
  }
130
 
134
  public function do_uninstall()
135
  {
136
  $this->do_checkbox(
137
+ __('Remove Settings/Files At Uninstall', $this->plugin_text_domain),
138
  OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL,
139
  OMGF_UNINSTALL,
140
  __('Warning! This will remove all settings and cached fonts upon plugin deletion.', $this->plugin_text_domain)
includes/admin/settings/class-builder.php CHANGED
@@ -183,13 +183,13 @@ class OMGF_Admin_Settings_Builder
183
  * @param string $description
184
  * @param bool $update_required
185
  */
186
- public function do_text($label, $name, $placeholder, $value, $description = '', $update_required = false, $visible = true)
187
  {
188
  ?>
189
- <tr class="<?= str_replace('_', '-', $name); ?>-row" <?= $visible ? '' : 'style="display: none;"'; ?>>
190
- <th scope="row"><?= apply_filters($name . '_setting_label', $label); ?> <?= $update_required ?: ''; ?></th>
191
  <td>
192
- <input class="<?= str_replace('_', '-', $name); ?>" type="text" name="<?= $name; ?>" placeholder="<?= $placeholder; ?>" value="<?= $value; ?>" />
193
  <p class="description">
194
  <?= apply_filters($name . 'setting_description', $description); ?>
195
  </p>
183
  * @param string $description
184
  * @param bool $update_required
185
  */
186
+ public function do_text($label, $name, $placeholder, $value, $description = '', $disabled = false)
187
  {
188
  ?>
189
+ <tr class="<?= str_replace('_', '-', $name); ?>-row">
190
+ <th scope="row"><?= apply_filters($name . '_setting_label', $label); ?></th>
191
  <td>
192
+ <input <?= apply_filters($name . '_setting_disabled', $disabled) ? 'disabled' : ''; ?> class="<?= str_replace('_', '-', $name); ?>" type="text" name="<?= $name; ?>" placeholder="<?= $placeholder; ?>" value="<?= $value; ?>" />
193
  <p class="description">
194
  <?= apply_filters($name . 'setting_description', $description); ?>
195
  </p>
includes/admin/settings/class-detection.php CHANGED
@@ -93,12 +93,16 @@ class OMGF_Admin_Settings_Detection extends OMGF_Admin_Settings_Builder
93
  {
94
  return [
95
  'omgf_pro_process_stylesheets' => [
96
- 'label' => __('Process Stylesheets', $this->plugin_text_domain),
97
  'description' => __('Process stylesheets loaded from <code>fonts.googleapis.com</code> or <code>fonts.gstatic.com</code>.', $this->plugin_text_domain)
98
  ],
 
 
 
 
99
  'omgf_pro_process_inline_styles' => [
100
  'label' => __('Process Inline Styles', $this->plugin_text_domain),
101
- 'description' => __('Process all <code>@font-face</code> and <code>@import</code> rules loading Google Fonts.', $this->plugin_text_domain)
102
  ],
103
  'omgf_pro_process_webfont_loader' => [
104
  'label' => __('Process Webfont Loader', $this->plugin_text_domain),
93
  {
94
  return [
95
  'omgf_pro_process_stylesheets' => [
96
+ 'label' => __('Process External Stylesheets', $this->plugin_text_domain),
97
  'description' => __('Process stylesheets loaded from <code>fonts.googleapis.com</code> or <code>fonts.gstatic.com</code>.', $this->plugin_text_domain)
98
  ],
99
+ 'omgf_pro_process_stylesheet_imports' => [
100
+ 'label' => __('Process Stylesheet Imports', $this->plugin_text_domain),
101
+ 'description' => __('Scan stylesheets loaded by your theme and plugins for <code>@import</code> statements loading Google Fonts and process them.', $this->plugin_text_domain)
102
+ ],
103
  'omgf_pro_process_inline_styles' => [
104
  'label' => __('Process Inline Styles', $this->plugin_text_domain),
105
+ 'description' => __('Process all inline <code>@font-face</code> and <code>@import</code> rules loading Google Fonts.', $this->plugin_text_domain)
106
  ],
107
  'omgf_pro_process_webfont_loader' => [
108
  'label' => __('Process Webfont Loader', $this->plugin_text_domain),
includes/admin/settings/class-optimize.php CHANGED
@@ -62,7 +62,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
62
  <?= __('These settings affect the fonts OMGF downloads and the stylesheet it generates. If you\'re simply looking to replace your Google Fonts for locally hosted copies, the default settings should suffice.', $this->plugin_text_domain); ?>
63
  </p>
64
  <p>
65
- <?= sprintf(__('To install additional Google Fonts, a (free) add-on is required, which can be downloaded <a href="%s" target="blank">here</a>.', $this->plugin_text_domain), self::FFW_PRESS_OMGF_AF_URL); ?>
66
  </p>
67
  <?php
68
  }
@@ -84,10 +84,10 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
84
  public function do_promo_combine_requests()
85
  {
86
  $this->do_checkbox(
87
- __('Combine & Dedupe Google Fonts (Pro)', $this->plugin_text_domain),
88
  'omgf_pro_combine_requests',
89
  defined('OMGF_PRO_COMBINE_REQUESTS') ? true : false,
90
- __('Combine and deduplicate multiple font requests into one request. This feature is always on in OMGF Pro.', $this->plugin_text_domain) . ' ' . $this->promo,
91
  true
92
  );
93
  }
@@ -98,11 +98,11 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
98
  public function do_display_option()
99
  {
100
  $this->do_select(
101
- __('Font-display option', $this->plugin_text_domain),
102
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_DISPLAY_OPTION,
103
  OMGF_Admin_Settings::OMGF_FONT_DISPLAY_OPTIONS,
104
  OMGF_DISPLAY_OPTION,
105
- __('Select which font-display strategy to use. Defaults to Swap (recommended).', $this->plugin_text_domain)
106
  );
107
  }
108
 
@@ -114,7 +114,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
114
  public function do_woff2_only()
115
  {
116
  $this->do_checkbox(
117
- __('Load <code>.woff2</code> Only', $this->plugin_text_domain),
118
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_WOFF2_ONLY,
119
  OMGF_WOFF2_ONLY,
120
  __('Loading <code>.woff2</code> files only will result in a smaller stylesheet, but will make the stylesheet slightly less Cross Browser compatible. <code>.woff2</code> is supported by ~95% of browsers used by internet users globally.', $this->plugin_text_domain)
@@ -201,7 +201,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
201
  <th colspan="5"><?= sprintf(__('Stylesheet handle: %s', $this->plugin_text_domain), $handle); ?></th>
202
  </tr>
203
  <?php foreach ($fonts as $font) : ?>
204
- <?php if (count((array) $font->variants) <= 0) continue; ?>
205
  <?php
206
  $aka = in_array($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) ? array_search($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) : '';
207
  ?>
@@ -347,7 +347,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
347
  public function do_optimize_edit_roles()
348
  {
349
  $this->do_checkbox(
350
- __('Optimize fonts for logged in editors/administrators?', $this->plugin_text_domain),
351
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZE_EDIT_ROLES,
352
  OMGF_OPTIMIZE_EDIT_ROLES,
353
  __('Should only be disabled while debugging/testing, e.g. using a page builder or switching themes.', $this->plugin_text_domain)
62
  <?= __('These settings affect the fonts OMGF downloads and the stylesheet it generates. If you\'re simply looking to replace your Google Fonts for locally hosted copies, the default settings should suffice.', $this->plugin_text_domain); ?>
63
  </p>
64
  <p>
65
+ <?= sprintf(__('To install additional Google Fonts, an add-on is required, which can be downloaded <a href="%s" target="blank">here</a>.', $this->plugin_text_domain), self::FFW_PRESS_OMGF_AF_URL); ?>
66
  </p>
67
  <?php
68
  }
84
  public function do_promo_combine_requests()
85
  {
86
  $this->do_checkbox(
87
+ __('Combine & Dedupe (Pro)', $this->plugin_text_domain),
88
  'omgf_pro_combine_requests',
89
  defined('OMGF_PRO_COMBINE_REQUESTS') ? true : false,
90
+ __('Combine and deduplicate multiple Google Fonts stylesheets into one stylesheet. This feature is always on in OMGF Pro.', $this->plugin_text_domain) . ' ' . $this->promo,
91
  true
92
  );
93
  }
98
  public function do_display_option()
99
  {
100
  $this->do_select(
101
+ __('Font-Display Option', $this->plugin_text_domain),
102
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_DISPLAY_OPTION,
103
  OMGF_Admin_Settings::OMGF_FONT_DISPLAY_OPTIONS,
104
  OMGF_DISPLAY_OPTION,
105
+ __('Select which value to set the font-display attribute to. Defaults to Swap (recommended).', $this->plugin_text_domain)
106
  );
107
  }
108
 
114
  public function do_woff2_only()
115
  {
116
  $this->do_checkbox(
117
+ __('<code>WOFF2</code> Only', $this->plugin_text_domain),
118
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_WOFF2_ONLY,
119
  OMGF_WOFF2_ONLY,
120
  __('Loading <code>.woff2</code> files only will result in a smaller stylesheet, but will make the stylesheet slightly less Cross Browser compatible. <code>.woff2</code> is supported by ~95% of browsers used by internet users globally.', $this->plugin_text_domain)
201
  <th colspan="5"><?= sprintf(__('Stylesheet handle: %s', $this->plugin_text_domain), $handle); ?></th>
202
  </tr>
203
  <?php foreach ($fonts as $font) : ?>
204
+ <?php if (!is_object($font) || count((array) $font->variants) <= 0) continue; ?>
205
  <?php
206
  $aka = in_array($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) ? array_search($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) : '';
207
  ?>
347
  public function do_optimize_edit_roles()
348
  {
349
  $this->do_checkbox(
350
+ __('Optimize Fonts For Editors/Administrators?', $this->plugin_text_domain),
351
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZE_EDIT_ROLES,
352
  OMGF_OPTIMIZE_EDIT_ROLES,
353
  __('Should only be disabled while debugging/testing, e.g. using a page builder or switching themes.', $this->plugin_text_domain)
includes/api/class-download.php CHANGED
@@ -99,12 +99,20 @@ class OMGF_API_Download extends WP_REST_Controller
99
  $fonts = [];
100
 
101
  foreach ($font_families as $font_family) {
 
 
 
 
102
  $fonts[] = $this->grab_font_family($font_family, $query);
103
  }
104
 
105
  // Filter out empty elements, i.e. failed requests.
106
  $fonts = array_filter($fonts);
107
 
 
 
 
 
108
  foreach ($fonts as $font_key => &$font) {
109
  $fonts_request = $this->build_fonts_request($font_families, $font);
110
 
@@ -300,10 +308,16 @@ class OMGF_API_Download extends WP_REST_Controller
300
  sprintf($url, $family) . $query_string
301
  );
302
 
303
- $response_code = $response['response']['code'] ?? '';
 
 
 
 
304
 
305
  if ($response_code !== 200) {
306
- $message = sprintf(__('<strong>%s</strong> could not be found using the current configuration. The API returned the following error: %s', $this->plugin_text_domain), ucfirst($family), wp_remote_retrieve_body($response));
 
 
307
 
308
  OMGF_Admin_Notice::set_notice(
309
  $message,
@@ -312,12 +326,22 @@ class OMGF_API_Download extends WP_REST_Controller
312
  'error'
313
  );
314
 
 
 
 
 
 
 
 
 
 
 
 
 
315
  return [];
316
  }
317
 
318
- if (!is_wp_error($response) && wp_remote_retrieve_response_code($response) == 200) {
319
- return json_decode(wp_remote_retrieve_body($response));
320
- }
321
  }
322
 
323
  /**
99
  $fonts = [];
100
 
101
  foreach ($font_families as $font_family) {
102
+ if (empty($font_family)) {
103
+ continue;
104
+ }
105
+
106
  $fonts[] = $this->grab_font_family($font_family, $query);
107
  }
108
 
109
  // Filter out empty elements, i.e. failed requests.
110
  $fonts = array_filter($fonts);
111
 
112
+ if (empty($fonts)) {
113
+ exit();
114
+ }
115
+
116
  foreach ($fonts as $font_key => &$font) {
117
  $fonts_request = $this->build_fonts_request($font_families, $font);
118
 
308
  sprintf($url, $family) . $query_string
309
  );
310
 
311
+ if (is_wp_error($response)) {
312
+ OMGF_Admin_Notice::set_notice(sprintf(__('An error occurred while trying to fetch fonts: %s', $this->plugin_text_domain), $response->get_error_message()), $response->get_error_code(), true, 'error', 500);
313
+ }
314
+
315
+ $response_code = wp_remote_retrieve_response_code($response);
316
 
317
  if ($response_code !== 200) {
318
+ $font_family = str_replace('-', ' ', $family);
319
+ $error_message = wp_remote_retrieve_body($response);
320
+ $message = sprintf(__('<strong>%s</strong> could not be found. The API returned the following error: %s.', $this->plugin_text_domain), ucwords($font_family), $error_message);
321
 
322
  OMGF_Admin_Notice::set_notice(
323
  $message,
326
  'error'
327
  );
328
 
329
+ if ($error_message == 'Not found') {
330
+ $message = sprintf(__('Please verify that %s is available for free at Google Fonts by doing <a href="%s" target="_blank">a manual search</a>. Maybe it\'s a Premium font?', $this->plugin_text_domain), ucwords($font_family), 'https://fonts.google.com/?query=' . str_replace('-', '+', $family));
331
+
332
+ OMGF_Admin_Notice::set_notice($message, 'omgf_api_info_not_found', false, 'info');
333
+ }
334
+
335
+ if ($error_message == 'Internal Server Error') {
336
+ $message = sprintf(__('Try using the Force Subsets option (available in OMGF Pro) to force loading %s in a subset in which it\'s actually available. Use the Language filter <a href="%s" target="_blank">here</a> to verify which subsets are available for %s.', $this->plugin_text_domain), ucwords($font_family), 'https://fonts.google.com/?query=' . str_replace('-', '+', $family), ucwords($font_family));
337
+
338
+ OMGF_Admin_Notice::set_notice($message, 'omgf_api_info_internal_server_error', false, 'info');
339
+ }
340
+
341
  return [];
342
  }
343
 
344
+ return json_decode(wp_remote_retrieve_body($response));
 
 
345
  }
346
 
347
  /**
includes/class-admin.php CHANGED
@@ -38,6 +38,8 @@ class OMGF_Admin
38
  $this->show_notice = apply_filters(
39
  'omgf_admin_options_show_notice',
40
  [
 
 
41
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_WOFF2_ONLY,
42
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_PATH,
43
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_URI,
38
  $this->show_notice = apply_filters(
39
  'omgf_admin_options_show_notice',
40
  [
41
+ OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZATION_MODE,
42
+ OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_DISPLAY_OPTION,
43
  OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_WOFF2_ONLY,
44
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_PATH,
45
  OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_URI,
includes/class-optimize.php CHANGED
@@ -24,6 +24,9 @@ class OMGF_Optimize
24
  /** @var string */
25
  private $settings_page = '';
26
 
 
 
 
27
  /** @var string */
28
  private $settings_updated = '';
29
 
@@ -33,6 +36,7 @@ class OMGF_Optimize
33
  public function __construct()
34
  {
35
  $this->settings_page = $_GET['page'] ?? '';
 
36
  $this->settings_updated = $_GET['settings-updated'] ?? '';
37
 
38
  $this->init();
@@ -45,10 +49,15 @@ class OMGF_Optimize
45
  */
46
  private function init()
47
  {
48
- if (
49
- OMGF_Admin_Settings::OMGF_ADMIN_PAGE != $this->settings_page
50
- || !$this->settings_updated
51
- ) {
 
 
 
 
 
52
  return;
53
  }
54
 
@@ -63,6 +72,22 @@ class OMGF_Optimize
63
  }
64
  }
65
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
  /**
67
  * @return void
68
  */
@@ -170,22 +195,6 @@ class OMGF_Optimize
170
  );
171
  }
172
 
173
- /**
174
- * If this site is non-SSL it makes no sense to verify its SSL certificates.
175
- *
176
- * Settings sslverify to false will set CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
177
- * to 0 further down the road.
178
- *
179
- * @param mixed $url
180
- * @return bool
181
- */
182
- public function verify_ssl($args)
183
- {
184
- $args['sslverify'] = strpos(home_url(), 'https:') !== false;
185
-
186
- return $args;
187
- }
188
-
189
  /**
190
  * @param $url
191
  *
24
  /** @var string */
25
  private $settings_page = '';
26
 
27
+ /** @var string */
28
+ private $settings_tab = '';
29
+
30
  /** @var string */
31
  private $settings_updated = '';
32
 
36
  public function __construct()
37
  {
38
  $this->settings_page = $_GET['page'] ?? '';
39
+ $this->settings_tab = $_GET['tab'] ?? OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_OPTIMIZE;
40
  $this->settings_updated = $_GET['settings-updated'] ?? '';
41
 
42
  $this->init();
49
  */
50
  private function init()
51
  {
52
+ if (OMGF_Admin_Settings::OMGF_ADMIN_PAGE != $this->settings_page) {
53
+ return;
54
+ }
55
+
56
+ if (OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_OPTIMIZE != $this->settings_tab) {
57
+ return;
58
+ }
59
+
60
+ if (!$this->settings_updated) {
61
  return;
62
  }
63
 
72
  }
73
  }
74
 
75
+ /**
76
+ * If this site is non-SSL it makes no sense to verify its SSL certificates.
77
+ *
78
+ * Settings sslverify to false will set CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
79
+ * to 0 further down the road.
80
+ *
81
+ * @param mixed $url
82
+ * @return bool
83
+ */
84
+ public function verify_ssl($args)
85
+ {
86
+ $args['sslverify'] = strpos(home_url(), 'https:') !== false;
87
+
88
+ return $args;
89
+ }
90
+
91
  /**
92
  * @return void
93
  */
195
  );
196
  }
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  /**
199
  * @param $url
200
  *
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.7
6
- Stable tag: 4.4.2
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -123,6 +123,10 @@ No, not yet. But I will definitely try to make it compatible in the future!
123
 
124
  == Changelog ==
125
 
 
 
 
 
126
  = 4.4.2 =
127
  * Upped static version of Admin CSS files.
128
 
@@ -251,7 +255,7 @@ No, not yet. But I will definitely try to make it compatible in the future!
251
  * Some settings were moved to a new tab: Basic Settings.
252
  * Improved Welcome and Documentation tab.
253
  * Clarified option descriptions.
254
- * Removed 'Generate Stylesheet' tab, which'll be released in a separate (free) add-on plugin soon.
255
  * Removed 'Use Web Font Loader?' option, because it causes Cumulative Layout Shift and will not work with OMGF's new Auto Replace feature.
256
  * Removed 'Remove Version Parameter' option, because it has become obsolete. The new detection method uses the initial script's version, if set.
257
  * Font Preloading is temporarily removed and will be re-introduced (in a different form, along with new features) in a later release.
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.7
6
+ Stable tag: 4.4.3
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
123
 
124
  == Changelog ==
125
 
126
+ = 4.4.3 =
127
+ * Fixed a few warnings/notices.
128
+ * Re-worded some options and option descriptions.
129
+
130
  = 4.4.2 =
131
  * Upped static version of Admin CSS files.
132
 
255
  * Some settings were moved to a new tab: Basic Settings.
256
  * Improved Welcome and Documentation tab.
257
  * Clarified option descriptions.
258
+ * Removed 'Generate Stylesheet' tab, which'll be released in a separate add-on plugin soon.
259
  * Removed 'Use Web Font Loader?' option, because it causes Cumulative Layout Shift and will not work with OMGF's new Auto Replace feature.
260
  * Removed 'Remove Version Parameter' option, because it has become obsolete. The new detection method uses the initial script's version, if set.
261
  * Font Preloading is temporarily removed and will be re-introduced (in a different form, along with new features) in a later release.