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

Version Description

  • Added toggleable navigation menu. Made it a bit more UX friendly.
  • Enhanced search and auto-detect: search results of one, are now appended to the result of the other. Also, duplicate search queries are now filtered, so they will not return duplicate subset results.
Download this release

Release Info

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

Code changes from version 3.1.2 to 3.1.3

css/omgf-admin.css CHANGED
@@ -14,9 +14,42 @@
14
  * * * * * * * * * * * * * * * * * * * */
15
 
16
  /**
17
- * Responsiveness
18
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  .settings-column {
21
  display: inline-block;
22
  }
@@ -24,44 +57,39 @@
24
  .settings-column.left {
25
  float: left;
26
  min-width: 655px;
27
- width: 37%;
28
- }
29
-
30
- .settings-column.center {
31
- width: 35%
32
  }
33
 
34
  .settings-column.right {
35
  float: right;
36
- width: 25%;
37
  }
38
 
39
- @media only screen and (max-width: 940px) {
 
 
 
40
  .settings-column {
41
  display: block;
42
  float: none;
43
  }
44
 
45
  .settings-column.left,
46
- .settings-column.center,
47
  .settings-column.right {
48
  width: 100%;
49
  }
50
  }
51
 
52
- @media only screen and (min-width: 941px) and (max-width: 1024px) {
53
- .settings-column.center {
54
- width: 66%;
55
- }
56
-
57
- .settings-column.right {
58
- width: 33%;
59
- }
60
- }
61
-
62
  /**
63
  * Generate Stylesheet-form
64
  */
 
 
 
 
 
 
 
65
 
66
  #omgf-search {
67
  line-height: 38px;
@@ -69,6 +97,13 @@
69
  padding: 3px 10px;
70
  }
71
 
 
 
 
 
 
 
 
72
  .omgf-loading {
73
  position: absolute;
74
  width: 100%;
14
  * * * * * * * * * * * * * * * * * * * */
15
 
16
  /**
17
+ * Navigation
18
  */
19
+ .omgf-nav {
20
+ padding: 1em 0 1.5em;
21
+ }
22
+
23
+ .omgf-nav .dashicons-before:before {
24
+ margin-right: .25em;
25
+ }
26
+
27
+ .omgf-nav span {
28
+ color: #23282d;
29
+ font-size: 1.3em;
30
+ margin-right: 1.5em;
31
+ font-weight: 600;
32
+ }
33
+
34
+ .omgf-nav span:hover {
35
+ cursor: pointer;
36
+ }
37
 
38
+ .omgf-nav .selected,
39
+ .omgf-nav span:hover {
40
+ border-bottom: 1px dashed #23282d;
41
+ padding: 3px 0;
42
+ }
43
+
44
+ .omgf-nav span:not(.selected) {
45
+ opacity: 0.85;
46
+ }
47
+
48
+
49
+
50
+ /**
51
+ * Sections
52
+ */
53
  .settings-column {
54
  display: inline-block;
55
  }
57
  .settings-column.left {
58
  float: left;
59
  min-width: 655px;
60
+ width: 66%;
 
 
 
 
61
  }
62
 
63
  .settings-column.right {
64
  float: right;
65
+ width: 28.6%;
66
  }
67
 
68
+ /**
69
+ * Responsiveness
70
+ */
71
+ @media only screen and (max-width: 1024px) {
72
  .settings-column {
73
  display: block;
74
  float: none;
75
  }
76
 
77
  .settings-column.left,
 
78
  .settings-column.right {
79
  width: 100%;
80
  }
81
  }
82
 
 
 
 
 
 
 
 
 
 
 
83
  /**
84
  * Generate Stylesheet-form
85
  */
86
+ .omgf-generate-stylesheet table {
87
+ margin-top: .66em;
88
+ }
89
+
90
+ .omgf-search-section {
91
+ margin-top: 1em;
92
+ }
93
 
94
  #omgf-search {
95
  line-height: 38px;
97
  padding: 3px 10px;
98
  }
99
 
