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

Version Description

  • Fixed: Minor performance improvement - content_url() is no longer used to generate download file URLs.
  • Rewrote Modify Source URL option's description.
Download this release

Release Info

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

Code changes from version 5.1.1 to 5.1.2

host-webfonts-local.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://ffw.press/wordpress/omgf/
6
  * Description: Increase GDPR compliance, reduce DNS requests and leverage browser cache by automatically downloading Google Fonts to your server.
7
- * Version: 5.1.1
8
  * Author: Daan from FFW.Press
9
  * Author URI: https://ffw.press
10
  * License: GPL2v2 or later
4
  * Plugin Name: OMGF
5
  * Plugin URI: https://ffw.press/wordpress/omgf/
6
  * Description: Increase GDPR compliance, reduce DNS requests and leverage browser cache by automatically downloading Google Fonts to your server.
7
+ * Version: 5.1.2
8
  * Author: Daan from FFW.Press
9
  * Author URI: https://ffw.press
10
  * License: GPL2v2 or later
includes/admin/settings/class-advanced.php CHANGED
@@ -76,14 +76,13 @@ class OMGF_Admin_Settings_Advanced extends OMGF_Admin_Settings_Builder
76
  public function do_promo_fonts_source_url()
77
  {
78
  $this->do_text(
79
- __('Modify Fonts Source URL (Pro)', $this->plugin_text_domain),
80
  'omgf_pro_source_url',
81
  __('e.g. https://cdn.mydomain.com/alternate/relative-path', $this->plugin_text_domain),
82
  defined('OMGF_PRO_SOURCE_URL') ? OMGF_PRO_SOURCE_URL : '',
83
  sprintf(
84
- __("Modify the <code>src</code> for each font file in stylesheets generated by OMGF Pro. This can be anything; from an absolute URL pointing to your CDN (e.g. <code>%s</code>) to an alternate relative URL (e.g. <code>/renamed-wp-content-dir/alternate/path/to/font-files</code>) to work with <em>security thru obscurity</em> plugins. Enter the full path to OMGF's files. Defaults to <code>%s</code> (no trailing slash)", $this->plugin_text_domain),
85
- str_replace(home_url(), 'https://your-cdn.com', OMGF_UPLOAD_URL),
86
- OMGF_UPLOAD_URL
87
  ) . ' ' . $this->promo,
88
  true
89
  );
76
  public function do_promo_fonts_source_url()
77
  {
78
  $this->do_text(
79
+ __('Modify Source URL (Pro)', $this->plugin_text_domain),
80
  'omgf_pro_source_url',
81
  __('e.g. https://cdn.mydomain.com/alternate/relative-path', $this->plugin_text_domain),
82
  defined('OMGF_PRO_SOURCE_URL') ? OMGF_PRO_SOURCE_URL : '',
83
  sprintf(
84
+ __("Modify the <code>src</code> attribute for font files and stylesheets generated by OMGF Pro. This can be anything; from an absolute URL pointing to your CDN (e.g. <code>%s</code>) to an alternate relative URL (e.g. <code>/renamed-wp-content-dir/alternate/path/to/font-files</code>) to work with <em>security thru obscurity</em> plugins. Enter the full path to OMGF's files. Default: (empty)", $this->plugin_text_domain),
85
+ 'https://your-cdn.com/wp-content/uploads/omgf'
 
86
  ) . ' ' . $this->promo,
87
  true
88
  );
includes/class-download.php CHANGED
@@ -49,7 +49,7 @@ class OMGF_Download
49
  }
50
 
51
  /**
52
- * Download $url to $path and return content_url() to $filename.
53
  *
54
  * @return string
55
  *
@@ -65,10 +65,10 @@ class OMGF_Download
65
  wp_mkdir_p($this->path);
66
 
67
  $file = $this->path . '/' . $this->filename . '.' . $this->extension;
68
- $file_uri = str_replace(WP_CONTENT_DIR, '', $file);
69
 
70
  if (file_exists($file)) {
71
- return urlencode(content_url($file_uri));
72
  }
73
 
74
  if (strpos($this->url, '//') === 0) {
@@ -88,6 +88,6 @@ class OMGF_Download
88
  copy($tmp, $file);
89
  @unlink($tmp);
90
 
91
- return urlencode(content_url($file_uri));
92
  }
93
  }
49
  }
50
 
51
  /**
52
+ * Download $url to $path and return OMGF_UPLOAD_URL to $filename.
53
  *
54
  * @return string
55
  *
65
  wp_mkdir_p($this->path);
66
 
67
  $file = $this->path . '/' . $this->filename . '.' . $this->extension;
68
+ $file_url = OMGF_UPLOAD_URL . str_replace(OMGF_UPLOAD_DIR, '', $this->path) . '/' . $this->filename . '.' . $this->extension;
69
 
70
  if (file_exists($file)) {
71
+ return $file_url;
72
  }
73
 
74
  if (strpos($this->url, '//') === 0) {
88
  copy($tmp, $file);
89
  @unlink($tmp);
90
 
91
+ return $file_url;
92
  }
93
  }
includes/class-omgf.php CHANGED
@@ -61,7 +61,7 @@ class OMGF
61
  define('OMGF_TEST_MODE', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_TEST_MODE)));
62
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL)));
63
  define('OMGF_UPLOAD_DIR', apply_filters('omgf_upload_dir', WP_CONTENT_DIR . '/uploads/omgf'));
64
- define('OMGF_UPLOAD_URL', apply_filters('omgf_upload_url', content_url('/uploads/omgf')));
65
  }
66
 
67
  /**
@@ -119,7 +119,7 @@ class OMGF
119
  }
120
 
121
  /**
122
- * content_url() uses is_ssl() to detect whether SSL is used. This fails for servers behind
123
  * load balancers and/or reverse proxies. So, we double check with this filter.
124
  *
125
  * @since v4.4.4
61
  define('OMGF_TEST_MODE', esc_attr(get_option(OMGF_Admin_Settings::OMGF_OPTIMIZE_SETTING_TEST_MODE)));
62
  define('OMGF_UNINSTALL', esc_attr(get_option(OMGF_Admin_Settings::OMGF_ADV_SETTING_UNINSTALL)));
63
  define('OMGF_UPLOAD_DIR', apply_filters('omgf_upload_dir', WP_CONTENT_DIR . '/uploads/omgf'));
64
+ define('OMGF_UPLOAD_URL', apply_filters('omgf_upload_url', WP_CONTENT_URL . '/uploads/omgf'));
65
  }
66
 
67
  /**
119
  }
120
 
121
  /**
122
+ * content_url uses is_ssl() to detect whether SSL is used. This fails for servers behind
123
  * load balancers and/or reverse proxies. So, we double check with this filter.
124
  *
125
  * @since v4.4.4
includes/class-optimize.php CHANGED
@@ -220,7 +220,7 @@ class OMGF_Optimize
220
  return $current_stylesheet;
221
  break;
222
  default: // 'url'
223
- return str_replace(OMGF_UPLOAD_DIR, content_url('uploads/omgf'), $local_file);
224
  }
225
  }
226
 
220
  return $current_stylesheet;
221
  break;
222
  default: // 'url'
223
+ return str_replace(OMGF_UPLOAD_DIR, OMGF_UPLOAD_URL, $local_file);
224
  }
225
  }
226
 
includes/frontend/class-process.php CHANGED
@@ -123,7 +123,7 @@ class OMGF_Frontend_Process
123
  /**
124
  * @since v5.0.1 An extra check, because people tend to forget to flush their caches when changing fonts, etc.
125
  */
126
- if (!file_exists(str_replace(content_url(), WP_CONTENT_DIR, $url))) {
127
  continue;
128
  }
129
 
123
  /**
124
  * @since v5.0.1 An extra check, because people tend to forget to flush their caches when changing fonts, etc.
125
  */
126
+ if (!file_exists(str_replace(OMGF_UPLOAD_URL, OMGF_UPLOAD_DIR, $url))) {
127
  continue;
128
  }
129
 
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.9
6
- Stable tag: 5.1.1
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -75,6 +75,10 @@ For the FAQ, [click here](https://docs.ffw.press/category/76-omgf-pro---faq).
75
 
76
  == Changelog ==
77
 
 
 
 
 
78
  = 5.1.1 =
79
  * Fixed: using `print_r()` in an output buffer caused 500 errors.
80
  - Removed the remaining (one) entries of `OMGF::debug`, because of this and Test Mode now allows for much user-friendly testing, anyway.
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.9
6
+ Stable tag: 5.1.2
7
  Requires PHP: 7.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
75
 
76
  == Changelog ==
77
 
78
+ = 5.1.2 =
79
+ * Fixed: Minor performance improvement - content_url() is no longer used to generate download file URLs.
80
+ * Rewrote Modify Source URL option's description.
81
+
82
  = 5.1.1 =
83
  * Fixed: using `print_r()` in an output buffer caused 500 errors.
84
  - Removed the remaining (one) entries of `OMGF::debug`, because of this and Test Mode now allows for much user-friendly testing, anyway.