Version Description
- Fixed bug which would continuously show 'No fonts founds' notice in admin, among others.
- Increased compatibility with caching plugins, which would cause static pages to be served and block OMGF from pointing requests to its Download API.
- Added some notices (which disappear ;-)) for manual optimization process in admin area, making it clear when optimization is finished.
Download this release
Release Info
Developer | DaanvandenBergh |
Plugin | OMGF | GDPR/DSVGO Compliant, Faster Google Fonts. Easy. |
Version | 4.1.3 |
Comparing to | |
See all releases |
Code changes from version 4.1.2 to 4.1.3
- host-webfonts-local.php +2 -2
- includes/admin/class-notice.php +54 -2
- includes/api/class-download.php +7 -2
- includes/class-admin.php +18 -12
- includes/class-ajax.php +44 -32
- includes/frontend/class-functions.php +15 -0
- readme.txt +8 -3
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 automatically saving Google Fonts to your server and removing the external Google Fonts.
|
7 |
-
* Version: 4.1.
|
8 |
* Author: Daan (from Fast FW Press)
|
9 |
* Author URI: https://ffwp.dev
|
10 |
* License: GPL2v2 or later
|
@@ -19,7 +19,7 @@ defined( 'ABSPATH' ) || exit;
|
|
19 |
*/
|
20 |
define( 'OMGF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
21 |
define( 'OMGF_PLUGIN_FILE', __FILE__ );
|
22 |
-
define( 'OMGF_STATIC_VERSION', '
|
23 |
|
24 |
/**
|
25 |
* Takes care of loading classes on demand.
|
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 automatically saving Google Fonts to your server and removing the external Google Fonts.
|
7 |
+
* Version: 4.1.3
|
8 |
* Author: Daan (from Fast FW Press)
|
9 |
* Author URI: https://ffwp.dev
|
10 |
* License: GPL2v2 or later
|
19 |
*/
|
20 |
define( 'OMGF_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
21 |
define( 'OMGF_PLUGIN_FILE', __FILE__ );
|
22 |
+
define( 'OMGF_STATIC_VERSION', '4.1.3' );
|
23 |
|
24 |
/**
|
25 |
* Takes care of loading classes on demand.
|
includes/admin/class-notice.php
CHANGED
@@ -19,11 +19,14 @@ defined( 'ABSPATH' ) || exit;
|
|
19 |
class OMGF_Admin_Notice
|
20 |
{
|
21 |
const OMGF_ADMIN_NOTICE_TRANSIENT = 'omgf_admin_notice';
|
22 |
-
const OMGF_ADMIN_NOTICE_EXPIRATION =
|
23 |
|
24 |
/** @var array $notices */
|
25 |
public static $notices = [];
|
26 |
|
|
|
|
|
|
|
27 |
/**
|
28 |
* @param $message
|
29 |
* @param string $type (info|warning|error|success)
|
@@ -32,7 +35,12 @@ class OMGF_Admin_Notice
|
|
32 |
* @param int $code
|
33 |
*/
|
34 |
public static function set_notice ( $message, $message_id = '', $die = true, $type = 'success', $code = 200, $screen_id = 'all' ) {
|
35 |
-
self::$notices
|
|
|
|
|
|
|
|
|
|
|
36 |
self::$notices[ $screen_id ][ $type ][ $message_id ] = $message;
|
37 |
|
38 |
set_transient( self::OMGF_ADMIN_NOTICE_TRANSIENT, self::$notices, self::OMGF_ADMIN_NOTICE_EXPIRATION );
|
@@ -48,6 +56,25 @@ class OMGF_Admin_Notice
|
|
48 |
}
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
/**
|
52 |
* Prints notice (if any) grouped by type.
|
53 |
*/
|
@@ -76,4 +103,29 @@ class OMGF_Admin_Notice
|
|
76 |
|
77 |
delete_transient( self::OMGF_ADMIN_NOTICE_TRANSIENT );
|
78 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
}
|
19 |
class OMGF_Admin_Notice
|
20 |
{
|
21 |
const OMGF_ADMIN_NOTICE_TRANSIENT = 'omgf_admin_notice';
|
22 |
+
const OMGF_ADMIN_NOTICE_EXPIRATION = 60;
|
23 |
|
24 |
/** @var array $notices */
|
25 |
public static $notices = [];
|
26 |
|
27 |
+
/** @var string $plugin_text_domain */
|
28 |
+
private static $plugin_text_domain = 'host-webfonts-local';
|
29 |
+
|
30 |
/**
|
31 |
* @param $message
|
32 |
* @param string $type (info|warning|error|success)
|
35 |
* @param int $code
|
36 |
*/
|
37 |
public static function set_notice ( $message, $message_id = '', $die = true, $type = 'success', $code = 200, $screen_id = 'all' ) {
|
38 |
+
self::$notices = get_transient( self::OMGF_ADMIN_NOTICE_TRANSIENT );
|
39 |
+
|
40 |
+
if ( ! self::$notices ) {
|
41 |
+
self::$notices = [];
|
42 |
+
}
|
43 |
+
|
44 |
self::$notices[ $screen_id ][ $type ][ $message_id ] = $message;
|
45 |
|
46 |
set_transient( self::OMGF_ADMIN_NOTICE_TRANSIENT, self::$notices, self::OMGF_ADMIN_NOTICE_EXPIRATION );
|
56 |
}
|
57 |
}
|
58 |
|
59 |
+
/**
|
60 |
+
* @param string $message_id
|
61 |
+
* @param string $type
|
62 |
+
* @param string $screen_id
|
63 |
+
*/
|
64 |
+
public static function unset_notice ( $message_id = '', $type = 'info', $screen_id = 'all' ) {
|
65 |
+
self::$notices = get_transient( self::OMGF_ADMIN_NOTICE_TRANSIENT );
|
66 |
+
|
67 |
+
if ( isset( self::$notices [ $screen_id ][ $type ][ $message_id ] ) ) {
|
68 |
+
unset( self::$notices [ $screen_id ][ $type ][ $message_id ] );
|
69 |
+
}
|
70 |
+
|
71 |
+
if ( is_array( self::$notices ) && empty( self::$notices [ $screen_id ] [ $type ] ) ) {
|
72 |
+
unset ( self::$notices [ $screen_id ] [ $type ] );
|
73 |
+
}
|
74 |
+
|
75 |
+
set_transient( self::OMGF_ADMIN_NOTICE_TRANSIENT, self::$notices, self::OMGF_ADMIN_NOTICE_EXPIRATION );
|
76 |
+
}
|
77 |
+
|
78 |
/**
|
79 |
* Prints notice (if any) grouped by type.
|
80 |
*/
|
103 |
|
104 |
delete_transient( self::OMGF_ADMIN_NOTICE_TRANSIENT );
|
105 |
}
|
106 |
+
|
107 |
+
/**
|
108 |
+
*
|
109 |
+
*/
|
110 |
+
public static function optimization_finished () {
|
111 |
+
self::set_notice(
|
112 |
+
__( 'OMGF has finished optimizing your Google Fonts. Enjoy! :-)', self::$plugin_text_domain ),
|
113 |
+
'omgf-finished-optimizing',
|
114 |
+
false
|
115 |
+
);
|
116 |
+
|
117 |
+
self::set_notice(
|
118 |
+
'<em>' . __( 'If you\'re using any CSS minify/combine and/or Full Page Caching plugins, don\'t forget to flush their caches.', self::$plugin_text_domain ) . '</em>',
|
119 |
+
'omgf-optimize-plugin-notice',
|
120 |
+
false,
|
121 |
+
'info'
|
122 |
+
);
|
123 |
+
|
124 |
+
self::set_notice(
|
125 |
+
__( 'OMGF will keep running silently in the background and will generate additional stylesheets when other Google Fonts are found on any of your pages.', self::$plugin_text_domain ),
|
126 |
+
'omgf-optimize-background',
|
127 |
+
false,
|
128 |
+
'info'
|
129 |
+
);
|
130 |
+
}
|
131 |
}
|
includes/api/class-download.php
CHANGED
@@ -35,6 +35,9 @@ class OMGF_API_Download extends WP_REST_Controller
|
|
35 |
/** @var string $path */
|
36 |
private $path = '';
|
37 |
|
|
|
|
|
|
|
38 |
public function __construct () {
|
39 |
add_filter( 'content_url', [ $this, 'rewrite_url' ], 10, 2 );
|
40 |
}
|
@@ -249,8 +252,10 @@ class OMGF_API_Download extends WP_REST_Controller
|
|
249 |
|
250 |
$local_src = '';
|
251 |
|
252 |
-
|
253 |
-
$
|
|
|
|
|
254 |
}
|
255 |
|
256 |
$stylesheet .= " src: $local_src\n";
|
35 |
/** @var string $path */
|
36 |
private $path = '';
|
37 |
|
38 |
+
/**
|
39 |
+
* OMGF_API_Download constructor.
|
40 |
+
*/
|
41 |
public function __construct () {
|
42 |
add_filter( 'content_url', [ $this, 'rewrite_url' ], 10, 2 );
|
43 |
}
|
252 |
|
253 |
$local_src = '';
|
254 |
|
255 |
+
if (is_array($variant->local)) {
|
256 |
+
foreach ( $variant->local as $local ) {
|
257 |
+
$local_src .= "local('$local'), ";
|
258 |
+
}
|
259 |
}
|
260 |
|
261 |
$stylesheet .= " src: $local_src\n";
|
includes/class-admin.php
CHANGED
@@ -34,20 +34,23 @@ class OMGF_Admin
|
|
34 |
/**
|
35 |
* Filterable list of options that require the cache to be emptied.
|
36 |
*/
|
37 |
-
$this->show_notice = apply_filters(
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
|
|
|
|
43 |
|
44 |
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_scripts' ] );
|
45 |
add_action( 'admin_notices', [ $this, 'print_notices' ] );
|
46 |
|
47 |
$this->do_basic_settings();
|
48 |
$this->do_advanced_settings();
|
49 |
-
$this->show_optimize_notice();
|
50 |
|
|
|
51 |
add_filter( 'pre_update_option', [ $this, 'settings_changed' ], 10, 3 );
|
52 |
}
|
53 |
|
@@ -98,13 +101,13 @@ class OMGF_Admin
|
|
98 |
* @return mixed
|
99 |
*/
|
100 |
public function settings_changed ( $value, $option_name, $old_value ) {
|
101 |
-
if (!in_array($option_name, $this->show_notice)) {
|
102 |
return $value;
|
103 |
}
|
104 |
|
105 |
if ( $value != $old_value ) {
|
106 |
OMGF_Admin_Notice::set_notice(
|
107 |
-
__('Settings changed. <a href="#" class="omgf-empty">Click here</a> to empty OMGF\'s cache.', $this->plugin_text_domain),
|
108 |
'omgf-settings-changed',
|
109 |
false
|
110 |
);
|
@@ -116,13 +119,16 @@ class OMGF_Admin
|
|
116 |
/**
|
117 |
*
|
118 |
*/
|
119 |
-
|
120 |
-
if (
|
|
|
|
|
|
|
121 |
return;
|
122 |
}
|
123 |
|
124 |
OMGF_Admin_Notice::set_notice(
|
125 |
-
__('OMGF is ready to optimize your Google Fonts. <a href="#" id="omgf-optimize">Start optimization</a>.', $this->plugin_text_domain),
|
126 |
'omgf-optimize',
|
127 |
false
|
128 |
);
|
34 |
/**
|
35 |
* Filterable list of options that require the cache to be emptied.
|
36 |
*/
|
37 |
+
$this->show_notice = apply_filters(
|
38 |
+
'omgf_admin_options_show_notice',
|
39 |
+
[
|
40 |
+
OMGF_Admin_Settings::OMGF_BASIC_SETTING_CACHE_PATH,
|
41 |
+
OMGF_Admin_Settings::OMGF_ADV_SETTING_CACHE_URI,
|
42 |
+
OMGF_Admin_Settings::OMGF_ADV_SETTING_RELATIVE_URL,
|
43 |
+
OMGF_Admin_Settings::OMGF_ADV_SETTING_CDN_URL
|
44 |
+
]
|
45 |
+
);
|
46 |
|
47 |
add_action( 'admin_enqueue_scripts', [ $this, 'enqueue_admin_scripts' ] );
|
48 |
add_action( 'admin_notices', [ $this, 'print_notices' ] );
|
49 |
|
50 |
$this->do_basic_settings();
|
51 |
$this->do_advanced_settings();
|
|
|
52 |
|
53 |
+
add_action( 'admin_init', [ $this, 'maybe_show_optimize_notice' ] );
|
54 |
add_filter( 'pre_update_option', [ $this, 'settings_changed' ], 10, 3 );
|
55 |
}
|
56 |
|
101 |
* @return mixed
|
102 |
*/
|
103 |
public function settings_changed ( $value, $option_name, $old_value ) {
|
104 |
+
if ( ! in_array( $option_name, $this->show_notice ) ) {
|
105 |
return $value;
|
106 |
}
|
107 |
|
108 |
if ( $value != $old_value ) {
|
109 |
OMGF_Admin_Notice::set_notice(
|
110 |
+
__( 'Settings changed. <a href="#" class="omgf-empty">Click here</a> to empty OMGF\'s cache.', $this->plugin_text_domain ),
|
111 |
'omgf-settings-changed',
|
112 |
false
|
113 |
);
|
119 |
/**
|
120 |
*
|
121 |
*/
|
122 |
+
public function maybe_show_optimize_notice () {
|
123 |
+
if ( get_option( OMGF_Admin_Settings::OMGF_OPTIMIZATION_COMPLETE ) ) {
|
124 |
+
// If any notices were set in a previous run, unset them.
|
125 |
+
OMGF_Admin_Notice::unset_notice( 'omgf-optimize' , 'success' );
|
126 |
+
|
127 |
return;
|
128 |
}
|
129 |
|
130 |
OMGF_Admin_Notice::set_notice(
|
131 |
+
__( 'OMGF is ready to optimize your Google Fonts. <a href="#" id="omgf-optimize">Start optimization</a>.', $this->plugin_text_domain ),
|
132 |
'omgf-optimize',
|
133 |
false
|
134 |
);
|
includes/class-ajax.php
CHANGED
@@ -40,12 +40,12 @@ class OMGF_AJAX
|
|
40 |
$this->delete( $entry );
|
41 |
}
|
42 |
|
43 |
-
|
44 |
|
45 |
OMGF_Admin_Notice::set_notice( __( 'Cache directory successfully emptied.', $this->plugin_text_domain ) );
|
46 |
} catch ( \Exception $e ) {
|
47 |
OMGF_Admin_Notice::set_notice(
|
48 |
-
__( '
|
49 |
'omgf-cache-error',
|
50 |
true,
|
51 |
'error',
|
@@ -78,14 +78,22 @@ class OMGF_AJAX
|
|
78 |
*/
|
79 |
public function optimize () {
|
80 |
$front_html = wp_remote_get(
|
81 |
-
site_url(),
|
82 |
[
|
83 |
-
'timeout'
|
84 |
]
|
85 |
);
|
86 |
|
87 |
if ( is_wp_error( $front_html ) ) {
|
88 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
89 |
}
|
90 |
|
91 |
$urls = [];
|
@@ -101,33 +109,48 @@ class OMGF_AJAX
|
|
101 |
|
102 |
if ( empty( $urls ) ) {
|
103 |
$message = __( 'No Google Fonts found to optimize. <a href="#" class="omgf-empty">Empty the Cache Directory</a> to start over.', $this->plugin_text_domain );
|
|
|
|
|
104 |
|
105 |
if ( apply_filters( 'apply_omgf_pro_promo', true ) ) {
|
106 |
-
$
|
|
|
|
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
109 |
OMGF_Admin_Notice::set_notice(
|
110 |
$message,
|
111 |
'omgf-fonts-not-found',
|
112 |
-
|
113 |
'error',
|
114 |
404
|
115 |
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
116 |
}
|
117 |
|
118 |
foreach ( $urls as $url ) {
|
119 |
$download = wp_remote_get(
|
120 |
-
|
121 |
[
|
122 |
-
'timeout'
|
123 |
]
|
124 |
);
|
125 |
|
126 |
if ( is_wp_error( $download ) ) {
|
127 |
-
|
128 |
|
129 |
OMGF_Admin_Notice::set_notice(
|
130 |
-
__( '
|
131 |
'omgf-download-failed',
|
132 |
true,
|
133 |
'error',
|
@@ -136,26 +159,15 @@ class OMGF_AJAX
|
|
136 |
}
|
137 |
}
|
138 |
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
'omgf-optimize-plugin-notice',
|
150 |
-
false,
|
151 |
-
'info'
|
152 |
-
);
|
153 |
-
|
154 |
-
OMGF_Admin_Notice::set_notice(
|
155 |
-
__( 'OMGF will keep running silently in the background and will generate additional stylesheets when other Google Fonts are found on any of your pages.', $this->plugin_text_domain ),
|
156 |
-
'omgf-optimize-background',
|
157 |
-
true,
|
158 |
-
'info'
|
159 |
-
);
|
160 |
}
|
161 |
}
|
40 |
$this->delete( $entry );
|
41 |
}
|
42 |
|
43 |
+
update_option( OMGF_Admin_Settings::OMGF_OPTIMIZATION_COMPLETE, false );
|
44 |
|
45 |
OMGF_Admin_Notice::set_notice( __( 'Cache directory successfully emptied.', $this->plugin_text_domain ) );
|
46 |
} catch ( \Exception $e ) {
|
47 |
OMGF_Admin_Notice::set_notice(
|
48 |
+
__( 'OMGF encountered an error while emptying the cache directory: ', $this->plugin_text_domain ) . $e->getMessage(),
|
49 |
'omgf-cache-error',
|
50 |
true,
|
51 |
'error',
|
78 |
*/
|
79 |
public function optimize () {
|
80 |
$front_html = wp_remote_get(
|
81 |
+
$this->no_cache( site_url() ),
|
82 |
[
|
83 |
+
'timeout' => 30
|
84 |
]
|
85 |
);
|
86 |
|
87 |
if ( is_wp_error( $front_html ) ) {
|
88 |
+
update_option( OMGF_Admin_Settings::OMGF_OPTIMIZATION_COMPLETE, false );
|
89 |
+
|
90 |
+
OMGF_Admin_Notice::set_notice(
|
91 |
+
__( 'OMGF encountered an error while fetching this site\'s frontend HTML', $this->plugin_text_domain ) . ': ' . $front_html->get_error_message(),
|
92 |
+
'omgf-fetch-failed',
|
93 |
+
true,
|
94 |
+
'error',
|
95 |
+
$front_html->get_error_code()
|
96 |
+
);
|
97 |
}
|
98 |
|
99 |
$urls = [];
|
109 |
|
110 |
if ( empty( $urls ) ) {
|
111 |
$message = __( 'No Google Fonts found to optimize. <a href="#" class="omgf-empty">Empty the Cache Directory</a> to start over.', $this->plugin_text_domain );
|
112 |
+
$info = sprintf( __( 'If you believe this is an error, <a href="%s" target="_blank">click here</a> to trigger the optimization manually in your site\'s frontend.', $this->plugin_text_domain ), $this->no_cache( site_url() ) );
|
113 |
+
$info .= ' ' . __( 'If this message keeps appearing,', $this->plugin_text_domain );
|
114 |
|
115 |
if ( apply_filters( 'apply_omgf_pro_promo', true ) ) {
|
116 |
+
$info .= ' ' . sprintf( __( 'head over to the Support Forum and <a target="_blank" href="%s">shoot me a ticket</a>.', $this->plugin_text_domain ), 'https://wordpress.org/support/plugin/host-webfonts-local/' );
|
117 |
+
} else {
|
118 |
+
$info .= ' ' . sprintf( __( '<a target="_blank" href="%s">send me a support ticket</a>.', $this->plugin_text_domain ), 'https://ffwp.dev/contact/' );
|
119 |
}
|
120 |
|
121 |
+
OMGF_Admin_Notice::unset_notice('omgf-optimize', 'success');
|
122 |
+
OMGF_Admin_Notice::unset_notice('omgf-optimize-plugin-notice');
|
123 |
+
OMGF_Admin_Notice::unset_notice('omgf-optimize-background');
|
124 |
+
|
125 |
OMGF_Admin_Notice::set_notice(
|
126 |
$message,
|
127 |
'omgf-fonts-not-found',
|
128 |
+
false,
|
129 |
'error',
|
130 |
404
|
131 |
);
|
132 |
+
|
133 |
+
OMGF_Admin_Notice::set_notice(
|
134 |
+
$info,
|
135 |
+
'omgf-support-info',
|
136 |
+
true,
|
137 |
+
'info'
|
138 |
+
);
|
139 |
}
|
140 |
|
141 |
foreach ( $urls as $url ) {
|
142 |
$download = wp_remote_get(
|
143 |
+
$this->no_cache( $url ),
|
144 |
[
|
145 |
+
'timeout' => 30
|
146 |
]
|
147 |
);
|
148 |
|
149 |
if ( is_wp_error( $download ) ) {
|
150 |
+
update_option( OMGF_Admin_Settings::OMGF_OPTIMIZATION_COMPLETE, false );
|
151 |
|
152 |
OMGF_Admin_Notice::set_notice(
|
153 |
+
__( 'OMGF encountered an error while downloading Google Fonts', $this->plugin_text_domain ) . ': ' . $download->get_error_message(),
|
154 |
'omgf-download-failed',
|
155 |
true,
|
156 |
'error',
|
159 |
}
|
160 |
}
|
161 |
|
162 |
+
update_option( OMGF_Admin_Settings::OMGF_OPTIMIZATION_COMPLETE, true );
|
163 |
+
}
|
164 |
+
|
165 |
+
/**
|
166 |
+
* @param $url
|
167 |
+
*
|
168 |
+
* @return string
|
169 |
+
*/
|
170 |
+
private function no_cache ( $url ) {
|
171 |
+
return add_query_arg( [ 'nocache' => substr( md5( microtime() ), rand( 0, 26 ), 5 ) ], $url );
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
172 |
}
|
173 |
}
|
includes/frontend/class-functions.php
CHANGED
@@ -82,6 +82,8 @@ class OMGF_Frontend_Functions
|
|
82 |
foreach ( $fonts as $handle => $font ) {
|
83 |
$wp_styles->registered [ $handle ]->src = '';
|
84 |
}
|
|
|
|
|
85 |
}
|
86 |
|
87 |
/**
|
@@ -104,6 +106,19 @@ class OMGF_Frontend_Functions
|
|
104 |
|
105 |
$wp_styles->registered[ $handle ]->src = str_replace( [ 'https://fonts.googleapis.com/', '//fonts.googleapis.com/' ], site_url( '/wp-json/omgf/v1/download/' ), $font->src ) . "&handle=$handle";
|
106 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
107 |
}
|
108 |
|
109 |
/**
|
82 |
foreach ( $fonts as $handle => $font ) {
|
83 |
$wp_styles->registered [ $handle ]->src = '';
|
84 |
}
|
85 |
+
|
86 |
+
$this->maybe_show_optimization_finished_notice();
|
87 |
}
|
88 |
|
89 |
/**
|
106 |
|
107 |
$wp_styles->registered[ $handle ]->src = str_replace( [ 'https://fonts.googleapis.com/', '//fonts.googleapis.com/' ], site_url( '/wp-json/omgf/v1/download/' ), $font->src ) . "&handle=$handle";
|
108 |
}
|
109 |
+
|
110 |
+
$this->maybe_show_optimization_finished_notice();
|
111 |
+
}
|
112 |
+
|
113 |
+
/**
|
114 |
+
*
|
115 |
+
*/
|
116 |
+
private function maybe_show_optimization_finished_notice () {
|
117 |
+
if ( ! get_option( OMGF_Admin_Settings::OMGF_OPTIMIZATION_COMPLETE ) ) {
|
118 |
+
update_option( OMGF_Admin_Settings::OMGF_OPTIMIZATION_COMPLETE, true );
|
119 |
+
|
120 |
+
OMGF_Admin_Notice::optimization_finished();
|
121 |
+
}
|
122 |
}
|
123 |
|
124 |
/**
|
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.5
|
6 |
-
Stable tag: 4.1.
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
@@ -112,14 +112,19 @@ N/A
|
|
112 |
|
113 |
== Changelog ==
|
114 |
|
|
|
|
|
|
|
|
|
|
|
115 |
= 4.1.2 =
|
116 |
-
*
|
117 |
|
118 |
= 4.1.1 =
|
119 |
* Use transients instead of options.
|
120 |
* Fixed some minor notices and warnings.
|
121 |
|
122 |
-
= 4.1.0 =
|
123 |
* Added some on-boarding to ease the use of the new interface.
|
124 |
* OMGF will now show a notice in the admin area, if the optimization never ran, to increase UX.
|
125 |
* Added a loader when any of the following actions are triggered:
|
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.5
|
6 |
+
Stable tag: 4.1.3
|
7 |
Requires PHP: 7.0
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
112 |
|
113 |
== Changelog ==
|
114 |
|
115 |
+
= 4.1.3 =
|
116 |
+
* Fixed bug which would continuously show 'No fonts founds' notice in admin, among others.
|
117 |
+
* Increased compatibility with caching plugins, which would cause static pages to be served and block OMGF from pointing requests to its Download API.
|
118 |
+
* Added some notices (which disappear ;-)) for manual optimization process in admin area, making it clear when optimization is finished.
|
119 |
+
|
120 |
= 4.1.2 =
|
121 |
+
* Fixed syntax error (unexpected ')' on line 147).
|
122 |
|
123 |
= 4.1.1 =
|
124 |
* Use transients instead of options.
|
125 |
* Fixed some minor notices and warnings.
|
126 |
|
127 |
+
= 4.1.0 | October 1st, 2020 =
|
128 |
* Added some on-boarding to ease the use of the new interface.
|
129 |
* OMGF will now show a notice in the admin area, if the optimization never ran, to increase UX.
|
130 |
* Added a loader when any of the following actions are triggered:
|