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

Version Description

| September 14th, 2022 = * Added: output_array() debug function to allow printing arrays in the debug log. * Fixes: Cannot use output buffering in output buffering display handlers * Added: Mesmerize theme compatibility * Fixed: decode any special HTML entities to make sure all parameters in the URL are properly parsed. * Improved: Preload option is now reworded to Load Early, because many people seemed to confuse it with "Download" * Improved: Do Not Load is shortened to Don't Load * Improved: Manage Optimized Fonts is reworded to Optimize Local Fonts and the Optimize Fonts tab is reworded to Local Fonts to make more sense as to what its purpose actually is. * Fixed: Similar stylesheets would sometimes be replaced twice, causing layout breaks. * Fixed: if there are no options on the page, the Save Changes button is now disabled. * Added: omgf_admin_optimize_verify_ssl filter for local development areas. * Added: omgf_frontend_process_before_ob_start filter so other plugins (hint: OMGF Pro) have a proper way to execute only when OMGF is allowed to run. * Added: compatibility fix for Category Slider Pro for WooCommerce (@see: https://wordpress.org/support/topic/adds-a-unique-identifier-to-google-fonts/) * Added: Refresh Cache button in Task Manager.

Download this release

Release Info

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

Code changes from version 5.3.6 to 5.3.7

assets/css/omgf-admin.css CHANGED
@@ -24,7 +24,11 @@
24
  border-radius: 3px;
25
  white-space: nowrap;
26
  }
27
- .omgf .button-cancel.omgf-empty {
 
 
 
 
28
  padding: 1px 10px !important;
29
  }
30
  .omgf .button-cancel:hover {
@@ -33,6 +37,11 @@
33
  color: #fff;
34
  border-color: #d54e21;
35
  }
 
 
 
 
 
36
  /**
37
  * Navigation
38
  */
24
  border-radius: 3px;
25
  white-space: nowrap;
26
  }
27
+ .omgf .button-cancel.omgf-refresh {
28
+ color: #FF851B;
29
+ }
30
+ .omgf .button-cancel.omgf-empty,
31
+ .omgf .button-cancel.omgf-refresh {
32
  padding: 1px 10px !important;
33
  }
34
  .omgf .button-cancel:hover {
37
  color: #fff;
38
  border-color: #d54e21;
39
  }
40
+ .omgf .button-cancel:hover#omgf-refresh {
41
+ color: #fff;
42
+ background: #FF851B;
43
+ border-color: #FF851B;
44
+ }
45
  /**
46
  * Navigation
47
  */
