Disable Google Fonts - Version 1.2

Version Description

  • Released on 9th December 2015
  • Remove fonts used in Twenty Sixteen.
Download this release

Release Info

Developer dimadin
Plugin Icon wp plugin Disable Google Fonts
Version 1.2
Comparing to
See all releases

Code changes from version 1.1 to 1.2

Files changed (2) hide show
  1. disable-google-fonts.php +82 -1
  2. readme.txt +7 -3
disable-google-fonts.php CHANGED
@@ -15,7 +15,9 @@
15
  * Description: Disable enqueuing of Open Sans and other fonts used by WordPress from Google.
16
  * Author: Milan Dinić
17
  * Author URI: http://blog.milandinic.com/
18
- * Version: 1.1
 
 
19
  * License: GPL
20
  */
21
 
@@ -32,6 +34,40 @@ class Disable_Google_Fonts {
32
  public function __construct() {
33
  add_filter( 'gettext_with_context', array( $this, 'disable_open_sans' ), 888, 4 );
34
  add_action( 'after_setup_theme', array( $this, 'register_theme_fonts_disabler' ), 1 );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
35
  }
36
 
37
  /**
@@ -174,6 +210,46 @@ class Disable_Google_Fonts {
174
  return $translations;
175
  }
176
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
177
  /**
178
  * Register filters that disable fonts for bundled themes.
179
  *
@@ -197,6 +273,11 @@ class Disable_Google_Fonts {
197
  $template = get_template();
198
 
199
  switch ( $template ) {
 
 
 
 
 
200
  case 'twentyfifteen' :
201
  add_filter( 'gettext_with_context', array( $this, 'disable_noto_sans' ), 888, 4 );
202
  add_filter( 'gettext_with_context', array( $this, 'disable_noto_serif' ), 888, 4 );
15
  * Description: Disable enqueuing of Open Sans and other fonts used by WordPress from Google.
16
  * Author: Milan Dinić
17
  * Author URI: http://blog.milandinic.com/
18
+ * Version: 1.2
19
+ * Text Domain: disable-google-fonts
20
+ * Domain Path: /languages/
21
  * License: GPL
22
  */
23
 
34
  public function __construct() {
35
  add_filter( 'gettext_with_context', array( $this, 'disable_open_sans' ), 888, 4 );
36
  add_action( 'after_setup_theme', array( $this, 'register_theme_fonts_disabler' ), 1 );
37
+
38
+ // Register plugins action links filter
39
+ add_filter( 'plugin_action_links', array( $this, 'action_links' ), 10, 2 );
40
+ add_filter( 'network_admin_plugin_action_links', array( $this, 'action_links' ), 10, 2 );
41
+ }
42
+
43
+ /**
44
+ * Add action links to plugins page.
45
+ *
46
+ * @since 1.2
47
+ * @access public
48
+ *
49
+ * @param array $links Existing plugin's action links.
50
+ * @param string $plugin_file Path to the plugin file.
51
+ * @return array $links New plugin's action links.
52
+ */
53
+ public function action_links( $links, $plugin_file ) {
54
+ // Set basename
55
+ $basename = plugin_basename( __FILE__ );
56
+
57
+ // Check if it is for this plugin
58
+ if ( $basename != $plugin_file ) {
59
+ return $links;
60
+ }
61
+
62
+ // Load translations
63
+ load_plugin_textdomain( 'disable-google-fonts', false, dirname( $basename ) . '/languages' );
64
+
65
+ // Add new links
66
+ $links['donate'] = '<a href="http://blog.milandinic.com/donate/">' . __( 'Donate', 'disable-google-fonts' ) . '</a>';
67
+ $links['wpdev'] = '<a href="http://blog.milandinic.com/wordpress/custom-development/">' . __( 'WordPress Developer', 'disable-google-fonts' ) . '</a>';
68
+ $links['premiums'] = '<strong><a href="https://shop.milandinic.com/">' . __( 'Premium WordPress Plugins', 'disable-google-fonts' ) . '</a></strong>';
69
+
70
+ return $links;
71
  }
72
 
73
  /**
210
  return $translations;
211
  }
212
 
213
+ /**
214
+ * Force 'off' as a result of Merriweather font toggler string translation.
215
+ *
216
+ * @since 1.2
217
+ * @access public
218
+ *
219
+ * @param string $translations Translated text.
220
+ * @param string $text Text to translate.
221
+ * @param string $context Context information for the translators.
222
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
223
+ * @return string $translations Translated text.
224
+ */
225
+ public function disable_merriweather( $translations, $text, $context, $domain ) {
226
+ if ( 'Merriweather font: on or off' == $context && 'on' == $text ) {
227
+ $translations = 'off';
228
+ }
229
+
230
+ return $translations;
231
+ }
232
+
233
+ /**
234
+ * Force 'off' as a result of Montserrat font toggler string translation.
235
+ *
236
+ * @since 1.2
237
+ * @access public
238
+ *
239
+ * @param string $translations Translated text.
240
+ * @param string $text Text to translate.
241
+ * @param string $context Context information for the translators.
242
+ * @param string $domain Text domain. Unique identifier for retrieving translated strings.
243
+ * @return string $translations Translated text.
244
+ */
245
+ public function disable_montserrat( $translations, $text, $context, $domain ) {
246
+ if ( 'Montserrat font: on or off' == $context && 'on' == $text ) {
247
+ $translations = 'off';
248
+ }
249
+
250
+ return $translations;
251
+ }
252
+
253
  /**
254
  * Register filters that disable fonts for bundled themes.
255
  *
273
  $template = get_template();
274
 
275
  switch ( $template ) {
276
+ case 'twentysixteen' :
277
+ add_filter( 'gettext_with_context', array( $this, 'disable_merriweather' ), 888, 4 );
278
+ add_filter( 'gettext_with_context', array( $this, 'disable_montserrat' ), 888, 4 );
279
+ add_filter( 'gettext_with_context', array( $this, 'disable_inconsolata' ), 888, 4 );
280
+ break;
281
  case 'twentyfifteen' :
282
  add_filter( 'gettext_with_context', array( $this, 'disable_noto_sans' ), 888, 4 );
283
  add_filter( 'gettext_with_context', array( $this, 'disable_noto_serif' ), 888, 4 );
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: dimadin
3
  Donate link: http://blog.milandinic.com/donate/
4
  Tags: Open Sans, Google Fonts, Google Web Fonts
5
  Requires at least: 3.5
6
- Tested up to: 4.1
7
- Stable tag: 1.1
8
 
9
  Disable enqueuing of Open Sans and other fonts used by WordPress from Google.
10
 
@@ -12,7 +12,7 @@ Disable enqueuing of Open Sans and other fonts used by WordPress from Google.
12
 
13
  [Plugin homepage](http://blog.milandinic.com/wordpress/plugins/disable-google-fonts/) | [Plugin author](http://blog.milandinic.com/) | [Donate](http://blog.milandinic.com/donate/)
14
 
15
- This plugin stops loading of Open Sans and other fonts used by WordPress and bundled themes (Twenty Twelve, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen) from Google Fonts.
16
 
17
  Reasons for not using Google Fonts might be privacy and security, local development or production, blocking of Google's servers, characters not supported by font, performance.
18
 
@@ -27,6 +27,10 @@ And it's on [GitHub](https://github.com/dimadin/disable-google-fonts).
27
 
28
  == Changelog ==
29
 
 
 
 
 
30
  = 1.1 =
31
  * Released on 29th December 2014
32
  * Remove fonts used in Twenty Fifteen.
3
  Donate link: http://blog.milandinic.com/donate/
4
  Tags: Open Sans, Google Fonts, Google Web Fonts
5
  Requires at least: 3.5
6
+ Tested up to: 4.5
7
+ Stable tag: 1.2
8
 
9
  Disable enqueuing of Open Sans and other fonts used by WordPress from Google.
10
 
12
 
13
  [Plugin homepage](http://blog.milandinic.com/wordpress/plugins/disable-google-fonts/) | [Plugin author](http://blog.milandinic.com/) | [Donate](http://blog.milandinic.com/donate/)
14
 
15
+ This plugin stops loading of Open Sans and other fonts used by WordPress and bundled themes (Twenty Twelve, Twenty Thirteen, Twenty Fourteen, Twenty Fifteen, Twenty Sixteen) from Google Fonts.
16
 
17
  Reasons for not using Google Fonts might be privacy and security, local development or production, blocking of Google's servers, characters not supported by font, performance.
18
 
27
 
28
  == Changelog ==
29
 
30
+ = 1.2 =
31
+ * Released on 9th December 2015
32
+ * Remove fonts used in Twenty Sixteen.
33
+
34
  = 1.1 =
35
  * Released on 29th December 2014
36
  * Remove fonts used in Twenty Fifteen.