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

Version Description

  • OMGF can now rewrite the URI from where fonts are served using the 'Serve webfonts from...' setting. This is particularly useful when using seurity through obscurity (e.g. WP Hide)
  • Fixed bug where clicking 'save changes' would remove listed fonts and subsets.
  • Gave some settings more accurate descriptions.
Download this release

Release Info

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

Code changes from version 3.0.1 to 3.1.0

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.0.1
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
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.0
8
  * Author: Daan van den Bergh
9
  * Author URI: https://daan.dev
10
  * License: GPL2v2 or later
includes/admin/class-settings.php CHANGED
@@ -18,6 +18,7 @@ defined('ABSPATH') || exit;
18
 
19
  class OMGF_Admin_Settings extends OMGF_Admin
20
  {
 
21
  const OMGF_FONT_DISPLAY_OPTIONS = array(
22
  'Auto (default)' => 'auto',
23
  'Block' => 'block',
@@ -29,7 +30,8 @@ class OMGF_Admin_Settings extends OMGF_Admin
29
  const OMGF_SETTING_SUBSETS = 'omgf_subsets';
30
  const OMGF_SETTING_FONTS = 'omgf_fonts';
31
  const OMGF_SETTING_DETECTED_FONTS = 'omgf_detected_fonts';
32
- const OMGF_SETTING_CACHE_DIR = 'omgf_cache_dir';
 
33
  const OMGF_SETTING_CDN_URL = 'omgf_cdn_url';
34
  const OMGF_SETTING_WEB_FONT_LOADER = 'omgf_web_font_loader';
35
  const OMGF_SETTING_REMOVE_VERSION = 'omgf_remove_version';
@@ -52,6 +54,7 @@ class OMGF_Admin_Settings extends OMGF_Admin
52
  $caosLink = plugin_basename(OMGF_PLUGIN_FILE);
53
 
54
  add_filter("plugin_action_links_$caosLink", array($this, 'create_settings_link'));
 
55
  // @formatter:on
56
 
57
  parent::__construct();
@@ -89,18 +92,18 @@ class OMGF_Admin_Settings extends OMGF_Admin
89
  <div class="wrap">
90
  <h1><?php _e('OMGF | Optimize My Google Fonts', 'host-webfonts-local'); ?></h1>
91
 
92
- <form id="omgf-options-form" class="settings-column left" name="omgf-options-form" method="post">
93
- <div class="">
94
- <?php $this->get_template('generate-stylesheet'); ?>
95
- </div>
96
  </form>
97
 
98
  <form id="omgf-settings-form" class="settings-column center" name="omgf-settings-form" method="post" action="options.php">
99
  <?php
100
- settings_fields('omgf-basic-settings');
101
- do_settings_sections('omgf-basic-settings');
102
 
103
- $this->get_template('basic-settings');
104
 
105
  do_action('omgf_after_settings_form_settings');
106
 
@@ -125,7 +128,7 @@ class OMGF_Admin_Settings extends OMGF_Admin
125
  foreach ($this->get_settings() as $constant => $value)
126
  {
127
  register_setting(
128
- 'omgf-basic-settings',
129
  $value
130
  );
131
  }
@@ -145,6 +148,28 @@ class OMGF_Admin_Settings extends OMGF_Admin
145
  return $links;
146
  }
147
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
148
  /**
149
  * Get all settings using the constants in this class.
150
  *
18
 
19
  class OMGF_Admin_Settings extends OMGF_Admin
20
  {
21
+ const OMGF_SETTINGS_FIELD_ADVANCED = 'omgf-advanced-settings';
22
  const OMGF_FONT_DISPLAY_OPTIONS = array(
23
  'Auto (default)' => 'auto',
24
  'Block' => 'block',
30
  const OMGF_SETTING_SUBSETS = 'omgf_subsets';
31
  const OMGF_SETTING_FONTS = 'omgf_fonts';
32
  const OMGF_SETTING_DETECTED_FONTS = 'omgf_detected_fonts';
33
+ const OMGF_SETTING_CACHE_PATH = 'omgf_cache_dir';
34
+ const OMGF_SETTING_CACHE_URI = 'omgf_cache_uri';
35
  const OMGF_SETTING_CDN_URL = 'omgf_cdn_url';
36
  const OMGF_SETTING_WEB_FONT_LOADER = 'omgf_web_font_loader';
37
  const OMGF_SETTING_REMOVE_VERSION = 'omgf_remove_version';
54
  $caosLink = plugin_basename(OMGF_PLUGIN_FILE);
55
 
56
  add_filter("plugin_action_links_$caosLink", array($this, 'create_settings_link'));
57
+ add_filter('whitelist_options', [$this, 'remove_settings_from_whitelist'], 100);
58
  // @formatter:on
59
 
60
  parent::__construct();
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
 
128
  foreach ($this->get_settings() as $constant => $value)
129
  {
130
  register_setting(
131
+ OMGF_Admin_Settings::OMGF_SETTINGS_FIELD_ADVANCED,
132
  $value
133
  );
134
  }
148
  return $links;
149
  }
150
 
151
+ /**
152
+ * Preserve fonts and subsets when saving changes.
153
+ *
154
+ * @param $options
155
+ *
156
+ * @return array
157
+ */
158
+ public function remove_settings_from_whitelist($options)
159
+ {
160
+ if (!isset($options[self::OMGF_SETTINGS_FIELD_ADVANCED])) {
161
+ return $options;
162
+ }
163
+
164
+ foreach ($options[self::OMGF_SETTINGS_FIELD_ADVANCED] as $key => &$setting) {
165
+ if ($setting == self::OMGF_SETTING_FONTS || $setting == self::OMGF_SETTING_SUBSETS) {
166
+ unset($options[self::OMGF_SETTINGS_FIELD_ADVANCED][$key]);
167
+ }
168
+ }
169
+
170
+ return $options;
171
+ }
172
+
173
  /**
174
  * Get all settings using the constants in this class.
175
  *
includes/ajax/class-download.php CHANGED
@@ -53,7 +53,7 @@ class OMGF_AJAX_Download extends OMGF_AJAX
53
  */
54
  private function create_dir_recursive()
55
  {
56
- $uploadDir = OMGF_UPLOAD_DIR;
57
  if (!file_exists($uploadDir)) {
58
  wp_mkdir_p($uploadDir);
59
  }
@@ -99,18 +99,18 @@ class OMGF_AJAX_Download extends OMGF_AJAX
99
  * We rewrite the local filename for easier debugging in the waterfall.
100
  */
101
  $filename = sanitize_title_with_dashes($font['font_family']) . '-' . $font['font_weight'] . '-' . $font['font_style'] . '-' . substr(basename($remoteFile), -10);
102
- $localFile = OMGF_UPLOAD_DIR . '/' . $filename;
103
 
104
  try {
105
  $this->download_file($localFile, $remoteFile);
106
  $font['downloaded'] = 1;
107
  } catch (Exception $e) {
108
- OMGF_Admin_Notice::set_notice(__("File ($remoteFile) could not be downloaded: ", 'host-webfonts-local') . $e->getMessage(), 'error', $e->getCode());
109
  }
110
 
111
  clearstatcache();
112
 
113
- $font[$type] = OMGF_UPLOAD_URL . '/' . $filename;
114
  }
115
  }
