Google Fonts for WordPress - Version 2.3.8

Version Description

Download this release

Release Info

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

Code changes from version 2.3.7 to 2.3.8

changelog.txt CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  = 2.3.7 =
2
 
3
  * Add compatibility pack for ColorLib themes
1
+ = 2.3.8 =
2
+
3
+ * Administrators can now disable the editor-level font controls
4
+
5
  = 2.3.7 =
6
 
7
  * Add compatibility pack for ColorLib themes
includes/class-ogf-classic-editor.php CHANGED
@@ -40,7 +40,11 @@ if ( ! class_exists( 'OGF_Classic_Editor' ) ) :
40
  */
41
  public function __construct() {
42
 
43
- $this->ogf_fonts = new OGF_Fonts();
 
 
 
 
44
  $this->system_fonts = ogf_system_fonts();
45
 
46
  add_filter( 'mce_buttons', array( $this, 'tinymce_add_buttons' ), 1 );
40
  */
41
  public function __construct() {
42
 
43
+ if ( true === get_theme_mod( 'ogf_disable_post_level_controls', 1 ) ) {
44
+ return;
45
+ }
46
+
47
+ $this->ogf_fonts = new OGF_Fonts();
48
  $this->system_fonts = ogf_system_fonts();
49
 
50
  add_filter( 'mce_buttons', array( $this, 'tinymce_add_buttons' ), 1 );
includes/customizer/settings.php CHANGED
@@ -178,26 +178,46 @@ function ogf_customize_register( $wp_customize ) {
178
  )
179
  );
180
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
181
  $wp_customize->add_setting(
182
  'ogf_font_display',
183
  array(
184
- 'sanitize_callback' => 'ogf_sanitize_select',
185
- 'default' => 'swap',
186
  )
187
  );
188
 
189
  $wp_customize->add_control(
190
  'ogf_font_display',
191
  array(
192
- 'type' => 'select',
193
- 'section' => 'ogf_debugging',
194
- 'label' => __( 'Font Display' ),
195
- 'choices' => array(
196
- 'swap' => __( 'Swap', 'olympus-google-fonts' ),
197
- 'block' => __( 'Block', 'olympus-google-fonts' ),
198
- 'fallback' => __( 'Fallback', 'olympus-google-fonts' ),
199
- 'optional' => __( 'Optional', 'olympus-google-fonts' ),
200
- ),
201
  )
202
  );
203
 
@@ -293,14 +313,19 @@ function ogf_customize_register( $wp_customize ) {
293
  }
294
  add_action( 'customize_register', 'ogf_customize_register' );
295
 
 
 
 
 
 
 
296
  function ogf_sanitize_select( $input, $setting ) {
 
 
297
 
298
- // Ensure input is a slug.
299
- $input = sanitize_key( $input );
300
-
301
- // Get list of choices from the control associated with the setting.
302
- $choices = $setting->manager->get_control( $setting->id )->choices;
303
 
304
- // If the input is a valid key, return it; otherwise, return the default.
305
- return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
306
  }
178
  )
179
  );
180
 
181
+ $wp_customize->add_setting(
182
+ 'ogf_disable_post_level_controls',
183
+ array(
184
+ 'default' => '',
185
+ 'transport' => 'postMessage',
186
+ 'sanitize_callback' => 'wp_validate_boolean',
187
+ )
188
+ );
189
+
190
+ $wp_customize->add_control(
191
+ 'ogf_disable_post_level_controls',
192
+ array(
193
+ 'label' => esc_html__( 'Disable Editor Controls', 'olympus-google-fonts' ),
194
+ 'section' => 'ogf_debugging',
195
+ 'settings' => 'ogf_disable_post_level_controls',
196
+ 'type' => 'checkbox',
197
+ 'description' => esc_html__( 'Remove font controls from the individual post editor screen (Gutenberg and Classic).', 'olympus-google-fonts' ),
198
+ )
199
+ );
200
+
201
  $wp_customize->add_setting(
202
  'ogf_font_display',
203
  array(
204
+ 'sanitize_callback' => 'ogf_sanitize_select',
205
+ 'default' => 'swap',
206
  )
207
  );
208
 
209
  $wp_customize->add_control(
210
  'ogf_font_display',
211
  array(
212
+ 'type' => 'select',
213
+ 'section' => 'ogf_debugging',
214
+ 'label' => __( 'Font Display' ),
215
+ 'choices' => array(
216
+ 'swap' => __( 'Swap', 'olympus-google-fonts' ),
217
+ 'block' => __( 'Block', 'olympus-google-fonts' ),
218
+ 'fallback' => __( 'Fallback', 'olympus-google-fonts' ),
219
+ 'optional' => __( 'Optional', 'olympus-google-fonts' ),
220
+ ),
221
  )
222
  );
223
 
313
  }
314
  add_action( 'customize_register', 'ogf_customize_register' );
315
 
316
+ /**
317
+ * Sanitize value from select field.
318
+ *
319
+ * @param string $input The selected input.
320
+ * @param string $setting The setting.
321
+ */
322
  function ogf_sanitize_select( $input, $setting ) {
323
+ // Ensure input is a slug.
324
+ $input = sanitize_key( $input );
325
 
326
+ // Get list of choices from the control associated with the setting.
327
+ $choices = $setting->manager->get_control( $setting->id )->choices;
 
 
 
328
 
329
+ // If the input is a valid key, return it; otherwise, return the default.
330
+ return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
331
  }
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 typography plugin. No coding required. 900+ font choices.
8
- * Version: 2.3.7
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
@@ -19,7 +19,7 @@
19
  */
20
 
21
  if ( ! defined( 'OGF_VERSION' ) ) {
22
- define( 'OGF_VERSION', '2.3.7' );
23
  }
24
 
25
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
@@ -31,9 +31,13 @@ if ( ! defined( 'OGF_DIR_URL' ) ) {
31
  }
32
 
33
  require_once OGF_DIR_PATH . 'class-olympus-google-fonts.php';
34
- require_once OGF_DIR_PATH . 'blocks/init.php';
35
  require_once OGF_DIR_PATH . 'admin/class-ogf-welcome-screen.php';
36
 
 
 
 
 
 
37
  $gfwp = new Olympus_Google_Fonts();
38
 
39
  $current_theme = wp_get_theme();
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 typography plugin. No coding required. 900+ font choices.
8
+ * Version: 2.3.8
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
19
  */
20
 
21
  if ( ! defined( 'OGF_VERSION' ) ) {
22
+ define( 'OGF_VERSION', '2.3.8' );
23
  }
24
 
25
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
31
  }
32
 
33
  require_once OGF_DIR_PATH . 'class-olympus-google-fonts.php';
 
34
  require_once OGF_DIR_PATH . 'admin/class-ogf-welcome-screen.php';
35
 
36
+
37
+ if ( false === get_theme_mod( 'ogf_disable_post_level_controls', false ) ) {
38
+ require_once OGF_DIR_PATH . 'blocks/init.php';
39
+ }
40
+
41
  $gfwp = new Olympus_Google_Fonts();
42
 
43
  $current_theme = wp_get_theme();
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://fontsplugin.com/#pricing
5
  Requires at least: 4.0
6
  Tested up to: 5.5
7
  License: GPLv2 or later
8
- Stable tag: 2.3.7
9
 
10
  The easiest to use Google Fonts Typography Plugin. No coding required. 900+ font choices.
11
 
5
  Requires at least: 4.0
6
  Tested up to: 5.5
7
  License: GPLv2 or later
8
+ Stable tag: 2.3.8
9
 
10
  The easiest to use Google Fonts Typography Plugin. No coding required. 900+ font choices.
11