100
+ .omgf-search-section caption {
101
+ text-align: left;
102
+ font-size: 1.2em;
103
+ font-weight: 600;
104
+ margin: 0.66em 0 0.33em;
105
+ }
106
+
107
  .omgf-loading {
108
  position: absolute;
109
  width: 100%;
host-webfonts-local.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
6
  * Description: Minimize DNS requests and leverage browser cache by easily saving Google Fonts to your server and removing the external Google Fonts.
7
- * Version: 3.1.2
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
@@ -20,7 +20,7 @@ defined('ABSPATH') || exit;
20
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
21
  define('OMGF_PLUGIN_FILE', __FILE__);
22
  define('OMGF_DB_VERSION', '3.0.0');
23
- define('OMGF_STATIC_VERSION', '3.1.2');
24
  define('OMGF_WEB_FONT_LOADER_VERSION', '1.6.26');
25
 
26
  /**
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://daan.dev/wordpress-plugins/host-google-fonts-locally
6
  * Description: Minimize DNS requests and leverage browser cache by easily saving Google Fonts to your server and removing the external Google Fonts.
7
+ * Version: 3.1.3
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
20
  define('OMGF_PLUGIN_DIR', plugin_dir_path(__FILE__));
21
  define('OMGF_PLUGIN_FILE', __FILE__);
22
  define('OMGF_DB_VERSION', '3.0.0');
23
+ define('OMGF_STATIC_VERSION', '3.1.3');
24
  define('OMGF_WEB_FONT_LOADER_VERSION', '1.6.26');
25
 
26
  /**
includes/admin/class-auto-detect.php CHANGED
@@ -39,48 +39,51 @@ class OMGF_Admin_AutoDetect
39
  }
40
 
41
  /**
42
- * Initialize Auto Detect.
43
  */
44
  private function init()
45
  {
46
  $font_properties = $this->extract_font_properties($this->detected_fonts);
47
 
48
- $fonts = $this->build_subsets_array($font_properties);
49
-
50
- // Fetch available font styles from API, except for default WordPress Admin fonts.
51
- foreach ($fonts as $index => &$font) {
52
- if (($index == 0 && $font['subset_font'] == 'open-sans') || ($index == 1 && $font['subset_font'] == 'noto-serif')) {
53
- unset($fonts[$index]);
54
 
 
 
55
  continue;
56
  }
57
 
58
  $font_styles[$font['subset_font']] = $this->api->get_font_styles($font['subset_font'], implode(',', $font['selected_subsets']));
 
 
 
59
  }
60
 
61
- update_option(OMGF_Admin_Settings::OMGF_SETTING_SUBSETS, $fonts);
62
 
63
  // Match used styles with available styles.
64
- foreach ($fonts as $subset) {
65
  $used_styles[] = $this->process_used_styles($subset['used_styles'], $font_styles[$subset['subset_font']]);
66
  }
67
 
68
  if (isset($used_styles)) {
69
- $detected_fonts = array_merge(...$used_styles);
70
 
71
- update_option(OMGF_Admin_Settings::OMGF_SETTING_FONTS, $detected_fonts);
72
  }
73
 
74
  /** It only needs to run once. */
75
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_AUTO_DETECTION_ENABLED);
76
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_DETECTED_FONTS);
77
 
78
- if (empty($fonts)) {
79
- OMGF_Admin_Notice::set_notice(__('Auto-detection completed successfully, but no Google Fonts were found.', 'host-webfonts-local'), false, 'warning');
80
 
81
  OMGF_Admin_Notice::set_notice(sprintf(__('Your theme (or plugin) might be using unconventional methods (or Web Font Loader) to load Google Fonts. For a custom integration to load your Google Fonts locally, <a href="%s" target="_blank">hire me</a> or <a href="%s" target="_blank">contact me</a> when in doubt.', 'host-webfonts-local'), 'https://woosh.dev/wordpress-services/omgf-expert-configuration/', OMGF_SITE_URL . '/contact'), false, 'info');
82
  } else {
83
- OMGF_Admin_Notice::set_notice(__('Auto-detection completed. Please check the results and proceed to download the fonts and generate the stylesheet.', 'host-webfonts-local'), false);
 
 
 
84
  }
85
  }
86
 