assets/css/omgf-admin.css.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["omgf-admin.less"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkBA,KACE;EACE,WAAA;EACA,qBAAA;EACA,yBAAA;EACA,gBAAA;EACA,eAAA;EACA,kBAAA;EACA,mBAAA;;AAEA,KATF,eASG;EACC,4BAAA;;AAGF,KAbF,eAaG;EACC,eAAA;EACA,mBAAA;EACA,WAAA;EACA,qBAAA;;;;;AAQN;EACE,oBAAA;;AADF,SAGE;EACE,eAAA;;AAJJ,SAOE,kBAAiB;EACf,oBAAA;EACA,mBAAA;;AAIJ,KAAM;EACJ,iBAAA;;AADF,KAAM,KAGJ;EACE,iBAAA;;AAJJ,KAAM,KAQJ,mBACE;EACE,eAAA;EACA,cAAA;;AAXN,KAAM,KAQJ,mBAME;EACE,eAAA;EACA,gBAAA;EACA,cAAA;EACA,eAAA;;AAlBN,KAAM,KAQJ,mBAME,GAME;EACE,mBAAA;EACA,iBAAA;EACA,kBAAA;;AAEA,KAzBF,KAQJ,mBAME,GAME,GAKG;EACC,aAAa,WAAb;EACA,eAAA;EACA,oBAAA;;AAGF,KA/BF,KAQJ,mBAME,GAME,GAWG,MAAM;EACL,SAAS,OAAT;EACA,cAAA;;AAGF,KApCF,KAQJ,mBAME,GAME,GAgBG,MAAM;EACL,SAAS,OAAT;EACA,cAAA;;AAGF,KAzCF,KAQJ,mBAME,GAME,GAqBG,UAAU;EACT,SAAS,OAAT;EACA,cAAA;;AAGF,KA9CF,KAQJ,mBAME,GAME,GA0BG,mBAAmB;EAClB,SAAS,OAAT;EACA,cAAA;;AAGF,KAnDF,KAQJ,mBAME,GAME,GA+BG,SAAS;EACR,SAAS,OAAT;EACA,cAAA;;AAOV;EACE,kBAAA;EACA,kBAAA;EACA,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AA;EACA,mBAAA;EACA,kBAAA;;AApBJ,QAME,cAgBE;EACE,YAAA;;AAvBN,QAME,cAoBE;EACE,gBAAA;;AAIJ,QAAC,MAAO;EACN,mBAAA;;AAIJ;EACE,UAAA;EACA,gBAAA;;AAGF,eACE;EACE,mBAAA;;AAFJ,eACE,SAGE;EACE,aAAA;EACA,mBAAA;EACA,8BAAA;;AAPN,eACE,SAGE,kBAKE,QACE,GACE;EACE,mBAAA;;AAEA,eAbV,SAGE,kBAKE,QACE,GACE,GAGG;EACC,mBAAA;;AAfd,eACE,SAGE,kBAKE,QACE,GACE,GAOE;EACE,qBAAA;EACA,iBAAA;;AAGE,eAtBd,SAGE,kBAKE,QACE,GACE,GAOE,EAIE,EACG;EACC,iBAAA;EACA,cAAA;;AAOV,eA/BN,SAGE,kBAKE,QAuBG;EACC,kBAAA;;AADF,eA/BN,SAGE,kBAKE,QAuBG,KAGC;EACE,kBAAA;;AAJJ,eA/BN,SAGE,kBAKE,QAuBG,KAGC,WAGE;EACE,cAAA;;AASd,wBAA0C;EACxC;IACE,cAAA;;EADF,8BAGE;IACE,kBAAA;IACA,aAAA;IACA,YAAA;;;;;;AAQN;EACE,eAAA;EACA,0CAAA;EACA,WAAA;EACA,YAAA;EACA,MAAA;EACA,kBAAA;;AANF,aAQE;EACE,QAAA;EACA,SAAA;EACA,kBAAA;EACA,eAAe,gBAAf;EACA,WAAW,gBAAX;;;;;AAOJ,gBACE;EACE,uBAAA;;AAIA,gBADF,WACG;EACC,sBAAA;;AAGF,gBALF,WAKG,WAAW;EACV,cAAA;;AAXN,gBAeE;EACE,WAAA"}
1
+ {"version":3,"sources":["omgf-admin.less"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkBA,KACE;EACE,WAAA;EACA,qBAAA;EACA,yBAAA;EACA,gBAAA;EACA,eAAA;EACA,kBAAA;EACA,mBAAA;;AAEA,KATF,eASG;EACC,cAAA;;AAGF,KAbF,eAaG;AACD,KAdF,eAcG;EACC,4BAAA;;A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AEA,eAbV,SAGE,kBAKE,QACE,GACE,GAGG;EACC,mBAAA;;AAfd,eACE,SAGE,kBAKE,QACE,GACE,GAOE;EACE,qBAAA;EACA,iBAAA;;AAGE,eAtBd,SAGE,kBAKE,QACE,GACE,GAOE,EAIE,EACG;EACC,iBAAA;EACA,cAAA;;AAOV,eA/BN,SAGE,kBAKE,QAuBG;EACC,kBAAA;;AADF,eA/BN,SAGE,kBAKE,QAuBG,KAGC;EACE,kBAAA;;AAJJ,eA/BN,SAGE,kBAKE,QAuBG,KAGC,WAGE;EACE,cAAA;;AASd,wBAA0C;EACxC;IACE,cAAA;;EADF,8BAGE;IACE,kBAAA;IACA,aAAA;IACA,YAAA;;;;;;AAQN;EACE,eAAA;EACA,0CAAA;EACA,WAAA;EACA,YAAA;EACA,MAAA;EACA,kBAAA;;AANF,aAQE;EACE,QAAA;EACA,SAAA;EACA,kBAAA;EACA,eAAe,gBAAf;EACA,WAAW,gBAAX;;;;;AAOJ,gBACE;EACE,uBAAA;;AAIA,gBADF,WACG;EACC,sBAAA;;AAGF,gBALF,WAKG,WAAW;EACV,cAAA;;AAXN,gBAeE;EACE,WAAA"}
assets/css/omgf-admin.less CHANGED
@@ -26,7 +26,12 @@
26
  border-radius: 3px;
27
  white-space: nowrap;
28
 
29
- &.omgf-empty {
 
 
 
 
 
30
  padding: 1px 10px !important;
31
  }
32
 
@@ -35,6 +40,12 @@
35
  background: #d54e21;
36
  color: #fff;
37
  border-color: #d54e21;
 
 
 
 
 
 
38
  }
39
  }
40
  }
