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

Version Description

| April 10th, 2021 = * Moved sidebar to its own 'Help' tab to clean up the interface. * Manage Optimize Fonts panel is now shown inline with other options (and has its own label). * Each stylesheet's handle is now more prominently visible and the font family is better readable. * Added mass actions to each font family for easier management of each stylesheet. * Took a different approach to deal with SSL/Non-SSL for local Dev environments. * Performance improvements to manual detection mode (decreased risk of timeouts!) * Overall UX tweaks and performance improvements.

Download this release

Release Info

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

Code changes from version 4.3.2 to 4.4.0

assets/css/omgf-admin.css CHANGED
@@ -44,20 +44,21 @@
44
  margin-right: 0.25em;
45
  line-height: 1.15em;
46
  }
47
- /**
48
- * Sections
49
- */
50
- .settings-column.left {
51
- float: left;
52
- width: 66%;
53
- }
54
- .settings-column.right {
55
- float: right;
56
- width: 21.75%;
57
- }
58
  .omgf-optimize-fonts-container {
59
  text-align: center;
60
  padding: 25px 50px;
 
 
 
 
 
 
 
 
 
 
 
 
61
  }
62
  .omgf-optimize-fonts-container h3 {
63
  font-size: 1.3em;
@@ -80,13 +81,41 @@
80
  padding: 5px 0 0 10px;
81
  width: 40%;
82
  }
83
- .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody th .handle {
84
- font-weight: 400;
85
- }
86
  .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td {
87
  padding-bottom: 5px;
88
  width: 100px;
89
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody tr:last-child td {
91
  padding-bottom: 10px;
92
  }
@@ -120,30 +149,15 @@
120
  .omgf-optimize-fonts-container ul {
121
  text-align: justify;
122
  }
123
- /**
124
- * Welcome block
125
- */
126
- #omgf-welcome-panel {
127
- padding: 20px 10px 5px;
128
- }
129
- #omgf-welcome-panel .welcome-panel-content {
130
- margin-left: 0;
131
- padding: 0 15px;
132
- }
133
- #omgf-welcome-panel h3 > .dashicons {
134
- line-height: 1.4;
135
- }
136
- #omgf-welcome-panel .dashicons.ffwp-heart:before {
137
- color: #FF4136;
138
- }
139
- #omgf-welcome-panel .welcome-icon:before {
140
- padding: 0;
141
- }
142
- #omgf-welcome-panel .signature {
143
- text-align: center;
144
- }
145
- #omgf-welcome-panel .signature-image {
146
- max-width: 90%;
147
  }
148
  /**
149
  * Loader
@@ -164,16 +178,18 @@
164
  transform: translate(0, -70%);
165
  }
166
  /**
167
- * Responsiveness
168
  */
169
- @media only screen and (max-width: 1024px) {
170
- .settings-column {
171
- display: block;
172
- float: none;
173
- }
174
- .settings-column.left,
175
- .settings-column.right {
176
- width: 100%;
177
- }
 
 
178
  }
179
  /*# sourceMappingURL=./omgf-admin.css.map */
44
  margin-right: 0.25em;
45
  line-height: 1.15em;
46
  }
 
 
 
 
 
 
 
 
 
 
 
47
  .omgf-optimize-fonts-container {
48
  text-align: center;
49
  padding: 25px 50px;
50
+ max-width: 1024px;
51
+ margin: 20px auto 0 220px;
52
+ overflow: visible;
53
+ position: relative;
54
+ }
55
+ .omgf-optimize-fonts-container .option-title {
56
+ position: absolute;
57
+ left: -220px;
58
+ top: 0;
59
+ font-weight: 600;
60
+ font-size: 14px;
61
+ color: #1d2327;
62
  }
63
  .omgf-optimize-fonts-container h3 {
64
  font-size: 1.3em;
81
  padding: 5px 0 0 10px;
82
  width: 40%;
83
  }
 
 
 
84
  .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td {
85
  padding-bottom: 5px;
86
  width: 100px;
87
  }
88
+ .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .unload-mass-action {
89
+ font-size: 0.9em;
90
+ }
91
+ .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .unload-mass-action .tooltip {
92
+ position: relative;
93
+ font-size: 16px;
94
+ line-height: 25px;
95
+ }
96
+ .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .unload-mass-action .tooltip .tooltip-text {
97
+ visibility: hidden;
98
+ position: absolute;
99
+ top: 100%;
100
+ left: 100%;
101
+ z-index: 10000;
102
+ background-color: rgba(0, 0, 0, 0.75);
103
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
104
+ font-size: 0.8em;
105
+ color: #fff;
106
+ line-height: 1.5;
107
+ width: 180px;
108
+ padding: 10px;
109
+ margin-left: -90px;
110
+ border-radius: 3px;
111
+ }
112
+ .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .unload-mass-action .tooltip:hover .tooltip-text {
113
+ visibility: visible;
114
+ }
115
+ .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody td .family {
116
+ padding: 0 10px 0;
117
+ font-weight: 600;
118
+ }
119
  .omgf-optimize-fonts-container .omgf-optimize-fonts-manage table tbody tr:last-child td {
120
  padding-bottom: 10px;
121
  }
149
  .omgf-optimize-fonts-container ul {
150
  text-align: justify;
151
  }
152
+ @media only screen and (max-width: 782px) {
153
+ .omgf-optimize-fonts-container {
154
+ margin: 20px 0;
155
+ }
156
+ .omgf-optimize-fonts-container .option-title {
157
+ position: relative;
158
+ left: initial;
159
+ top: initial;
160
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
161
  }
162
  /**
163
  * Loader
178
  transform: translate(0, -70%);
179
  }
180
  /**
181
+ * Welcome Block
182
  */
183
+ #footer-thankyou a {
184
+ vertical-align: -0.65em;
185
+ }
186
+ #footer-thankyou .dashicons.ffwp-heart {
187
+ vertical-align: middle;
188
+ }
189
+ #footer-thankyou .dashicons.ffwp-heart:before {
190
+ color: #FF4136;
191
+ }
192
+ #footer-thankyou .signature-image {
193
+ width: 96px;
194
  }
195
  /*# sourceMappingURL=./omgf-admin.css.map */
assets/css/omgf-admin.css.map CHAN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,kBAAA;EACA,eAAe,kBAAf;EACA,WAAW,kBAAX;;;;;AAOH,gBACC;EACE,uBAAA;;AAIA,gBADF,WACG;EACC,sBAAA;;AAGF,gBALF,WAKG,WAAW;EACV,cAAA;;AAXL,gBAeC;EACE,WAAA"}
assets/css/omgf-admin.less CHANGED
@@ -52,24 +52,22 @@
52
  }
53
  }
54
 
55
- /**
56
- * Sections
57
- */
58
- .settings-column {
59
- &.left {
60
- float: left;
61
- width: 66%;
62
- }
63
-
64
- &.right {
65
- float: right;
66
- width: 21.75%;
67
- }
68
- }
69
-
70
  .omgf-optimize-fonts-container {
71
  text-align: center;
72
  padding: 25px 50px;
 
 
 
 
 
 
 
 
 
 
 
 
 
73
 
74
  h3 {
75
  font-size: 1.3em;
@@ -94,21 +92,55 @@
94
 
95
  th {
96
  padding: 5px 0 0 10px;
97
- width: 40%;
98
-
99
- .handle {
100
- font-weight: 400;
101
- }
102
  }
103
 
104
  td {
105
  padding-bottom: 5px;
106
  width: 100px;
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
107
  }
108
 
109
- tr:last-child {
110
- td {
111
- padding-bottom: 10px;
 
 
112
  }
113
  }
114
  }
@@ -154,38 +186,16 @@
154
  }
155
  }
156
 
