Google Fonts for WordPress - Version 2.5.8

Version Description

Download this release

Release Info

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

Code changes from version 2.5.7 to 2.5.8

blocks/init.php CHANGED
@@ -95,6 +95,7 @@ function olympus_google_fonts_block_render( $attributes ) {
95
  $color = isset( $attributes['color'] ) ? sanitize_text_field( $attributes['color'] ) : '';
96
  $output = '';
97
  $style = '';
 
98
 
99
  if ( $font_id ) {
100
 
@@ -113,27 +114,27 @@ function olympus_google_fonts_block_render( $attributes ) {
113
  $font_family = $font_id;
114
  }
115
 
116
- $style = "font-family: {$font_family};";
117
  }
118
 
119
  if ( $variant && '0' !== $variant ) {
120
- $style .= "font-weight: {$variant};";
121
  }
122
 
123
  if ( $font_size ) {
124
- $style .= "font-size: {$font_size}px;";
125
  }
126
 
127
  if ( $line_height ) {
128
- $style .= "line-height: {$line_height};";
129
  }
130
 
131
  if ( $align ) {
132
- $style .= "text-align: {$align};";
133
  }
134
 
135
  if ( $color ) {
136
- $style .= "color: {$color};";
137
  }
138
 
139
  $output .= '<' . $block_type . ' class="fonts-plugin-block" style="' . $style . '">';
95
  $color = isset( $attributes['color'] ) ? sanitize_text_field( $attributes['color'] ) : '';
96
  $output = '';
97
  $style = '';
98
+ $forced = ogf_is_forced();
99
 
100
  if ( $font_id ) {
101
 
114
  $font_family = $font_id;
115
  }
116
 
117
+ $style = "font-family: {$font_family}{$forced};";
118
  }
119
 
120
  if ( $variant && '0' !== $variant ) {
121
+ $style .= "font-weight: {$variant}{$forced};";
122
  }
123
 
124
  if ( $font_size ) {
125
+ $style .= "font-size: {$font_size}px{$forced};";
126
  }
127
 
128
  if ( $line_height ) {
129
+ $style .= "line-height: {$line_height}{$forced};";
130
  }
131
 
132
  if ( $align ) {
133
+ $style .= "text-align: {$align}{$forced};";
134
  }
135
 
136
  if ( $color ) {
137
+ $style .= "color: {$color}{$forced};";
138
  }
139
 
140
  $output .= '<' . $block_type . ' class="fonts-plugin-block" style="' . $style . '">';
changelog.txt CHANGED
@@ -1,3 +1,9 @@
 
 
 
 
 
 
1
  = 2.5.7 =
2
 
3
  * Add control for quotes (blockquotes)
1
+ = 2.5.8 =
2
+
3
+ * Fix issue where 'Font Loading' screen was not showing if any non-Google fonts were chosen.
4
+ * If 'Force Styles' is enabled, add !important to block output.
5
+ * Add compatibility pack for the Graphene theme.
6
+
7
  = 2.5.7 =
8
 
9
  * Add control for quotes (blockquotes)
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', '2.5.7' );
43
  }
44
 
45
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
39
  */