26
  border-radius: 3px;
27
  white-space: nowrap;
28
 
29
+ &.omgf-refresh {
30
+ color: #FF851B;
31
+ }
32
+
33
+ &.omgf-empty,
34
+ &.omgf-refresh {
35
  padding: 1px 10px !important;
36
  }
37
 
40
  background: #d54e21;
41
  color: #fff;
42
  border-color: #d54e21;
43
+
44
+ &#omgf-refresh {
45
+ color: #fff;
46
+ background: #FF851B;
47
+ border-color: #FF851B;
48
+ }
49
  }
50
  }
51
  }
assets/js/omgf-admin.js CHANGED
@@ -41,7 +41,7 @@ jQuery(document).ready(function ($) {
41
  // Buttons (AJAX, etc.)
42
  $('#omgf-save-optimize').on('click', function () { $('#omgf-optimize-settings-form #submit').click(); });
43
  $('#omgf-remove-stylesheet').on('click', this.remove_stylesheet_from_db);
44
- $('#omgf-cache-refresh').on('click', this.refresh_cache);
45
  $('.omgf-empty, #omgf-cache-flush').on('click', this.empty_cache_directory);
46
  $('#omgf-optimize-settings-form').on('submit', this.show_loader_before_submit);
47
  $('#omgf-delete-log').on('click', this.delete_log);
41
  // Buttons (AJAX, etc.)
42
  $('#omgf-save-optimize').on('click', function () { $('#omgf-optimize-settings-form #submit').click(); });
43
  $('#omgf-remove-stylesheet').on('click', this.remove_stylesheet_from_db);
44
+ $('.omgf-refresh, #omgf-cache-refresh').on('click', this.refresh_cache);
45
  $('.omgf-empty, #omgf-cache-flush').on('click', this.empty_cache_directory);
46
  $('#omgf-optimize-settings-form').on('submit', this.show_loader_before_submit);
47
  $('#omgf-delete-log').on('click', this.delete_log);
host-webfonts-local.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://daan.dev/wordpress/omgf/
6
  * Description: Increase GDPR compliance, reduce DNS requests and leverage browser cache by automatically downloading Google Fonts to your server.
7
- * Version: 5.3.6
8
  * Author: Daan from Daan.dev
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
@@ -19,7 +19,7 @@ defined('ABSPATH') || exit;
19
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
20
  define('OMGF_PLUGIN_FILE', __FILE__);
21
  define('OMGF_PLUGIN_BASENAME', plugin_basename(OMGF_PLUGIN_FILE));
22
- define('OMGF_STATIC_VERSION', '5.3.3');
23
  define('OMGF_DB_VERSION', '5.3.4');
24
 
25
  /**
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://daan.dev/wordpress/omgf/
6
  * Description: Increase GDPR compliance, reduce DNS requests and leverage browser cache by automatically downloading Google Fonts to your server.
7
+ * Version: 5.3.7
8
  * Author: Daan from Daan.dev
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
19
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
20
  define('OMGF_PLUGIN_FILE', __FILE__);
21
  define('OMGF_PLUGIN_BASENAME', plugin_basename(OMGF_PLUGIN_FILE));
22
+ define('OMGF_STATIC_VERSION', '5.3.7');
23
  define('OMGF_DB_VERSION', '5.3.4');
24
 
25
  /**
includes/admin/class-optimize.php CHANGED
@@ -74,7 +74,7 @@ class OMGF_Admin_Optimize
74
  */
75
  public function verify_ssl($args)
76
  {
77
- $args['sslverify'] = strpos(get_home_url(), 'https:') !== false;
78
 
79
  return $args;
80
  }
74
  */
75
  public function verify_ssl($args)
76
  {
77
+ $args['sslverify'] = apply_filters('omgf_admin_optimize_verify_ssl', strpos(get_home_url(), 'https:') !== false);
78
 
79
  return $args;
80
  }
includes/admin/class-settings.php CHANGED
@@ -288,7 +288,7 @@ class OMGF_Admin_Settings extends OMGF_Admin
288
 
289
  public function optimize_fonts_tab()
290
  {
291
- $this->generate_tab(self::OMGF_SETTINGS_FIELD_OPTIMIZE, 'dashicons-performance', __('Optimize Fonts', $this->plugin_text_domain));
292
  }
293
 
294
  /**
@@ -397,7 +397,7 @@ class OMGF_Admin_Settings extends OMGF_Admin
397
 
398
  ?>
399
  <?php if ($this->active_tab !== self::OMGF_SETTINGS_FIELD_HELP) : ?>
400
- <?php submit_button($this->submit_button_text, 'primary', 'submit', false); ?>
401
  <?php endif; ?>
402
  </form>
403
  <?php
288
 
289
  public function optimize_fonts_tab()
290
  {
291
+ $this->generate_tab(self::OMGF_SETTINGS_FIELD_OPTIMIZE, 'dashicons-performance', __('Local Fonts', $this->plugin_text_domain));
292
  }
293
 
294
  /**
397
 
398
  ?>
399
  <?php if ($this->active_tab !== self::OMGF_SETTINGS_FIELD_HELP) : ?>
400
+ <?php submit_button($this->submit_button_text, 'primary', 'submit', false, empty($this->get_settings()) ? 'disabled' : null); ?>
401
  <?php endif; ?>
402
  </form>
403
  <?php
includes/admin/settings/class-detection.php CHANGED
@@ -59,7 +59,7 @@ class OMGF_Admin_Settings_Detection extends OMGF_Admin_Settings_Builder
59
  <th scope="row"><?= __('Google Fonts Processing', $this->plugin_text_domain); ?></th>
60
  <td>
61
  <p class="description">
62
- <?= sprintf(__('By default, OMGF replaces Google Fonts stylesheets (e.g. <code>https://fonts.googleapis.com/css?family=Open+Sans</code>) with locally hosted copies. This behavior can be tweaked further using the <strong>Advanced Processing (Pro)</strong> option. To remove/unload Google Fonts, go to <em>Optimize Fonts</em> > <a href="%s"><em>Manage Optimized Fonts</em></a> and click <strong>Unload all</strong> next to the stylesheet handle you\'d like to remove.', $this->plugin_text_domain), admin_url('options-general.php?page=optimize-webfonts&tab=omgf-optimize-settings#omgf-manage-optimized-fonts')); ?>
63
  </p>
64
  </td>
65
  </tr>
59
  <th scope="row"><?= __('Google Fonts Processing', $this->plugin_text_domain); ?></th>
60
  <td>
61
  <p class="description">
62
+ <?= sprintf(__('By default, OMGF replaces Google Fonts stylesheets (e.g. <code>https://fonts.googleapis.com/css?family=Open+Sans</code>) with locally hosted copies. This behavior can be tweaked further using the <strong>Advanced Processing (Pro)</strong> option. To remove/unload Google Fonts, go to <em>Local Fonts</em> > <a href="%s"><em>Optimize Local Fonts</em></a> and click <strong>Unload all</strong> next to the stylesheet handle you\'d like to remove.', $this->plugin_text_domain), admin_url('options-general.php?page=optimize-webfonts&tab=omgf-optimize-settings#omgf-manage-optimized-fonts')); ?>
63
  </p>
64
  </td>
65
  </tr>
includes/admin/settings/class-optimize.php CHANGED
@@ -30,7 +30,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
30
  {
31
  parent::__construct();
32
 
33
- $this->title = __('Optimize Google Fonts', $this->plugin_text_domain);
34
 
35
  add_filter('omgf_optimize_settings_content', [$this, 'do_title'], 10);
36
  add_filter('omgf_optimize_settings_content', [$this, 'do_description'], 11);
@@ -83,7 +83,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
83
  <div class="omgf-task-manager postbox" style="padding: 0 15px 5px;">
84
  <h3><?= __('Task Manager', $this->plugin_text_domain); ?></h3>
85
  <p class="description">
86
- <?= __('A quick overview of the stylesheets (and their status) currently in your cache folder.', $this->plugin_text_domain); ?>
87
  </p>
88
  <?php
89
  }
@@ -141,9 +141,10 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
141
  </td>
142
  </tr>
143
  <tr>
144
- <th scope="row"><?php _e('Flush Cache', $this->plugin_text_domain); ?></th>
145
  <td class="task-manager-row">
146
  <a id="omgf-empty" data-init="<?= OMGF_Admin_Settings::OMGF_ADMIN_PAGE; ?>" data-nonce="<?= wp_create_nonce(OMGF_Admin_Settings::OMGF_ADMIN_PAGE); ?>" class="omgf-empty button-cancel"><?php _e('Empty Cache Directory', $this->plugin_text_domain); ?></a>
 
147
  </td>
148
  </tr>
149
  <?php
@@ -242,7 +243,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
242
  */
243
  $this->optimized_fonts = OMGF::optimized_fonts();
244
  ?>
245
- <span class="option-title"><?= __('Manage Optimized Fonts', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo sprintf(__('Don\'t know where or how to start optimizing your Google Fonts? That\'s okay. <a href="%s">This guide</a> will get you sorted.', $this->plugin_text_domain), 'https://daan.dev/blog/how-to/wordpress-google-fonts/'); ?></span></span></span></span>
246
  <?php if (!empty($this->optimized_fonts)) : ?>
247
  <?= $this->do_optimized_fonts_manager(); ?>
248
  <?php else : ?>
@@ -270,9 +271,9 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
270
  <td>&nbsp;</td>
271
  <th><?= __('Style', $this->plugin_text_domain); ?></th>
272
  <th><?= __('Weight', $this->plugin_text_domain); ?></th>
273
- <th><?= __('Preload', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo sprintf(__('<a href="%s">Preload font files</a> prior to page rendering to improve perceived loading times. Only use preload for font files that are used above the fold.', $this->plugin_text_domain), 'https://daan.dev/blog/how-to/wordpress-google-fonts/#3-2-preloading-font-files-above-the-fold'); ?></span><img width="230" class="illustration" src="<?= plugin_dir_url(OMGF_PLUGIN_FILE) . 'assets/images/above-the-fold.png'; ?>" /></span></span></th>
274
- <th><?= __('Do not load', $this->plugin_text_domain); ?></th>
275
- <th><?= __('Fallback Font Stack (Pro)', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo __('Reduce Cumulative Layout Shift (CLS) by making sure all text using Google Fonts has a similar system font to display while the Google Fonts are being downloaded.', $this->plugin_text_domain) . ' ' . $this->promo; ?></span></span></span></th>
276
  <th><?= __('Replace (Pro)', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo sprintf(__('When the <a href="%s">Replace option</a> is checked, the selected Fallback Font Stack will replace the corresponding Google Font family, instead of functioning as a fallback.', $this->plugin_text_domain), 'https://daan.dev/blog/how-to/wordpress-google-fonts/#7-4-specify-a-fallback-font-stack') . ' ' . $this->promo; ?></span></span></span></th>
277
  </tr>
278
  </thead>
30
  {
31
  parent::__construct();
32
 
33
+ $this->title = __('Optimize Local Google Fonts', $this->plugin_text_domain);
34
 
35
  add_filter('omgf_optimize_settings_content', [$this, 'do_title'], 10);
36
  add_filter('omgf_optimize_settings_content', [$this, 'do_description'], 11);
83
  <div class="omgf-task-manager postbox" style="padding: 0 15px 5px;">
84
  <h3><?= __('Task Manager', $this->plugin_text_domain); ?></h3>
85
  <p class="description">
86
+ <?= __('A quick overview of all found Google Fonts stylesheets (and their status) currently saved on (and served from) your server.', $this->plugin_text_domain); ?>
87
  </p>
88
  <?php
89
  }
141
  </td>
142
  </tr>
143
  <tr>
144
+ <th scope="row"><?php _e('Manage Cache', $this->plugin_text_domain); ?></th>
145
  <td class="task-manager-row">
146
  <a id="omgf-empty" data-init="<?= OMGF_Admin_Settings::OMGF_ADMIN_PAGE; ?>" data-nonce="<?= wp_create_nonce(OMGF_Admin_Settings::OMGF_ADMIN_PAGE); ?>" class="omgf-empty button-cancel"><?php _e('Empty Cache Directory', $this->plugin_text_domain); ?></a>
147
+ <a id="omgf-refresh" data-init="<?= OMGF_Admin_Settings::OMGF_ADMIN_PAGE; ?>" data-nonce="<?= wp_create_nonce(OMGF_Admin_Settings::OMGF_ADMIN_PAGE); ?>" class="omgf-refresh button-cancel"><?php _e('Refresh Cache (and maintain settings)', $this->plugin_text_domain); ?></a>
148
  </td>
149
  </tr>
150
  <?php
243
  */
244
  $this->optimized_fonts = OMGF::optimized_fonts();
245
  ?>
246
+ <span class="option-title"><?= __('Optimize Local Fonts', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo sprintf(__('Don\'t know where or how to start optimizing your Google Fonts? That\'s okay. <a href="%s">This guide</a> will get you sorted.', $this->plugin_text_domain), 'https://daan.dev/blog/how-to/wordpress-google-fonts/'); ?></span></span></span></span>
247
  <?php if (!empty($this->optimized_fonts)) : ?>
248
  <?= $this->do_optimized_fonts_manager(); ?>
249
  <?php else : ?>
271
  <td>&nbsp;</td>
272
  <th><?= __('Style', $this->plugin_text_domain); ?></th>
273
  <th><?= __('Weight', $this->plugin_text_domain); ?></th>
274
+ <th><?= __('Load Early', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo sprintf(__('<a href="%s">Preload font files</a> prior to page rendering to improve perceived loading times. Only use preload for font files that are used above the fold.', $this->plugin_text_domain), 'https://daan.dev/blog/how-to/wordpress-google-fonts/#3-2-preloading-font-files-above-the-fold'); ?></span><img width="230" class="illustration" src="<?= plugin_dir_url(OMGF_PLUGIN_FILE) . 'assets/images/above-the-fold.png'; ?>" /></span></span></th>
275
+ <th><?= __('Don\'t Load', $this->plugin_text_domain); ?></th>
276
+ <th><?= __('Fallback (Pro)', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo __('Reduce Cumulative Layout Shift (CLS) by making sure all text using Google Fonts has a similar system font to display while the Google Fonts are being downloaded.', $this->plugin_text_domain) . ' ' . $this->promo; ?></span></span></span></th>
277
  <th><?= __('Replace (Pro)', $this->plugin_text_domain); ?><span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><span class="inline-text"><?php echo sprintf(__('When the <a href="%s">Replace option</a> is checked, the selected Fallback Font Stack will replace the corresponding Google Font family, instead of functioning as a fallback.', $this->plugin_text_domain), 'https://daan.dev/blog/how-to/wordpress-google-fonts/#7-4-specify-a-fallback-font-stack') . ' ' . $this->promo; ?></span></span></span></th>
278
  </tr>
279
  </thead>
includes/class-omgf.php CHANGED
@@ -235,7 +235,7 @@ class OMGF
235
  }
236
 
237
  /**
238
- * Manage Optimized Fonts to be displayed in the Optimized Fonts table.
239
  *
240
  * Use a static variable to reduce database reads/writes.
241
  *
@@ -432,4 +432,34 @@ class OMGF
432
 
433
  error_log(current_time('Y-m-d H:i:s') . ' ' . microtime() . ": $message\n", 3, self::$log_file);
434
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
435
  }
235
  }
236
 
237
  /**
238
+ * Optimized Local Fonts to be displayed in the Optimize Local Fonts table.
239
  *
240
  * Use a static variable to reduce database reads/writes.
241
  *
432
 
433
  error_log(current_time('Y-m-d H:i:s') . ' ' . microtime() . ": $message\n", 3, self::$log_file);
434
  }
435
+
436
+ /**
437
+ * To prevent "Cannot use output buffering in output buffering display handlers" errors, I introduced a debug array feature,
438
+ * to easily display, well, arrays in the debug log (duh!)
439
+ *
440
+ * @since v5.3.7
441
+ *
442
+ * @param $name A desriptive name to be shown in the debug log
443
+ * @param $array The array to be displayed in the debug log
444
+ *
445
+ * @return void
446
+ */
447
+ public static function debug_array($name, $array)
448
+ {
449
+ if (!is_array($array) && !is_object($array)) {
450
+ return;
451
+ }
452
+
453
+ OMGF::debug(__('Showing debug information for', 'host-webfonts-local') . ': ' . $name);
454
+
455
+ foreach ($array as $key => $elem) {
456
+ if (is_array($elem) || is_object($elem)) {
457
+ OMGF::debug_array(sprintf(__('Subelement %s is array/object', 'host-webfonts-local'), $key), $elem);
458
+
459
+ continue;
460
+ }
461
+
462
+ error_log(current_time('Y-m-d H:i:s') . ' ' . microtime() . ": " . $key . ' => ' . $elem . "\n", 3, self::$log_file);
463
+ }
464
+ }
465
  }
includes/class-optimize.php CHANGED
@@ -222,7 +222,7 @@ class OMGF_Optimize
222
 
223
  $font_families = array_unique($font_families[1]);
224
 
225
- OMGF::debug(__('Font-families found: ', $this->plugin_text_domain) . print_r($font_families, true));
226
 
227
  foreach ($font_families as $font_family) {
228
  $id = strtolower(str_replace(' ', '-', $font_family));
@@ -311,7 +311,7 @@ class OMGF_Optimize
311
  }
312
  }
313
 
314
- OMGF::debug(__('Generated the following @font-face objects: ', $this->plugin_text_domain) . print_r($font_object, true));
315
 
316
  OMGF::debug(__('All @font-face statements processed.', $this->plugin_text_domain));
317
 
@@ -334,7 +334,7 @@ class OMGF_Optimize
334
 
335
  $subsets = array_unique($subsets[1]);
336
 
337
- OMGF::debug(__('This stylesheet contains @font-face statements for the following subsets: ', $this->plugin_text_domain) . print_r($subsets, true));
338
 
339
  return $subsets;
340
  }
222
 
223
  $font_families = array_unique($font_families[1]);
224
 
225
+ OMGF::debug_array(__('Font-families found', $this->plugin_text_domain), $font_families);
226
 
227
  foreach ($font_families as $font_family) {
228
  $id = strtolower(str_replace(' ', '-', $font_family));
311
  }
312
  }
313
 
314
+ OMGF::debug_array(__('Generated @font-face objects', $this->plugin_text_domain), $font_object);
315
 
316
  OMGF::debug(__('All @font-face statements processed.', $this->plugin_text_domain));
317
 
334
 
335
  $subsets = array_unique($subsets[1]);
336
 
337
+ OMGF::debug_array(__('Subset @font-face statements', $this->plugin_text_domain), $subsets);
338
 
339
  return $subsets;
340
  }
includes/frontend/class-process.php CHANGED
@@ -189,6 +189,8 @@ class OMGF_Frontend_Process
189
  return false;
190
  }
191
 
 
 
192
  /**
193
  * Let's GO!
194
  */
@@ -325,7 +327,20 @@ class OMGF_Frontend_Process
325
  return apply_filters('omgf_processed_html', $html, $this);
326
  }
327
 
328
- $html = str_replace($search_replace['search'], $search_replace['replace'], $html);
 
 
 
 
 
 
 
 
 
 
 
 
 
329
 
330
  return apply_filters('omgf_processed_html', $html, $this);
331
  }