157
- /**
158
- * Welcome block
159
- */
160
- #omgf-welcome-panel {
161
- padding: 20px 10px 5px;
162
-
163
- .welcome-panel-content {
164
- margin-left: 0;
165
- padding: 0 15px;
166
- }
167
-
168
- h3 > .dashicons {
169
- line-height: 1.4;
170
- }
171
 
172
- .dashicons {
173
- &.ffwp-heart:before {
174
- color: #FF4136;
 
175
  }
176
  }
177
-
178
- .welcome-icon:before {
179
- padding: 0;
180
- }
181
-
182
- .signature {
183
- text-align: center;
184
- }
185
-
186
- .signature-image {
187
- max-width: 90%;
188
- }
189
  }
190
 
191
  /**
@@ -209,16 +219,24 @@
209
  }
210
 
211
  /**
212
- * Responsiveness
213
  */
214
- @media only screen and (max-width: 1024px) {
215
- .settings-column {
216
- display: block;
217
- float: none;
218
 
219
- &.left,
220
- &.right {
221
- width: 100%;
 
 
 
 
222
  }
223
  }
224
- }
 
 
 
 
52
  }
53
  }
54
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
  .omgf-optimize-fonts-container {
56
  text-align: center;
57
  padding: 25px 50px;
58
+ max-width: 1024px;
59
+ margin: 20px auto 0 220px;
60
+ overflow: visible;
61
+ position: relative;
62
+
63
+ .option-title {
64
+ position: absolute;
65
+ left: -220px;
66
+ top: 0;
67
+ font-weight: 600;
68
+ font-size: 14px;
69
+ color: #1d2327;
70
+ }
71
 
72
  h3 {
73
  font-size: 1.3em;
92
 
93
  th {
94
  padding: 5px 0 0 10px;
95
+ width: 40%;
 
 
 
 
96
  }
97
 
98
  td {
99
  padding-bottom: 5px;
100
  width: 100px;
101
+
102
+ .unload-mass-action {
103
+ font-size: .9em;
104
+
105
+ .tooltip {
106
+ position: relative;
107
+ font-size: 16px;
108
+ line-height: 25px;
109
+
110
+ .tooltip-text {
111
+ visibility: hidden;
112
+ position: absolute;
113
+ top: 100%;
114
+ left: 100%;
115
+ z-index: 10000;
116
+ background-color: rgba(0, 0, 0, 0.75);
117
+ font-family: -apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif;
118
+ font-size: .8em;
119
+ color: #fff;
120
+ line-height: 1.5;
121
+ width: 180px;
122
+ padding: 10px;
123
+ margin-left: -90px;
124
+ border-radius: 3px;
125
+ }
126
+
127
+ &:hover .tooltip-text {
128
+ visibility: visible;
129
+ }
130
+ }
131
+ }
132
+
133
+ .family {
134
+ padding: 0 10px 0;
135
+ font-weight: 600;
136
+ }
137
  }
138
 
139
+ tr {
140
+ &:last-child {
141
+ td {
142
+ padding-bottom: 10px;
143
+ }
144
  }
145
  }
146
  }
186
  }
187
  }
188
 
189
+ @media only screen and (max-width: 782px) {
190
+ .omgf-optimize-fonts-container {
191
+ margin: 20px 0;
 
 
 
 
 
 
 
 
 
 
 
192
 
193
+ .option-title {
194
+ position: relative;
195
+ left: initial;
196
+ top: initial;
197
  }
198
  }
 
 
 
 
 
 
 
 
 
 
 
 
199
  }
200
 
201
  /**
219
  }
220
 
221
  /**
222
+ * Welcome Block
223
  */
224
+ #footer-thankyou {
225
+ a {
226
+ vertical-align: -.65em;
227
+ }
228
 
229
+ .dashicons {
230
+ &.ffwp-heart {
231
+ vertical-align: middle;
232
+ }
233
+
234
+ &.ffwp-heart:before {
235
+ color: #FF4136;
236
  }
237
  }