@@ -98,6 +101,14 @@ class OMGF_Admin_AutoDetect
98
  foreach ($fontSource as $source) {
99
  $parts = parse_url($source);
100
 
 
 
 
 
 
 
 
 
101
  parse_str($parts['query'], $font_properties[]);
102
 
103
  /**
@@ -150,14 +161,14 @@ class OMGF_Admin_AutoDetect
150
  }
151
 
152
  /**
153
- * @param $usedStyles
154
- * @param $availableStyles
155
  *
156
  * @return array
157
  */
158
- private function process_used_styles($usedStyles, $availableStyles)
159
  {
160
- foreach ($usedStyles as &$style) {
161
  $fontWeight = preg_replace('/[^0-9]/', '', $style);
162
  $fontStyle = preg_replace('/[^a-zA-Z]/', '', $style);
163
 
@@ -169,11 +180,11 @@ class OMGF_Admin_AutoDetect
169
  }
170
 
171
  return array_filter(
172
- $availableStyles,
173
- function ($style) use ($usedStyles) {
174
  $fontStyle = $style['font_weight'] . ($style['font_style'] !== 'normal' ? $style['font_style'] : '');
175
 
176
- return in_array($fontStyle, $usedStyles);
177
  }
178
  );
179
  }
39
  }
40
 
41
  /**
42
+ * Run Auto Detect.
43
  */
44
  private function init()
45
  {
46
  $font_properties = $this->extract_font_properties($this->detected_fonts);
47
 
48
+ $subsets = $this->build_subsets_array($font_properties);
 
 
 
 
 
49
 
50
+ foreach ($subsets as $index => &$font) {
51
+ if (!is_numeric($index)) {
52
  continue;
53
  }
54
 
55
  $font_styles[$font['subset_font']] = $this->api->get_font_styles($font['subset_font'], implode(',', $font['selected_subsets']));
56
+
57
+ $subsets[$font['subset_font']] = $font;
58
+ unset($subsets[$index]);
59
  }
60
 
61
+ update_option(OMGF_Admin_Settings::OMGF_SETTING_SUBSETS, $subsets);
62
 
63
  // Match used styles with available styles.
64
+ foreach ($subsets as $subset) {
65
  $used_styles[] = $this->process_used_styles($subset['used_styles'], $font_styles[$subset['subset_font']]);
66
  }
67
 
68
  if (isset($used_styles)) {
69
+ $detected_font_styles = array_merge(...$used_styles);
70
 
71
+ update_option(OMGF_Admin_Settings::OMGF_SETTING_FONTS, $detected_font_styles);
72
  }
73
 
74
  /** It only needs to run once. */
75
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_AUTO_DETECTION_ENABLED);
76
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_DETECTED_FONTS);
77
 
78
+ if (empty($subsets)) {
79
+ OMGF_Admin_Notice::set_notice(__('Auto Detect completed successfully, but no Google Fonts were found.', 'host-webfonts-local'), false, 'warning');
80
 
81
  OMGF_Admin_Notice::set_notice(sprintf(__('Your theme (or plugin) might be using unconventional methods (or Web Font Loader) to load Google Fonts. For a custom integration to load your Google Fonts locally, <a href="%s" target="_blank">hire me</a> or <a href="%s" target="_blank">contact me</a> when in doubt.', 'host-webfonts-local'), 'https://woosh.dev/wordpress-services/omgf-expert-configuration/', OMGF_SITE_URL . '/contact'), false, 'info');
82
  } else {
83
+ $count_subsets = count($subsets);
84
+ $count_fonts = count($detected_font_styles);
85
+
86
+ OMGF_Admin_Notice::set_notice(__("Auto Detect found $count_subsets subsets and $count_fonts font styles. Please check the results and proceed to download the fonts and generate the stylesheet.", 'host-webfonts-local'), false);
87
  }
88
  }
89
 
