Google Fonts for WordPress - Version 1.8.3

Version Description

Download this release

Release Info

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

Code changes from version 1.8.2 to 1.8.3

assets/css/customize-controls.css CHANGED
@@ -6,7 +6,8 @@
6
  #customize-theme-controls #sub-accordion-section-ogf_advanced__content,
7
  #customize-theme-controls #sub-accordion-section-ogf_advanced__sidebar,
8
  #customize-theme-controls #sub-accordion-section-ogf_advanced__footer,
9
- #customize-theme-controls #sub-accordion-section-ogf_advanced__custom {
 
10
  overflow: visible;
11
  }
12
 
6
  #customize-theme-controls #sub-accordion-section-ogf_advanced__content,
7
  #customize-theme-controls #sub-accordion-section-ogf_advanced__sidebar,
8
  #customize-theme-controls #sub-accordion-section-ogf_advanced__footer,
9
+ #customize-theme-controls #sub-accordion-section-ogf_advanced__custom,
10
+ #customize-theme-controls #sub-accordion-section-ogf_advanced__css {
11
  overflow: visible;
12
  }
13
 
assets/js/customize-controls.js CHANGED
@@ -1,6 +1,6 @@
1
  'use strict';
2
 
3
- /* global ogf_font_array */
4
  ( function( api ) {
5
  api.controlConstructor[ 'typography' ] = api.Control.extend(
6
  {
@@ -175,6 +175,31 @@
175
  },
176
  }
177
  );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
178
  }( wp.customize ) );
179
 
180
  /* === Checkbox Multiple Control === */
1
  'use strict';
2
 
3
+ /* global ogf_font_array, ajaxurl, fontsReset, location */
4
  ( function( api ) {
5
  api.controlConstructor[ 'typography' ] = api.Control.extend(
6
  {
175
  },
176
  }
177
  );
178
+
179
+ wp.customize.control( 'ogf_reset_fonts', function( control ) {
180
+ control.container.find( '.button' ).on( 'click', function( event ) {
181
+ event.preventDefault();
182
+
183
+ const data = {
184
+ wp_customize: 'on',
185
+ action: 'customizer_reset',
186
+ security: fontsReset.nonce,
187
+ };
188
+
189
+ const confirmReset = confirm( fontsReset.confirm );
190
+
191
+ if ( ! confirmReset ) {
192
+ return;
193
+ }
194
+
195
+ jQuery( this ).attr( 'disabled', 'disabled' );
196
+
197
+ jQuery.post( ajaxurl, data, function( result ) {
198
+ wp.customize.state( 'saved' ).set( true );
199
+ location.reload();
200
+ } );
201
+ } );
202
+ } );
203
  }( wp.customize ) );
204
 
205
  /* === Checkbox Multiple Control === */
changelog.txt CHANGED
@@ -1,4 +1,9 @@
1
- = 1.8.1 =
 
 
 
 
 
2
 
3
  * Further improve theme compatibility for basic settings
4
 
1
+ = 1.8.3 =
2
+
3
+ * Move 'CSS' setting to 'Advanced' panel
4
+ * Add 'Reset' option to 'Debugging' section
5
+
6
+ = 1.8.2 =
7
 
8
  * Further improve theme compatibility for basic settings
9
 
class-olympus-google-fonts.php CHANGED
@@ -60,6 +60,9 @@ class Olympus_Google_Fonts {
60
  // Deactivation class.
61
  require OGF_DIR_PATH . 'includes/class-ogf-deactivation.php';
62
 
 
 
 
63
  }
64
 
