Google Fonts for WordPress - Version 1.7.6

Version Description

Download this release

Release Info

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

Code changes from version 1.7.5 to 1.7.6

blocks/init.php CHANGED
@@ -95,11 +95,11 @@ function olympus_google_fonts_block_render( $attributes ) {
95
 
96
  $font_family = esc_attr( str_replace( '+', ' ', $font_id ) );
97
  $font_id = str_replace( '+', '-', strtolower( $font_id ) );
98
-
99
- $fonts = ogf_fonts_array();
100
- $variants = $fonts[ $font_id ]['variants'];
101
  unset( $variants[0] );
102
- $variants_for_url = join( array_keys( esc_attr( $variants ) ), ',' );
 
103
 
104
  wp_enqueue_style( 'google-font-' . $font_id, 'https://fonts.googleapis.com/css?family=' . $font_family . ':' . $variants_for_url . '&display=swap', array(), OGF_VERSION );
105
 
95
 
96
  $font_family = esc_attr( str_replace( '+', ' ', $font_id ) );
97
  $font_id = str_replace( '+', '-', strtolower( $font_id ) );
98
+ $fonts = ogf_fonts_array();
99
+ $variants = $fonts[ $font_id ]['variants'];
 
100
  unset( $variants[0] );
101
+
102
+ $variants_for_url = join( array_keys( $variants ), ',' );
103
 
104
  wp_enqueue_style( 'google-font-' . $font_id, 'https://fonts.googleapis.com/css?family=' . $font_family . ':' . $variants_for_url . '&display=swap', array(), OGF_VERSION );
105
 
changelog.txt CHANGED
@@ -1,4 +1,9 @@
1
- = 1.7.4 =
 
 
 
 
 
2
 
3
  * Fix font-display: swap in Gutenberg Block.
4
  * Improve compatibility with MailOptin.
1
+ = 1.7.6 =
2
+
3
+ * Add global font choices to block editor.
4
+ * Fix error in Gutenberg block.
5
+
6
+ = 1.7.5 =
7
 
8
  * Fix font-display: swap in Gutenberg Block.
9
  * Improve compatibility with MailOptin.
class-olympus-google-fonts.php CHANGED
@@ -48,6 +48,9 @@ class Olympus_Google_Fonts {
48
  include OGF_DIR_PATH . 'includes/customizer/settings.php';
49
  include OGF_DIR_PATH . 'includes/customizer/output-css.php';
50
 
 
 
 
51
  // Notifications class.
52
  include OGF_DIR_PATH . 'includes/class-ogf-notifications.php';
53
 
48
  include OGF_DIR_PATH . 'includes/customizer/settings.php';
49
  include OGF_DIR_PATH . 'includes/customizer/output-css.php';
50
 
51
+ // Required files for the Gutenberg editor.
52
+ include OGF_DIR_PATH . 'includes/gutenberg/output-css.php';
53
+
54
  // Notifications class.
55
  include OGF_DIR_PATH . 'includes/class-ogf-notifications.php';
56
 
includes/gutenberg/output-css.php ADDED
@@ -0,0 +1,92 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Output the Google Fonts CSS in Gutenberg.
4
+ *
5
+ * @package olympus-google-fonts
6
+ * @copyright Copyright (c) 2019, Fonts Plugin
7
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
+ */
9
+
10
+
11
+ /**
12
+ * Enqeue the Google Fonts URL.
13
+ */
14
+ function ogf_gutenberg_enqueue_fonts() {
15
+
16
+ $fonts = new OGF_Fonts();
17
+
18
+ if ( $fonts->has_custom_fonts() ) {
19
+ $url = $fonts->build_url();
20
+ wp_enqueue_style( 'olympus-google-fonts', $url, array(), OGF_VERSION );
21
+ }
22
+
23
+ }
24
+
25
+ add_action( 'enqueue_block_editor_assets', 'ogf_gutenberg_enqueue_fonts' );
26
+
27
+
28
+ /**
29
+ * Output the font CSS to wp_head.
30
+ */
31
+ function ogf_gutenberg_output_css() {
32
+
33
+ // Only load on Gutenberg-enabled pages.
34
+ global $current_screen;
35
+ $current_screen = get_current_screen();
36
+ if ( ! method_exists( $current_screen, 'is_block_editor' ) || ! $current_screen->is_block_editor() ) {
37
+ return;
38
+ }
39
+
40
+ ?>
41
+ <!-- Fonts Plugin Gutenberg CSS - https://fontsplugin.com/ -->
42
+ <style>
43
+ <?php
44
+
45
+ do_action( 'ogf_gutenberg_inline_styles' );
46
+
47
+ $elements = array(
48
+ 'ogf_body' => array(
49
+ 'selectors' => '.editor-writing-flow, .editor-styles-wrapper p, .editor-styles-wrapper h3, #editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input',
50
+ ),
51
+ 'ogf_headings' => array(
52
+ 'selectors' => '#editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input, .editor-styles-wrapper h1, .editor-styles-wrapper h2, .editor-styles-wrapper h3, .editor-styles-wrapper h4, .editor-styles-wrapper h5, .editor-styles-wrapper h6',
53
+ ),
54
+ 'ogf_inputs' => array(
55
+ 'selectors' => 'button, input, select, textarea',
56
+ ),
57
+ 'ogf_post_page_content' => array(
58
+ 'selectors' => '.editor-styles-wrapper p',
59
+ ),
60
+ 'ogf_post_page_h1' => array(
61
+ 'selectors' => '#editor .editor-styles-wrapper .editor-post-title__block .editor-post-title__input, .editor-styles-wrapper h1',
62
+ ),
63
+ 'ogf_post_page_h2' => array(
64
+ 'selectors' => '.editor-styles-wrapper h2',
65
+ ),
66
+ 'ogf_post_page_h3' => array(
67
+ 'selectors' => '.editor-styles-wrapper h3',
68
+ ),
69
+ 'ogf_post_page_h4' => array(
70
+ 'selectors' => '.editor-styles-wrapper h4',
71
+ ),
72
+ 'ogf_post_page_h5' => array(
73
+ 'selectors' => '.editor-styles-wrapper h5',
74
+ ),
75
+ 'ogf_post_page_h6' => array(
76
+ 'selectors' => '.editor-styles-wrapper h6',
77
+ ),
78
+ );
79
+
80
+ $elements = apply_filters( 'ogf_gutenberg_elements', $elements );
81
+
82
+ foreach ( $elements as $id => $values ) {
83
+ ogf_generate_css( $values['selectors'], $id );
84
+ }
85
+ ?>
86
+ </style>
87
+ <!-- Fonts Plugin Gutenberg CSS -->
88
+ <?php
89
+ }
90
+
91
+ // Output custom CSS to live site.
92
+ add_action( 'admin_head', 'ogf_gutenberg_output_css' );
olympus-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: Google Fonts for WordPress
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The easiest to use Google Fonts plugin. No coding required. 870+ font choices.
8
- * Version: 1.7.5
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_campaign=heading
11
  * Text Domain: olympus-google-fonts
@@ -18,7 +18,7 @@
18
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
19
  */
20
 
21
- define( 'OGF_VERSION', '1.7.5' );
22
  define( 'OGF_DIR_PATH', plugin_dir_path( __FILE__ ) );
23
  define( 'OGF_DIR_URL', plugin_dir_url( __FILE__ ) );
24
 
5
  * Plugin Name: Google Fonts for WordPress
6
  * Plugin URI: https://wordpress.org/plugins/olympus-google-fonts/
7
  * Description: The easiest to use Google Fonts plugin. No coding required. 870+ font choices.
8
+ * Version: 1.7.6
9
  * Author: Fonts Plugin
10
  * Author URI: https://fontsplugin.com/?utm_source=wporg&utm_campaign=heading
11
  * Text Domain: olympus-google-fonts
18
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
19
  */
20
 
21
+ define( 'OGF_VERSION', '1.7.6' );
22
  define( 'OGF_DIR_PATH', plugin_dir_path( __FILE__ ) );
23
  define( 'OGF_DIR_URL', plugin_dir_url( __FILE__ ) );
24
 
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://fontsplugin.com/#pricing
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
  License: GPLv2 or later
8
- Stable tag: 1.7.5
9
 
10
  The easiest to use Google Fonts Plugin. No coding required. 870+ font choices.
11
 
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
  License: GPLv2 or later
8
+ Stable tag: 1.7.6
9
 
10
  The easiest to use Google Fonts Plugin. No coding required. 870+ font choices.
11