238
+
239
+ .signature-image {
240
+ width: 96px;
241
+ }
242
+ }
assets/js/omgf-admin.js CHANGED
@@ -29,6 +29,9 @@ jQuery(document).ready(function ($) {
29
  $('.omgf-optimize-fonts-manage .unload').on('change', this.generate_cache_key);
30
  $('.omgf-optimize-fonts-manage .unload').on('change', this.toggle_preload);
31
  $('.omgf-optimize-fonts-manage .preload').on('change', this.toggle_unload);
 
 
 
32
 
33
  // Buttons
34
  $('.omgf-empty').on('click', this.empty_cache_directory);
@@ -143,6 +146,54 @@ jQuery(document).ready(function ($) {
143
  omgf_admin.toggle(this, 'unload');
144
  },
145
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
146
  /**
147
  * Toggle a checkbox.
148
  *
29
  $('.omgf-optimize-fonts-manage .unload').on('change', this.generate_cache_key);
30
  $('.omgf-optimize-fonts-manage .unload').on('change', this.toggle_preload);
31
  $('.omgf-optimize-fonts-manage .preload').on('change', this.toggle_unload);
32
+ $('.omgf-optimize-fonts-manage .unload-italics').on('click', this.unload_italics);
33
+ $('.omgf-optimize-fonts-manage .unload-all').on('click', this.unload_all);
34
+ $('.omgf-optimize-fonts-manage .load-all').on('click', this.load_all);
35
 
36
  // Buttons
37
  $('.omgf-empty').on('click', this.empty_cache_directory);
146
  omgf_admin.toggle(this, 'unload');
147
  },
148
 
149
+ /**
150
+ * Unload all italic styles for current font family.
151
+ */
152
+ unload_italics: function (e) {
153
+ e.preventDefault();
154
+
155
+ var id = $(this).parents('.font-family').data('id');
156
+ var unloads = $('.unload');
157
+
158
+ unloads.each(function (index, item) {
159
+ if (item.value.includes('italic') && item.dataset.fontId == id && item.checked == false) {
160
+ item.click();
161
+ }
162
+ });
163
+ },
164
+
165
+ /**
166
+ * Unload all fonts for current font family.
167
+ */
168
+ unload_all: function (e) {
169
+ e.preventDefault();
170
+
171
+ var id = $(this).parents('.font-family').data('id');
172
+ var unloads = $('.unload');
173
+
174
+ unloads.each(function (index, item) {
175
+ if (item.dataset.fontId == id && item.checked == false) {
176
+ item.click();
177
+ }
178
+ });
179
+ },
180
+
181
+ /**
182
+ * Uncheck all unload checkboxes for the current font family.
183
+ */
184
+ load_all: function (e) {
185
+ e.preventDefault();
186
+
187
+ var id = $(this).parents('.font-family').data('id');
188
+ var unloads = $('.unload');
189
+
190
+ unloads.each(function (index, item) {
191
+ if (item.dataset.fontId == id && item.checked == true) {
192
+ item.click();
193
+ }
194
+ });
195
+ },
196
+
197
  /**
198
  * Toggle a checkbox.
199
  *
host-webfonts-local.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: OMGF
6
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
7
  * Description: Minimize DNS requests, leverage browser cache and speed up WordPress by saving Google Fonts to your server and removing external Google Fonts requests.
8
- * Version: 4.3.2
9
  * Author: Daan from FFW.Press
10
  * Author URI: https://ffw.press
11
  * License: GPL2v2 or later
@@ -21,7 +21,7 @@ defined('ABSPATH') || exit;
21
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
22
  define('OMGF_PLUGIN_FILE', __FILE__);
23
  define('OMGF_PLUGIN_BASENAME', plugin_basename(OMGF_PLUGIN_FILE));
24
- define('OMGF_STATIC_VERSION', '4.2.0');
25
 
26
  /**
27
  * Takes care of loading classes on demand.
5
  * Plugin Name: OMGF
6
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
7
  * Description: Minimize DNS requests, leverage browser cache and speed up WordPress by saving Google Fonts to your server and removing external Google Fonts requests.
8
+ * Version: 4.4.0
9
  * Author: Daan from FFW.Press
10
  * Author URI: https://ffw.press
11
  * License: GPL2v2 or later
21
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
22
  define('OMGF_PLUGIN_FILE', __FILE__);
23
  define('OMGF_PLUGIN_BASENAME', plugin_basename(OMGF_PLUGIN_FILE));
24
+ define('OMGF_STATIC_VERSION', '4.4.0');
25
 
26
  /**
27
  * Takes care of loading classes on demand.
includes/admin/class-settings.php CHANGED
@@ -18,12 +18,15 @@ defined('ABSPATH') || exit;
18
 
19
  class OMGF_Admin_Settings extends OMGF_Admin
20
  {
 
 
21
  /**
22
  * Settings Fields
23
  */
24
  const OMGF_SETTINGS_FIELD_OPTIMIZE = 'omgf-optimize-settings';
25
  const OMGF_SETTINGS_FIELD_DETECTION = 'omgf-detection-settings';
26
  const OMGF_SETTINGS_FIELD_ADVANCED = 'omgf-advanced-settings';
 
27
 
28
  /**
29
  * Option Values
@@ -133,7 +136,7 @@ class OMGF_Admin_Settings extends OMGF_Admin
133
  add_action('admin_menu', [$this, 'create_menu']);
134
  add_filter('plugin_action_links_' . plugin_basename(OMGF_PLUGIN_FILE), [$this, 'create_settings_link']);
135
 
136
- if ($this->page !== 'optimize-webfonts') {
137
  return;
138
  }
139
 
@@ -141,15 +144,20 @@ class OMGF_Admin_Settings extends OMGF_Admin
141
  $this->submit_button_text = __('Save & Optimize', $this->plugin_text_domain);
142
  }
143
 
 
 
 
144
  // Tabs
145
  add_action('omgf_settings_tab', [$this, 'optimize_fonts_tab'], 0);
146
  add_action('omgf_settings_tab', [$this, 'detection_settings_tab'], 1);
147
  add_action('omgf_settings_tab', [$this, 'advanced_settings_tab'], 2);
 
148
 
149
  // Content
150
  add_action('omgf_settings_content', [$this, 'optimize_fonts_content'], 0);
151
  add_action('omgf_settings_content', [$this, 'detection_settings_content'], 1);
152
  add_action('omgf_settings_content', [$this, 'advanced_settings_content'], 2);
 
153
  }
154
 
155
  /**
@@ -161,13 +169,11 @@ class OMGF_Admin_Settings extends OMGF_Admin
161
  'OMGF',
162
  'Optimize Google Fonts',
163
  'manage_options',
164
- 'optimize-webfonts',
165
  [$this, 'create_settings_page']
166
  );
167
 
168
- // @formatter:off
169
  add_action('admin_init', [$this, 'register_settings']);
170
- // @formatter:on
171
  }
172
 
173
  /**
@@ -186,19 +192,13 @@ class OMGF_Admin_Settings extends OMGF_Admin
186
  <?= get_plugin_data(OMGF_PLUGIN_FILE)['Description']; ?>
187
  </p>
188
 
189
- <div class="settings-column left">
190
  <h2 class="omgf-nav nav-tab-wrapper">
191
  <?php do_action('omgf_settings_tab'); ?>
192
  </h2>
193
 
194
  <?php do_action('omgf_settings_content'); ?>
195
  </div>
196
-
197
- <div class="settings-column right">
198
- <div id="omgf-welcome-panel" class="welcome-panel">
199
- <?php $this->get_template('welcome'); ?>
200
- </div>
201
- </div>
202
  </div>
203
  <?php
204
  }
@@ -214,6 +214,7 @@ class OMGF_Admin_Settings extends OMGF_Admin
214
  $this->active_tab !== self::OMGF_SETTINGS_FIELD_OPTIMIZE
215
  && $this->active_tab !== self::OMGF_SETTINGS_FIELD_DETECTION
216
  && $this->active_tab !== self::OMGF_SETTINGS_FIELD_ADVANCED
 
217
  ) {
218
  $this->active_tab = apply_filters('omgf_admin_settings_active_tab', self::OMGF_SETTINGS_FIELD_OPTIMIZE);
219
  }
@@ -244,6 +245,8 @@ class OMGF_Admin_Settings extends OMGF_Admin
244
  case (self::OMGF_SETTINGS_FIELD_ADVANCED):
245
  $needle = 'OMGF_ADV_SETTING_';
246
  break;
 
 
247
  default:
248
  $needle = apply_filters('omgf_settings_needle', 'OMGF_OPTIMIZE_SETTING_');
249
  }
@@ -278,6 +281,16 @@ class OMGF_Admin_Settings extends OMGF_Admin
278
  $this->generate_tab(self::OMGF_SETTINGS_FIELD_ADVANCED, 'dashicons-admin-settings', __('Advanced Settings', $this->plugin_text_domain));
279
  }
280
 
 
 
 
 
 
 
 
 
 
 
281
  /**
282
  * @param $id
283
  * @param null $icon
@@ -326,6 +339,16 @@ class OMGF_Admin_Settings extends OMGF_Admin
326
  $this->do_settings_content(self::OMGF_SETTINGS_FIELD_ADVANCED);
327
  }
328
 
 
 
 
 
 
 
 
 
 
 
329
  /**
330
  * @param $field
331
  */
@@ -346,9 +369,11 @@ class OMGF_Admin_Settings extends OMGF_Admin
346
 
347
  do_action('omgf_after_settings_form_settings');
348
 
349
- submit_button($this->submit_button_text, 'primary', 'submit', false);
350
  ?>
351
- <a id="omgf-empty" class="omgf-empty button-cancel"><?php _e('Empty Cache Directory', $this->plugin_text_domain); ?></a>
 
 
 
352
  </form>
353
  <?php
354
  }
@@ -366,4 +391,17 @@ class OMGF_Admin_Settings extends OMGF_Admin
366
 
367
  return $links;
368
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
369
  }
18
 
19
  class OMGF_Admin_Settings extends OMGF_Admin
20
  {
21
+ const OMGF_ADMIN_PAGE = 'optimize-webfonts';
22
+
23
  /**
24
  * Settings Fields
25
  */
26
  const OMGF_SETTINGS_FIELD_OPTIMIZE = 'omgf-optimize-settings';
27
  const OMGF_SETTINGS_FIELD_DETECTION = 'omgf-detection-settings';
28
  const OMGF_SETTINGS_FIELD_ADVANCED = 'omgf-advanced-settings';
29
+ const OMGF_SETTINGS_FIELD_HELP = 'omgf-help';
30
 
31
  /**
32
  * Option Values
136
  add_action('admin_menu', [$this, 'create_menu']);
137
  add_filter('plugin_action_links_' . plugin_basename(OMGF_PLUGIN_FILE), [$this, 'create_settings_link']);
138
 
139
+ if ($this->page !== self::OMGF_ADMIN_PAGE) {
140
  return;
141
  }
142
 
144
  $this->submit_button_text = __('Save & Optimize', $this->plugin_text_domain);
145
  }
146
 
147
+ // Footer Text
148
+ add_filter('admin_footer_text', [$this, 'footer_text_left']);
149
+
150
  // Tabs
151
  add_action('omgf_settings_tab', [$this, 'optimize_fonts_tab'], 0);
152
  add_action('omgf_settings_tab', [$this, 'detection_settings_tab'], 1);
153
  add_action('omgf_settings_tab', [$this, 'advanced_settings_tab'], 2);
154
+ add_action('omgf_settings_tab', [$this, 'help_tab'], 3);
155
 
156
  // Content
157
  add_action('omgf_settings_content', [$this, 'optimize_fonts_content'], 0);
158
  add_action('omgf_settings_content', [$this, 'detection_settings_content'], 1);
159
  add_action('omgf_settings_content', [$this, 'advanced_settings_content'], 2);
160
+ add_action('omgf_settings_content', [$this, 'help_content'], 3);
161
  }
162
 
163
  /**
169
  'OMGF',
170
  'Optimize Google Fonts',
171
  'manage_options',
172
+ self::OMGF_ADMIN_PAGE,
173
  [$this, 'create_settings_page']
174
  );
175
 
 
176
  add_action('admin_init', [$this, 'register_settings']);
 
177
  }
178
 
179
  /**
192
  <?= get_plugin_data(OMGF_PLUGIN_FILE)['Description']; ?>
193
  </p>
194
 
195
+ <div class="settings-column">
196
  <h2 class="omgf-nav nav-tab-wrapper">
197
  <?php do_action('omgf_settings_tab'); ?>
198
  </h2>
199
 
200
  <?php do_action('omgf_settings_content'); ?>
201
  </div>
 
 
 
 
 
 
202
  </div>
203
  <?php
204
  }
214
  $this->active_tab !== self::OMGF_SETTINGS_FIELD_OPTIMIZE
215
  && $this->active_tab !== self::OMGF_SETTINGS_FIELD_DETECTION
216
  && $this->active_tab !== self::OMGF_SETTINGS_FIELD_ADVANCED
217
+ && $this->active_tab !== self::OMGF_SETTINGS_FIELD_HELP
218
  ) {
219
  $this->active_tab = apply_filters('omgf_admin_settings_active_tab', self::OMGF_SETTINGS_FIELD_OPTIMIZE);
220
  }
245
  case (self::OMGF_SETTINGS_FIELD_ADVANCED):
246
  $needle = 'OMGF_ADV_SETTING_';
247
  break;
248
+ case (self::OMGF_SETTINGS_FIELD_HELP):
249
+ $needle = 'OMGF_HELP_SETTING_';
250
  default:
251
  $needle = apply_filters('omgf_settings_needle', 'OMGF_OPTIMIZE_SETTING_');
252
  }
281
  $this->generate_tab(self::OMGF_SETTINGS_FIELD_ADVANCED, 'dashicons-admin-settings', __('Advanced Settings', $this->plugin_text_domain));
282
  }
283
 
284
+ /**
285
+ * Add Help Tab to Settings Screen.
286
+ *
287
+ * @return void
288
+ */
289
+ public function help_tab()
290
+ {
291
+ $this->generate_tab(self::OMGF_SETTINGS_FIELD_HELP, 'dashicons-editor-help', __('Help', $this->plugin_text_domain));
292
+ }
293
+
294
  /**
295
  * @param $id
296
  * @param null $icon
339
  $this->do_settings_content(self::OMGF_SETTINGS_FIELD_ADVANCED);
340
  }
341
 
342
+ /**
343
+ * Render Help content
344
+ *
345
+ * @return void
346
+ */
347
+ public function help_content()
348
+ {
349
+ $this->do_settings_content(self::OMGF_SETTINGS_FIELD_HELP);
350
+ }
351
+
352
  /**
353
  * @param $field
354
  */
369
 
370
  do_action('omgf_after_settings_form_settings');
371
 
 
372
  ?>
373
+ <?php if ($this->active_tab !== self::OMGF_SETTINGS_FIELD_HELP) : ?>
374
+ <?php submit_button($this->submit_button_text, 'primary', 'submit', false); ?>
375
+ <a id="omgf-empty" class="omgf-empty button-cancel"><?php _e('Empty Cache Directory', $this->plugin_text_domain); ?></a>
376
+ <?php endif; ?>
377
  </form>
378
  <?php
379
  }
391
 
392
  return $links;
393
  }