65
  /**
@@ -113,7 +116,6 @@ class Olympus_Google_Fonts {
113
 
114
  wp_localize_script( 'ogf-customize-controls', 'ogf_font_array', ogf_fonts_array() );
115
  wp_localize_script( 'ogf-customize-controls', 'ogf_system_fonts', ogf_system_fonts() );
116
-
117
  }
118
 
119
  /**
60
  // Deactivation class.
61
  require OGF_DIR_PATH . 'includes/class-ogf-deactivation.php';
62
 
63
+ // Reset class.
64
+ require OGF_DIR_PATH . 'includes/class-ogf-reset.php';
65
+
66
  }
67
 
68
  /**
116
 
117
  wp_localize_script( 'ogf-customize-controls', 'ogf_font_array', ogf_fonts_array() );
118
  wp_localize_script( 'ogf-customize-controls', 'ogf_system_fonts', ogf_system_fonts() );
 
119
  }
120
 
121
  /**
includes/class-ogf-reset.php ADDED
@@ -0,0 +1,108 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Reset fonts class.
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
+ if ( ! class_exists( 'OGF_Reset' ) ) :
11
+ /**
12
+ * The 'Reset Fonts' class.
13
+ */
14
+ class OGF_Reset {
15
+
16
+ /**
17
+ * WP_Customize object.
18
+ *
19
+ * @var WP_Customize_Manager
20
+ */
21
+ private $wp_customize;
22
+
23
+ /**
24
+ * Class constructor.
25
+ */
26
+ public function __construct() {
27
+ add_action( 'customize_register', array( $this, 'customize_register' ) );
28
+ add_action( 'wp_ajax_customizer_reset', array( $this, 'ajax_customizer_reset' ) );
29
+ add_action( 'customize_register', array( $this, 'customize_register' ) );
30
+ add_action( 'customize_controls_enqueue_scripts', array( $this, 'customize_scripts' ), 101 );
31
+ }
32
+
33
+ /**
34
+ * Add localize script to assets/js/customize-controls.js.
35
+ */
36
+ public function customize_scripts() {
37
+ wp_localize_script(
38
+ 'ogf-customize-controls',
39
+ 'fontsReset',
40
+ array(
41
+ 'confirm' => esc_html__( 'This will reset all fonts set by this plugin to their defaults. This action can not be reversed.', 'olympus-google-fonts' ),
42
+ 'nonce' => wp_create_nonce( 'ogf_reset' ),
43
+ )
44
+ );
45
+ }
46
+
47
+ /**
48
+ * Store a reference to `WP_Customize_Manager` instance
49
+ *
50
+ * @param Object $wp_customize Global $wp_customize object.
51
+ */
52
+ public function customize_register( $wp_customize ) {
53
+ $this->wp_customize = $wp_customize;
54
+
55
+ $wp_customize->add_control(
56
+ 'ogf_reset_fonts',
57
+ array(
58
+ 'type' => 'button',
59
+ 'settings' => array(),
60
+ 'priority' => 100,
61
+ 'section' => 'ogf_debugging',
62
+ 'input_attrs' => array(
63
+ 'value' => __( 'Reset All Fonts', 'olympus-google-fonts' ),
64
+ 'class' => 'button button-link-delete',
65
+ ),
66
+ )
67
+ );
68
+
69
+ }
70
+
71
+ /**
72
+ * The reset AJAX request handler.
73
+ */
74
+ public function ajax_customizer_reset() {
75
+ if ( ! $this->wp_customize->is_preview() ) {
76
+ wp_send_json_error( 'not_preview' );
77
+ }
78
+
79
+ if ( ! check_ajax_referer( 'ogf_reset', 'security' ) ) {
80
+ wp_send_json_error( 'invalid_nonce' );
81
+ }
82
+
83
+ $this->reset_customizer();
84
+
85
+ wp_send_json_success();
86
+ }
87
+
88
+ /**
89
+ * Perform the reset.
90
+ */
91
+ public function reset_customizer() {
92
+ $settings = ogf_get_elements();
93
+ foreach ( $settings as $key => $value ) {
94
+ set_theme_mod( $key . '_font', null );
95
+ set_theme_mod( $key . '_font_weight', null );
96
+ set_theme_mod( $key . '_font_style', null );
97
+ set_theme_mod( $key . '_font_size', null );
98
+ set_theme_mod( $key . '_font_color', null );
99
+ set_theme_mod( $key . '_line_height', null );
100
+ }
101
+ }
102
+ }
103
+ endif;
104
+
105
+ /*
106
+ * Instantiate the OGF_Reset class.
107
+ */
108
+ new OGF_Reset();
includes/class-ogf-welcome.php CHANGED
@@ -28,7 +28,7 @@ if ( ! class_exists( 'OGF_Welcome' ) ) :
28
  private $message;
29
 
