Local Google Fonts - Version 0.5

Version Description

Download this release

Release Info

Developer everpress
Plugin Icon 128x128 Local Google Fonts
Version 0.5
Comparing to
See all releases

Code changes from version 0.4 to 0.5

README.md CHANGED
@@ -4,7 +4,7 @@ Contributors: everpress
4
  Tags: googlefonts, google, fonts, gdpr, lgf, font, speed
5
  Requires at least: 4.2
6
  Tested up to: 6.0
7
- Stable tag: 0.4
8
  Requires PHP: 5.6+
9
  License: GPLv2 or later
10
  Author: EverPress
@@ -28,8 +28,6 @@ more on [wptavern.com](https://wptavern.com/german-court-fines-website-owner-for
28
 
29
  ### 1. Quick install (activate, setup and forget)
30
 
31
- ![Quick install (activate, setup and forget)](https://ps.w.org/local-google-fonts/assets/screenshot-1.png)
32
-
33
  ### 2. Automatically loads all used fonts to your server (wp-content/uploads)
34
 
35
  ### 3. Cleanup on plugin deactivation
@@ -42,8 +40,30 @@ more on [wptavern.com](https://wptavern.com/german-court-fines-website-owner-for
42
  2. Activate the plugin through the 'Plugins' menu in WordPress
43
  3. Go to Settings => Google Fonts and decide which fonts should get loaded locally
44
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  ## Changelog
46
 
 
 
 
 
47
  ### 0.4
48
 
49
  - you may have to reload fonts so please check the settings page
4
  Tags: googlefonts, google, fonts, gdpr, lgf, font, speed
5
  Requires at least: 4.2
6
  Tested up to: 6.0
7
+ Stable tag: 0.5
8
  Requires PHP: 5.6+
9
  License: GPLv2 or later
10
  Author: EverPress
28
 
29
  ### 1. Quick install (activate, setup and forget)
30
 
 
 
31
  ### 2. Automatically loads all used fonts to your server (wp-content/uploads)
32
 
33
  ### 3. Cleanup on plugin deactivation
40
  2. Activate the plugin through the 'Plugins' menu in WordPress
41
  3. Go to Settings => Google Fonts and decide which fonts should get loaded locally
42
 
43
+ ## Frequently Asked Questions
44
+
45
+ ### Will this load Google Fonts automatically?
46
+
47
+ No, each font set must be manually triggered. Automatic loading of assets from a third party server is forbidden by the [plugin guidelines](https://developer.wordpress.org/plugins/wordpress-org/detailed-plugin-guidelines/).
48
+
49
+ ### Is it Legal to Self-Host Google Fonts?
50
+
51
+ Yes. The open source fonts from Google Fonts are published under a licenses that allow you to use them on any website, no matter if it’s commercial or personal.
52
+
53
+ ### My fonts do not show up on the settings page, what can I do?
54
+
55
+ Fonts are discovered once they are used. Try to browse your front end first and get back to the settings page.
56
+
57
+ ### My fonts are not replaced, what can I do?
58
+
59
+ The plugin currently only checks fonts embedded via [`wp_enqueue_style`](https://developer.wordpress.org/reference/functions/wp_enqueue_style/) if you use Google fonts via `@import` you have to change that first.
60
+
61
  ## Changelog
62
 
63
+ ### 0.5
64
+
65
+ - added option to flush everything
66
+
67
  ### 0.4
68
 
69
  - you may have to reload fonts so please check the settings page
includes/class-local-google-fonts-admin.php CHANGED
@@ -64,6 +64,10 @@ class LGF_Admin {
64
  }
65
  }
66
 
 
 
 
 
67
  }
68
 
69
  public function get_font_info( $src ) {
@@ -250,6 +254,9 @@ class LGF_Admin {
250
  <?php endif; ?>
251
  </p>
252
  <?php endforeach ?>
 
 
 
253
  </form>
254
  </div>
255
  <?php
64
  }
65
  }
66
 
67
+ if ( isset( $_POST['flush'] ) ) {
68
+ $class->remove_set();
69
+ }
70
+
71
  }
72
 
73
  public function get_font_info( $src ) {
254
  <?php endif; ?>
255
  </p>
256
  <?php endforeach ?>
257
+ <p class="textright">
258
+ <button class="host-locally button button-link-delete" name="flush" value="1"><?php esc_html_e( 'Remove all stored data', 'local-google-fonts' ); ?></button>
259
+ </p>
260
  </form>
261
  </div>
262
  <?php
includes/class-local-google-fonts.php CHANGED
@@ -156,8 +156,11 @@ class LGF {
156
  delete_option( 'local_google_fonts_buffer' );
157
  }
158
 
159
- public function remove_set( $id ) {
160
- $folder = WP_CONTENT_DIR . '/uploads/fonts/' . basename( $id );
 
 
 
161
  if ( is_dir( $folder ) ) {
162
  $WP_Filesystem = $this->wp_filesystem();
163
  return $WP_Filesystem->delete( $folder, true );
156
  delete_option( 'local_google_fonts_buffer' );
157
  }
158
 
159
+ public function remove_set( $id = null ) {
160
+ $folder = WP_CONTENT_DIR . '/uploads/fonts';
161
+ if ( ! is_null( $id ) ) {
162
+ $folder .= '/' . basename( $id );
163
+ }
164
  if ( is_dir( $folder ) ) {
165
  $WP_Filesystem = $this->wp_filesystem();
166
  return $WP_Filesystem->delete( $folder, true );
local-google-fonts.php CHANGED
@@ -2,7 +2,7 @@
2
  /*
3
  Plugin Name: Local Google Fonts
4
  Description: Host your used Google fonts on your server and make your site GDPR compliant.
5
- Version: 0.4
6
  Author: EverPress
7
  Author URI: https://everpress.co
8
  Text Domain: local-google-fonts
2
  /*
3
  Plugin Name: Local Google Fonts
4
  Description: Host your used Google fonts on your server and make your site GDPR compliant.
5
+ Version: 0.5
6
  Author: EverPress
7
  Author URI: https://everpress.co
8
  Text Domain: local-google-fonts