394
+
395
+ /**
396
+ * Changes footer text.
397
+ *
398
+ * @return string
399
+ */
400
+ public function footer_text_left()
401
+ {
402
+ $logo = '<a target="_blank" title="Visit FFW Press" href="https://ffw.press/wordpress-plugins/"><img class="signature-image" alt="Visit FFW Press" src="https://ffw.press/wp-content/uploads/2021/01/logo-color-full@025x.png"></a>';
403
+ $text = sprintf(__('Coded with %s in The Netherlands.', $this->plugin_text_domain), '<span class="dashicons dashicons-heart ffwp-heart"></span>');
404
+
405
+ return '<span id="footer-thankyou">' . $logo . ' ' . $text . '</span>';
406
+ }
407
  }
includes/admin/settings/class-help.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /* * * * * * * * * * * * * * * * * * * * *
3
+ *
4
+ * ██████╗ ███╗ ███╗ ██████╗ ███████╗
5
+ * ██╔═══██╗████╗ ████║██╔════╝ ██╔════╝
6
+ * ██║ ██║██╔████╔██║██║ ███╗█████╗
7
+ * ██║ ██║██║╚██╔╝██║██║ ██║██╔══╝
8
+ * ╚██████╔╝██║ ╚═╝ ██║╚██████╔╝██║
9
+ * ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
10
+ *
11
+ * @package : OMGF
12
+ * @author : Daan van den Bergh
13
+ * @copyright: (c) 2021 Daan van den Bergh
14
+ * @url : https://daan.dev
15
+ * * * * * * * * * * * * * * * * * * * */
16
+
17
+ defined('ABSPATH') || exit;
18
+
19
+ class OMGF_Admin_Settings_Help extends OMGF_Admin_Settings_Builder
20
+ {
21
+ /**
22
+ *
23
+ * @return void
24
+ */
25
+ public function __construct()
26
+ {
27
+ $this->title = __('Help & Documentation', $this->plugin_text_domain);
28
+
29
+ // Title
30
+ add_filter('omgf_help_content', [$this, 'do_title'], 10);
31
+
32
+ // Content
33
+ add_filter('omgf_help_content', [$this, 'do_content'], 20);
34
+ }
35
+
36
+ public function do_content()
37
+ {
38
+ $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=support_tab';
39
+ $tweetUrl = "https://twitter.com/intent/tweet?text=I+am+using+OMGF+to+speed+up+Google+Fonts+for+@WordPress!+Try+it+for+yourself:&via=Dan0sz&hashtags=GoogleFonts,WordPress,Pagespeed,Insights&url=https://wordpress.org/plugins/host-webfonts-local/";
40
+ ?>
41
+ <div class="welcome-panel">
42
+ <div class="welcome-panel-content">
43
+ <h2><?= __('Thank you for using OMGF!'); ?></h2>
44
+ <p class="about-description">
45
+ <?= __('Need help configuring OMGF? Please refer to the links below to get you started.', $this->plugin_text_domain); ?>
46
+ </p>
47
+ <div class="welcome-panel-column-container">
48
+ <div class="welcome-panel-column">
49
+ <h3>
50
+ <?php _e('Need Help?', $this->plugin_text_domain); ?>
51
+ </h3>
52
+ <ul>
53
+ <li><a class="welcome-icon dashicons-controls-play" target="_blank" href="<?= apply_filters('omgf_settings_sidebar_quick_start', 'https://ffw.press/docs/omgf-pro/quick-start/'); ?>"><?= __('Quick Start Guide', $this->plugin_text_domain); ?></a></li>
54
+ <li><a class="welcome-icon dashicons-text-page" target="_blank" href="<?= apply_filters('omgf_settings_sidebar_user_manual', 'https://ffw.press/docs/omgf-pro/user-manual/'); ?>"><?= __('User Manual', $this->plugin_text_domain); ?></a></li>
55
+ <li><a class="welcome-icon dashicons-editor-help" target="_blank" href="<?= apply_filters('omgf_settings_sidebar_faq_link', 'https://wordpress.org/plugins/host-webfonts-local/#description'); ?>"><?= __('FAQ', $this->plugin_text_domain); ?></a></li>
56
+ <li><a class="welcome-icon dashicons-bell" target="_blank" href="<?= apply_filters('omgf_settings_sidebar_get_support_link', 'https://wordpress.org/support/plugin/host-webfonts-local/#new-post'); ?>"><?= __('Get Support', $this->plugin_text_domain); ?></a></li>
57
+ </ul>
58
+ </div>
59
+ <div class="welcome-panel-column">
60
+ <h3><?= __('Support OMGF & Spread the Word!', $this->plugin_text_domain); ?></h3>
61
+ <ul>
62
+ <li><a class="welcome-icon dashicons-star-filled" target="_blank" href="https://wordpress.org/support/plugin/host-webfonts-local/reviews/?rate=5#new-post"><?= __('Write a 5-star Review or,', $this->plugin_text_domain); ?></a></li>
63
+ <li><a class="welcome-icon dashicons-twitter" target="_blank" href="<?= $tweetUrl; ?>"><?= __('Tweet about it!', $this->plugin_text_domain); ?></a></li>
64
+ </ul>
65
+ </div>
66
+ <div class="welcome-panel-column welcome-panel-last">
67
+ <h3 class="signature"><?= __('Check out my other plugins', $this->plugin_text_domain); ?> @</h3>
68
+ <p class="signature">
69
+ <a target="_blank" title="<?= __('Visit FFW Press', $this->plugin_text_domain); ?>" href="https://ffw.press/wordpress-plugins/"><img class="signature-image" alt="<?= __('Visit FFW Press', $this->plugin_text_domain); ?>" src="https://ffw.press/wp-content/uploads/2021/01/logo-color-full@05x.png" /></a>
70
+ </p>
71
+ </div>
72
+ </div>
73
+ </div>
74
+ </div>
75
+ </div>
76
+ <?php
77
+ }
78
+ }
includes/admin/settings/class-optimize.php CHANGED
@@ -149,7 +149,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
149
  {
150
  $this->optimized_fonts = omgf_init()::optimized_fonts();
151
  ?>
152
- <h3><?= $this->optimized_fonts ? 'Manage Optimized Google Fonts' : __('Are you ready to Optimize your Google Fonts?', $this->plugin_text_domain); ?></h3>
153
  <?php if ($this->optimized_fonts) : ?>
154
  <?= $this->do_optimized_fonts_manager(); ?>
155
  <?php else : ?>
@@ -178,8 +178,8 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
178
  <td>&nbsp;</td>
179
  <th><?= __('Style', $this->plugin_text_domain); ?></th>
180
  <th><?= __('Weight', $this->plugin_text_domain); ?></th>
181
- <th class="preload"><?= __('Preload', $this->plugin_text_domain); ?></th>
182
- <th class="unload"><?= __('Do not load', $this->plugin_text_domain); ?></th>
183
  </tr>
184
  </thead>
185
  <?php
@@ -192,18 +192,23 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
192
  }