@@ -370,6 +385,13 @@ class OMGF_Frontend_Process
370
  continue;
371
  }
372
 
 
 
 
 
 
 
 
373
  /**
374
  * If no valid id attribute was found then this means that this stylesheet wasn't enqueued
375
  * using proper WordPress conventions. We generate our own using the length of the href attribute
@@ -405,11 +427,23 @@ class OMGF_Frontend_Process
405
  * sure we can make a difference between different Google Fonts configurations.
406
  */
407
  $google_fonts[$key]['id'] = str_replace('-1', '-' . strlen($href['href']), $id);
 
 
 
 
 
 
 
 
 
408
  } else {
409
  $google_fonts[$key]['id'] = $id;
410
  }
411
 
412
  $google_fonts[$key]['link'] = $link;
 
 
 
413
  $google_fonts[$key]['href'] = $href['href'];
414
  }
415
 
@@ -515,7 +549,11 @@ class OMGF_Frontend_Process
515
  continue;
516
  }
517
 
518
- $query = parse_url($stack['href'], PHP_URL_QUERY);
 
 
 
 
519
  parse_str($query, $query);
520
 
521
  /**
189
  return false;
190
  }
191
 
192
+ do_action('omgf_frontend_process_before_ob_start');
193
+
194
  /**
195
  * Let's GO!
196
  */