40
  public function constants() {
41
  if ( ! defined( 'OGF_VERSION' ) ) {
42
+ define( 'OGF_VERSION', '2.5.8' );
43
  }
44
 
45
  if ( ! defined( 'OGF_DIR_PATH' ) ) {
compatibility/graphenethemessolutions.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Compatibility file for Graphene theme.
4
+ *
5
+ * @package olympus-google-fonts
6
+ * @copyright Copyright (c) 2020, Fonts Plugin
7
+ * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
+ */
9
+
10
+ /**
11
+ * Modify the default element selectors to improve compatibility with Graphen theme.
12
+ *
13
+ * @param array $elements The default elements.
14
+ */
15
+ function ogf_silverks_elements( $elements ) {
16
+ $elements['ogf_sidebar_headings']['selectors'] = '.widget-title, .widget-area h1, .widget-area h2, .widget-area h3, .widget-area h4, .widget-area h5, .widget-area h6, #secondary h1, #secondary h2, #secondary h3, #secondary h4, #secondary h5, #secondary h6, #sidebar h1, #sidebar h2, #sidebar h3, #sidebar h4, #sidebar h5, #sidebar h6, #sidebar1 h1, #sidebar1 h2, #sidebar1 h3, #sidebar1 h4, #sidebar1 h5, #sidebar1 h6, #sidebar2 h1, #sidebar2 h2, #sidebar2 h3, #sidebar2 h4, #sidebar2 h5, #sidebar2 h6';
17
+ $elements['ogf_sidebar_content']['selectors'] = '.widget-area, .widget, .sidebar, #sidebar, #sidebar1, #sidebar2, #secondary';
18
+
19
+ return $elements;
20
+ }
21
+ add_filter( 'ogf_elements', 'ogf_silverks_elements' );
includes/customizer/output-css.php CHANGED
@@ -15,25 +15,18 @@ function ogf_output_css() {
15
  <!-- Fonts Plugin CSS - https://fontsplugin.com/ -->
16
  <style>
17
  <?php
18
-
19
  do_action( 'ogf_inline_styles' );
20
- echo ogf_return_custom_font_css();
21
-
22
  foreach ( ogf_get_elements() as $id => $values ) {
23
  ogf_generate_css( $values['selectors'], $id );
24
  }
25
  foreach ( ogf_get_custom_elements() as $id => $values ) {
26
  ogf_generate_css( $values['selectors'], $id );
27
  }
28
-
29
-
30
  ?>
31
  </style>
32
  <!-- Fonts Plugin CSS -->
33
  <?php
34
  }
35
-
36
- // Output custom CSS to live site.
37
  add_action( 'wp_head', 'ogf_output_css', 1000 );
38
 
39
  /**
@@ -72,6 +65,15 @@ function ogf_return_custom_font_css() {
72
  return $css;
73
  }
74
 
 
 
 
 
 
 
 
 
 
75
  /**
76
  * Helper function to build the CSS styles.
77
  *
@@ -229,40 +231,37 @@ function ogf_is_forced() {
229
  if ( 1 === (int) get_theme_mod( 'ogf_force_styles' ) ) {
230
  return ' !important';
231
  }
 
232
  }
233
 
234
  /**
235
  * Helper function to build the CSS variables.
236
  */
237
  function ogf_generate_css_variables() {
238
- $body_font = get_theme_mod( 'ogf_body_font', false );
239
- $headings_font = get_theme_mod( 'ogf_headings_font', false );
240
- $inputs_font = get_theme_mod( 'ogf_inputs_font', false );
241
 
242
  if ( $body_font === 'default' && $headings_font === 'default' && $inputs_font === 'default' ) {
243
  return;
244
  }
245
 
246
- if ( ! $body_font && ! $headings_font && ! $inputs_font ) {
247
- return;
248
- }
249
-
250
- $css = ':root {';
251
 
252
- if ( $body_font ) {
253
  $body_font_stack = str_replace( '"', '', ogf_build_font_stack( $body_font ) );
254
- $css .= '--font-base: ' . esc_attr( $body_font_stack ) . ';';
255
  }
256
- if ( $headings_font ) {
257
  $headings_font_stack = str_replace( '"', '', ogf_build_font_stack( $headings_font ) );
258
- $css .= '--font-headings: ' . esc_attr( $headings_font_stack ) . ';';
259
  }
260
- if ( $inputs_font ) {
261
  $inputs_font_stack = str_replace( '"', '', ogf_build_font_stack( $inputs_font ) );
262
- $css .= '--font-input: ' . esc_attr( $inputs_font_stack ) . ';';
263
  }
264
 
265
- $css .= '}';
266
 
267
  echo $css;
268
  }
15
  <!-- Fonts Plugin CSS - https://fontsplugin.com/ -->
16
  <style>
17
  <?php
 
18
  do_action( 'ogf_inline_styles' );
 
 
19
  foreach ( ogf_get_elements() as $id => $values ) {
20
  ogf_generate_css( $values['selectors'], $id );
21
  }
22
  foreach ( ogf_get_custom_elements() as $id => $values ) {
23
  ogf_generate_css( $values['selectors'], $id );
24
  }
 
 
25
  ?>
26
  </style>
27
  <!-- Fonts Plugin CSS -->
28
  <?php
29
  }
 
 
30
  add_action( 'wp_head', 'ogf_output_css', 1000 );
31
 
32
  /**
65
  return $css;
66
  }
67
 
68
+ /**
69
+ * Echo ogf_return_custom_font_css
70
+ */
71
+ function ogf_echo_custom_font_css() {
72
+ echo ogf_return_custom_font_css();
73
+ }
74
+ add_action( 'ogf_inline_styles', 'ogf_echo_custom_font_css', 2, 0 );
75
+ add_action( 'ogf_gutenberg_inline_styles', 'ogf_echo_custom_font_css', 2 );
76
+
77
  /**
78
  * Helper function to build the CSS styles.
79
  *
231
  if ( 1 === (int) get_theme_mod( 'ogf_force_styles' ) ) {
232
  return ' !important';
233
  }
234
+ return '';
235
  }
236
 
237
  /**
238
  * Helper function to build the CSS variables.
239
  */
240
  function ogf_generate_css_variables() {
241
+ $body_font = get_theme_mod( 'ogf_body_font', 'default' );
242
+ $headings_font = get_theme_mod( 'ogf_headings_font', 'default' );
243
+ $inputs_font = get_theme_mod( 'ogf_inputs_font', 'default' );
244
 
245
  if ( $body_font === 'default' && $headings_font === 'default' && $inputs_font === 'default' ) {
246
  return;
247
  }
248
 
249
+ $css = ':root {' . PHP_EOL;
 
 
 
 
250
 
251
+ if ( $body_font && $body_font !== 'default' ) {
252
  $body_font_stack = str_replace( '"', '', ogf_build_font_stack( $body_font ) );
253
+ $css .= '--font-base: ' . esc_attr( $body_font_stack ) . ';' . PHP_EOL;
254
  }
255
+ if ( $headings_font && $headings_font !== 'default' ) {
256
  $headings_font_stack = str_replace( '"', '', ogf_build_font_stack( $headings_font ) );
257
+ $css .= '--font-headings: ' . esc_attr( $headings_font_stack ) . ';' . PHP_EOL;
258
  }
259
+ if ( $inputs_font && $inputs_font !== 'default' ) {
260
  $inputs_font_stack = str_replace( '"', '', ogf_build_font_stack( $inputs_font ) );
261
+ $css .= '--font-input: ' . esc_attr( $inputs_font_stack ) . ';' . PHP_EOL;
262
  }
263
 
264
+ $css .= '}' . PHP_EOL;
265
 
266
  echo $css;
267
  }
includes/customizer/settings.php CHANGED
@@ -225,22 +225,23 @@ function ogf_customize_register( $wp_customize ) {
225
 
226
  if ( $fonts->has_google_fonts() ) {
227
 
228
- $choices = $fonts->choices;
229
-
230
  // Build the selective font loading controls.
231
- foreach ( $choices as $font_id ) {
232
 
233
  if ( ! ogf_is_google_font( $font_id ) ) {
234
- return;
235
  }
236
 
237
  $weights = $fonts->get_font_weights( $font_id );
238
  $name = $fonts->get_font_name( $font_id );
239
  $all_variants = ogf_font_variants();
240
  $new_variants = array();
 
241
  foreach ( $weights as $key => $value ) {
242
  $new_variants[ $key ] = $all_variants[ $key ];
243
  }
 
 
244
  unset( $new_variants[0] );
245
 
246
  $wp_customize->add_setting(
225
 
226
  if ( $fonts->has_google_fonts() ) {
227
 
 
 
228
  // Build the selective font loading controls.
229
+ foreach ( $fonts->choices as $font_id ) {
230
 
231
  if ( ! ogf_is_google_font( $font_id ) ) {
232
+ continue;
233
  }
234
 
235
  $weights = $fonts->get_font_weights( $font_id );
236
  $name = $fonts->get_font_name( $font_id );
237
  $all_variants = ogf_font_variants();
238
  $new_variants = array();
239
+
240
  foreach ( $weights as $key => $value ) {
241
  $new_variants[ $key ] = $all_variants[ $key ];
242
  }
243
+
244
+ // remove the 'default' value.
245
  unset( $new_variants[0] );
246
 
247
  $wp_customize->add_setting(
includes/functions.php CHANGED
@@ -119,7 +119,7 @@ function ogf_get_elements() {
119
  'label' => esc_html__( 'Headings Typography', 'olympus-google-fonts' ),
120
  'description' => esc_html__( 'Select and configure the font for your sidebar headings.', 'olympus-google-fonts' ),
121
  'section' => 'ogf_advanced__sidebar',
122
- 'selectors' => '.widget-title, .widget-area h1, .widget-area h2, .widget-area h3, .widget-area h4, .widgets-area h5, .widget-area h6, #secondary h1, #secondary h2, #secondary h3, #secondary h4, #secondary h5, #secondary h6',
123
  ),
124
  'ogf_sidebar_content' => array(
125
  'label' => esc_html__( 'Content Typography', 'olympus-google-fonts' ),
119
  'label' => esc_html__( 'Headings Typography', 'olympus-google-fonts' ),
120
  'description' => esc_html__( 'Select and configure the font for your sidebar headings.', 'olympus-google-fonts' ),
121
  'section' => 'ogf_advanced__sidebar',
122
+ 'selectors' => '.widget-title, .widget-area h1, .widget-area h2, .widget-area h3, .widget-area h4, .widget-area h5, .widget-area h6, #secondary h1, #secondary h2, #secondary h3, #secondary h4, #secondary h5, #secondary h6',
123
  ),
124
  'ogf_sidebar_content' => array(
125
  'label' => esc_html__( 'Content Typography', 'olympus-google-fonts' ),
includes/gutenberg/output-css.php CHANGED
@@ -167,11 +167,3 @@ function ogf_generate_css_gutenberg( $selector, $option_name ) {
167
 
168
  }
169
  }
170
-
171
- /**
172
- * Add CSS for Custom Font Uploads to Gutenberg
173
- */
174
- function ogf_gutenberg_custom_font_css() {
175
- echo ogf_return_custom_font_css();
176
- }
177
- add_action( 'ogf_gutenberg_inline_styles', 'ogf_gutenberg_custom_font_css', 2 );
167
 
168
  }
169
  }
 
 
 
 
 
 
 
 
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. 1000+ font choices.
8
- * Version: 2.5.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
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. 1000+ font choices.
8
+ * Version: 2.5.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
readme.txt CHANGED
@@ -5,7 +5,7 @@ Donate link: https://fontsplugin.com/#pricing
5
  Requires at least: 4.0
6
  Tested up to: 5.7
7
  License: GPLv2 or later
8
- Stable tag: 2.5.7
9
 
10
  The easiest to use Google Fonts Typography Plugin. No coding required. 1000+ font choices.
11
 
5
  Requires at least: 4.0
6
  Tested up to: 5.7
7
  License: GPLv2 or later
8
+ Stable tag: 2.5.8
9
 
10
  The easiest to use Google Fonts Typography Plugin. No coding required. 1000+ font choices.
11