116
 
53
  */
54
  private function create_dir_recursive()
55
  {
56
+ $uploadDir = OMGF_FONTS_DIR;
57
  if (!file_exists($uploadDir)) {
58
  wp_mkdir_p($uploadDir);
59
  }
99
  * We rewrite the local filename for easier debugging in the waterfall.
100
  */
101
  $filename = sanitize_title_with_dashes($font['font_family']) . '-' . $font['font_weight'] . '-' . $font['font_style'] . '-' . substr(basename($remoteFile), -10);
102
+ $localFile = OMGF_FONTS_DIR . '/' . $filename;
103
 
104
  try {
105
  $this->download_file($localFile, $remoteFile);
106
  $font['downloaded'] = 1;
107
  } catch (Exception $e) {
108
+ OMGF_Admin_Notice::set_notice(__("File ($remoteFile) could not be downloaded: ", 'host-webfonts-local') . $e->getMessage(), false, 'error', $e->getCode());
109
  }
110
 
111
  clearstatcache();
112
 
113
+ $font[$type] = OMGF_FONTS_URL . '/' . $filename;
114
  }
115
  }
116
 
includes/ajax/class-generate.php CHANGED
@@ -49,10 +49,10 @@ class OMGF_AJAX_Generate extends OMGF_AJAX
49
  $this->process_fonts($selectedFonts);