327
  return apply_filters('omgf_processed_html', $html, $this);
328
  }
329
 
330
+ /**
331
+ * Use string position of $search to make sure only that instance of the string is replaced.
332
+ *
333
+ * This is to prevent duplicate replaces.
334
+ *
335
+ * @since v5.3.7
336
+ */
337
+ foreach ($search_replace['search'] as $key => $search) {
338
+ $position = strpos($html, $search);
339
+
340
+ if ($position !== false && isset($search_replace['replace'][$key])) {
341
+ $html = substr_replace($html, $search_replace['replace'][$key], $position, strlen($search));
342
+ }
343
+ }
344
 
345
  return apply_filters('omgf_processed_html', $html, $this);
346
  }
385
  continue;
386
  }
387
 
388
+ /**
389
+ * Mesmerize Theme compatibility
390
+ */
391
+ if ($href['href'] === '#') {
392
+ preg_match('/data-href=[\'"](?P<href>.*?)[\'"]/', $link, $href);
393
+ }
394
+
395
  /**
396
  * If no valid id attribute was found then this means that this stylesheet wasn't enqueued
397
  * using proper WordPress conventions. We generate our own using the length of the href attribute
427
  * sure we can make a difference between different Google Fonts configurations.
428
  */
429
  $google_fonts[$key]['id'] = str_replace('-1', '-' . strlen($href['href']), $id);