101
  foreach ($fontSource as $source) {
102
  $parts = parse_url($source);
103
 
104
+ /**
105
+ * Skip over default Admin WordPress fonts; Noto Serif and Open Sans, which are always detected first (as far as I know.)
106
+ * We check on iteration value, to make sure these fonts are still returned if they are also used in the theme.
107
+ */
108
+ if (($i == 0 && strpos($parts['query'], 'Open+Sans') !== false) || ($i == 0 && strpos($parts['query'], 'Noto+Serif') !== false)) {
109
+ continue;
110
+ }
111
+
112
  parse_str($parts['query'], $font_properties[]);
113
 
114
  /**
161
  }
162
 
163
  /**
164
+ * @param $used_styles
165
+ * @param $available_styles
166
  *
167
  * @return array
168
  */
169
+ private function process_used_styles($used_styles, $available_styles)
170
  {
171
+ foreach ($used_styles as &$style) {
172
  $fontWeight = preg_replace('/[^0-9]/', '', $style);
173
  $fontStyle = preg_replace('/[^a-zA-Z]/', '', $style);
174
 
180
  }
181
 
182
  return array_filter(
183
+ $available_styles,
184
+ function ($style) use ($used_styles) {
185
  $fontStyle = $style['font_weight'] . ($style['font_style'] !== 'normal' ? $style['font_style'] : '');
186
 
187
+ return in_array($fontStyle, $used_styles);
188
  }
189
  );
190
  }
includes/admin/class-settings.php CHANGED
@@ -92,24 +92,35 @@ class OMGF_Admin_Settings extends OMGF_Admin
92
  <div class="wrap">
93
  <h1><?php _e('OMGF | Optimize My Google Fonts', 'host-webfonts-local'); ?></h1>
94
 
95
- <form id="omgf-fonts-form" class="settings-column left" name="omgf-fonts-form">
96
- <?php
97
- $this->get_template('generate-stylesheet');
98
- ?>
99
- </form>
100
-
101
- <form id="omgf-settings-form" class="settings-column center" name="omgf-settings-form" method="post" action="options.php">
102
- <?php
103
- settings_fields(OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_ADVANCED);
104
- do_settings_sections(OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_ADVANCED);
105
-
106
- $this->get_template('advanced-settings');
107
-
108
- do_action('omgf_after_settings_form_settings');
109
-
110
- submit_button();
111
- ?>
112
- </form>
 
 
 
 
 
 
 
 
 
 
 
113
 
114
  <div class="settings-column right">
115
  <?php $this->get_template('welcome'); ?>
92
  <div class="wrap">
93
  <h1><?php _e('OMGF | Optimize My Google Fonts', 'host-webfonts-local'); ?></h1>
94
 
95
+ <p class="about-description">
96
+ <?= get_plugin_data(OMGF_PLUGIN_FILE)['Description']; ?>
97
+ </p>
98
+
99
+ <div class="settings-column left">
100
+ <div class="omgf-nav">
101
+ <span class="generate-stylesheet dashicons-before dashicons-admin-appearance selected"><?php _e('Generate Stylesheet', 'host-webfonts-local'); ?></span>
102
+ <span class="advanced-settings dashicons-before dashicons-admin-settings"><?php _e('Advanced Settings', 'host-webfonts-local'); ?></span>
103
+ </div>
104
+
105
+ <form id="omgf-generate-stylesheet-form" name="omgf-generate-stylesheet-form" style="display: block;">
106
+ <?php
107
+ $this->get_template('generate-stylesheet');
108
+ ?>
109
+ </form>
110
+
111
+ <form id="omgf-advanced-settings-form" name="omgf-settings-form" method="post" action="options.php" style="display: none;">
112
+ <?php
113
+ settings_fields(OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_ADVANCED);
114
+ do_settings_sections(OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_ADVANCED);
115
+
116
+ $this->get_template('advanced-settings');
117
+
118
+ do_action('omgf_after_settings_form_settings');
119
+
120
+ submit_button();
121
+ ?>
122
+ </form>
123
+ </div>
124
 
125
  <div class="settings-column right">
126
  <?php $this->get_template('welcome'); ?>
includes/class-ajax.php CHANGED
@@ -69,7 +69,7 @@ class OMGF_AJAX
69
  continue;
70
  }
71
 
72
- $response[] = $subsets;
73
  }
74
 
75
  $option_subsets = array_merge($option_subsets, $response);
@@ -88,7 +88,7 @@ class OMGF_AJAX
88
 
89
  $url = get_permalink(get_posts()[0]->ID);
90
 