50
 
51
  $fonts = implode("\n", $this->fonts);
52
- $file = OMGF_UPLOAD_DIR . '/' . OMGF_FILENAME;
53
 
54
  /**
55
- * If the file can be created and uploaded. Let's try to write it.
56
  */
57
  try {
58
  $stylesheet = fopen($file, 'w') or OMGF_Admin_Notice::set_notice(__("Cannot create file {$file}", 'host-webfonts-local', true, 'error', 400));
49
  $this->process_fonts($selectedFonts);
50
 
51
  $fonts = implode("\n", $this->fonts);
52
+ $file = OMGF_FONTS_DIR . '/' . OMGF_FILENAME;
53
 
54
  /**
55
+ * If the file can be created and written. Let's try to write it.
56
  */
57
  try {
58
  $stylesheet = fopen($file, 'w') or OMGF_Admin_Notice::set_notice(__("Cannot create file {$file}", 'host-webfonts-local', true, 'error', 400));
includes/class-ajax.php CHANGED
@@ -189,7 +189,7 @@ class OMGF_AJAX
189
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_SUBSETS);
190
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_FONTS);
191
 
192
- array_map('unlink', array_filter((array) glob(OMGF_UPLOAD_DIR . '/*')));
193
 
194
  OMGF_Admin_Notice::set_notice(__('Cache directory successfully emptied.', 'host-webfonts-local'));
195
  } catch (\Exception $e) {
189
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_SUBSETS);
190
  delete_option(OMGF_Admin_Settings::OMGF_SETTING_FONTS);
191
 
192
+ array_map('unlink', array_filter((array) glob(OMGF_FONTS_DIR . '/*')));
193
 
194
  OMGF_Admin_Notice::set_notice(__('Cache directory successfully emptied.', 'host-webfonts-local'));
195
  } catch (\Exception $e) {
includes/class-omgf.php CHANGED
@@ -55,20 +55,22 @@ class OMGF
55
  define('OMGF_HELPER_URL', 'https://google-webfonts-helper.herokuapp.com/api/fonts/');
56
  define('OMGF_FILENAME', 'fonts.css');
57
  define('OMGF_AUTO_DETECT_ENABLED', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_AUTO_DETECTION_ENABLED, false)));
58
- define('OMGF_CACHE_DIR', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_CACHE_DIR)) ?: '/cache/omgf-webfonts');
 
59
  define('OMGF_RELATIVE_URL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_RELATIVE_URL)));
60
  define('OMGF_CDN_URL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_CDN_URL)));
61
  define('OMGF_WEB_FONT_LOADER', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_WEB_FONT_LOADER)));
62
  define('OMGF_REMOVE_VERSION', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_REMOVE_VERSION)));
63
  define('OMGF_CURRENT_BLOG_ID', get_current_blog_id());
64
- define('OMGF_UPLOAD_DIR', WP_CONTENT_DIR . OMGF_CACHE_DIR);
65
- define('OMGF_UPLOAD_URL', $this->get_upload_url());
66
  define('OMGF_DISPLAY_OPTION', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION)) ?: 'auto');
67
  define('OMGF_REMOVE_GFONTS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS)));
68
  define('OMGF_PRELOAD', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_ENABLE_PRELOAD)));
69
  define('OMGF_ENQUEUE_ORDER', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_ENQUEUE_ORDER, 100)));
70
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_UNINSTALL)));
71
  }
 
72
  /**
73
  * @return OMGF_Admin_Settings
74
  */
@@ -120,7 +122,7 @@ class OMGF
120
  */
121
  public function create_cache_dir()