430
+ } elseif (strpos($id, 'sp-wpcp-google-fonts') !== false) {
431
+ /**
432
+ * Compatibility fix for Category Slider Pro for WooCommerce
433
+ *
434
+ * @since v5.3.7 This plugin finds it necessary to provide each Google Fonts stylesheet with a
435
+ * unique identifier, to make sure its never cached. The worst idea eve. On top
436
+ * of that, it throws OMGF off the rails entirely, eventually crashing the site.
437
+ */
438
+ $google_fonts[$key]['id'] = 'sp-wpcp-google-fonts';
439
  } else {
440
  $google_fonts[$key]['id'] = $id;
441
  }
442
 
443
  $google_fonts[$key]['link'] = $link;
444
+ /**
445
+ * This is used for search/replace later on. This shouldn't be tampered with.
446
+ */
447
  $google_fonts[$key]['href'] = $href['href'];
448
  }
449
 
549
  continue;
550
  }
551
 
552
+ /**
553
+ * @since v5.3.7 decode URL and special HTML chars, to make sure all params are properly processed later on.
554
+ */
555
+ $href = urldecode(htmlspecialchars_decode($stack['href']));
556
+ $query = parse_url($href, PHP_URL_QUERY);
557
  parse_str($query, $query);
558
 
559
  /**
readme.txt CHANGED
@@ -1,9 +1,9 @@
1
- === OMGF | GDPR Compliant, Faster Google Fonts. Easy. ===
2
  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: 6.0
6
- Stable tag: 5.3.6
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -76,6 +76,21 @@ For the FAQ, [click here](https://daan.dev/docs/omgf-pro-faq/).
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  = 5.3.6 | August 10th, 2022 =
80
  * Added: compatibility for Download Manager and other plugin who insert stylesheet into the `head` using multiple lines.
81
  * Added: omgf_generate_stylesheet_after filter.
1
+ === OMGF | GDPR/DSVGO Compliant, Faster Google Fonts. Easy. ===
2
  Contributors: DaanvandenBergh
3
+ Tags: google, fonts, gdpr, dsvgo, cache, speed, preload, font-display, webfonts, subsets, remove, minimize, external, requests
4
  Requires at least: 4.6
5
  Tested up to: 6.0
6
+ Stable tag: 5.3.7
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
76
 
77
  == Changelog ==
78
 
79
+ = 5.3.7 | September 14th, 2022 =
80
+ * Added: output_array() debug function to allow printing arrays in the debug log.
81
+ * Fixes: Cannot use output buffering in output buffering display handlers
82
+ * Added: Mesmerize theme compatibility
83
+ * Fixed: decode any special HTML entities to make sure all parameters in the URL are properly parsed.
84
+ * Improved: *Preload* option is now reworded to *Load Early*, because many people seemed to confuse it with "Download"
85
+ * Improved: *Do Not Load* is shortened to *Don't Load*
86
+ * Improved: *Manage Optimized Fonts* is reworded to *Optimize Local Fonts* and the **Optimize Fonts** tab is reworded to **Local Fonts** to make more sense as to what its purpose actually is.
87
+ * Fixed: Similar stylesheets would sometimes be replaced twice, causing layout breaks.
88
+ * Fixed: if there are no options on the page, the Save Changes button is now disabled.
89
+ * Added: omgf_admin_optimize_verify_ssl filter for local development areas.
90
+ * Added: omgf_frontend_process_before_ob_start filter so other plugins (hint: OMGF Pro) have a proper way to execute only when OMGF is allowed to run.
91
+ * Added: compatibility fix for Category Slider Pro for WooCommerce (@see: https://wordpress.org/support/topic/adds-a-unique-identifier-to-google-fonts/)
92
+ * Added: Refresh Cache button in Task Manager.
93
+
94
  = 5.3.6 | August 10th, 2022 =
95
  * Added: compatibility for Download Manager and other plugin who insert stylesheet into the `head` using multiple lines.
96
  * Added: omgf_generate_stylesheet_after filter.