30
  /**
31
- * Tyle.
32
  *
33
  * @var string $type
34
  */
@@ -106,6 +106,6 @@ $message = sprintf(
106
  );
107
 
108
  /*
109
- * Instantiate the OGF_Welcome class.
110
- */
111
  new OGF_Welcome( 'ogf-welcome', $message, 'success' );
28
  private $message;
29
 
30
  /**
31
+ * Type.
32
  *
33
  * @var string $type
34
  */
106
  );
107
 
108
  /*
109
+ * Instantiate the OGF_Welcome class.
110
+ */
111
  new OGF_Welcome( 'ogf-welcome', $message, 'success' );
includes/customizer/panels.php CHANGED
@@ -153,5 +153,13 @@ function ogf_panels_customize_register( $wp_customize ) {
153
  )
154
  );
155
 
 
 
 
 
 
 
 
 
156
  }
157
  add_action( 'customize_register', 'ogf_panels_customize_register' );
153
  )
154
  );
155
 
156
+ $wp_customize->add_section(
157
+ 'ogf_advanced__css',
158
+ array(
159
+ 'title' => esc_html__( 'Load Fonts for CSS', 'olympus-google-fonts' ),
160
+ 'panel' => 'ogf_advanced',
161
+ )
162
+ );
163
+
164
  }
165
  add_action( 'customize_register', 'ogf_panels_customize_register' );
includes/customizer/settings.php CHANGED
@@ -55,8 +55,7 @@ function ogf_customize_register( $wp_customize ) {
55
  array(
56
  'label' => esc_html__( 'Load Fonts for CSS', 'olympus-google-fonts' ),
57
  'description' => esc_html__( 'Load fonts but don\'t automatically assign them to an element.', 'olympus-google-fonts' ),
58
- 'section' => 'ogf_basic',
59
- 'priority' => '90',
60
  )
61
  )
62
  );
55
  array(
56
  'label' => esc_html__( 'Load Fonts for CSS', 'olympus-google-fonts' ),
57
  'description' => esc_html__( 'Load fonts but don\'t automatically assign them to an element.', 'olympus-google-fonts' ),
58
+ 'section' => 'ogf_advanced__css',
 
59
  )
60
  )
61
  );
includes/gutenberg/output-css.php CHANGED
@@ -7,24 +7,21 @@
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
  */
7
  * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License
8
  */
9
 
 
10
  /**
11
  * Enqeue the Google Fonts URL.
12
  */
13
  function ogf_gutenberg_enqueue_fonts() {
14
 
15
+ $fonts = new OGF_Fonts();
 
 
 
 
 
16
 
17
+ if ( $fonts->has_custom_fonts() ) {
18
+ $url = $fonts->build_url();
19
+ wp_enqueue_style( 'olympus-google-fonts', $url, array(), OGF_VERSION );
20
+ }
21
 
22
+ }
23
  add_action( 'enqueue_block_editor_assets', 'ogf_gutenberg_enqueue_fonts' );
24
 
 
25
  /**
26
  * Output the font CSS to wp_head.
27
  */
languages/olympus-google-fonts.pot CHANGED
@@ -2,14 +2,14 @@
2
  # This file is distributed under the same license as the Google Fonts Typography plugin.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Google Fonts Typography 1.8.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/olympus-google-fonts\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "POT-Creation-Date: 2019-06-20T09:27:02+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.1.0\n"
15
  "X-Domain: olympus-google-fonts\n"
@@ -34,11 +34,11 @@ msgstr ""
34
  msgid "https://fontsplugin.com/?utm_source=wporg&utm_campaign=heading"
35
  msgstr ""
36
 
37
- #: class-olympus-google-fonts.php:143
38
  msgid "Settings"
39
  msgstr ""
40
 
41
- #: class-olympus-google-fonts.php:148
42
  msgid "Upgrade to Pro"
43
  msgstr ""
44
 
@@ -269,6 +269,14 @@ msgstr ""
269
  msgid "Verdana"
270
  msgstr ""
271
 
 
 
 
 
 
 
 
 
272
  #. translators: %s Link to Google Fonts customizer panel.
273
  #: includes/class-ogf-welcome.php:104