122
  {
123
- $uploadDir = OMGF_UPLOAD_DIR;
124
  if (!is_dir($uploadDir)) {
125
  wp_mkdir_p($uploadDir);
126
  }
@@ -141,16 +143,18 @@ class OMGF
141
  /**
142
  * @return string
143
  */
144
- public function get_upload_url()
145
  {
146
- If (OMGF_RELATIVE_URL) {
147
- return '/' . $this->get_content_dir() . OMGF_CACHE_DIR;
148
  }
149
 
150
  if (OMGF_CDN_URL) {
151
- $uploadUrl = '//' . OMGF_CDN_URL . '/' . $this->get_content_dir() . OMGF_CACHE_DIR;
 
 
152
  } else {
153
- $uploadUrl = get_site_url(OMGF_CURRENT_BLOG_ID, $this->get_content_dir() . OMGF_CACHE_DIR);
154
  }
155
 
156
  return $uploadUrl;
55
  define('OMGF_HELPER_URL', 'https://google-webfonts-helper.herokuapp.com/api/fonts/');
56
  define('OMGF_FILENAME', 'fonts.css');
57
  define('OMGF_AUTO_DETECT_ENABLED', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_AUTO_DETECTION_ENABLED, false)));
58
+ define('OMGF_CACHE_PATH', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_CACHE_PATH)) ?: '/cache/omgf-webfonts');
59
+ define('OMGF_CACHE_URI', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_CACHE_URI)) ?: '');
60
  define('OMGF_RELATIVE_URL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_RELATIVE_URL)));
61
  define('OMGF_CDN_URL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_CDN_URL)));
62
  define('OMGF_WEB_FONT_LOADER', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_WEB_FONT_LOADER)));
63
  define('OMGF_REMOVE_VERSION', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_REMOVE_VERSION)));
64
  define('OMGF_CURRENT_BLOG_ID', get_current_blog_id());
65
+ define('OMGF_FONTS_DIR', WP_CONTENT_DIR . OMGF_CACHE_PATH);
66
+ define('OMGF_FONTS_URL', $this->get_fonts_url());
67
  define('OMGF_DISPLAY_OPTION', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION)) ?: 'auto');
68
  define('OMGF_REMOVE_GFONTS', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_REMOVE_GOOGLE_FONTS)));
69
  define('OMGF_PRELOAD', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_ENABLE_PRELOAD)));
70
  define('OMGF_ENQUEUE_ORDER', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_ENQUEUE_ORDER, 100)));
71
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_SETTING_UNINSTALL)));
72
  }
73
+
74
  /**
75
  * @return OMGF_Admin_Settings
76
  */
122
  */
123
  public function create_cache_dir()
124
  {
125
+ $uploadDir = OMGF_FONTS_DIR;
126
  if (!is_dir($uploadDir)) {
127
  wp_mkdir_p($uploadDir);
128
  }
143
  /**
144
  * @return string
145
  */
146
+ public function get_fonts_url()
147
  {
148
+ if (OMGF_RELATIVE_URL) {
149
+ return '/' . $this->get_content_dir() . OMGF_CACHE_PATH;
150
  }
151
 
152
  if (OMGF_CDN_URL) {
153
+ $uploadUrl = '//' . OMGF_CDN_URL . '/' . $this->get_content_dir() . OMGF_CACHE_PATH;
154
+ } elseif (OMGF_CACHE_URI) {
155
+ $uploadUrl = OMGF_CACHE_URI;
156
  } else {
157
+ $uploadUrl = get_site_url(OMGF_CURRENT_BLOG_ID, $this->get_content_dir() . OMGF_CACHE_PATH);
158
  }
159
 
160
  return $uploadUrl;
includes/class-uninstall.php CHANGED
@@ -42,7 +42,7 @@ class OMGF_Uninstall
42
 
43
  $this->wpdb = $wpdb;
44
  $this->options = $settings->get_settings();
45
- $this->cacheDir = OMGF_UPLOAD_DIR;
46
 
47
  $this->remove_db_entries();
48
  $this->delete_files();
42
 
43
  $this->wpdb = $wpdb;
44
  $this->options = $settings->get_settings();
45
+ $this->cacheDir = OMGF_FONTS_DIR;
46
 
47
  $this->remove_db_entries();
48
  $this->delete_files();
includes/frontend/class-functions.php CHANGED
@@ -115,7 +115,7 @@ class OMGF_Frontend_Functions
115
  if (OMGF_WEB_FONT_LOADER) {
116
  $this->get_template('web-font-loader');
117
  } else {
118
- wp_enqueue_style(self::OMGF_STYLE_HANDLE, OMGF_UPLOAD_URL . '/' . OMGF_FILENAME, array(), (OMGF_REMOVE_VERSION ? null : OMGF_STATIC_VERSION));
119
  }
120
  }
121
 
115
  if (OMGF_WEB_FONT_LOADER) {
116
  $this->get_template('web-font-loader');
117
  } else {
118
+ wp_enqueue_style(self::OMGF_STYLE_HANDLE, OMGF_FONTS_URL . '/' . OMGF_FILENAME, array(), (OMGF_REMOVE_VERSION ? null : OMGF_STATIC_VERSION));
119
  }
120
  }
