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

Version Description

| August 2nd, 2022 = * Fixed: use a more reliable regular expression to detect Google Fonts. * Fixed: Divi/Elementor compatibility is now disabled by default. * Added: DB migration script which invalidates the current stylesheets, if they don't confirm to the new standards yet. * Fixed: always allow debug log file to be deleted from the admin screen. * Fixed: filestat() failed-warning when enabling Debug Mode for the first time.

Download this release

Release Info

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

Code changes from version 5.3.4 to 5.3.5

assets/css/omgf-admin.css CHANGED
@@ -23,6 +23,8 @@
23
  background: 0 0;
24
  border-radius: 3px;
25
  white-space: nowrap;
 
 
26
  padding: 1px 10px !important;
27
  }
28
  .omgf .button-cancel:hover {
23
  background: 0 0;
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 {
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;EACA,4BAAA;;AAEA,KAVF,eAUG;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,mBAA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EACA,UAAA;EACA,cAAA;EACA,qCAAA;EACA,gDAAgD,oDAAoD,4BAApG;EACA,gBAAA;EACA,WAAA;EACA,gBAAA;EACA,YAAA;EACA,aAAA;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"}
assets/css/omgf-admin.less CHANGED
@@ -25,7 +25,10 @@
25
  background: 0 0;
26
  border-radius: 3px;
27
  white-space: nowrap;
28
- padding: 1px 10px !important;
 
 
 
29
 
30
  &:hover {
31
  cursor: pointer;
25
  background: 0 0;
26
  border-radius: 3px;
27
  white-space: nowrap;
28
+
29
+ &.omgf-empty {
30
+ padding: 1px 10px !important;
31
+ }
32
 
33
  &:hover {
34
  cursor: pointer;
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.4
8
  * Author: Daan from Daan.dev
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
@@ -20,7 +20,7 @@ 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.3');
24
 
25
  /**
26
  * Takes care of loading classes on demand.
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.5
8
  * Author: Daan from Daan.dev
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
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
  /**
26
  * Takes care of loading classes on demand.
includes/admin/settings/class-advanced.php CHANGED
@@ -100,7 +100,7 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
100
  __('Divi/Elementor Compatibility', $this->plugin_text_domain),
101
  OMGF_Admin_Settings::OMGF_ADV_SETTING_COMPATIBILITY,
102
  OMGF_COMPATIBILITY,
103
- __('Divi and Elementor use the same handle for Google Fonts stylesheets with different configurations. OMGF includes compatibility fixes to make sure these different stylesheets are processed correctly. However, if you have too many different stylesheets and you want to force the usage of 1 stylesheet throughout all your pages, disabling Divi/Elementor Compatibility might help. Default: on', $this->plugin_text_domain)
104
  );
105
  }
106
 
@@ -129,8 +129,8 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
129
  $nonce = wp_create_nonce(OMGF_Admin_Settings::OMGF_ADMIN_PAGE);
130
  ?>
131
  <a class="button button-secondary" href="<?php echo admin_url("admin-ajax.php?action=omgf_download_log&nonce=$nonce"); ?>"><?php _e('Download Log', $this->plugin_text_domain); ?></a>
 
132
  <?php if (filesize(OMGF::$log_file) > MB_IN_BYTES) : ?>
133
- <a id="omgf-delete-log" class="button button-cancel" data-nonce="<?php echo $nonce; ?>"><?php _e('Delete log', $this->plugin_text_domain); ?></a>
134
  <p class="omgf-warning"><?php _e('Your log file is currently larger than 1MB. To protect your filesystem, debug logging has stopped. Delete the log file to enable debug logging again.', $this->plugin_text_domain); ?></p>
135
  <?php endif; ?>
136
  <?php else : ?>
100
  __('Divi/Elementor Compatibility', $this->plugin_text_domain),
101
  OMGF_Admin_Settings::OMGF_ADV_SETTING_COMPATIBILITY,
102
  OMGF_COMPATIBILITY,
103
+ __('Divi and Elementor use the same handle for Google Fonts stylesheets with different configurations. OMGF includes compatibility fixes to make sure these different stylesheets are processed correctly. Enable this if you see some fonts not appearing correctly. Default: off', $this->plugin_text_domain)
104
  );
105
  }
106
 
129
  $nonce = wp_create_nonce(OMGF_Admin_Settings::OMGF_ADMIN_PAGE);
130
  ?>
131
  <a class="button button-secondary" href="<?php echo admin_url("admin-ajax.php?action=omgf_download_log&nonce=$nonce"); ?>"><?php _e('Download Log', $this->plugin_text_domain); ?></a>
132
+ <a id="omgf-delete-log" class="button button-cancel" data-nonce="<?php echo $nonce; ?>"><?php _e('Delete log', $this->plugin_text_domain); ?></a>
133
  <?php if (filesize(OMGF::$log_file) > MB_IN_BYTES) : ?>
 
134
  <p class="omgf-warning"><?php _e('Your log file is currently larger than 1MB. To protect your filesystem, debug logging has stopped. Delete the log file to enable debug logging again.', $this->plugin_text_domain); ?></p>
135
  <?php endif; ?>
136
  <?php else : ?>
includes/admin/settings/class-optimize.php CHANGED
@@ -184,7 +184,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
184
  __('Apply Font-Display Option Globally (Pro)', $this->plugin_text_domain),
185
  'omgf_pro_force_font_display',
186
  defined('OMGF_PRO_FORCE_FONT_DISPLAY') ? OMGF_PRO_FORCE_FONT_DISPLAY : false,
187
- __('Apply the above <code>font-display</code> attribute value to all <code>@font-face</code> statements found on your site to <strong>ensure text remains visible during webfont load</strong>.', $this->plugin_text_domain),
188
  !defined('OMGF_PRO_FORCE_FONT_DISPLAY')
189
  );
190
  }
@@ -200,7 +200,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
200
  __('Remove Async Google Fonts (Pro)', $this->plugin_text_domain),
201
  'omgf_pro_remove_async_fonts',
202
  defined('OMGF_PRO_REMOVE_ASYNC_FONTS') ? OMGF_PRO_REMOVE_ASYNC_FONTS : false,
203
- sprintf(__('Remove Google Fonts loaded (asynchronously) by (3rd party) JavaScript libraries used by some themes/plugins. This won\'t work with embedded content (i.e. <code>iframe</code>). <strong>Warning!</strong> Make sure you load the Google Fonts, either <a href="%s">manually</a> or by using a plugin (like <a href="%s" target="_blank">Additional Fonts</a>) to prevent styling breaks.', $this->plugin_text_domain), 'https://daan.dev/docs/omgf-pro/remove-async-google-fonts/', 'https://daan.dev/wordpress/omgf-additional-fonts/'),
204
  !defined('OMGF_PRO_REMOVE_ASYNC_FONTS')
205
  );
206
  }
@@ -272,8 +272,8 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
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); ?></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'); ?></span></span></span></th>
277
  </tr>
278
  </thead>
279
  <?php
184
  __('Apply Font-Display Option Globally (Pro)', $this->plugin_text_domain),
185
  'omgf_pro_force_font_display',
186
  defined('OMGF_PRO_FORCE_FONT_DISPLAY') ? OMGF_PRO_FORCE_FONT_DISPLAY : false,
187
+ __('Apply the above <code>font-display</code> attribute value to all <code>@font-face</code> statements found on your site to <strong>ensure text remains visible during webfont load</strong>.', $this->plugin_text_domain) . ' ' . $this->promo,
188
  !defined('OMGF_PRO_FORCE_FONT_DISPLAY')
189
  );
190
  }
200
  __('Remove Async Google Fonts (Pro)', $this->plugin_text_domain),
201
  'omgf_pro_remove_async_fonts',
202
  defined('OMGF_PRO_REMOVE_ASYNC_FONTS') ? OMGF_PRO_REMOVE_ASYNC_FONTS : false,
203
+ sprintf(__('Remove Google Fonts loaded (asynchronously) by (3rd party) JavaScript libraries used by some themes/plugins. This won\'t work with embedded content (i.e. <code>iframe</code>). <strong>Warning!</strong> Make sure you load the Google Fonts, either <a href="%s">manually</a> or by using <a href="%s" target="_blank">a plugin</a> to prevent styling breaks.', $this->plugin_text_domain), 'https://daan.dev/docs/omgf-pro/remove-async-google-fonts/', 'https://daan.dev/wordpress/omgf-additional-fonts/') . ' ' . $this->promo,
204
  !defined('OMGF_PRO_REMOVE_ASYNC_FONTS')
205
  );
206
  }
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>
279
  <?php
includes/class-admin.php CHANGED
@@ -121,8 +121,6 @@ class OMGF_Admin
121
  ),
122
  'omgf-post-update'
123
  );
124
-
125
- update_option(OMGF_Admin_Settings::OMGF_CURRENT_DB_VERSION, OMGF_DB_VERSION);
126
  }
127
  }
128
 
121
  ),
122
  'omgf-post-update'
123
  );
 
 
124
  }
125
  }
126
 
includes/class-omgf.php CHANGED
@@ -72,7 +72,7 @@ class OMGF
72
  define('OMGF_UNLOAD_STYLESHEETS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS, '')));
73
  define('OMGF_CACHE_KEYS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_CACHE_KEYS, '')));
74
  define('OMGF_TEST_MODE', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_TEST_MODE)));
75
- define('OMGF_COMPATIBILITY', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_COMPATIBILITY, 'on')));
76
  define('OMGF_DEBUG_MODE', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_DEBUG_MODE)));
77
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL)));
78
  define('OMGF_UPLOAD_DIR', apply_filters('omgf_upload_dir', WP_CONTENT_DIR . '/uploads/omgf'));
@@ -425,7 +425,7 @@ class OMGF
425
  {
426
  if (
427
  OMGF_DEBUG_MODE !== 'on' ||
428
- (OMGF_DEBUG_MODE === 'on' && filesize(self::$log_file) > MB_IN_BYTES)
429
  ) {
430
  return;
431
  }
72
  define('OMGF_UNLOAD_STYLESHEETS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS, '')));
73
  define('OMGF_CACHE_KEYS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_CACHE_KEYS, '')));
74
  define('OMGF_TEST_MODE', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_TEST_MODE)));
75
+ define('OMGF_COMPATIBILITY', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_COMPATIBILITY)));
76
  define('OMGF_DEBUG_MODE', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_DEBUG_MODE)));
77
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL)));
78
  define('OMGF_UPLOAD_DIR', apply_filters('omgf_upload_dir', WP_CONTENT_DIR . '/uploads/omgf'));
425
  {
426
  if (
427
  OMGF_DEBUG_MODE !== 'on' ||
428
+ (OMGF_DEBUG_MODE === 'on' && file_exists(self::$log_file) && filesize(self::$log_file) > MB_IN_BYTES)
429
  ) {
430
  return;
431
  }
includes/db/class-migrate.php CHANGED
@@ -25,6 +25,10 @@ class OMGF_DB_Migrate
25
  if ($this->should_run_migration('5.3.3')) {
26
  new OMGF_DB_Migrate_V533();
27
  }
 
 
 
 
28
  }
29
 
30
  /**
25
  if ($this->should_run_migration('5.3.3')) {
26
  new OMGF_DB_Migrate_V533();
27
  }
28
+
29
+ if ($this->should_run_migration('5.3.4')) {
30
+ new OMGF_DB_Migrate_V534();
31
+ }
32
  }
33
 
34
  /**
includes/db/migrate/class-v534.php ADDED
@@ -0,0 +1,75 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ defined('ABSPATH') || exit;
3
+
4
+ /**
5
+ * @package OMGF Pro
6
+ * @author Daan van den Bergh
7
+ * https://daan.dev
8
+ * @copyright © 2022 Daan van den Bergh. All Rights Reserved.
9
+ * @since v5.3.4
10
+ */
11
+ class OMGF_DB_Migrate_V534
12
+ {
13
+ /** @var $version string The version number this migration script was introduced with. */
14
+ private $version = '5.3.4';
15
+
16
+ /**
17
+ * Buid
18
+ *
19
+ * @return void
20
+ */
21
+ public function __construct()
22
+ {
23
+ $this->init();
24
+ }
25
+
26
+ /**
27
+ * Initialize
28
+ *
29
+ * @return void
30
+ */
31
+ private function init()
32
+ {
33
+ $optimized_fonts = OMGF::optimized_fonts() ?? [];
34
+ $upgrade_req = false;
35
+
36
+ foreach ($optimized_fonts as $stylesheet => $fonts) {
37
+ foreach ($fonts as $font) {
38
+ $variants = $font->variants ?? [];
39
+
40
+ foreach ($variants as $key => $variant) {
41
+ /**
42
+ * Optimized Fonts needs upgrading if $variants is still an indexed array.
43
+ *
44
+ * @since v5.3.0 $variants should be an associative array.
45
+ */
46
+ if (is_numeric($key)) {
47
+ $upgrade_req = true;
48
+
49
+ break;
50
+ }
51
+ }
52
+
53
+ if ($upgrade_req) {
54
+ break;
55
+ }
56
+ }
57
+
58
+ if ($upgrade_req) {
59
+ break;
60
+ }
61
+ }
62
+
63
+ /**
64
+ * Mark cache as stale if upgrade is required.
65
+ */
66
+ if ($upgrade_req) {
67
+ update_option(OMGF_Admin_Settings::OMGF_CACHE_IS_STALE, $upgrade_req);
68
+ }
69
+
70
+ /**
71
+ * Update stored version number.
72
+ */
73
+ update_option(OMGF_Admin_Settings::OMGF_CURRENT_DB_VERSION, $this->version);
74
+ }
75
+ }
includes/frontend/class-process.php CHANGED
@@ -306,15 +306,19 @@ class OMGF_Frontend_Process
306
  }
307
 
308
  /**
309
- * Use positive lookaround for stricter matching.
310
  */
311
- preg_match_all('/(?=\<link).+?href=[\'"](https:)?\/\/fonts\.googleapis\.com\/css.+?[\'"].+?(?<=>)/', $html, $links);
312
 
313
  if (!isset($links[0]) || empty($links[0])) {
314
  return apply_filters('omgf_processed_html', $html, $this);
315
  }
316
 
317
- $google_fonts = $this->build_fonts_set($links[0]);
 
 
 
 
318
  $search_replace = $this->build_search_replace($google_fonts);
319
 
320
  if (empty($search_replace['search']) || empty($search_replace['replace'])) {
306
  }
307
 
308
  /**
309
+ * @since v5.3.5 Use a generic regex and filter them separately.
310
  */
311
+ preg_match_all('/<link.*?[\/]?>/', $html, $links);
312
 
313
  if (!isset($links[0]) || empty($links[0])) {
314
  return apply_filters('omgf_processed_html', $html, $this);
315
  }
316
 
317
+ $links = array_filter($links[0], function ($link) {
318
+ return strpos($link, 'fonts.googleapis.com/css') !== false;
319
+ });
320
+
321
+ $google_fonts = $this->build_fonts_set($links);
322
  $search_replace = $this->build_search_replace($google_fonts);
323
 
324
  if (empty($search_replace['search']) || empty($search_replace['replace'])) {
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: 6.0
6
- Stable tag: 5.3.4
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,13 @@ For the FAQ, [click here](https://daan.dev/docs/omgf-pro-faq/).
76
 
77
  == Changelog ==
78
 
 
 
 
 
 
 
 
79
  = 5.3.4 =
80
  * Fixed: Debug Mode wouldn't stop logging at 1MB.
81
  * Fixed: "No log file available for download" message would show when Debug Mode was disabled under Advanced Settings.
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.5
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.5 | August 2nd, 2022 =
80
+ * Fixed: use a more reliable regular expression to detect Google Fonts.
81
+ * Fixed: Divi/Elementor compatibility is now disabled by default.
82
+ * Added: DB migration script which invalidates the current stylesheets, if they don't confirm to the new standards yet.
83
+ * Fixed: always allow debug log file to be deleted from the admin screen.
84
+ * Fixed: filestat() failed-warning when enabling Debug Mode for the first time.
85
+
86
  = 5.3.4 =
87
  * Fixed: Debug Mode wouldn't stop logging at 1MB.
88
  * Fixed: "No log file available for download" message would show when Debug Mode was disabled under Advanced Settings.