193
  ?>
194
  <tbody class="stylesheet" id="<?= $handle; ?>">
 
 
 
195
  <?php foreach ($fonts as $font) : ?>
196
  <?php if (count((array) $font->variants) <= 0) continue; ?>
197
  <?php
198
  $aka = in_array($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) ? array_search($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) : '';
199
  ?>
200
- <th><?= $font->family; ?> <span class="handle">(<em><?= $aka ? sprintf(__('formerly known as <strong>%s</strong>', $this->plugin_text_domain), ucfirst($aka)) . ' -- ' : ''; ?><?= __('Stylesheet handle', $this->plugin_text_domain); ?>: <strong><?= $handle; ?></strong></em>)</span></th>
 
 
201
  <?php foreach ($font->variants as $variant) : ?>
202
  <tr>
203
  <td></td>
204
  <?php
205
- $preload = get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_PRELOAD_FONTS)[$handle][$font->id][$variant->id] ?? '';
206
- $unload = get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_FONTS)[$handle][$font->id][$variant->id] ?? '';
207
  $class = $handle . '-' . $font->id . '-' . $variant->id;
208
  ?>
209
  <td><?= $variant->fontStyle; ?></td>
@@ -224,12 +229,12 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
224
  <p>
225
  <span class="dashicons-before dashicons-info-outline"></span>
226
  <?php if (OMGF_OPTIMIZATION_MODE == 'manual') : ?>
227
- <em><?= sprintf(__("This list is populated with all Google Fonts captured from <strong>%s</strong>. Optimizations will be applied on every page using these fonts. If you want to optimize additional Google Fonts from other pages, temporarily switch to <strong>Automatic</strong> and visit the pages containing the stylesheets you'd like to optimize. This list will automatically be populated with the captured fonts. When you feel the list is complete, switch back to <strong>Manual</strong>.", $this->plugin_text_domain), OMGF_MANUAL_OPTIMIZE_URL); ?></em>
228
  <?php else : ?>
229
  <?php
230
  $no_cache_param = '?omgf_optimize=' . substr(md5(microtime()), rand(0, 26), 5);
231
  ?>
232
- <em><?= sprintf(__("This list is automatically populated with Google Fonts throughout your entire site. Optimizations will be applied on every page using these fonts. <strong>Automatic</strong> mode might not work when a Full Page Cache plugin is activated. If this list is not being populated with Google Fonts, you could try to visit your frontend and append the following parameter to the URL: <strong>%s</strong>", $this->plugin_text_domain), $no_cache_param); ?></em>
233
  <?php endif; ?>
234
  </p>
235
  </div>
@@ -256,7 +261,8 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
256
  <span class="dashicons-before dashicons-yes"></span> <?= __('Pros:', $this->plugin_text_domain); ?>
257
  </h3>
258
  <ul>
259
- <li><?= __('A small performance boost, because no calls to OMGF\'s Download API are made in the frontend.', $this->plugin_text_domain); ?></li>
 
260
  </ul>
261
  </div>
262
  <div class="omgf-optimize-fonts-cons">
@@ -264,7 +270,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
264
  <span class="dashicons-before dashicons-no"></span> <?= __('Cons', $this->plugin_text_domain); ?>
265
  </h3>
266
  <ul>
267
- <li><?= __('High maintenance if you use a lot of different fonts on different pages.', $this->plugin_text_domain); ?></li>
268
  </ul>
269
  </div>
270
  <p>
@@ -307,7 +313,7 @@ class OMGF_Admin_Settings_Optimize extends OMGF_Admin_Settings_Builder
307
  <span class="dashicons-before dashicons-no"></span> <?= __('Cons', $this->plugin_text_domain); ?>
308
  </h3>
309
  <ul>
310
- <li><?= __("Visitors might experience slow loading times, the 1st time they land on a page containing unoptimized Google Fonts. Every subsequent request to that page (and other pages using that same stylesheet) will be fast.", $this->plugin_text_domain); ?></li>
311
  </ul>
312
  </div>
313
  <div class="omgf-optimize-fonts-tooltip">
149
  {
150
  $this->optimized_fonts = omgf_init()::optimized_fonts();
151
  ?>
152
+ <span class="option-title"><?= __('Manage Optimized Fonts', $this->plugin_text_domain); ?></span>
153
  <?php if ($this->optimized_fonts) : ?>
154
  <?= $this->do_optimized_fonts_manager(); ?>
155
  <?php else : ?>
178
  <td>&nbsp;</td>
179
  <th><?= __('Style', $this->plugin_text_domain); ?></th>
180
  <th><?= __('Weight', $this->plugin_text_domain); ?></th>
181
+ <th><?= __('Preload', $this->plugin_text_domain); ?></th>
182
+ <th><?= __('Do not load', $this->plugin_text_domain); ?></th>
183
  </tr>
184
  </thead>
185
  <?php
192
  }