274
  msgid "Thank you for installing <strong>Google Fonts for WordPress</strong>! Configure your fonts here: <a href=\"%s\">WordPress Customizer</a>"
@@ -353,6 +361,7 @@ msgid "Custom Elements"
353
  msgstr ""
354
 
355
  #: includes/customizer/settings.php:56
 
356
  msgid "Load Fonts for CSS"
357
  msgstr ""
358
 
@@ -360,11 +369,11 @@ msgstr ""
360
  msgid "Load fonts but don't automatically assign them to an element."
361
  msgstr ""
362
 
363
- #: includes/customizer/settings.php:157
364
  msgid "Force Styles?"
365
  msgstr ""
366
 
367
- #: includes/customizer/settings.php:161
368
  msgid "If your choices are not displaying correctly, check this box."
369
  msgstr ""
370
 
2
  # This file is distributed under the same license as the Google Fonts Typography plugin.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Google Fonts Typography 1.8.3\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/olympus-google-fonts\n"
7
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
8
  "Language-Team: LANGUAGE <LL@li.org>\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
+ "POT-Creation-Date: 2019-06-25T16:30:10+00:00\n"
13
  "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
14
  "X-Generator: WP-CLI 2.1.0\n"
15
  "X-Domain: olympus-google-fonts\n"
34
  msgid "https://fontsplugin.com/?utm_source=wporg&utm_campaign=heading"
35
  msgstr ""
36
 
37
+ #: class-olympus-google-fonts.php:145
38
  msgid "Settings"
39
  msgstr ""
40
 
41
+ #: class-olympus-google-fonts.php:150
42
  msgid "Upgrade to Pro"
43
  msgstr ""
44
 
269
  msgid "Verdana"
270
  msgstr ""
271
 
272
+ #: includes/class-ogf-reset.php:41
273
+ msgid "This will reset all fonts set by this plugin to their defaults. This action can not be reversed."
274
+ msgstr ""
275
+
276
+ #: includes/class-ogf-reset.php:63
277
+ msgid "Reset All Fonts"
278
+ msgstr ""
279
+
280
  #. translators: %s Link to Google Fonts customizer panel.
281
  #: includes/class-ogf-welcome.php:104
282
  msgid "Thank you for installing <strong>Google Fonts for WordPress</strong>! Configure your fonts here: <a href=\"%s\">WordPress Customizer</a>"
361
  msgstr ""
362
 
363
  #: includes/customizer/settings.php:56
364
+ #: includes/customizer/panels.php:159
365
  msgid "Load Fonts for CSS"
366
  msgstr ""
367
 
369
  msgid "Load fonts but don't automatically assign them to an element."
370
  msgstr ""
371
 
372
+ #: includes/customizer/settings.php:156
373
  msgid "Force Styles?"
374
  msgstr ""
375
 
376
+ #: includes/customizer/settings.php:160
377
  msgid "If your choices are not displaying correctly, check this box."
378
  msgstr ""
379
 
olympus-google-fonts.php CHANGED
@@ -5,7 +5,7 @@
5
  * Plugin Name: 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. 870+ font choices.
8
- * Version: 1.8.2
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.8.2' );
22
  define( 'OGF_DIR_PATH', plugin_dir_path( __FILE__ ) );
23
  define( 'OGF_DIR_URL', plugin_dir_url( __FILE__ ) );
24
 
5
  * Plugin Name: 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. 870+ font choices.
8
+ * Version: 1.8.3
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.8.3' );
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.8.2
9
 
10
  The easiest to use Google Fonts Typography Plugin. No coding required. 870+ font choices.
11
 
@@ -47,6 +47,7 @@ The Google Fonts for WordPress plugin will work with all WordPress themes and ha
47
  * TwentyFifteen
48
  * TwentySixteen
49
  * TwentySeventeen
 
50
 
51
  ### Further Reading
52
 
5
  Requires at least: 4.0
6
  Tested up to: 5.2
7
  License: GPLv2 or later
8
+ Stable tag: 1.8.3
9
 
10
  The easiest to use Google Fonts Typography Plugin. No coding required. 870+ font choices.
11
 
47
  * TwentyFifteen
48
  * TwentySixteen
49
  * TwentySeventeen
50
+ * ThemeGrill
51
 
52
  ### Further Reading
53