121
 
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.0.1
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -24,7 +24,7 @@ Please keep in mind that, although I try to make the configuration of this plugi
24
 
25
  == Features ==
26
  - *Automatically detect* which Google Fonts your theme is using or,
27
- - Easily find additional fonts in any/multiple subsets,
28
  - Download them and generate a stylesheet, which is automatically added to your header using WordPress' wp_head()-function,
29
  - Change the caching path (where the fonts and stylesheet are saved) for increased compatibility with Multisite environments and Caching- and Security-plugins, such as WP Super Cache, Autoptimize and WordFence,
30
  - Serve your fonts from your CDN,
@@ -105,6 +105,11 @@ N/A
105
 
106
  == Changelog ==
107
 
 
 
 
 
 
108
  = 3.0.1 =
109
  * [BUGFIX] Passing glue string after array is deprecated. Swap the parameters.
110
 
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.0
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
24
 
25
  == Features ==
26
  - *Automatically detect* which Google Fonts your theme is using or,
27
+ - Easily find fonts in multiple subsets,
28
  - Download them and generate a stylesheet, which is automatically added to your header using WordPress' wp_head()-function,
29
  - Change the caching path (where the fonts and stylesheet are saved) for increased compatibility with Multisite environments and Caching- and Security-plugins, such as WP Super Cache, Autoptimize and WordFence,
30
  - Serve your fonts from your CDN,
105
 
106
  == Changelog ==
107
 
108
+ = 3.1.0 =
109
+ * OMGF can now rewrite the URI from where fonts are served using the 'Serve webfonts from...' setting. This is particularly useful when using seurity through obscurity (e.g. WP Hide)
110
+ * Fixed bug where clicking 'save changes' would remove listed fonts and subsets.
111
+ * Gave some settings more accurate descriptions.
112
+
113
  = 3.0.1 =
114
  * [BUGFIX] Passing glue string after array is deprecated. Swap the parameters.
115
 
templates/admin/{block-basic-settings.phtml → block-advanced-settings.phtml} RENAMED
@@ -19,28 +19,42 @@ defined('ABSPATH') || exit;
19
  $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
20
  ?>
21
  <div class="">
22
- <h3><?php _e('Basic Settings', 'host-webfonts-local'); ?></h3>
23
  <p class="description">
24
- <?php _e('* Empty Cache Directory, Download Fonts and Generate Stylesheet after changing this setting.', 'host-webfonts-local'); ?>
 
25
  </p>
26
  <table class="form-table">
27
  <tr valign="top">
28
  <th scope="row">
29
- <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_DIR; ?>">
30
- <?php _e('Save webfonts to...', 'host-webfonts-local'); ?> *
31
  </label>
32
  </th>
33
  <td>
34
- <input id="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_DIR; ?>" class="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_DIR; ?>" type="text" name="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_DIR; ?>" placeholder="<?= __('e.g. /cache/omgf-webfonts', 'host-webfonts-local'); ?>" value="<?= OMGF_CACHE_DIR; ?>"/>
35
  <p class="description">