193
  ?>
194
  <tbody class="stylesheet" id="<?= $handle; ?>">
195
+ <tr>
196
+ <th colspan="5"><?= sprintf(__('Stylesheet handle: %s', $this->plugin_text_domain), $handle); ?></th>
197
+ </tr>
198
  <?php foreach ($fonts as $font) : ?>
199
  <?php if (count((array) $font->variants) <= 0) continue; ?>
200
  <?php
201
  $aka = in_array($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) ? array_search($font->id, OMGF_API_Download::OMGF_RENAMED_GOOGLE_FONTS) : '';
202
  ?>
203
+ <tr class="font-family" data-id="<?= $font->id; ?>">
204
+ <td colspan="5"><span class="family"><em><?= $font->family; ?><?= $aka ? ' (' . sprintf(__('formerly known as <strong>%s</strong>', $this->plugin_text_domain) . ')', ucfirst($aka)) : ''; ?></em></span> <span class="unload-mass-action">(<a href="#" class="unload-italics"><?= __('Unload italics', $this->plugin_text_domain); ?></a> <span class="dashicons dashicons-info tooltip"><span class="tooltip-text"><?= __('In most situations you can safely unload all Italic font styles. Modern browsers are capable of mimicking Italic font styles.', $this->plugin_text_domain); ?></span></span> | <a href="#" class="unload-all"><?= __('Unload all', $this->plugin_text_domain); ?></a> | <a href="#" class="load-all"><?= __('Load all', $this->plugin_text_domain); ?></a>)</span></td>
205
+ </tr>
206
  <?php foreach ($font->variants as $variant) : ?>
207
  <tr>
208
  <td></td>
209
  <?php
210
+ $preload = OMGF::preloaded_fonts()[$handle][$font->id][$variant->id] ?? '';
211
+ $unload = OMGF::unloaded_fonts()[$handle][$font->id][$variant->id] ?? '';
212
  $class = $handle . '-' . $font->id . '-' . $variant->id;
213
  ?>
214
  <td><?= $variant->fontStyle; ?></td>
229
  <p>
230
  <span class="dashicons-before dashicons-info-outline"></span>
231
  <?php if (OMGF_OPTIMIZATION_MODE == 'manual') : ?>
232
+ <em><?= sprintf(__("This list is populated with all Google Fonts captured and downloaded from <strong>%s</strong>. Optimizations will be applied on every page using these fonts. If you want to optimize additional Google Fonts from other pages, temporarily switch to <strong>Automatic</strong> and visit the pages containing the stylesheets you'd like to optimize. This list will automatically be populated with the captured fonts. When you feel the list is complete, switch back to <strong>Manual</strong>.", $this->plugin_text_domain), OMGF_MANUAL_OPTIMIZE_URL); ?></em>
233
  <?php else : ?>
234
  <?php
235
  $no_cache_param = '?omgf_optimize=' . substr(md5(microtime()), rand(0, 26), 5);
236
  ?>
237
+ <em><?= sprintf(__("This list is automatically populated with Google Fonts captured throughout your entire site. Optimizations will be applied on every page using these fonts. <strong>Automatic</strong> mode might not work when a Full Page Cache plugin is activated. If this list is not being populated with Google Fonts, you could try to visit your frontend and append the following parameter to the URL: <strong>%s</strong>", $this->plugin_text_domain), $no_cache_param); ?></em>
238
  <?php endif; ?>
239
  </p>
240
  </div>
261
  <span class="dashicons-before dashicons-yes"></span> <?= __('Pros:', $this->plugin_text_domain); ?>
262
  </h3>
263
  <ul>
264
+ <li><?= __('A small initial performance boost, because no calls to OMGF\'s Download API are made in the frontend.', $this->plugin_text_domain); ?></li>
265
+ <li><?= __('Force one stylesheet to be used throughout the site.', $this->plugin_text_domain); ?></li>
266
  </ul>
267
  </div>
268
  <div class="omgf-optimize-fonts-cons">
270
  <span class="dashicons-before dashicons-no"></span> <?= __('Cons', $this->plugin_text_domain); ?>
271
  </h3>
272
  <ul>
273
+ <li><?= __('A font that is only used on a few pages might be lost if one of those URLs isn\'t scanned for fonts.', $this->plugin_text_domain); ?></li>
274
  </ul>
275
  </div>
276
  <p>
313
  <span class="dashicons-before dashicons-no"></span> <?= __('Cons', $this->plugin_text_domain); ?>
314
  </h3>
315
  <ul>
316
+ <li><?= __("The first time an unoptimized Google Fonts stylesheet is found, the API will be triggered in the frontend, which might cause the page to load slower than usual. All subsequent pageviews for that page (and all pages using that same stylesheet will load just as fast as when Manual mode is used.", $this->plugin_text_domain); ?></li>
317
  </ul>
318
  </div>
319
  <div class="omgf-optimize-fonts-tooltip">
includes/class-admin.php CHANGED
@@ -52,6 +52,7 @@ class OMGF_Admin
52
  $this->do_optimize_settings();
53
  $this->do_detection_settings();
54
  $this->do_advanced_settings();
 
55
 
56
  add_filter('pre_update_option_omgf_optimized_fonts', [$this, 'decode_option'], 10, 3);
57
  add_filter('pre_update_option_omgf_cache_keys', [$this, 'clean_up_cache'], 10, 3);
@@ -71,16 +72,6 @@ class OMGF_Admin
71
  }
72
  }
73
 
74
- /**
75
- * @param $name
76
- *
77
- * @return mixed
78
- */
79
- protected function get_template($name)
80
- {
81
- return include OMGF_PLUGIN_DIR . 'templates/admin/block-' . $name . '.phtml';
82
- }
83
-
84
  /**
85
  * Add notice to admin screen.
86
  */
@@ -113,6 +104,16 @@ class OMGF_Admin
113
  return new OMGF_Admin_Settings_Advanced();
114
  }
115
 
 
 
 
 
 
 
 
 
 
 
116
  /**
117
  * @param $old_value
118
  * @param $value
52
  $this->do_optimize_settings();
53
  $this->do_detection_settings();
54
  $this->do_advanced_settings();
55
+ $this->do_help();
56
 
57
  add_filter('pre_update_option_omgf_optimized_fonts', [$this, 'decode_option'], 10, 3);
58
  add_filter('pre_update_option_omgf_cache_keys', [$this, 'clean_up_cache'], 10, 3);
72
  }
73
  }
74
 
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * Add notice to admin screen.
77
  */
104
  return new OMGF_Admin_Settings_Advanced();
105
  }
106
 
107
+ /**
108
+ * Add filters for Help section.
109
+ *
110
+ * @return OMGF_Admin_Settings_Help
111
+ */
112
+ private function do_help()
113
+ {
114
+ return new OMGF_Admin_Settings_Help();
115
+ }
116
+
117
  /**
118
  * @param $old_value
119
  * @param $value
includes/class-optimize.php CHANGED
@@ -21,44 +21,54 @@ class OMGF_Optimize
21
  /** @var string */
22
  private $plugin_text_domain = 'host-webfonts-local';
23
 
24
- /** @var mixed|string */
25
- private $optimization_mode = '';
 
 
 
26
 
27
  /**
28
  * OMGF_Optimize constructor.
29
  */
30
  public function __construct()
