Google Fonts for WordPress - Version 3.1.1

Version Description

Download this release

Release Info

Developer DannyCooper
Plugin Icon 128x128 Google Fonts for WordPress
Version 3.1.1
Comparing to
See all releases

Code changes from version 3.0.23 to 3.1.1

changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 3.0.21 =
2
 
3
  * Improve compatability with Full Site Editing (FSE)
1
+ = 3.1.0 =
2
+
3
+ * Automatically add all custom uploaded and typekit/adobe fonts to the Classic Editor
4
+
5
  = 3.0.21 =
6
 
7
  * Improve compatability with Full Site Editing (FSE)
class-olympus-google-fonts.php CHANGED
@@ -39,7 +39,7 @@ class Olympus_Google_Fonts {
39
  */
40
  public function constants() {
41
  if ( ! defined( 'OGF_VERSION' ) ) {
42
- define( 'OGF_VERSION', '3.0.20' );
43
  }
44
 
45
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
39
  */
40
  public function constants() {
41
  if ( ! defined( 'OGF_VERSION' ) ) {
42
+ define( 'OGF_VERSION', '3.1.0' );
43
  }
44
 
45
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
includes/class-ogf-classic-editor.php CHANGED
@@ -58,6 +58,7 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
58
  add_filter( 'tiny_mce_before_init', array( $this, 'tinymce_custom_options' ) );
59
  add_filter( 'ogf_classic_font_formats', array( $this, 'tinymce_add_fonts' ) );
60
  add_action( 'admin_init', array( $this, 'google_fonts_enqueue' ) );
 
61
  }
62
 
63
  /**
@@ -132,24 +133,19 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
132
  $new_default = '';
133
  $choices = $this->ogf_fonts->choices;
134
  foreach ( array_unique( $choices ) as $font ) {
135
- if ( ogf_is_system_font( $font ) ) {
136
- // do nothing.
137
- } elseif ( ogf_is_custom_font( $font ) ) {
138
- $fonts = ogf_custom_fonts();
139
- $font = str_replace( 'cf-', '', $font );
140
- if ( array_key_exists( $font, $fonts ) ) {
141
- $new_default .= $fonts[ $font ]['label'] . '=' . $fonts[ $font ]['stack'] . ';';
142
- }
143
- } elseif ( ogf_is_typekit_font( $font ) ) {
144
- $fonts = ogf_typekit_fonts();
145
- $font = str_replace( 'tk-', '', $font );
146
- if ( array_key_exists( $font, $fonts ) ) {
147
- $new_default .= $fonts[ $font ]['label'] . '=' . $fonts[ $font ]['stack'] . ';';
148
- }
149
- } else {
150
  $new_default .= $this->ogf_fonts->get_font_name( $font ) . '=' . $this->ogf_fonts->get_font_name( $font ) . ';';
151
  }
152
  }
 
 
 
 
 
 
 
 
 
153
  $new_default .= $old_default;
154
  return $new_default;
155
  }
@@ -164,6 +160,26 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
164
  }
165
  }
166
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
167
  }
168
  endif;
169
 
58
  add_filter( 'tiny_mce_before_init', array( $this, 'tinymce_custom_options' ) );
59
  add_filter( 'ogf_classic_font_formats', array( $this, 'tinymce_add_fonts' ) );
60
  add_action( 'admin_init', array( $this, 'google_fonts_enqueue' ) );
61
+ add_action( 'admin_init', array( $this, 'typekit_fonts_enqueue' ) );
62
  }
63
 
64
  /**
133
  $new_default = '';
134
  $choices = $this->ogf_fonts->choices;
135
  foreach ( array_unique( $choices ) as $font ) {
136
+ if ( ogf_is_google_font( $font ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
137
  $new_default .= $this->ogf_fonts->get_font_name( $font ) . '=' . $this->ogf_fonts->get_font_name( $font ) . ';';
138
  }
139
  }
140
+
141
+ foreach ( array_unique( $this->custom_fonts ) as $font ) {
142
+ $new_default .= $font['label'] . '=' . $font['stack'] . ';';
143
+ }
144
+
145
+ foreach ( $this->typekit_fonts as $font ) {
146
+ $new_default .= $font['label'] . '=' . str_replace( '"', '', $font['stack'] ) . ';';
147
+ }
148
+
149
  $new_default .= $old_default;
150
  return $new_default;
151
  }
160
  }
161
  }
162
 
163
+ /**
164
+ * Enqueue the Typekit Fonts in TinyMCE.
165
+ */
166
+ public function typekit_fonts_enqueue() {
167
+ global $editor_styles;
168
+
169
+ $typekit_data = get_option( 'fp-typekit-data', array() );
170
+
171
+ if ( is_array( $typekit_data ) ) {
172
+ foreach ( $typekit_data as $id => $values ) {
173
+ // skip if the kit is disabled.
174
+ if ( $values['enabled'] === false ) {
175
+ continue;
176
+ }
177
+
178
+ $editor_styles[] = esc_url( 'https://use.typekit.com/' . $id . '.css' );
179
+ }
180
+ }
181
+ }
182
+
183
  }
184
  endif;
185
 
olympus-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: Fonts Plugin | Google Fonts Typography
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
8
- * Version: 3.0.21
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_medium=readme&utm_campaign=description
11
  * Text Domain: olympus-google-fonts
5
  * Plugin Name: Fonts Plugin | Google Fonts Typography
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
8
+ * Version: 3.1.0
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_medium=readme&utm_campaign=description
11
  * Text Domain: olympus-google-fonts
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://fontsplugin.com/#pricing
5
  Requires at least: 4.0
6
  Tested up to: 6.0
7
  License: GPLv2 or later
8
- Stable tag: 3.0.21
9
 
10
  The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
11
 
5
  Requires at least: 4.0
6
  Tested up to: 6.0
7
  License: GPLv2 or later
8
+ Stable tag: 3.1.0
9
 
10
  The easiest to use Google Fonts Plugin. No coding required. Optimized for Speed. 1000+ font choices.
11