36
- <?php _e("Changes the path where webfonts are cached inside WordPress' content directory (usually <code>wp-content</code>). If you're using Multisite, give each site a unique cache directory path. Defaults to <code>/cache/omgf-webfonts</code>.", 'host-webfonts-local'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
37
  </p>
38
  </td>
39
  </tr>
40
  <tr valign="top">
41
  <th scope="row">
42
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_RELATIVE_URL; ?>">
43
- <?php _e('Use Relative URLs?', 'host-webfonts-local'); ?> *
44
  </label>
45
  </th>
46
  <td>
@@ -53,7 +67,7 @@ $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
53
  <tr valign="top">
54
  <th scope="row">
55
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_CDN_URL; ?>">
56
- <?php _e('Serve fonts from CDN', 'host-webfonts-local'); ?> *
57
  </label>
58
  </th>
59
  <td>
@@ -92,7 +106,7 @@ $utmTags = '?utm_source=omgf&utm_medium=plugin&utm_campaign=settings';
92
  <tr valign="top">
93
  <th scope="row">
94
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_DISPLAY_OPTION; ?>">
95
- <?php _e('Font-display option', 'host-webfonts-local'); ?>
96
  </label>
97
  </th>
98
  <td>
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; ?>">
31
+ <?php _e('Save webfonts to...', 'host-webfonts-local'); ?> **
32
  </label>
33
  </th>
34
  <td>
35
+ <input id="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_PATH; ?>" class="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_PATH; ?>" type="text" name="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_PATH; ?>" placeholder="<?= __('e.g. /cache/omgf-webfonts', 'host-webfonts-local'); ?>" value="<?= OMGF_CACHE_PATH; ?>"/>
36
  <p class="description">
37
+ <?php _e("The relative path (inside <code>wp-content</code>) to the cache directory where webfonts should be stored. Give each site a unique value if you're using Multisite. Defaults to <code>/cache/omgf-webfonts</code>.", 'host-webfonts-local'); ?>
38
+ </p>
39
+ </td>
40
+ </tr>
41
+ <tr valign="top">
42
+ <th scope="row">
43
+ <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_URI; ?>">
44
+ <?php _e('Serve webfonts from...', 'host-webfonts-local'); ?> **
45
+ </label>
46
+ </th>
47
+ <td>
48
+ <input id="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_URI; ?>" class="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_URI; ?>" type="text" name="<?= OMGF_Admin_Settings::OMGF_SETTING_CACHE_URI; ?>" placeholder="<?= __('e.g. /app/cache/omgf-webfonts', 'host-webfonts-local'); ?>" value="<?= OMGF_CACHE_URI; ?>" />
49
+ <p class="description">
50
+ <?php _e('The relative path to serve webfonts from. Useful for when you\'re using security through obscurity plugins, such as WP Hide. If left empty, the cache directory specified above will be used.', 'host-webfonts-local'); ?>
51
  </p>
52
  </td>
53
  </tr>
54
  <tr valign="top">
55
  <th scope="row">
56
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_RELATIVE_URL; ?>">
57
+ <?php _e('Use Relative URLs?', 'host-webfonts-local'); ?> **
58
  </label>
59
  </th>
60
  <td>
67
  <tr valign="top">
68
  <th scope="row">
69
  <label for="<?= OMGF_Admin_Settings::OMGF_SETTING_CDN_URL; ?>">
70
+ <?php _e('Serve fonts from CDN', 'host-webfonts-local'); ?> **
71
  </label>
72
  </th>
73
  <td>
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>
templates/frontend-web-font-loader.phtml CHANGED
@@ -27,7 +27,7 @@ $families = array_unique(
27
  )
28
  );
29
  $omgfStaticVersion = '?ver=' . OMGF_STATIC_VERSION;
30
- $omgfSrcUrl = OMGF_UPLOAD_URL . '/' . OMGF_FILENAME . (OMGF_REMOVE_VERSION ? null : $omgfStaticVersion);
31
  $wflVersion = '?ver=' . OMGF_WEB_FONT_LOADER_VERSION;
32
  $wflSrcUrl = plugin_dir_url(OMGF_PLUGIN_FILE) . 'js/libraries/webfont.js' . (OMGF_REMOVE_VERSION ? null : $wflVersion);
33
  ?>
27
  )
28
  );
29
  $omgfStaticVersion = '?ver=' . OMGF_STATIC_VERSION;
30
+ $omgfSrcUrl = OMGF_FONTS_URL . '/' . OMGF_FILENAME . (OMGF_REMOVE_VERSION ? null : $omgfStaticVersion);
31
  $wflVersion = '?ver=' . OMGF_WEB_FONT_LOADER_VERSION;
32
  $wflSrcUrl = plugin_dir_url(OMGF_PLUGIN_FILE) . 'js/libraries/webfont.js' . (OMGF_REMOVE_VERSION ? null : $wflVersion);
33
  ?>