31
  {
32
- $option_page = $_POST['option_page'] ?? '';
33
- $this->optimization_mode = $_POST[OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_OPTIMIZATION_MODE] ?? '';
34
 
 
 
 
 
 
 
 
 
 
 
35
  if (
36
- OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_OPTIMIZE != $option_page
37
- && !$this->optimization_mode
38
  ) {
39
  return;
40
  }
41
 
42
- // Will die when it fails.
43
- check_admin_referer('omgf-optimize-settings-options');
44
-
45
- update_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_CACHE_KEYS, $_POST[OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_CACHE_KEYS] ?? '');
46
- update_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_FONTS, $_POST[OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_FONTS] ?? '');
47
- update_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_PRELOAD_FONTS, $_POST[OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_PRELOAD_FONTS] ?? '');
48
- update_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS, $_POST[OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_UNLOAD_STYLESHEETS] ?? '');
49
 
50
- if ('manual' == $this->optimization_mode) {
51
  $this->run_manual();
52
  }
53
 
54
- if ('auto' == $this->optimization_mode) {
55
  $this->run_auto();
56
  }
57
  }
58
 
 
 
 
59
  private function run_manual()
60
  {
61
- $url = esc_url_raw($_POST[OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_MANUAL_OPTIMIZE_URL]);
62
 
63
  $front_html = $this->remote_get($url);
64
 
@@ -93,6 +103,9 @@ class OMGF_Optimize
93
  $this->optimization_succeeded();
94
  }
95
 
 
 
 
96
  private function optimization_succeeded()
97
  {
98
  add_settings_error('general', 'omgf_optimization_success', __('Optimization completed successfully.'), 'success');
@@ -121,11 +134,17 @@ class OMGF_Optimize
121
  add_settings_error('general', 'omgf_frontend_fetch_failed', __('OMGF encountered an error while fetching this site\'s frontend HTML', $this->plugin_text_domain) . ': ' . $front_html->get_error_code() . ' - ' . $front_html->get_error_message(), 'error');
122
  }
123
 
 
 
 
124
  private function no_urls_found()
125
  {
126
  add_settings_error('general', 'omgf_no_urls_found', sprintf(__('No (additional) Google Fonts found to optimize. If you believe this is an error, please refer to the %stroubleshooting%s section of the documentation for possible solutions.', $this->plugin_text_domain), '<a href="https://ffw.press/docs/omgf-pro/troubleshooting">', '</a>'), 'info');
127
  }
128
 
 
 
 
129
  private function run_auto()