91
- OMGF_Admin_Notice::set_notice(__("Auto-detection mode enabled. Open any page on your frontend (e.g. your <a href='$url' target='_blank'>latest post</a>). After the page is fully loaded, return here and <a href='javascript:location.reload()'>click here</a> to refresh this page.", "host-webfonts-local"));
92
  }
93
 
94
  /**
@@ -104,6 +104,11 @@ class OMGF_AJAX
104
 
105
  $search_google_fonts = $_POST['search_google_fonts'];
106
 
 
 
 
 
 
107
  $subsets = get_option(OMGF_Admin_Settings::OMGF_SETTING_SUBSETS);
108
 
109
  // Unset subsets which were checked before, but aren't now.
69
  continue;
70
  }
71
 
72
+ $response[$subsets['subset_font']] = $subsets;
73
  }
74
 
75
  $option_subsets = array_merge($option_subsets, $response);
88
 
89
  $url = get_permalink(get_posts()[0]->ID);
90
 
91
+ OMGF_Admin_Notice::set_notice(__("Auto Detect enabled. Open any page on your frontend (e.g. your <a href='$url' target='_blank'>latest post</a>). After the page is fully loaded, return here and <a href='javascript:location.reload()'>click here</a> to refresh this page.", "host-webfonts-local"));
92
  }
93
 
94
  /**
104
 
105
  $search_google_fonts = $_POST['search_google_fonts'];
106
 
107
+ foreach ($search_google_fonts as $index => $google_font) {
108
+ $search_google_fonts[$google_font['subset_font']] = $google_font;
109
+ unset($search_google_fonts[$index]);
110
+ }
111
+
112
  $subsets = get_option(OMGF_Admin_Settings::OMGF_SETTING_SUBSETS);
113
 
114
  // Unset subsets which were checked before, but aren't now.
js/omgf-admin.js CHANGED
@@ -28,6 +28,13 @@ jQuery(document).ready(function ($) {
28
  preload_font_styles: [],
29
  font_style_list: [],
30
 
 
 
 
 
 
 
 
31
  // Selectors
32
  $loader: $('.omgf-loading'),
33
  $font_families: $('.omgf-subset-font-family'),
@@ -42,6 +49,9 @@ jQuery(document).ready(function ($) {
42
  * Initialize all on click events.
43
  */
