Version Description
Codename: Einstein | October 9th, 2022 =
* Fixed: if permalinks were outdated after setting up SSL, stylesheets would contain non-SSL links to the font files, causing Mixed Content and CORS errors.
* Fixed: when running Perfmatters' frontend script manager, OMGF would break the page.
* Added: "Warnings" section to Task Manager, which will refer users to specific parts of the documentation in the following situations:
- When using a theme which requires additional configuration to be compatible with OMGF,
- When using a theme which uses exotic Google Fonts implementations (WebFont Loader, @import
statements, etc.),
- When embedded content (iframes) loading Google Fonts found, like Google Maps, Youtube, etc.
* Fixed: preloaded Google Fonts stylesheets would be removed, breaking styling for plugins/themes using the
Release Info
Developer | DaanvandenBergh |
Plugin | OMGF | GDPR/DSVGO Compliant, Faster Google Fonts. Easy. |
Version | 5.4.0 |
Comparing to | |
See all releases |
Code changes from version 5.3.9 to 5.4.0
- assets/css/omgf-admin.css +18 -2
- assets/css/omgf-admin.css.map +1 -1
- assets/css/omgf-admin.less +22 -3
- assets/css/omgf-admin.min.css +1 -1
- assets/js/omgf-admin.js +39 -0
- host-webfonts-local.php +2 -2
- includes/admin/class-settings.php +8 -5
- includes/admin/settings/class-builder.php +2 -2
- includes/admin/settings/class-detection.php +2 -2
- includes/admin/settings/class-optimize.php +18 -2
- includes/class-ajax.php +35 -0
- includes/class-omgf.php +165 -0
- includes/class-optimize.php +6 -1
- includes/frontend/class-process.php +62 -5
- includes/optimize/class-run.php +5 -1
- readme.md +11 -10
- readme.txt +17 -5
@@ -63,12 +63,28 @@
|
|
63 |
}
|
64 |
.omgf form .omgf-task-manager .task-manager-row {
|
65 |
padding-left: 0;
|
66 |
-
line-height: 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
67 |
}
|
68 |
.omgf form .omgf-task-manager ul {
|
69 |
margin-top: 5px;
|
70 |
list-style: none;
|
71 |
-
margin-left: 0;
|
72 |
padding-left: 0;
|
73 |
}
|
74 |
.omgf form .omgf-task-manager ul li {
|
63 |
}
|
64 |
.omgf form .omgf-task-manager .task-manager-row {
|
65 |
padding-left: 0;
|
66 |
+
line-height: 1.33;
|
67 |
+
}
|
68 |
+
.omgf form .omgf-task-manager .task-manager-row .task-manager-notice {
|
69 |
+
padding: 18px 12px;
|
70 |
+
border: 1px solid #ececec;
|
71 |
+
border-left: 4px solid #ececec;
|
72 |
+
}
|
73 |
+
.omgf form .omgf-task-manager .task-manager-row .task-manager-notice ol {
|
74 |
+
margin-left: 1em;
|
75 |
+
}
|
76 |
+
.omgf form .omgf-task-manager .task-manager-row .task-manager-notice.warning {
|
77 |
+
border: 1px solid #FFDC00;
|
78 |
+
border-left: 4px solid #FFDC00;
|
79 |
+
background-color: #FFFBDF;
|
80 |
+
}
|
81 |
+
.omgf form .omgf-task-manager .task-manager-row .task-manager-notice h4 {
|
82 |
+
margin-top: 0;
|
83 |
}
|
84 |
.omgf form .omgf-task-manager ul {
|
85 |
margin-top: 5px;
|
86 |
list-style: none;
|
87 |
+
margin-left: 0.5em;
|
88 |
padding-left: 0;
|
89 |
}
|
90 |
.omgf form .omgf-task-manager ul li {
|
@@ -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,cAAA;;AAGF,KAbF,eAaG;AACD,KAdF,eAcG;EACC,4BAAA;;AAGF,KAlBF,eAkBG;EACC,eAAA;EACA,mBAAA;EACA,WAAA;EACA,qBAAA;;AAEA,KAxBJ,eAkBG,MAME;EACC,WAAA;EACA,mBAAA;EACA,qBAAA;;;;;AASR;EACE,oBAAA;;AADF,SAGE;EACE,eAAA;;AAJJ,SAOE,kBAAiB;EACf,oBAAA;EACA,mBAAA;;AAIJ,KAAM;EACJ,iBAAA;;AADF,KAAM,KAGJ;EACE,iBAAA;;AAJJ,KAAM,
|
1 |
+
{"version":3,"sources":["omgf-admin.less"],"names":[],"mappings":"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"}
|
@@ -71,19 +71,38 @@
|
|
71 |
|
72 |
.dashicons {
|
73 |
line-height: 15px;
|
74 |
-
|
75 |
}
|
76 |
|
77 |
.omgf-task-manager {
|
78 |
.task-manager-row {
|
79 |
padding-left: 0;
|
80 |
-
line-height: 1;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
81 |
}
|
82 |
|
83 |
ul {
|
84 |
margin-top: 5px;
|
85 |
list-style: none;
|
86 |
-
margin-left: 0;
|
87 |
padding-left: 0;
|
88 |
|
89 |
li {
|
71 |
|
72 |
.dashicons {
|
73 |
line-height: 15px;
|
|
|
74 |
}
|
75 |
|
76 |
.omgf-task-manager {
|
77 |
.task-manager-row {
|
78 |
padding-left: 0;
|
79 |
+
line-height: 1.33;
|
80 |
+
|
81 |
+
.task-manager-notice {
|
82 |
+
padding: 18px 12px;
|
83 |
+
border: 1px solid #ececec;
|
84 |
+
border-left: 4px solid #ececec;
|
85 |
+
|
86 |
+
ol {
|
87 |
+
margin-left: 1em;
|
88 |
+
}
|
89 |
+
|
90 |
+
&.warning {
|
91 |
+
border: 1px solid #FFDC00;
|
92 |
+
border-left: 4px solid #FFDC00;
|
93 |
+
background-color: #FFFBDF;
|
94 |
+
}
|
95 |
+
|
96 |
+
h4 {
|
97 |
+
margin-top: 0;
|
98 |
+
}
|
99 |
+
}
|
100 |
}
|
101 |
|
102 |
ul {
|
103 |
margin-top: 5px;
|
104 |
list-style: none;
|
105 |
+
margin-left: 0.5em;
|
106 |
padding-left: 0;
|
107 |
|
108 |
li {
|
@@ -1 +1 @@
|
|
1 |
-
.omgf .button-cancel{color:#a00;text-decoration:none;border-color:transparent;box-shadow:none;background:0 0;border-radius:3px;white-space:nowrap
|
1 |
+
.omgf .button-cancel{color:#a00;text-decoration:none;border-color:transparent;box-shadow:none;background:0 0;border-radius:3px;white-space:nowrap}.omgf .button-cancel.omgf-refresh{color:#ff851b}.omgf .button-cancel.omgf-empty,.omgf .button-cancel.omgf-refresh{padding:1px 10px!important}.omgf .button-cancel:hover{cursor:pointer;background:#d54e21;color:#fff;border-color:#d54e21}.omgf .button-cancel:hover#omgf-refresh{color:#fff;background:#ff851b;border-color:#ff851b}.omgf-nav{padding:1em 0 1.5em}.omgf-nav a{cursor:pointer}.omgf-nav .dashicons-before:before{margin-right:.25em;line-height:1.15em}.omgf form{max-width:1350px}.omgf form .dashicons{line-height:15px}.omgf form .omgf-task-manager .task-manager-row{padding-left:0;line-height:1}.omgf form .omgf-task-manager .task-manager-row .task-manager-notice{padding:18px 12px;border-radius:3px;border:1px solid #c3c4c7}.omgf form .omgf-task-manager .task-manager-row .task-manager-notice.warning{background-color:#ffdc00}.omgf form .omgf-task-manager ul{margin-top:5px;list-style:none;margin-left:0;padding-left:0}.omgf form .omgf-task-manager ul li{padding-left:1.5em;text-indent:-2em;line-height:1.5em}.omgf form .omgf-task-manager ul li:before{font-family:dashicons;font-size:16px;vertical-align:-3px}.omgf form .omgf-task-manager ul li.stale:before{content:"\f534";color:#ff851b}.omgf form .omgf-task-manager ul li.found:before{content:"\f15e";color:#2ecc40}.omgf form .omgf-task-manager ul li.not-found:before{content:"\f158";color:#ff4136}.omgf form .omgf-task-manager ul li.stale-cache-notice:before{content:"\f348";color:#0074d9}.omgf form .omgf-task-manager ul li.unloaded:before{content:"\f460";color:#0074d9}.omgf-optimize-fonts-container{text-align:center;padding:25px 50px;max-width:1024px;margin:20px auto 0 220px;overflow:visible;position:relative}.omgf-optimize-fonts-container .option-title{position:absolute;left:-220px;top:0;font-weight:600;font-size:14px;color:#1d2327}.omgf-optimize-fonts-container h3{font-size:1.3em;margin-top:0}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage{text-align:left}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table{width:100%;border-collapse:collapse}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table thead th{width:13%}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody{border:1px solid #ccd0d4}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody th{padding:5px 0 0 10px;width:40%}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td{padding-bottom:5px;width:13%}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .unload-mass-action{font-size:.9em}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .unload-mass-action:hover{cursor:pointer}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .family{padding:0 10px 0;font-weight:600}.omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody tr:last-child td{padding-bottom:10px}.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-pros{margin-right:10px}.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-cons,.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-pros{text-align:left;width:48%;display:inline-block;vertical-align:top}.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-cons span:before,.omgf-optimize-fonts-container .omgf-optimize-fonts-description .omgf-optimize-fonts-pros span:before{vertical-align:-4px}.omgf-optimize-fonts-container .omgf-optimize-fonts-description label{font-size:18px;font-weight:700}.omgf-optimize-fonts-container .omgf-optimize-fonts-tooltip{padding:0 15px 5px}.omgf-optimize-fonts-container p,.omgf-optimize-fonts-container ul{text-align:justify}.tooltip{position:relative;font-size:16px;line-height:16px;height:12px}.tooltip .tooltip-text{visibility:hidden;position:absolute;top:100%;left:100%;z-index:10000;background-color:rgba(0,0,0,.75);font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;font-size:.8em;color:#fff;line-height:1.5;width:250px;padding:10px;margin-left:-125px;border-radius:3px}.tooltip .tooltip-text a{color:#fff}.tooltip .tooltip-text .illustration{margin-top:10px}.tooltip:hover .tooltip-text{visibility:visible}.omgf-warning{color:red;font-weight:600}#omgf-help-form .postbox{padding:0 15px 5px}#omgf-help-form .postbox .column-container{display:flex;flex-flow:row wrap;justify-content:space-between}#omgf-help-form .postbox .column-container .column ul li{margin-bottom:10px}#omgf-help-form .postbox .column-container .column ul li:last-child{margin-bottom:none}#omgf-help-form .postbox .column-container .column ul li a{text-decoration:none;line-height:1.45}#omgf-help-form .postbox .column-container .column ul li a i.dashicons{margin-right:5px;color:#646970}#omgf-help-form .postbox .column-container .column.last{margin-right:45px}#omgf-help-form .postbox .column-container .column.last .signature{text-align:center}#omgf-help-form .postbox .column-container .column.last .signature .dashicons-heart{color:#ff4136}@media only screen and (max-width:782px){.omgf-optimize-fonts-container{margin:20px 0}.omgf-optimize-fonts-container .option-title{position:relative;left:initial;top:initial}}.omgf-loading{position:fixed;background-color:rgba(255,255,255,.6);width:100%;height:100%;top:0;text-align:center}.omgf-loading .spinner{top:50%;left:50%;position:absolute;-ms-transform:translateX(-50%);transform:translateX(-50%)}#footer-thankyou a{vertical-align:-.65em}#footer-thankyou .dashicons.ffwp-heart{vertical-align:middle}#footer-thankyou .dashicons.ffwp-heart:before{color:#ff4136}#footer-thankyou .signature-image{width:96px}
|
@@ -41,6 +41,7 @@ jQuery(document).ready(function ($) {
|
|
41 |
|
42 |
// Buttons (AJAX, etc.)
|
43 |
$('#omgf-save-optimize').on('click', function () { $('#omgf-optimize-settings-form #submit').click(); });
|
|
|
44 |
$('#omgf-remove-stylesheet').on('click', this.remove_stylesheet_from_db);
|
45 |
$('.omgf-refresh, #omgf-cache-refresh').on('click', this.refresh_cache);
|
46 |
$('.omgf-empty, #omgf-cache-flush').on('click', this.empty_cache_directory);
|
@@ -90,6 +91,34 @@ jQuery(document).ready(function ($) {
|
|
90 |
}
|
91 |
},
|
92 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
93 |
remove_stylesheet_from_db: function () {
|
94 |
var handle = $(this).data('handle');
|
95 |
|
@@ -326,6 +355,9 @@ jQuery(document).ready(function ($) {
|
|
326 |
});
|
327 |
},
|
328 |
|
|
|
|
|
|
|
329 |
delete_log: function () {
|
330 |
if (omgf_admin.delete_log_xhr) {
|
331 |
omgf_admin.delete_log_xhr.abort();
|
@@ -347,10 +379,17 @@ jQuery(document).ready(function ($) {
|
|
347 |
});
|
348 |
},
|
349 |
|
|
|
|
|
|
|
350 |
show_loader_before_submit: function () {
|
351 |
omgf_admin.show_loader();
|
352 |
},
|
353 |
|
|
|
|
|
|
|
|
|
354 |
/**
|
355 |
*
|
356 |
*/
|
41 |
|
42 |
// Buttons (AJAX, etc.)
|
43 |
$('#omgf-save-optimize').on('click', function () { $('#omgf-optimize-settings-form #submit').click(); });
|
44 |
+
$(document).on('click', 'a[id^=omgf-hide-notice-]', this.hide_notice);
|
45 |
$('#omgf-remove-stylesheet').on('click', this.remove_stylesheet_from_db);
|
46 |
$('.omgf-refresh, #omgf-cache-refresh').on('click', this.refresh_cache);
|
47 |
$('.omgf-empty, #omgf-cache-flush').on('click', this.empty_cache_directory);
|
91 |
}
|
92 |
},
|
93 |
|
94 |
+
/**
|
95 |
+
*
|
96 |
+
*/
|
97 |
+
hide_notice: function () {
|
98 |
+
var warning_id = $(this).data('warning-id');
|
99 |
+
var nonce = $(this).data('nonce');
|
100 |
+
|
101 |
+
$.ajax({
|
102 |
+
type: 'POST',
|
103 |
+
url: ajaxurl,
|
104 |
+
data: {
|
105 |
+
action: 'omgf_hide_notice',
|
106 |
+
warning_id: warning_id,
|
107 |
+
nonce: nonce
|
108 |
+
},
|
109 |
+
beforeSend: function () {
|
110 |
+
omgf_admin.show_loader();
|
111 |
+
},
|
112 |
+
complete: function (result) {
|
113 |
+
if (result.responseJSON !== undefined && result.responseJSON.data !== undefined) {
|
114 |
+
$('#task-manager-notice-row').replaceWith(result.responseJSON.data);
|
115 |
+
}
|
116 |
+
|
117 |
+
omgf_admin.hide_loader();
|
118 |
+
}
|
119 |
+
});
|
120 |
+
},
|
121 |
+
|
122 |
remove_stylesheet_from_db: function () {
|
123 |
var handle = $(this).data('handle');
|
124 |
|
355 |
});
|
356 |
},
|
357 |
|
358 |
+
/**
|
359 |
+
*
|
360 |
+
*/
|
361 |
delete_log: function () {
|
362 |
if (omgf_admin.delete_log_xhr) {
|
363 |
omgf_admin.delete_log_xhr.abort();
|
379 |
});
|
380 |
},
|
381 |
|
382 |
+
/**
|
383 |
+
*
|
384 |
+
*/
|
385 |
show_loader_before_submit: function () {
|
386 |
omgf_admin.show_loader();
|
387 |
},
|
388 |
|
389 |
+
hide_loader: function () {
|
390 |
+
$('.omgf-loading').fadeOut(300, function () { $('.omgf-loading').remove() });
|
391 |
+
},
|
392 |
+
|
393 |
/**
|
394 |
*
|
395 |
*/
|
@@ -4,7 +4,7 @@
|
|
4 |
* Plugin Name: OMGF
|
5 |
* Plugin URI: https://daan.dev/wordpress/omgf/
|
6 |
* Description: Increase GDPR/DSVGO compliance, reduce DNS requests and leverage browser cache by automatically downloading Google Fonts to your server.
|
7 |
-
* Version: 5.
|
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.
|
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/DSVGO compliance, reduce DNS requests and leverage browser cache by automatically downloading Google Fonts to your server.
|
7 |
+
* Version: 5.4.0
|
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.4.0');
|
23 |
define('OMGF_DB_VERSION', '5.3.4');
|
24 |
|
25 |
/**
|
@@ -23,10 +23,13 @@ class OMGF_Admin_Settings extends OMGF_Admin
|
|
23 |
/**
|
24 |
* Transients
|
25 |
*/
|
26 |
-
const OMGF_NEWS_REEL
|
27 |
-
const
|
28 |
-
const
|
29 |
-
const
|
|
|
|
|
|
|
30 |
|
31 |
/**
|
32 |
* Settings Fields
|
@@ -397,7 +400,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, empty($this->get_settings()) ? 'disabled' : null); ?>
|
401 |
<?php endif; ?>
|
402 |
</form>
|
403 |
<?php
|
23 |
/**
|
24 |
* Transients
|
25 |
*/
|
26 |
+
const OMGF_NEWS_REEL = 'omgf_news_reel';
|
27 |
+
const OMGF_OPTIMIZE_HAS_RUN = 'omgf_optimize_has_run';
|
28 |
+
const OMGF_CACHE_IS_STALE = 'omgf_cache_is_stale';
|
29 |
+
const OMGF_CURRENT_DB_VERSION = 'omgf_current_db_version';
|
30 |
+
const OMGF_CACHE_TIMESTAMP = 'omgf_cache_timestamp';
|
31 |
+
const OMGF_FOUND_IFRAMES = 'omgf_found_iframes';
|
32 |
+
const OMGF_HIDDEN_NOTICES = 'omgf_hidden_notices';
|
33 |
|
34 |
/**
|
35 |
* Settings Fields
|
400 |
|
401 |
?>
|
402 |
<?php if ($this->active_tab !== self::OMGF_SETTINGS_FIELD_HELP) : ?>
|
403 |
+
<?php submit_button($this->submit_button_text, 'primary', 'submit', false, empty($this->get_settings()) || (empty($this->get_settings()) && defined('OMGF_PRO_AUTO_CONFIG') && OMGF_PRO_AUTO_CONFIG) ? 'disabled' : null); ?>
|
404 |
<?php endif; ?>
|
405 |
</form>
|
406 |
<?php
|
@@ -206,12 +206,12 @@ class OMGF_Admin_Settings_Builder
|
|
206 |
* @param $checked
|
207 |
* @param $description
|
208 |
*/
|
209 |
-
public function do_checkbox($label, $name, $checked, $description, $disabled = false)
|
210 |
{
|
211 |
?>
|
212 |
<tr>
|
213 |
<th scope="row"><?= apply_filters($name . '_setting_label', $label); ?></th>
|
214 |
-
<td
|
215 |
<label for="<?= $name; ?>">
|
216 |
<input id="<?= $name; ?>" type="checkbox" <?= apply_filters($name . '_setting_disabled', $disabled) ? 'disabled' : ''; ?> class="<?= str_replace('_', '-', $name); ?>" name="<?= $name; ?>" <?= $checked == "on" ? 'checked = "checked"' : ''; ?> />
|
217 |
<?= apply_filters($name . '_setting_description', $description); ?>
|
206 |
* @param $checked
|
207 |
* @param $description
|
208 |
*/
|
209 |
+
public function do_checkbox($label, $name, $checked, $description, $disabled = false, $td_classes = '')
|
210 |
{
|
211 |
?>
|
212 |
<tr>
|
213 |
<th scope="row"><?= apply_filters($name . '_setting_label', $label); ?></th>
|
214 |
+
<td <?php echo $td_classes ? "class=$td_classes" : ''; ?>>
|
215 |
<label for="<?= $name; ?>">
|
216 |
<input id="<?= $name; ?>" type="checkbox" <?= apply_filters($name . '_setting_disabled', $disabled) ? 'disabled' : ''; ?> class="<?= str_replace('_', '-', $name); ?>" name="<?= $name; ?>" <?= $checked == "on" ? 'checked = "checked"' : ''; ?> />
|
217 |
<?= apply_filters($name . '_setting_description', $description); ?>
|
@@ -82,13 +82,13 @@ class OMGF_Admin_Settings_Detection extends OMGF_Admin_Settings_Builder
|
|
82 |
$disabled = !defined(strtoupper($name)) ? 'disabled' : '';
|
83 |
?>
|
84 |
<label for="<?= $name; ?>">
|
85 |
-
<input type="checkbox" name="<?= $name; ?>" id="<?= $name; ?>" <?= $checked ? 'checked="checked"' : ''; ?> <?= $disabled; ?> /><?= $data['label']; ?>
|
86 |
|
87 |
</label>
|
88 |
<?php endforeach; ?>
|
89 |
</fieldset>
|
90 |
<p class="description">
|
91 |
-
<?= sprintf(__('By default, OMGF scans each page for mentions of URLs pointing to fonts.googleapis.com. If you need OMGF to "dig deeper", e.g. inside a theme\'s/plugin\'s CSS stylesheets or (Web Font Loader) JS files, <a href="%s" target="_blank">enable these options</a> to increase its level of detection. Best used in combination with a page caching plugin.', $this->plugin_text_domain), 'https://daan.dev/docs/omgf-pro/detection-settings-advanced-processing/') . ' ' . $this->promo; ?>
|
92 |
</p>
|
93 |
<ul>
|
94 |
<?php foreach ($this->advanced_processing_pro_options() as $name => $data) : ?>
|
82 |
$disabled = !defined(strtoupper($name)) ? 'disabled' : '';
|
83 |
?>
|
84 |
<label for="<?= $name; ?>">
|
85 |
+
<input type="checkbox" name="<?= $name; ?>" id="<?= $name; ?>" <?= $checked ? 'checked="checked"' : ''; ?> <?= apply_filters('omgf_detection_settings_advanced_processing_options_disabled', $disabled, $name); ?> /><?= $data['label']; ?>
|
86 |
|
87 |
</label>
|
88 |
<?php endforeach; ?>
|
89 |
</fieldset>
|
90 |
<p class="description">
|
91 |
+
<?= apply_filters('omgf_detection_settings_advanced_processing_description', sprintf(__('By default, OMGF scans each page for mentions of URLs pointing to fonts.googleapis.com. If you need OMGF to "dig deeper", e.g. inside a theme\'s/plugin\'s CSS stylesheets or (Web Font Loader) JS files, <a href="%s" target="_blank">enable these options</a> to increase its level of detection. Best used in combination with a page caching plugin.', $this->plugin_text_domain), 'https://daan.dev/docs/omgf-pro/detection-settings-advanced-processing/')) . ' ' . $this->promo; ?>
|
92 |
</p>
|
93 |
<ul>
|
94 |
<?php foreach ($this->advanced_processing_pro_options() as $name => $data) : ?>
|
@@ -98,6 +98,9 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
|
|
98 |
$stylesheets = OMGF::optimized_fonts();
|
99 |
$unloaded_stylesheets = OMGF::unloaded_stylesheets();
|
100 |
?>
|
|
|
|
|
|
|
101 |
<tr valign="top">
|
102 |
<th scope="row"><?= __('Cache Status', $this->plugin_text_domain); ?></th>
|
103 |
<td class="task-manager-row">
|
@@ -124,7 +127,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
|
|
124 |
</ul>
|
125 |
<?php else : ?>
|
126 |
<p>
|
127 |
-
|
128 |
</p>
|
129 |
<?php endif; ?>
|
130 |
</td>
|
@@ -140,6 +143,16 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
|
|
140 |
</ul>
|
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">
|
@@ -355,6 +368,9 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
|
|
355 |
<span class="dashicons-before dashicons-info-outline"></span>
|
356 |
<em><?= sprintf(__("This list is populated with all Google Fonts stylesheets captured and downloaded throughout your site. It will grow organically if other Google Fonts stylesheets are discovered throughout your site.", $this->plugin_text_domain), get_site_url()); ?></em>
|
357 |
</p>
|
|
|
|
|
|
|
358 |
</div>
|
359 |
<input type="hidden" name="<?= OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZED_FONTS; ?>" value="<?= base64_encode(serialize($this->optimized_fonts)); ?>" />
|
360 |
<input id="<?= OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS; ?>" type="hidden" name="<?= OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS; ?>" value="<?= esc_attr(OMGF_UNLOAD_STYLESHEETS); ?>" />
|
@@ -374,7 +390,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
|
|
374 |
<div class="omgf-optimize-fonts-tooltip">
|
375 |
<p>
|
376 |
<span class="dashicons-before dashicons-info-outline"></span>
|
377 |
-
<em><?= sprintf(__('After clicking <strong>Save & Optimize</strong>, this section will be populated with any Google Fonts (along with requested styles and available options) requested on <code>%s</code>. The list will grow organically if other Google Fonts stylesheets are discovered throughout your site.', $this->plugin_text_domain), get_site_url()); ?></em>
|
378 |
</p>
|
379 |
</div>
|
380 |
</div>
|
98 |
$stylesheets = OMGF::optimized_fonts();
|
99 |
$unloaded_stylesheets = OMGF::unloaded_stylesheets();
|
100 |
?>
|
101 |
+
<tr valign="top">
|
102 |
+
<?php OMGF::task_manager_warnings(); ?>
|
103 |
+
</tr>
|
104 |
<tr valign="top">
|
105 |
<th scope="row"><?= __('Cache Status', $this->plugin_text_domain); ?></th>
|
106 |
<td class="task-manager-row">
|
127 |
</ul>
|
128 |
<?php else : ?>
|
129 |
<p>
|
130 |
+
<?php echo __('No stylesheets found. <a href="#" id="omgf-save-optimize">Start optimization</a>?', $this->plugin_text_domain); ?> <?php echo get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_HAS_RUN) ? sprintf(__('(If optimization seems to be failing, read <a href="%s" target="_blank">this</a>.)', $this->plugin_text_domain), 'https://daan.dev/docs/omgf-pro-troubleshooting/no-fonts-detected/') : ''; ?>
|
131 |
</p>
|
132 |
<?php endif; ?>
|
133 |
</td>
|
143 |
</ul>
|
144 |
</td>
|
145 |
</tr>
|
146 |
+
<?php
|
147 |
+
$this->do_checkbox(
|
148 |
+
__('Auto-Configure Adv. Processing (Pro)', $this->plugin_text_domain),
|
149 |
+
'omgf_pro_auto_config',
|
150 |
+
defined('OMGF_PRO_AUTO_CONFIG') && OMGF_PRO_AUTO_CONFIG,
|
151 |
+
sprintf(__('Is OMGF not detecting all Google Fonts? Check this box <u>before</u> starting the optimization to auto-configure OMGF Pro\'s <a href="%s">Advanced Processing</a> features and "dig deeper" for Google Fonts where needed.', $this->plugin_text_domain), admin_url('options-general.php?page=optimize-webfonts&tab=omgf-detection-settings')) . ' ' . $this->promo,
|
152 |
+
!defined('OMGF_PRO_AUTO_CONFIG'),
|
153 |
+
'task-manager-row'
|
154 |
+
);
|
155 |
+
?>
|
156 |
<tr>
|
157 |
<th scope="row"><?php _e('Manage Cache', $this->plugin_text_domain); ?></th>
|
158 |
<td class="task-manager-row">
|
368 |
<span class="dashicons-before dashicons-info-outline"></span>
|
369 |
<em><?= sprintf(__("This list is populated with all Google Fonts stylesheets captured and downloaded throughout your site. It will grow organically if other Google Fonts stylesheets are discovered throughout your site.", $this->plugin_text_domain), get_site_url()); ?></em>
|
370 |
</p>
|
371 |
+
<p>
|
372 |
+
<small><?php echo __('', $this->plugin_text_domain); ?>
|
373 |
+
</p>
|
374 |
</div>
|
375 |
<input type="hidden" name="<?= OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZED_FONTS; ?>" value="<?= base64_encode(serialize($this->optimized_fonts)); ?>" />
|
376 |
<input id="<?= OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS; ?>" type="hidden" name="<?= OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS; ?>" value="<?= esc_attr(OMGF_UNLOAD_STYLESHEETS); ?>" />
|
390 |
<div class="omgf-optimize-fonts-tooltip">
|
391 |
<p>
|
392 |
<span class="dashicons-before dashicons-info-outline"></span>
|
393 |
+
<em><?= sprintf(__('After clicking <strong>Save & Optimize</strong>, this section will be populated with any Google Fonts (along with requested styles and available options) requested on <code>%s</code>. The list will grow organically if other Google Fonts stylesheets are discovered throughout your site.', $this->plugin_text_domain), get_site_url()); ?></em> [<a href="https://daan.dev/docs/omgf-pro-troubleshooting/no-fonts-detected/" target="_blank"><?php echo __('Why aren\'t my Google Fonts showing up on this list?', $this->plugin_text_domain); ?></a>]
|
394 |
</p>
|
395 |
</div>
|
396 |
</div>
|
@@ -26,6 +26,7 @@ class OMGF_AJAX
|
|
26 |
*/
|
27 |
public function __construct()
|
28 |
{
|
|
|
29 |
add_action('wp_ajax_omgf_remove_stylesheet_from_db', [$this, 'remove_stylesheet_from_db']);
|
30 |
add_action('wp_ajax_omgf_refresh_cache', [$this, 'refresh_cache']);
|
31 |
add_action('wp_ajax_omgf_empty_dir', [$this, 'empty_directory']);
|
@@ -33,6 +34,37 @@ class OMGF_AJAX
|
|
33 |
add_action('wp_ajax_omgf_delete_log', [$this, 'delete_log']);
|
34 |
}
|
35 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
/**
|
37 |
* Remove stylesheet with $handle from database.
|
38 |
*/
|
@@ -154,8 +186,11 @@ class OMGF_AJAX
|
|
154 |
'init' => $initiator,
|
155 |
'exclude' => [],
|
156 |
'queue' => [
|
|
|
157 |
OMGF_Admin_Settings::OMGF_CACHE_IS_STALE,
|
158 |
OMGF_Admin_Settings::OMGF_CACHE_TIMESTAMP,
|
|
|
|
|
159 |
OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_CACHE_KEYS,
|
160 |
OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZED_FONTS,
|
161 |
OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_FONTS,
|
26 |
*/
|
27 |
public function __construct()
|
28 |
{
|
29 |
+
add_action('wp_ajax_omgf_hide_notice', [$this, 'hide_notice']);
|
30 |
add_action('wp_ajax_omgf_remove_stylesheet_from_db', [$this, 'remove_stylesheet_from_db']);
|
31 |
add_action('wp_ajax_omgf_refresh_cache', [$this, 'refresh_cache']);
|
32 |
add_action('wp_ajax_omgf_empty_dir', [$this, 'empty_directory']);
|
34 |
add_action('wp_ajax_omgf_delete_log', [$this, 'delete_log']);
|
35 |
}
|
36 |
|
37 |
+
/**
|
38 |
+
* @since v5.4.0 Remove notice from task manager and return new HTML.
|
39 |
+
*
|
40 |
+
* @return string Valid HTML.
|
41 |
+
*/
|
42 |
+
public function hide_notice()
|
43 |
+
{
|
44 |
+
check_ajax_referer(OMGF_Admin_Settings::OMGF_ADMIN_PAGE, 'nonce');
|
45 |
+
|
46 |
+
if (!current_user_can('manage_options')) {
|
47 |
+
wp_die(__('Hmmm, are you lost?', $this->plugin_text_domain));
|
48 |
+
}
|
49 |
+
|
50 |
+
$warning_id = $_POST['warning_id'];
|
51 |
+
$hidden_notices = get_option(OMGF_Admin_Settings::OMGF_HIDDEN_NOTICES) ?: [];
|
52 |
+
|
53 |
+
if (!in_array($warning_id, $hidden_notices)) {
|
54 |
+
$hidden_notices[] = $warning_id;
|
55 |
+
}
|
56 |
+
|
57 |
+
update_option(OMGF_Admin_Settings::OMGF_HIDDEN_NOTICES, $hidden_notices);
|
58 |
+
|
59 |
+
ob_start();
|
60 |
+
|
61 |
+
OMGF::task_manager_warnings();
|
62 |
+
|
63 |
+
$result = ob_get_clean();
|
64 |
+
|
65 |
+
return wp_send_json_success($result);
|
66 |
+
}
|
67 |
+
|
68 |
/**
|
69 |
* Remove stylesheet with $handle from database.
|
70 |
*/
|
186 |
'init' => $initiator,
|
187 |
'exclude' => [],
|
188 |
'queue' => [
|
189 |
+
OMGF_Admin_Settings::OMGF_OPTIMIZE_HAS_RUN,
|
190 |
OMGF_Admin_Settings::OMGF_CACHE_IS_STALE,
|
191 |
OMGF_Admin_Settings::OMGF_CACHE_TIMESTAMP,
|
192 |
+
OMGF_Admin_Settings::OMGF_HIDDEN_NOTICES,
|
193 |
+
OMGF_Admin_Settings::OMGF_FOUND_IFRAMES,
|
194 |
OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_CACHE_KEYS,
|
195 |
OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZED_FONTS,
|
196 |
OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_FONTS,
|
@@ -18,6 +18,58 @@ defined('ABSPATH') || exit;
|
|
18 |
|
19 |
class OMGF
|
20 |
{
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
21 |
/**
|
22 |
* @var string $log_file Path where log file is located.
|
23 |
*/
|
@@ -49,12 +101,18 @@ class OMGF
|
|
49 |
add_filter('omgf_optimize_url', [$this, 'decode_url']);
|
50 |
add_action('admin_init', [$this, 'do_optimize']);
|
51 |
add_filter('content_url', [$this, 'force_ssl'], 1000, 2);
|
|
|
52 |
add_filter('pre_update_option_omgf_optimized_fonts', [$this, 'base64_decode_optimized_fonts']);
|
53 |
|
54 |
/**
|
55 |
* Render plugin update messages.
|
56 |
*/
|
57 |
add_action('in_plugin_update_message-' . OMGF_PLUGIN_BASENAME, [$this, 'render_update_notice'], 11, 2);
|
|
|
|
|
|
|
|
|
|
|
58 |
}
|
59 |
|
60 |
/**
|
@@ -234,6 +292,21 @@ class OMGF
|
|
234 |
}
|
235 |
}
|
236 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
237 |
/**
|
238 |
* Optimized Local Fonts to be displayed in the Optimize Local Fonts table.
|
239 |
*
|
@@ -384,6 +457,98 @@ class OMGF
|
|
384 |
return $generator->generate();
|
385 |
}
|
386 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
387 |
|
388 |
/**
|
389 |
* @return OMGF_Uninstall
|
18 |
|
19 |
class OMGF
|
20 |
{
|
21 |
+
/**
|
22 |
+
* @since v5.4.0 List of template handles which require additional configuration to be
|
23 |
+
* compatible with OMGF.
|
24 |
+
*/
|
25 |
+
const THEMES_ADDTNL_CONF = [
|
26 |
+
'Avada',
|
27 |
+
'customizr',
|
28 |
+
'enfold',
|
29 |
+
'Divi',
|
30 |
+
'Extra'
|
31 |
+
];
|
32 |
+
|
33 |
+
/**
|
34 |
+
* @since v5.4.? Plugins which require an upgrade to OMGF Pro.
|
35 |
+
*
|
36 |
+
* TODO: [OMGF-74] implement feature.
|
37 |
+
*/
|
38 |
+
const PLUGINS_REQ_PRO = [
|
39 |
+
'oxygen',
|
40 |
+
'optimizepress',
|
41 |
+
'popup-maker',
|
42 |
+
'thrive'
|
43 |
+
];
|
44 |
+
|
45 |
+
/**
|
46 |
+
* @since v5.4.0 Themes which require an upgrade to OMGF Pro to properly detect and
|
47 |
+
* fetch their Google Fonts.
|
48 |
+
*/
|
49 |
+
const THEMES_REQ_PRO = [
|
50 |
+
'Avada',
|
51 |
+
'customizr',
|
52 |
+
'enfold',
|
53 |
+
'jupiter',
|
54 |
+
'jupiterx',
|
55 |
+
'kadence',
|
56 |
+
'oxygen'
|
57 |
+
];
|
58 |
+
|
59 |
+
/**
|
60 |
+
* [OMGF-73] TODO: Most used Support chat widgets.
|
61 |
+
*/
|
62 |
+
const IFRAMES_LOADING_FONTS = [
|
63 |
+
'google-ads' => '//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js', // Google Ads
|
64 |
+
'youtube' => '//www.youtube.com/embed/', // Youtube Embeds
|
65 |
+
'google-maps-embeds' => '//www.google.com/maps/embed', // Google Maps
|
66 |
+
'google-maps-js-api' => '//maps.google.com/maps/api/js', // Google Maps JS API
|
67 |
+
'recaptcha' => '//www.google.com/recaptcha/api.js', // Recaptcha
|
68 |
+
'tawk.to' => '//embed.tawk.to' // Tawk.to
|
69 |
+
];
|
70 |
+
|
71 |
+
private $plugin_text_domain = 'host-webfonts-local';
|
72 |
+
|
73 |
/**
|
74 |
* @var string $log_file Path where log file is located.
|
75 |
*/
|
101 |
add_filter('omgf_optimize_url', [$this, 'decode_url']);
|
102 |
add_action('admin_init', [$this, 'do_optimize']);
|
103 |
add_filter('content_url', [$this, 'force_ssl'], 1000, 2);
|
104 |
+
add_filter('home_url', [$this, 'force_ssl'], 1000, 2);
|
105 |
add_filter('pre_update_option_omgf_optimized_fonts', [$this, 'base64_decode_optimized_fonts']);
|
106 |
|
107 |
/**
|
108 |
* Render plugin update messages.
|
109 |
*/
|
110 |
add_action('in_plugin_update_message-' . OMGF_PLUGIN_BASENAME, [$this, 'render_update_notice'], 11, 2);
|
111 |
+
|
112 |
+
/**
|
113 |
+
* Visual Composer Compatibility Fix
|
114 |
+
*/
|
115 |
+
add_filter('vc_get_vc_grid_data_response', [$this, 'parse_vc_grid_data'], 10);
|
116 |
}
|
117 |
|
118 |
/**
|
292 |
}
|
293 |
}
|
294 |
|
295 |
+
/**
|
296 |
+
* @since v5.4.0 [OMGF-75] Parse HTML generated by Visual Composer's Grid elements, which is loaded async using AJAX.
|
297 |
+
*
|
298 |
+
* @filter vc_get_vc_grid_data_response
|
299 |
+
*
|
300 |
+
* @return string Valid HTML generated by Visual Composer.
|
301 |
+
*/
|
302 |
+
public function parse_vc_grid_data($data)
|
303 |
+
{
|
304 |
+
$processor = new OMGF_Frontend_Process(true);
|
305 |
+
$data = $processor->parse($data);
|
306 |
+
|
307 |
+
return $data;
|
308 |
+
}
|
309 |
+
|
310 |
/**
|
311 |
* Optimized Local Fonts to be displayed in the Optimize Local Fonts table.
|
312 |
*
|
457 |
return $generator->generate();
|
458 |
}
|
459 |
|
460 |
+
/**
|
461 |
+
* Renders the Task Manager Warnings box.
|
462 |
+
*/
|
463 |
+
public static function task_manager_warnings()
|
464 |
+
{
|
465 |
+
$warnings = self::get_task_manager_warnings();
|
466 |
+
if (!empty($warnings)) : ?>
|
467 |
+
<td colspan="2" class="task-manager-row" id="task-manager-notice-row">
|
468 |
+
<div class="task-manager-notice warning">
|
469 |
+
<h4><?php echo sprintf(_n('%s potential conflict found in your configuration.', '%s potential conflicts found in your configuration.', count($warnings), 'host-webfonts-local'), count($warnings)); ?></h4>
|
470 |
+
<ol <?php echo count($warnings) === 1 ? "style='list-style: none; margin-left: 0;'" : ''; ?>>
|
471 |
+
<?php foreach ($warnings as $warning_id) : ?>
|
472 |
+
<li id="omgf-notice-<?php echo $warning_id; ?>">
|
473 |
+
<?php if ($warning_id == 'no_ssl') : ?>
|
474 |
+
<?php echo __('Your WordPress configuration isn\'t setup to use SSL (https://). If your frontend is showing System Fonts after optimization, this might be due to Mixed-Content and/or CORS warnings. Follow <a href="https://daan.dev/docs/omgf-pro-troubleshooting/system-fonts/" target="_blank">these steps</a> to fix it.', 'host-webfonts-local'); ?>
|
475 |
+
<?php endif; ?>
|
476 |
+
<?php if (in_array(str_replace('-addtnl-conf', '', $warning_id), self::THEMES_ADDTNL_CONF)) : ?>
|
477 |
+
<?php $template_id = strtolower($warning_id); ?>
|
478 |
+
<?php echo sprintf(__('Your theme (%s) requires additional configuration to be compatible with OMGF, follow <a href="%s" target="_blank">these steps</a> to fix it.', 'host-webfonts-local'), ucfirst(str_replace('-addtnl-conf', '', $warning_id)), "https://daan.dev/docs/omgf-pro-faq/$template_id-compatibility"); ?>
|
479 |
+
<?php endif; ?>
|
480 |
+
<?php if (in_array(str_replace('-req-pro', '', $warning_id), self::THEMES_REQ_PRO)) : ?>
|
481 |
+
<?php echo sprintf(__('Due to the exotic way your theme (%s) implements Google Fonts, OMGF Pro\'s Advanced Processing features are required to detect them. <a href="%s" target="_blank">Upgrade and install OMGF Pro</a> to continue.', 'host-webfonts-local'), ucfirst(str_replace('-req-pro', '', $warning_id)), OMGF_Admin_Settings::FFWP_WORDPRESS_PLUGINS_OMGF_PRO); ?>
|
482 |
+
<?php endif; ?>
|
483 |
+
<?php if (in_array($warning_id, array_keys(self::IFRAMES_LOADING_FONTS))) : ?>
|
484 |
+
<?php $iframe_name = ucwords(str_replace('-', ' ', $warning_id)); ?>
|
485 |
+
<?php echo sprintf(__('%s is loading an embedded iframe on your site. OMGF (Pro) can\'t process Google Fonts inside iframes. <a href="%s" target="_blank">Click here</a> to find out why and what you can do about it.', 'host-webfonts-local'), $iframe_name, 'https://daan.dev/docs/omgf-pro-faq/iframes/'); ?>
|
486 |
+
<?php endif; ?>
|
487 |
+
<small>[<a href="#" class="hide-notice" data-nonce="<?php echo wp_create_nonce(OMGF_Admin_Settings::OMGF_ADMIN_PAGE); ?>" data-warning-id="<?php echo $warning_id; ?>" id="omgf-hide-notice-<?php echo $warning_id; ?>"><?php echo __('Don\'t show again', 'host-webfonts-local'); ?></a>]</small>
|
488 |
+
</li>
|
489 |
+
<?php endforeach; ?>
|
490 |
+
</ol>
|
491 |
+
</div>
|
492 |
+
</td>
|
493 |
+
<?php endif;
|
494 |
+
}
|
495 |
+
|
496 |
+
/**
|
497 |
+
* Check if WordPress setup has known issues.
|
498 |
+
*
|
499 |
+
* @return array
|
500 |
+
*/
|
501 |
+
public static function get_task_manager_warnings()
|
502 |
+
{
|
503 |
+
$warnings = [];
|
504 |
+
$hidden_notices = get_option(OMGF_Admin_Settings::OMGF_HIDDEN_NOTICES) ?: [];
|
505 |
+
|
506 |
+
/**
|
507 |
+
* @since v5.4.0 OMGF-50 Not using SSL on your site (or at least, not having it properly configured in WordPress) will cause OMGF to
|
508 |
+
* add non-ssl (http://) links to stylesheets, and will lead to CORS and/or Mixed Content warnings in your frontend,
|
509 |
+
* effectively showing nothing but system fonts.
|
510 |
+
*/
|
511 |
+
if (strpos(get_option('home'), 'http://') !== false || strpos(get_option('siteurl'), 'http://') !== false) {
|
512 |
+
$warnings[] = 'no_ssl';
|
513 |
+
}
|
514 |
+
|
515 |
+
/**
|
516 |
+
* @since v5.4.0 OMGF-60 Warn the user if they're using a theme with known compatibility issues.
|
517 |
+
*/
|
518 |
+
$theme = wp_get_theme();
|
519 |
+
|
520 |
+
if (in_array($theme->template, self::THEMES_ADDTNL_CONF)) {
|
521 |
+
$warnings[] = $theme->template . '-addtnl-conf';
|
522 |
+
}
|
523 |
+
|
524 |
+
/**
|
525 |
+
* @since v5.4.0 Warn the user if they're using a theme which requires OMGF Pro's Advanced Processing features.
|
526 |
+
*/
|
527 |
+
if (in_array($theme->template, self::THEMES_REQ_PRO)) {
|
528 |
+
$warnings[] = $theme->template . '-req-pro';
|
529 |
+
}
|
530 |
+
|
531 |
+
/**
|
532 |
+
* @since v5.4.0 OMGF-70 Notify users if they're loading scripts loading embedded iframes, e.g. Google Maps, Youtube, etc.
|
533 |
+
*/
|
534 |
+
$iframe_scripts = get_option(OMGF_Admin_Settings::OMGF_FOUND_IFRAMES) ?: [];
|
535 |
+
|
536 |
+
foreach ($iframe_scripts as $script_id) {
|
537 |
+
$warnings[] = $script_id;
|
538 |
+
}
|
539 |
+
|
540 |
+
/**
|
541 |
+
* Process hidden warnings.
|
542 |
+
*/
|
543 |
+
foreach ($warnings as $i => $warning) {
|
544 |
+
if (in_array($warning, $hidden_notices)) {
|
545 |
+
unset($warnings[$i]);
|
546 |
+
}
|
547 |
+
}
|
548 |
+
|
549 |
+
return $warnings;
|
550 |
+
}
|
551 |
+
|
552 |
|
553 |
/**
|
554 |
* @return OMGF_Uninstall
|
@@ -203,7 +203,7 @@ class OMGF_Optimize
|
|
203 |
*/
|
204 |
private function grab_fonts_object($url)
|
205 |
{
|
206 |
-
OMGF::debug(__('Fetching stylesheet
|
207 |
|
208 |
$response = wp_remote_get($url, [
|
209 |
'user-agent' => self::USER_AGENT['woff2']
|
@@ -508,6 +508,11 @@ class OMGF_Optimize
|
|
508 |
*/
|
509 |
private function rewrite_variants($current, $replacement)
|
510 |
{
|
|
|
|
|
|
|
|
|
|
|
511 |
foreach ($current as $font_family => &$properties) {
|
512 |
if (!isset($properties->variants) || empty($properties->variants)) {
|
513 |
continue;
|
203 |
*/
|
204 |
private function grab_fonts_object($url)
|
205 |
{
|
206 |
+
OMGF::debug(__('Fetching stylesheet from: ', $this->plugin_text_domain) . $url);
|
207 |
|
208 |
$response = wp_remote_get($url, [
|
209 |
'user-agent' => self::USER_AGENT['woff2']
|
508 |
*/
|
509 |
private function rewrite_variants($current, $replacement)
|
510 |
{
|
511 |
+
OMGF::debug(__('Rewriting URLs for each font variant...', $this->plugin_text_domain));
|
512 |
+
|
513 |
+
OMGF::debug_array('Current Fonts Set', $current);
|
514 |
+
OMGF::debug_array('Replacement Fonts Set', $replacement);
|
515 |
+
|
516 |
foreach ($current as $font_family => &$properties) {
|
517 |
if (!isset($properties->variants) || empty($properties->variants)) {
|
518 |
continue;
|
@@ -33,18 +33,42 @@ class OMGF_Frontend_Process
|
|
33 |
'fl_builder',
|
34 |
'siteorigin_panels_live_editor',
|
35 |
'tve',
|
36 |
-
'vc_action'
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
];
|
38 |
|
39 |
/** @var string $timestamp */
|
40 |
private $timestamp = '';
|
41 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
42 |
/**
|
43 |
* OMGF_Frontend_Functions constructor.
|
|
|
|
|
44 |
*/
|
45 |
-
public function __construct()
|
46 |
{
|
47 |
$this->timestamp = get_option(OMGF_Admin_Settings::OMGF_CACHE_TIMESTAMP, '');
|
|
|
48 |
|
49 |
if (!$this->timestamp) {
|
50 |
$this->timestamp = time();
|
@@ -64,12 +88,14 @@ class OMGF_Frontend_Process
|
|
64 |
{
|
65 |
/**
|
66 |
* Halt execution if:
|
|
|
67 |
* * `nomgf` GET-parameter is set.
|
68 |
* * Test Mode is enabled and current user is not an admin.
|
69 |
* * Test Mode is enabled and `omgf` GET-parameter is not set.
|
70 |
*/
|
71 |
if (
|
72 |
-
|
|
|
73 |
|| ((OMGF_TEST_MODE == 'on' && !current_user_can('manage_options') && !isset($_GET['omgf_optimize']))
|
74 |
&& (OMGF_TEST_MODE == 'on' && !current_user_can('manage_options') && !isset($_GET['omgf_optimize']) && !isset($_GET['omgf'])))
|
75 |
) {
|
@@ -78,7 +104,11 @@ class OMGF_Frontend_Process
|
|
78 |
|
79 |
add_action('wp_head', [$this, 'add_preloads'], 3);
|
80 |
add_action('template_redirect', [$this, 'maybe_buffer_output'], 3);
|
81 |
-
|
|
|
|
|
|
|
|
|
82 |
|
83 |
/** Only hook into our own filter if Smart Slider 3 isn't active, as it has its own filter. */
|
84 |
if (!function_exists('smart_slider_3_plugins_loaded')) {
|
@@ -174,6 +204,17 @@ class OMGF_Frontend_Process
|
|
174 |
}
|
175 |
}
|
176 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
177 |
/**
|
178 |
* Honor PageSpeed=off parameter as used by mod_pagespeed, in use by some pagebuilders,
|
179 |
*
|
@@ -318,8 +359,14 @@ class OMGF_Frontend_Process
|
|
318 |
return apply_filters('omgf_processed_html', $html, $this);
|
319 |
}
|
320 |
|
|
|
|
|
|
|
|
|
|
|
|
|
321 |
$links = array_filter($links[0], function ($link) {
|
322 |
-
return strpos($link, 'fonts.googleapis.com/css') !== false;
|
323 |
});
|
324 |
|
325 |
$google_fonts = $this->build_fonts_set($links);
|
@@ -344,6 +391,16 @@ class OMGF_Frontend_Process
|
|
344 |
}
|
345 |
}
|
346 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
347 |
return apply_filters('omgf_processed_html', $html, $this);
|
348 |
}
|
349 |
|
33 |
'fl_builder',
|
34 |
'siteorigin_panels_live_editor',
|
35 |
'tve',
|
36 |
+
'vc_action',
|
37 |
+
'perfmatters' // Perfmatter's Frontend Script Manager.
|
38 |
+
];
|
39 |
+
|
40 |
+
/**
|
41 |
+
* Populates ?edit= parameter. To make sure OMGF doesn't run while editing posts.
|
42 |
+
*
|
43 |
+
* @var string[]
|
44 |
+
*/
|
45 |
+
private $edit_actions = [
|
46 |
+
'edit',
|
47 |
+
'elementor'
|
48 |
];
|
49 |
|
50 |
/** @var string $timestamp */
|
51 |
private $timestamp = '';
|
52 |
|
53 |
+
/**
|
54 |
+
* Break out early, e.g. if we want to parse other resources and don't need to
|
55 |
+
* setup all the hooks and filters.
|
56 |
+
*
|
57 |
+
* @since v5.4.0
|
58 |
+
*
|
59 |
+
* @var bool $break
|
60 |
+
*/
|
61 |
+
private $break = false;
|
62 |
+
|
63 |
/**
|
64 |
* OMGF_Frontend_Functions constructor.
|
65 |
+
*
|
66 |
+
* @var $break bool
|
67 |
*/
|
68 |
+
public function __construct($break = false)
|
69 |
{
|
70 |
$this->timestamp = get_option(OMGF_Admin_Settings::OMGF_CACHE_TIMESTAMP, '');
|
71 |
+
$this->break = $break;
|
72 |
|
73 |
if (!$this->timestamp) {
|
74 |
$this->timestamp = time();
|
88 |
{
|
89 |
/**
|
90 |
* Halt execution if:
|
91 |
+
* * $break parameter is set.
|
92 |
* * `nomgf` GET-parameter is set.
|
93 |
* * Test Mode is enabled and current user is not an admin.
|
94 |
* * Test Mode is enabled and `omgf` GET-parameter is not set.
|
95 |
*/
|
96 |
if (
|
97 |
+
$this->break
|
98 |
+
|| isset($_GET['nomgf'])
|
99 |
|| ((OMGF_TEST_MODE == 'on' && !current_user_can('manage_options') && !isset($_GET['omgf_optimize']))
|
100 |
&& (OMGF_TEST_MODE == 'on' && !current_user_can('manage_options') && !isset($_GET['omgf_optimize']) && !isset($_GET['omgf'])))
|
101 |
) {
|
104 |
|
105 |
add_action('wp_head', [$this, 'add_preloads'], 3);
|
106 |
add_action('template_redirect', [$this, 'maybe_buffer_output'], 3);
|
107 |
+
/**
|
108 |
+
* @since v5.3.10 parse() runs on priority 10. Run this afterwards, to make sure e.g. the <preload> -> <noscript> approach some theme
|
109 |
+
* developers use keeps working.
|
110 |
+
*/
|
111 |
+
add_filter('omgf_buffer_output', [$this, 'remove_resource_hints'], 11);
|
112 |
|
113 |
/** Only hook into our own filter if Smart Slider 3 isn't active, as it has its own filter. */
|
114 |
if (!function_exists('smart_slider_3_plugins_loaded')) {
|
204 |
}
|
205 |
}
|
206 |
|
207 |
+
/**
|
208 |
+
* Post edit actions
|
209 |
+
*/
|
210 |
+
if (array_key_exists('action', $_GET)) {
|
211 |
+
foreach ($this->edit_actions as $action) {
|
212 |
+
if ($_GET['action'] == $action) {
|
213 |
+
return false;
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
|
218 |
/**
|
219 |
* Honor PageSpeed=off parameter as used by mod_pagespeed, in use by some pagebuilders,
|
220 |
*
|
359 |
return apply_filters('omgf_processed_html', $html, $this);
|
360 |
}
|
361 |
|
362 |
+
/**
|
363 |
+
* @since v5.4.0 This approach is global on purpose. By just matching <link> elements containing the fonts.googleapis.com/css string,
|
364 |
+
* e.g. preload elements are also properly processed.
|
365 |
+
*
|
366 |
+
* @since v5.4.0 Added compatibility for BunnyCDN's "GDPR compliant" Google Fonts API.
|
367 |
+
*/
|
368 |
$links = array_filter($links[0], function ($link) {
|
369 |
+
return strpos($link, 'fonts.googleapis.com/css') !== false || strpos($link, 'fonts.bunny.net/css') !== false;
|
370 |
});
|
371 |
|
372 |
$google_fonts = $this->build_fonts_set($links);
|
391 |
}
|
392 |
}
|
393 |
|
394 |
+
$found_iframes = get_option(OMGF_Admin_Settings::OMGF_FOUND_IFRAMES) ?: [];
|
395 |
+
|
396 |
+
foreach (OMGF::IFRAMES_LOADING_FONTS as $script_id => $script) {
|
397 |
+
if (strpos($html, $script) !== false && !in_array($script_id, $found_iframes)) {
|
398 |
+
$found_iframes[] = $script_id;
|
399 |
+
}
|
400 |
+
}
|
401 |
+
|
402 |
+
update_option(OMGF_Admin_Settings::OMGF_FOUND_IFRAMES, $found_iframes);
|
403 |
+
|
404 |
return apply_filters('omgf_processed_html', $html, $this);
|
405 |
}
|
406 |
|
@@ -18,6 +18,8 @@ defined('ABSPATH') || exit;
|
|
18 |
|
19 |
class OMGF_Optimize_Run
|
20 |
{
|
|
|
|
|
21 |
/** @var string */
|
22 |
private $plugin_text_domain = 'host-webfonts-local';
|
23 |
|
@@ -38,6 +40,8 @@ class OMGF_Optimize_Run
|
|
38 |
*/
|
39 |
private function run()
|
40 |
{
|
|
|
|
|
41 |
$front_html = $this->get_front_html(get_home_url());
|
42 |
$error = false;
|
43 |
|
@@ -89,7 +93,7 @@ class OMGF_Optimize_Run
|
|
89 |
$wp_settings_errors = [];
|
90 |
}
|
91 |
|
92 |
-
add_settings_error('general', 'omgf_optimization_success', __('Optimization completed successfully.'), 'success');
|
93 |
|
94 |
OMGF_Admin_Notice::set_notice(
|
95 |
__('If you\'re using any 3rd party optimization plugins (e.g. WP Rocket, Autoptimize, W3 Total Cache, etc.) make sure to flush their caches for OMGF\'s optimizations to take effect.', $this->plugin_text_domain),
|
18 |
|
19 |
class OMGF_Optimize_Run
|
20 |
{
|
21 |
+
const DOCS_TEST_URL = 'https://daan.dev/docs/omgf-pro-troubleshooting/test-omgf-pro/';
|
22 |
+
|
23 |
/** @var string */
|
24 |
private $plugin_text_domain = 'host-webfonts-local';
|
25 |
|
40 |
*/
|
41 |
private function run()
|
42 |
{
|
43 |
+
update_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_HAS_RUN, true);
|
44 |
+
|
45 |
$front_html = $this->get_front_html(get_home_url());
|
46 |
$error = false;
|
47 |
|
93 |
$wp_settings_errors = [];
|
94 |
}
|
95 |
|
96 |
+
add_settings_error('general', 'omgf_optimization_success', __('Optimization completed successfully.', $this->plugin_text_domain) . ' ' . sprintf('<a target="_blank" href="%s">', self::DOCS_TEST_URL) . __('How can I verify it\'s working?', $this->plugin_text_domain) . '</a>', 'success');
|
97 |
|
98 |
OMGF_Admin_Notice::set_notice(
|
99 |
__('If you\'re using any 3rd party optimization plugins (e.g. WP Rocket, Autoptimize, W3 Total Cache, etc.) make sure to flush their caches for OMGF\'s optimizations to take effect.', $this->plugin_text_domain),
|
@@ -15,22 +15,23 @@ OMGF is written with performance and user-friendliness in mind. It uses the Goog
|
|
15 |
|
16 |
After installing the plugin, OMGF will automatically start looking for Google Fonts whenever a page is requested on your website.
|
17 |
|
18 |
-
All Google Fonts are listed in the **
|
19 |
|
20 |
-
-
|
21 |
-
-
|
22 |
-
- Set a
|
23 |
-
-
|
24 |
|
25 |
### Other Features include
|
26 |
|
27 |
- **Variable Fonts** support,
|
28 |
- **Remove unused subsets** to reduce the size of the CSS stylesheet,
|
29 |
- **Remove Resource Hints** (preload, preconnect, dns-prefetch) pointing to `fonts.googleapis.com` or `fonts.gstatic.com`,
|
30 |
-
- **Ensure text remains visible during webfont load** by forcing the
|
31 |
-
- **Ensure text remains visible during webfont load** by forcing the
|
32 |
|
33 |
### Additional Features in OMGF Pro
|
|
|
34 |
- **Multisite** support,
|
35 |
- "Dig deeper" to find Google Fonts and optimize further. OMGF Pro supports:
|
36 |
- `@font-face` and `@import` statements inside **inline `<style>` blocks**,
|
@@ -44,7 +45,7 @@ All Google Fonts are listed in the **Manage Optimized Fonts** section of OMGF's
|
|
44 |
- Set a relative path to easily migrate from development/staging areas to production/live, or
|
45 |
- Anything you like!
|
46 |
|
47 |
-
|
48 |
|
49 |
## Installation
|
50 |
|
@@ -55,9 +56,9 @@ All Google Fonts are listed in the **Manage Optimized Fonts** section of OMGF's
|
|
55 |
|
56 |
### From the Wordpress Repository
|
57 |
|
58 |
-
1. From your WordPress administrator area, go to
|
59 |
1. Search for 'Daan van den Bergh'
|
60 |
-
1. Click the 'Install' button next to
|
61 |
1. Click 'Activate'
|
62 |
|
63 |
## Frequently Asked Questions
|
15 |
|
16 |
After installing the plugin, OMGF will automatically start looking for Google Fonts whenever a page is requested on your website.
|
17 |
|
18 |
+
All Google Fonts are listed in the **Optimize Local Fonts** section of OMGF's settings screen. There, you can choose to:
|
19 |
|
20 |
+
- _Preload_ fonts to **reduce Cumulative Layout Shift** above the fold,
|
21 |
+
- _Unload_ fonts that're not used by you, your theme and/or plugins,
|
22 |
+
- Set a _Fallback Font Stack_ (OMGF Pro required), to further **reduce Cumulative Layout Shift**, or
|
23 |
+
- _Replace_ (OMGF Pro required) font-families with system fonts to **speed up page loading times**!
|
24 |
|
25 |
### Other Features include
|
26 |
|
27 |
- **Variable Fonts** support,
|
28 |
- **Remove unused subsets** to reduce the size of the CSS stylesheet,
|
29 |
- **Remove Resource Hints** (preload, preconnect, dns-prefetch) pointing to `fonts.googleapis.com` or `fonts.gstatic.com`,
|
30 |
+
- **Ensure text remains visible during webfont load** by forcing the _font-display_ attribute to your Google Fonts,
|
31 |
+
- **Ensure text remains visible during webfont load** by forcing the _font-display_ attribute to all your other fonts! (OMGF Pro required),
|
32 |
|
33 |
### Additional Features in OMGF Pro
|
34 |
+
|
35 |
- **Multisite** support,
|
36 |
- "Dig deeper" to find Google Fonts and optimize further. OMGF Pro supports:
|
37 |
- `@font-face` and `@import` statements inside **inline `<style>` blocks**,
|
45 |
- Set a relative path to easily migrate from development/staging areas to production/live, or
|
46 |
- Anything you like!
|
47 |
|
48 |
+
_[Purchase OMGF Pro](https://daan.dev/wordpress/omgf-pro/) | [Documentation](https://daan.dev/docs/omgf-pro/) | [Tested Plugins & Themes](https://daan.dev/docs/omgf-pro/tested-themes-plugins/)_
|
49 |
|
50 |
## Installation
|
51 |
|
56 |
|
57 |
### From the Wordpress Repository
|
58 |
|
59 |
+
1. From your WordPress administrator area, go to _Plugins > Add New_
|
60 |
1. Search for 'Daan van den Bergh'
|
61 |
+
1. Click the 'Install' button next to _OMGF | Host Google Fonts Locally_
|
62 |
1. Click 'Activate'
|
63 |
|
64 |
## Frequently Asked Questions
|
@@ -3,7 +3,7 @@ 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.
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -23,7 +23,7 @@ OMGF is written with performance and user-friendliness in mind. It uses the Goog
|
|
23 |
|
24 |
After installing the plugin, OMGF will automatically start looking for Google Fonts whenever a page is requested on your website.
|
25 |
|
26 |
-
All Google Fonts are listed in the **
|
27 |
|
28 |
- *Preload* fonts to **reduce Cumulative Layout Shift** above the fold,
|
29 |
- *Unload* fonts that're not used by you, your theme and/or plugins,
|
@@ -70,12 +70,24 @@ For the FAQ, [click here](https://daan.dev/docs/omgf-pro-faq/).
|
|
70 |
|
71 |
1. OMGF's Optimize Fonts screen. These settings affect the downloaded files and generated stylesheet(s).
|
72 |
2. The task manager offers a quick overview of the currently detected stylesheets and their status (e.g. loaded, stale or missing) along with quick links to simple management tasks, e.g. Empty Cache and Configure/Remove.
|
73 |
-
3. After you've completed configuring OMGF, the
|
74 |
4. OMGF Pro users can further tweak its level of detection under Detection Settings.
|
75 |
5. Advanced Settings. Change these to make OMGF work with your configuration (if needed). The default settings will suffice for most configurations.
|
76 |
|
77 |
== Changelog ==
|
78 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
= 5.3.9 | September 22nd, 2022 =
|
80 |
* Fixed: v5.3.7 introduced a bug affecting only users of the Jupiter theme only. The needed compatibility fixes wouldn't run on Save & Optimize.
|
81 |
|
@@ -90,7 +102,7 @@ For the FAQ, [click here](https://daan.dev/docs/omgf-pro-faq/).
|
|
90 |
* Fixed: decode any special HTML entities to make sure all parameters in the URL are properly parsed.
|
91 |
* Improved: *Preload* option is now reworded to *Load Early*, because many people seemed to confuse it with "Download"
|
92 |
* Improved: *Do Not Load* is shortened to *Don't Load*
|
93 |
-
* Improved: *
|
94 |
* Fixed: Similar stylesheets would sometimes be replaced twice, causing layout breaks.
|
95 |
* Fixed: if there are no options on the page, the Save Changes button is now disabled.
|
96 |
* Added: omgf_admin_optimize_verify_ssl filter for local development areas.
|
@@ -165,7 +177,7 @@ For the FAQ, [click here](https://daan.dev/docs/omgf-pro-faq/).
|
|
165 |
|
166 |
= 5.1.3 =
|
167 |
* Added: workaround for Divi builder to identify unique Google Fonts stylesheets.
|
168 |
-
* Added: extra links to documentation in
|
169 |
* Fixed: Changed links to new documentation hub.
|
170 |
* Fixed: don't use WP_Filesystem to get and put file contents.
|
171 |
|
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.4.0
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
23 |
|
24 |
After installing the plugin, OMGF will automatically start looking for Google Fonts whenever a page is requested on your website.
|
25 |
|
26 |
+
All Google Fonts are listed in the **Optimize Local Fonts** section of OMGF's settings screen. There, you can choose to:
|
27 |
|
28 |
- *Preload* fonts to **reduce Cumulative Layout Shift** above the fold,
|
29 |
- *Unload* fonts that're not used by you, your theme and/or plugins,
|
70 |
|
71 |
1. OMGF's Optimize Fonts screen. These settings affect the downloaded files and generated stylesheet(s).
|
72 |
2. The task manager offers a quick overview of the currently detected stylesheets and their status (e.g. loaded, stale or missing) along with quick links to simple management tasks, e.g. Empty Cache and Configure/Remove.
|
73 |
+
3. After you've completed configuring OMGF, the Optimize Local Fonts section will allow you to tweak all of your Google Fonts stylesheets, by e.g. unloading unused fonts and/or preloading fonts above the fold.
|
74 |
4. OMGF Pro users can further tweak its level of detection under Detection Settings.
|
75 |
5. Advanced Settings. Change these to make OMGF work with your configuration (if needed). The default settings will suffice for most configurations.
|
76 |
|
77 |
== Changelog ==
|
78 |
|
79 |
+
= 5.4.0 Codename: Einstein | October 9th, 2022 =
|
80 |
+
* Fixed: if permalinks were outdated after setting up SSL, stylesheets would contain non-SSL links to the font files, causing Mixed Content and CORS errors.
|
81 |
+
* Fixed: when running Perfmatters' frontend script manager, OMGF would break the page.
|
82 |
+
* Added: "Warnings" section to Task Manager, which will refer users to specific parts of the documentation in the following situations:
|
83 |
+
- When using a theme which requires additional configuration to be compatible with OMGF,
|
84 |
+
- When using a theme which uses exotic Google Fonts implementations (WebFont Loader, `@import` statements, etc.),
|
85 |
+
- When embedded content (iframes) loading Google Fonts found, like Google Maps, Youtube, etc.
|
86 |
+
* Fixed: preloaded Google Fonts stylesheets would be removed, breaking styling for plugins/themes using the <noscript> approach to load Google Fonts asynchronously.
|
87 |
+
* Added: link "How can I verify it's working?" to "Optimization Complete" message.
|
88 |
+
* Added: compatibility with Bunny.net's "GDPR compliant" CDN.
|
89 |
+
* Added: compatibility with Visual Composer's Grid elements.
|
90 |
+
|
91 |
= 5.3.9 | September 22nd, 2022 =
|
92 |
* Fixed: v5.3.7 introduced a bug affecting only users of the Jupiter theme only. The needed compatibility fixes wouldn't run on Save & Optimize.
|
93 |
|
102 |
* Fixed: decode any special HTML entities to make sure all parameters in the URL are properly parsed.
|
103 |
* Improved: *Preload* option is now reworded to *Load Early*, because many people seemed to confuse it with "Download"
|
104 |
* Improved: *Do Not Load* is shortened to *Don't Load*
|
105 |
+
* Improved: *Optimize Local 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.
|
106 |
* Fixed: Similar stylesheets would sometimes be replaced twice, causing layout breaks.
|
107 |
* Fixed: if there are no options on the page, the Save Changes button is now disabled.
|
108 |
* Added: omgf_admin_optimize_verify_ssl filter for local development areas.
|
177 |
|
178 |
= 5.1.3 =
|
179 |
* Added: workaround for Divi builder to identify unique Google Fonts stylesheets.
|
180 |
+
* Added: extra links to documentation in Optimize Local Fonts section.
|
181 |
* Fixed: Changed links to new documentation hub.
|
182 |
* Fixed: don't use WP_Filesystem to get and put file contents.
|
183 |
|