130
  {
131
  OMGF_Admin_Notice::set_notice(
@@ -137,30 +156,34 @@ class OMGF_Optimize
137
 
138
  /**
139
  * Wrapper for wp_remote_get() with preset params.
140
- *
141
- * @param mixed $url
142
- * @return array|WP_Error
143
  */
144
  private function remote_get($url)
145
  {
146
  return wp_remote_get(
147
  $this->no_cache_optimize_url($url),
148
  [
149
- 'timeout' => 30,
150
- 'sslverify' => $this->verify_ssl($url)
151
  ]
152
  );
153
  }
154
 
155
  /**
156
- * If URL is non-SSL, return false.
157
- *
158
- * @param mixed $url
159
- * @return bool
 
 
 
160
  */
161
- private function verify_ssl($url)
162
  {
163
- return strpos($url, 'https:') !== false;
 
 
164
  }
165
 
166
  /**
21
  /** @var string */
22
  private $plugin_text_domain = 'host-webfonts-local';
23
 
24
+ /** @var string */
25
+ private $settings_page = '';
26
+
27
+ /** @var string */
28
+ private $settings_updated = '';
29
 
30
  /**
31
  * OMGF_Optimize constructor.
32
  */
33
  public function __construct()
34
  {
35
+ $this->settings_page = $_GET['page'] ?? '';
36
+ $this->settings_updated = $_GET['settings-updated'] ?? '';
37
 
38
+ $this->init();
39
+ }
40
+
41
+ /**
42
+ * Run either manual or auto mode after settings are updated.
43
+ *
44
+ * @return void
45
+ */
46
+ private function init()
47
+ {
48
  if (
49
+ OMGF_Admin_Settings::OMGF_ADMIN_PAGE != $this->settings_page
50
+ || !$this->settings_updated
51
  ) {
52
  return;
53
  }
54
 
55
+ add_filter('http_request_args', [$this, 'verify_ssl']);
 
 
 
 
 
 
56
 
57
+ if ('manual' == OMGF_OPTIMIZATION_MODE) {
58
  $this->run_manual();
59
  }
60
 
61
+ if ('auto' == OMGF_OPTIMIZATION_MODE) {
62
  $this->run_auto();
63
  }
64
  }
65
 
66
+ /**
67
+ * @return void
68
+ */
69
  private function run_manual()
70
  {
71
+ $url = esc_url_raw(OMGF_MANUAL_OPTIMIZE_URL);
72
 
73
  $front_html = $this->remote_get($url);
74
 
103
  $this->optimization_succeeded();
104
  }
105
 
106
+ /**
107
+ * @return void
108
+ */
109
  private function optimization_succeeded()
110
  {
111
  add_settings_error('general', 'omgf_optimization_success', __('Optimization completed successfully.'), 'success');
134
  add_settings_error('general', 'omgf_frontend_fetch_failed', __('OMGF encountered an error while fetching this site\'s frontend HTML', $this->plugin_text_domain) . ': ' . $front_html->get_error_code() . ' - ' . $front_html->get_error_message(), 'error');
135
  }
136
 
137
+ /**
138
+ * @return void
139
+ */
140
  private function no_urls_found()
141
  {
142
  add_settings_error('general', 'omgf_no_urls_found', sprintf(__('No (additional) Google Fonts found to optimize. If you believe this is an error, please refer to the %stroubleshooting%s section of the documentation for possible solutions.', $this->plugin_text_domain), '<a href="https://ffw.press/docs/omgf-pro/troubleshooting">', '</a>'), 'info');
143
  }
144
 
145
+ /**
146
+ *
147
+ */
148
  private function run_auto()
149
  {
150
  OMGF_Admin_Notice::set_notice(
156
 
157
  /**
158
  * Wrapper for wp_remote_get() with preset params.
159
+ *
160
+ * @param mixed $url
161
+ * @return array|WP_Error
162
  */
163
  private function remote_get($url)
164
  {
165
  return wp_remote_get(
166
  $this->no_cache_optimize_url($url),
167
  [
168
+ 'timeout' => 30
 
169
  ]
170
  );
171
  }
172
 
173
  /**
174
+ * If this site is non-SSL it makes no sense to verify its SSL certificates.
175
+ *
176
+ * Settings sslverify to false will set CURLOPT_SSL_VERIFYPEER and CURLOPT_SSL_VERIFYHOST
177
+ * to 0 further down the road.
178
+ *
179
+ * @param mixed $url
180
+ * @return bool
181
  */
182
+ public function verify_ssl($args)
183
  {
184
+ $args['sslverify'] = strpos(home_url(), 'https:') !== false;
185
+
186
+ return $args;
187
  }
188
 
189
  /**
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: DaanvandenBergh
3
  Tags: google, fonts, gdpr, cache, speed, preload, font-display, webfonts, subsets, remove, minimize, external, requests
4
  Requires at least: 4.6
5
  Tested up to: 5.7
6
- Stable tag: 4.3.2
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -123,9 +123,18 @@ No, not yet. But I will definitely try to make it compatible in the future!
123
 
124
  == Changelog ==
125
 
 
 
 
 
 
 
 
 
 
126
  = 4.3.2 | April 5th, 2021 =
127
  * Fixed MIME type (`X-Content-Type-Options: nosniff`) related errors when using Download API.
128
- * When site is not using SSL, SSL verification (`sslverify`) is disabled while contacting the Download API.
129
  * When OMGF Pro is running in Automatic Mode, only preloads for the currently used stylesheet are loaded.
130
 
131
  = 4.3.1 | March 29th, 2021 =
3
  Tags: google, fonts, gdpr, cache, speed, preload, font-display, webfonts, subsets, remove, minimize, external, requests
4
  Requires at least: 4.6
5
  Tested up to: 5.7
6
+ Stable tag: 4.4.0
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
123
 
124
  == Changelog ==
125
 
126
+ = 4.4.0 | April 10th, 2021 =
127
+ * Moved sidebar to its own 'Help' tab to clean up the interface.
128
+ * Manage Optimize Fonts panel is now shown inline with other options (and has its own label).
129
+ * Each stylesheet's handle is now more prominently visible and the font family is better readable.
130
+ * Added mass actions to each font family for easier management of each stylesheet.
131
+ * Took a different approach to deal with SSL/Non-SSL for local Dev environments.
132
+ * Performance improvements to manual detection mode (decreased risk of timeouts!)
133
+ * Overall UX tweaks and performance improvements.
134
+
135
  = 4.3.2 | April 5th, 2021 =
136
  * Fixed MIME type (`X-Content-Type-Options: nosniff`) related errors when using Download API.
137
+ * When site is not using SSL, sslverify is disabled when contacting the Download API.
138
  * When OMGF Pro is running in Automatic Mode, only preloads for the currently used stylesheet are loaded.
139
 
140
  = 4.3.1 | March 29th, 2021 =
templates/admin/block-welcome.phtml DELETED
@@ -1,82 +0,0 @@
1
- <?php
2
- /* * * * * * * * * * * * * * * * * * * * *
3
- *
4
- * ██████╗ ███╗ ███╗ ██████╗ ███████╗
5
- * ██╔═══██╗████╗ ████║██╔════╝ ██╔════╝
6
- * ██║ ██║██╔████╔██║██║ ███╗█████╗
7
- * ██║ ██║██║╚██╔╝██║██║ ██║██╔══╝
8
- * ╚██████╔╝██║ ╚═╝ ██║╚██████╔╝██║
9
- * ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝
10
- *
11
- * @package : OMGF
12
- * @author : Daan van den Bergh
13
- * @copyright: (c) 2021 Daan van den Bergh
14
- * @url : https://daan.dev
15
- * * * * * * * * * * * * * * * * * * * */
16
-
17
- defined('ABSPATH') || exit;
18
-
19
- $plugin_text_domain = 'host-webfonts-local';
20
- $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=support_tab';
21
- $tweetUrl = 'https://twitter.com/intent/tweet?text=I+just+optimized+my+Google+Fonts+with+OMGF+for+@WordPress!+Try+it+for+yourself:&via=Dan0sz&hashtags=GoogleFonts,WordPress,Pagespeed,Insights&url=https://wordpress.org/plugins/host-webfonts-local/';
22
- ?>
23
- <div class="welcome-panel-content">
24
- <div class="welcome-panel-column-container">
25
- <div class="welcome-panel-column" style="width: 100%;">
26
- <?php if (apply_filters('apply_omgf_pro_promo', true)) : ?>
27
- <h2>
28
- <?php _e('Support OMGF by Spreading the Word!', $plugin_text_domain); ?>
29
- </h2>
30
- <p>
31
- <?= __('Just because this plugin\'s free, doesn\'t mean there\'s nothing you can do to support me! :)', $plugin_text_domain); ?>
32
- </p>
33
- <p>
34
- <?= sprintf(__('Please help me spread the word by leaving a %s5-star review%s on Wordpress.org or sending a %sTweet%s about OMGF.', $plugin_text_domain), '<a target="_blank" href="https://wordpress.org/support/plugin/host-webfonts-local/reviews/?rate=5#new-post">', '</a>', "<a href='$tweetUrl'>", '</a>'); ?>
35
- </p>
36
- <p>
37
- <a target="_blank" class="button button-secondary button-hero" href="https://wordpress.org/support/plugin/host-webfonts-local/reviews/?rate=5#new-post"><span class="dashicons-before dashicons-star-filled"> <?php _e('Review', $plugin_text_domain); ?></span></a>
38
- <a target="_blank" class="button button-secondary button-hero" href="<?= $tweetUrl; ?>"><span class="dashicons-before dashicons-twitter"> <?php _e('Tweet', $plugin_text_domain); ?></span></a>
39
- </p>
40
- <?php else : ?>
41
- <h2>
42
- <?= __('Do you <span class="dashicons dashicons-heart ffwp-heart"></span> OMGF Pro?', $plugin_text_domain); ?>
43
- </h2>
44
- <p>
45
- <?= __('Click the button below and receive a personal discount code for 10% off your next purchase!'); ?>
46
- </p>
47
- <p>
48
- <a target="_blank" class="button button-primary button-hero" href="<?= OMGF_Admin_Settings::FFWP_WORDPRESS_PLUGINS_OMGF_PRO . '#edd-reviews-title'; ?>"><span class="dashicons-before dashicons-star-filled"> <?php _e('Review', $plugin_text_domain); ?></span></a>
49
- <span><?= __('(login required)', $plugin_text_domain); ?></span>
50
- </p>
51
- <?php endif; ?>
52
- <hr />
53
- <h3>
54
- <?= __('Did you upgrade from OMGF v3 to v4?', $plugin_text_domain); ?>
55
- </h3>
56
- <p>
57
- <?= __('First off, thank you! :)', $plugin_text_domain); ?>
58
- </p>
59
- <p>
60
- <?= __('No features were moved from Free to Pro during this upgrade.', $plugin_text_domain); ?>
61
- </p>
62
- <p>
63
- <?= sprintf(__('However, if you find anything that broke after the upgrade. Please send me a <a target="_blank" href="%s">support ticket</a>.', $plugin_text_domain), 'https://wordpress.org/support/plugin/host-webfonts-local/#new-post'); ?>
64
- </p>
65
- <hr />
66
- <h3>
67
- <?php _e('Need Help?', $plugin_text_domain); ?>
68
- </h3>
69
- <ul>
70
- <li><a target="_blank" href="<?= apply_filters('omgf_settings_sidebar_quick_start', 'https://ffw.press/docs/omgf-pro/quick-start/'); ?>"><?= __('Quick Start Guide', $plugin_text_domain); ?></a></li>
71
- <li><a target="_blank" href="<?= apply_filters('omgf_settings_sidebar_user_manual', 'https://ffw.press/docs/omgf-pro/user-manual/'); ?>"><?= __('User Manual', $plugin_text_domain); ?></a></li>
72
- <li><a target="_blank" href="<?= apply_filters('omgf_settings_sidebar_faq_link', 'https://wordpress.org/plugins/host-webfonts-local/#description'); ?>"><?= __('FAQ', $plugin_text_domain); ?></a></li>
73
- <li><a target="_blank" href="<?= apply_filters('omgf_settings_sidebar_get_support_link', 'https://wordpress.org/support/plugin/host-webfonts-local/#new-post'); ?>"><?= __('Get Support', $plugin_text_domain); ?></a></li>
74
- </ul>
75
- <hr />
76
- <h4 class="signature"><?= sprintf(__('Coded with %s in The Netherlands.', $plugin_text_domain), '<span class="dashicons dashicons-heart ffwp-heart"></span>'); ?></h4>
77
- <p class="signature">
78
- <a target="_blank" title="<?= __('Visit FFW Press', $plugin_text_domain); ?>" href="https://ffw.press/wordpress-plugins/"><img class="signature-image" alt="<?= __('Visit FFW Press', $plugin_text_domain); ?>" src="https://ffw.press/wp-content/uploads/2021/01/logo-color-full@05x.png" /></a>
79
- </p>
80
- </div>
81
- </div>
82
- </div>