44
  init: function () {
 
 
 
45
  // Generate Stylesheet Section
46
  this.$subsets.on('click', function () { setTimeout(omgf_admin.search_google_fonts, this.timeout)});
47
  this.$preload_font_styles.on('click', function() { setTimeout(omgf_admin.preload_font_style, this.timeout)});
@@ -55,6 +65,19 @@ jQuery(document).ready(function ($) {
55
  $('#omgf-empty').on('click', this.empty_cache_directory);
56
  },
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  /**
59
  * Triggered when Search is clicked.
60
  */
28
  preload_font_styles: [],
29
  font_style_list: [],
30
 
31
+ // Settings screen elements
32
+ $nav: $('.omgf-nav span'),
33
+ $nav_generate_stylesheet: $('.generate-stylesheet'),
34
+ $nav_advanced_settings: $('.advanced-settings'),
35
+ $generate_stylesheet_form: $('#omgf-generate-stylesheet-form'),
36
+ $advanced_settings_form: $('#omgf-advanced-settings-form'),
37
+
38
  // Selectors
39
  $loader: $('.omgf-loading'),
40
  $font_families: $('.omgf-subset-font-family'),
49
  * Initialize all on click events.
50
  */
51
  init: function () {
52
+ // Nav
53
+ this.$nav.on('click', this.toggle_section);
54
+
55
  // Generate Stylesheet Section
56
  this.$subsets.on('click', function () { setTimeout(omgf_admin.search_google_fonts, this.timeout)});
57
  this.$preload_font_styles.on('click', function() { setTimeout(omgf_admin.preload_font_style, this.timeout)});
65
  $('#omgf-empty').on('click', this.empty_cache_directory);
66
  },
67
 
68
+ toggle_section: function () {
69
+ omgf_admin.$nav.removeClass('selected');
70
+ $(this).addClass('selected');
71
+
72
+ if (this.classList.contains('generate-stylesheet')) {
73
+ omgf_admin.$generate_stylesheet_form.fadeIn();
74
+ omgf_admin.$advanced_settings_form.fadeOut(100);
75
+ } else {
76
+ omgf_admin.$advanced_settings_form.fadeIn();
77
+ omgf_admin.$generate_stylesheet_form.fadeOut(100);
78
+ }
79
+ },
80
+
81
  /**
82
  * Triggered when Search is clicked.
83
  */
readme.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: DaanvandenBergh
3
  Tags: google, fonts, preload, font-display, webfonts, subsets, remove, minimize, external, requests, leverage, browser, cache
4
  Requires at least: 4.6
5
  Tested up to: 5.4
6
- Stable tag: 3.1.2
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -105,6 +105,10 @@ N/A
105
 
106
  == Changelog ==
107
 
 
 
 
 
108
  = 3.1.2 =
109
  * Comma-separated search now works better (supports ',' as well as ', ')
110
  * Search results are now added to the old subsets results. Allowing for more flexible search.
3
  Tags: google, fonts, preload, font-display, webfonts, subsets, remove, minimize, external, requests, leverage, browser, cache
4
  Requires at least: 4.6
5
  Tested up to: 5.4
6
+ Stable tag: 3.1.3
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
105
 
106
  == Changelog ==
107
 
108
+ = 3.1.3 =
109
+ * Added toggleable navigation menu. Made it a bit more UX friendly.
110
+ * Enhanced search and auto-detect: search results of one, are now appended to the result of the other. Also, duplicate search queries are now filtered, so they will not return duplicate subset results.
111
+
112
  = 3.1.2 =
113
  * Comma-separated search now works better (supports ',' as well as ', ')
114
  * Search results are now added to the old subsets results. Allowing for more flexible search.
templates/admin/block-advanced-settings.phtml CHANGED
@@ -19,12 +19,48 @@ defined('ABSPATH') || exit;
19
  $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
20
  ?>
21
  <div class="">
22
- <h3><?php _e('Advanced Settings', 'host-webfonts-local'); ?></h3>
23
  <p class="description">
24
- <?php _e('* Re-generate stylesheet after changing this setting.', 'host-webfonts-local'); ?><br />
 
 
 
 
 
25
  <?php _e('** Empty Cache Directory, Download Fonts and Generate Stylesheet after changing this setting.', 'host-webfonts-local'); ?>
26
  </p>
27
  <table class="form-table">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  <tr valign="top">
29
  <th scope="row">
30
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_PATH; ?>">
@@ -103,38 +139,6 @@ $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
103
  </p>
104
  </td>
105
  </tr>
106
- <tr valign="top">
107
- <th scope="row">
108
- <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION; ?>">
109
- <?php _e('Font-display option', 'host-webfonts-local'); ?> *
110
- </label>
111
- </th>
112
- <td>
113
- <select id="<?= OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION; ?>" name="<?= OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION; ?>">
114
- <?php foreach (OMGF_Admin_Settings::OMGF_FONT_DISPLAY_OPTIONS as $label => $value): ?>
115
- <option value="<?= $value; ?>" <?= $value == OMGF_DISPLAY_OPTION ? 'selected' : ''; ?>><?php _e($label, 'host-webfonts-local'); ?></option>
116
- <?php endforeach; ?>
117
- </select>
118
- <br/>
119
- <p class="description">
120
- <?php _e('Select which font-display strategy to use. Defaults to \'Auto\'.', 'host-webfonts-local'); ?>
121
- <a target="_blank" href="https://developers.google.com/web/updates/2016/02/font-display"><?php _e('Read more', 'host-webfonts-local'); ?></a>
122
- </p>
123
- </td>
124
- </tr>
125
- <tr valign="top">
126
- <th scope="row">
127
- <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>">
128
- <?php _e('Remove Google Fonts (experimental)', 'host-webfonts-local'); ?>
129
- </label>
130
- </th>
131
- <td>
132
- <input class="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>" id="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>" type="checkbox" name="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>" <?= OMGF_REMOVE_GFONTS == 'on' ? 'checked = "checked"' : ''; ?> />
133
- <p class="description">
134
- <?= sprintf(__('Enabling this option will attempt to remove any externally hosted Google Fonts-stylesheets from your WordPress-blog. If it doesn\'t work for you, click %shere%s for a more comprehensive guide.', 'host-webfonts-local'), '<a target="_blank" href="' . OMGF_SITE_URL . '/how-to/remove-google-fonts-wordpress/' . $utmTags . '">', '</a>'); ?>
135
- </p>
136
- </td>
137
- </tr>
138
  <tr valign="top">
139
  <th scope="row">
140
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_ENABLE_PRELOAD; ?>">
19
  $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
20
  ?>
21
  <div class="">
 
22
  <p class="description">
23
+ <strong><?= __('Make sure you\'ve saved your settings, before generating the stylesheet!', 'host-webfonts-local'); ?></strong>
24
+ </p>
25
+ <p class="description">
26
+ <?php _e('* Re-generate stylesheet after changing this setting.', 'host-webfonts-local'); ?>
27
+ </p>
28
+ <p class="description">
29
  <?php _e('** Empty Cache Directory, Download Fonts and Generate Stylesheet after changing this setting.', 'host-webfonts-local'); ?>
30
  </p>
31
  <table class="form-table">
32
+ <tr valign="top">
33
+ <th scope="row">
34
+ <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>">
35
+ <?php _e('Remove Google Fonts (experimental)', 'host-webfonts-local'); ?>
36
+ </label>
37
+ </th>
38
+ <td>
39
+ <input class="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>" id="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>" type="checkbox" name="<?= OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS; ?>" <?= OMGF_REMOVE_GFONTS == 'on' ? 'checked = "checked"' : ''; ?> />
40
+ <p class="description">
41
+ <?= sprintf(__('Enabling this option will attempt to remove any externally hosted Google Fonts-stylesheets from your WordPress-blog. If it doesn\'t work for you, your theme and/or plugin(s) are using unconventional methods (or Web Font Loader) to load Google Fonts. <a href="%s" target="_blank">Hire me</a> for a custom integration or <a href="%s" target="_blank">contact me</a> when in doubt.', 'host-webfonts-local'), 'https://woosh.dev/wordpress-services/omgf-expert-configuration/' . $utmTags, OMGF_SITE_URL . '/contact/' . $utmTags); ?>
42
+ </p>
43
+ </td>
44
+ </tr>
45
+ <tr valign="top">
46
+ <th scope="row">
47
+ <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION; ?>">
48
+ <?php _e('Font-display option', 'host-webfonts-local'); ?> *
49
+ </label>
50
+ </th>
51
+ <td>
52
+ <select id="<?= OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION; ?>" name="<?= OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION; ?>">
53
+ <?php foreach (OMGF_Admin_Settings::OMGF_FONT_DISPLAY_OPTIONS as $label => $value): ?>
54
+ <option value="<?= $value; ?>" <?= $value == OMGF_DISPLAY_OPTION ? 'selected' : ''; ?>><?php _e($label, 'host-webfonts-local'); ?></option>
55
+ <?php endforeach; ?>
56
+ </select>
57
+ <br/>
58
+ <p class="description">
59
+ <?php _e('Select which font-display strategy to use. Defaults to \'Auto\'.', 'host-webfonts-local'); ?>
60
+ <a target="_blank" href="https://developers.google.com/web/updates/2016/02/font-display"><?php _e('Read more', 'host-webfonts-local'); ?></a>
61
+ </p>
62
+ </td>
63
+ </tr>
64
  <tr valign="top">
65
  <th scope="row">
66
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_PATH; ?>">
139
  </p>
140
  </td>
141
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
142
  <tr valign="top">
143
  <th scope="row">
144
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_ENABLE_PRELOAD; ?>">
templates/admin/block-generate-stylesheet.phtml CHANGED
@@ -16,12 +16,16 @@
16
 
17
  defined('ABSPATH') || exit;
18
 
19
- $db = new OMGF_DB();
20
  $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
21
  ?>
22
  <div class="omgf-generate-stylesheet">
23
- <h3><?php _e('Generate Stylesheet', 'host-webfonts-local'); ?></h3>
24
-
 
 
 
 
25
  <div class="omgf-search-section">
26
  <div class="omgf-search-box">
27
  <input type="text" id="omgf-search" class="form-input-tip ui-autocomplete-input" placeholder="<?php _e('Search... [e.g. Roboto, Open Sans, Poppins]', 'host-webfonts-local'); ?>" />
@@ -29,9 +33,7 @@ $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
29
  <input type="button" id="omgf-auto-detect" class="button button-secondary button-hero" value="<?= __('Auto Detect', 'host-webfonts-local'); ?>" />
30
  </div>
31
  <table>
32
- <tr id="row" valign="top">
33
- <th align="left" colspan="3"><?php _e('Available subsets', 'host-webfonts-local'); ?></th>
34
- </tr>
35
  <tbody id="omgf-subsets">
36
  <?php
37
  $subsetFonts = $db->get_subsets();
@@ -64,12 +66,8 @@ $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
64
  <?php endif; ?>
65
  </tbody>
66
  </table>
67
- <table>
68
- <tr valign="top">
69
- <th align="left" colspan="3"><?php _e('Available fonts', 'host-webfonts-local'); ?></th>
70
- </tr>
71
- </table>
72
  <table id="omgf-font-styles-list">
 
73
  <?php
74
  $savedFonts = $db->get_total_fonts();
75
  ?>
@@ -106,7 +104,7 @@ $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
106
  <td align="center" style="width: 75px;">
107
  <input type="checkbox" class="omgf-font-preload" data-preload="<?= $fontId; ?>" value="1" <?= $font['preload'] == 1 ? 'checked' : ''; ?> />
108
  </td>
109
- <td>
110
  <input type="hidden" value="<?= $fontId; ?>" />
111
  <input type="hidden" value="<?= $font['local']; ?>" />
112
  <input type="hidden" value="<?= $font['url_ttf']; ?>" />
16
 
17
  defined('ABSPATH') || exit;
18
 
19
+ $db = new OMGF_DB();
20
  $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
21
  ?>
22
  <div class="omgf-generate-stylesheet">
23
+ <p class="description">
24
+ <?= __('<strong>Search</strong> returns all available subsets and font styles for each font family. <strong>Auto Detect</strong> only returns subsets and font styles that\'re used by your installed theme and plugins.', 'host-webfonts-local'); ?>
25
+ </p>
26
+ <p class="description">
27
+ <?= __('You can <strong>Search</strong> by either using a comma separated list (e.g. Open Sans, Poppins, Roboto) or by searching for each font family one by one.', 'host-webfonts-local'); ?>
28
+ </p>
29
  <div class="omgf-search-section">
30
  <div class="omgf-search-box">
31
  <input type="text" id="omgf-search" class="form-input-tip ui-autocomplete-input" placeholder="<?php _e('Search... [e.g. Roboto, Open Sans, Poppins]', 'host-webfonts-local'); ?>" />
33
  <input type="button" id="omgf-auto-detect" class="button button-secondary button-hero" value="<?= __('Auto Detect', 'host-webfonts-local'); ?>" />
34
  </div>
35
  <table>
36
+ <caption><?php _e('Available subsets', 'host-webfonts-local'); ?></caption>
 
 
37
  <tbody id="omgf-subsets">
38
  <?php
39
  $subsetFonts = $db->get_subsets();
66
  <?php endif; ?>
67
  </tbody>
68
  </table>
 
 
 
 
 
69
  <table id="omgf-font-styles-list">
70
+ <caption><?php _e('Available font styles', 'host-webfonts-local'); ?></caption>
71
  <?php
72
  $savedFonts = $db->get_total_fonts();
73
  ?>
104
  <td align="center" style="width: 75px;">
105
  <input type="checkbox" class="omgf-font-preload" data-preload="<?= $fontId; ?>" value="1" <?= $font['preload'] == 1 ? 'checked' : ''; ?> />
106
  </td>
107
+ <td style="width: 75px;">
108
  <input type="hidden" value="<?= $fontId; ?>" />
109
  <input type="hidden" value="<?= $font['local']; ?>" />
110
  <input type="hidden" value="<?= $font['url_ttf']; ?>" />