Custom Adobe Fonts (Typekit) - Version 1.0.8

Version Description

Download this release

Release Info

Developer Nikschavan
Plugin Icon 128x128 Custom Adobe Fonts (Typekit)
Version 1.0.8
Comparing to
See all releases

Code changes from version 1.0.7 to 1.0.8

classes/class-custom-typekit-fonts-admin.php CHANGED
@@ -90,7 +90,7 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
90
  <p><?php _e( 'Custom Typekit Fonts settings have been successfully saved.', 'custom-typekit-fonts' ); ?></p>
91
  </div>
92
  <?php
93
- }
94
  }
95
  }
96
  }
90
  <p><?php _e( 'Custom Typekit Fonts settings have been successfully saved.', 'custom-typekit-fonts' ); ?></p>
91
  </div>
92
  <?php
93
+ }
94
  }
95
  }
96
  }
classes/class-custom-typekit-fonts-render.php CHANGED
@@ -105,9 +105,12 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Render' ) ) :
105
  $custom_fonts = array();
106
  if ( ! empty( $all_fonts ) ) {
107
  foreach ( $all_fonts as $font_family_name => $fonts_url ) {
108
- $custom_fonts[ strtolower( str_replace( ' ', '-', $font_family_name ) ) ] = self::$font_base;
 
 
109
  }
110
  }
 
111
  return array_merge( $fonts, $custom_fonts );
112
  }
113
 
@@ -192,7 +195,7 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Render' ) ) :
192
  if ( ! empty( $kit_list['custom-typekit-font-details'] ) ) {
193
  echo '<optgroup label="Typekit">';
194
  foreach ( $kit_list['custom-typekit-font-details'] as $font => $properties ) {
195
- echo '<option value="' . esc_attr( $font ) . ',' . $properties['fallback'] . '" ' . selected( $font, $value, false ) . '>' . esc_attr( $font ) . '</option>';
196
  }
197
  }
198
  }
@@ -209,12 +212,15 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Render' ) ) :
209
  $fonts = $kit_list['custom-typekit-font-details'];
210
  $custom_fonts = array();
211
  if ( ! empty( $fonts ) ) :
212
- foreach ( $fonts as $font_family_name => $fonts_url ) :
213
- $custom_fonts[ $font_family_name ] = array(
 
 
 
214
  'fallback' => 'Verdana, Arial, sans-serif',
215
  'weights' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900' ),
216
  );
217
- endforeach;
218
  endif;
219
 
220
  return array_merge( $bb_fonts, $custom_fonts );
105
  $custom_fonts = array();
106
  if ( ! empty( $all_fonts ) ) {
107
  foreach ( $all_fonts as $font_family_name => $fonts_url ) {
108
+ $font_slug = isset( $fonts_url['slug'] ) ? $fonts_url['slug'] : '';
109
+ $font_css = isset( $fonts_url['css_names'][0] ) ? $fonts_url['css_names'][0] : $font_slug;
110
+ $custom_fonts[ $font_css ] = self::$font_base;
111
  }
112
  }
113
+
114
  return array_merge( $fonts, $custom_fonts );
115
  }
116
 
195
  if ( ! empty( $kit_list['custom-typekit-font-details'] ) ) {
196
  echo '<optgroup label="Typekit">';
197
  foreach ( $kit_list['custom-typekit-font-details'] as $font => $properties ) {
198
+ echo '<option value="\'' . esc_attr( $font ) . '\',' . esc_attr( $properties['fallback'] ) . '" ' . selected( $font, $value, false ) . '>' . esc_html( $font ) . '</option>';
199
  }
200
  }
201
  }
212
  $fonts = $kit_list['custom-typekit-font-details'];
213
  $custom_fonts = array();
214
  if ( ! empty( $fonts ) ) :
215
+ foreach ( $fonts as $font_family_name => $fonts_url ) {
216
+ $font_slug = isset( $fonts_url['slug'] ) ? $fonts_url['slug'] : '';
217
+ $font_css = isset( $fonts_url['css_names'][0] ) ? $fonts_url['css_names'][0] : $font_slug;
218
+
219
+ $custom_fonts[ $font_css ] = array(
220
  'fallback' => 'Verdana, Arial, sans-serif',
221
  'weights' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900' ),
222
  );
223
+ }
224
  endif;
225
 
226
  return array_merge( $bb_fonts, $custom_fonts );
classes/class-custom-typekit-fonts-update.php ADDED
@@ -0,0 +1,112 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Custom Typekit Fonts Update
4
+ *
5
+ * @package Custom Typekit Fonts
6
+ * @author Brainstorm Force
7
+ * @copyright Copyright (c) 2018, Astra
8
+ * @link https://wpastra.com/
9
+ * @since Astra 1.0.0
10
+ */
11
+
12
+ if ( ! class_exists( 'Custom_Typekit_Fonts_Update' ) ) {
13
+
14
+ /**
15
+ * Custom_Typekit_Fonts_Update initial setup
16
+ *
17
+ * @since 1.0.0
18
+ */
19
+ class Custom_Typekit_Fonts_Update {
20
+
21
+
22
+ /**
23
+ * Class instance.
24
+ *
25
+ * @access private
26
+ * @var $instance Class instance.
27
+ */
28
+ private static $instance;
29
+
30
+ /**
31
+ * Initiator
32
+ */
33
+ public static function get_instance() {
34
+ if ( ! isset( self::$instance ) ) {
35
+ self::$instance = new self();
36
+ }
37
+ return self::$instance;
38
+ }
39
+
40
+ /**
41
+ * Constructor
42
+ */
43
+ public function __construct() {
44
+
45
+ // Theme Updates.
46
+ if ( is_admin() ) {
47
+ add_action( 'admin_init', array( $this, 'init' ), 5 );
48
+ } else {
49
+ add_action( 'init', array( $this, 'init' ), 5 );
50
+ }
51
+
52
+ }
53
+
54
+ /**
55
+ * Return option name for storing the custom typekit version.
56
+ *
57
+ * @return String
58
+ */
59
+ private function get_option_name() {
60
+ return '_custom_typekit_fonts_version';
61
+ }
62
+
63
+ /**
64
+ * Implement theme update logic.
65
+ *
66
+ * @since 1.0.7
67
+ */
68
+ public function init() {
69
+ do_action( 'custom_typekit_fonts_update_before' );
70
+
71
+ // Get auto saved version number.
72
+ $saved_version = get_option( $this->get_option_name(), false );
73
+
74
+ // If equals then return.
75
+ if ( version_compare( $saved_version, CUSTOM_TYPEKIT_FONTS_VER, '=' ) ) {
76
+ return;
77
+ }
78
+
79
+ // Update to older version than 1.0.8 version.
80
+ if ( version_compare( $saved_version, '1.0.8', '<' ) ) {
81
+ $this->v_1_0_8();
82
+ }
83
+
84
+ // Update auto saved version number.
85
+ update_option( $this->get_option_name(), CUSTOM_TYPEKIT_FONTS_VER );
86
+
87
+ do_action( 'custom_typekit_fonts_update_after' );
88
+ }
89
+
90
+ /**
91
+ * Force udpate typekit fonts.
92
+ *
93
+ * @return void
94
+ */
95
+ private function v_1_0_8() {
96
+ $typekit = new Custom_Typekit_Fonts();
97
+ $custom_typekit = get_option( 'custom-typekit-fonts' );
98
+ $option = array();
99
+ $option['custom-typekit-font-id'] = sanitize_text_field( $custom_typekit['custom-typekit-font-id'] );
100
+ $option['custom-typekit-font-details'] = $typekit->get_custom_typekit_details( $custom_typekit['custom-typekit-font-id'] );
101
+
102
+ update_option( 'custom-typekit-fonts', $option );
103
+ }
104
+
105
+ }
106
+
107
+ }
108
+
109
+ /**
110
+ * Kicking this off by calling 'get_instance()' method
111
+ */
112
+ Custom_Typekit_Fonts_Update::get_instance();
classes/class-custom-typekit-fonts.php CHANGED
@@ -38,6 +38,7 @@ if ( ! class_exists( 'Custom_Typekit_Fonts' ) ) {
38
  public function __construct() {
39
  require_once CUSTOM_TYPEKIT_FONTS_DIR . 'classes/class-custom-typekit-fonts-admin.php';
40
  require_once CUSTOM_TYPEKIT_FONTS_DIR . 'classes/class-custom-typekit-fonts-render.php';
 
41
 
42
  add_action( 'init', array( $this, 'options_setting' ) );
43
 
@@ -151,6 +152,9 @@ if ( ! class_exists( 'Custom_Typekit_Fonts' ) ) {
151
  $typekit_info[ $family_name ]['weights'][] = $weight;
152
  }
153
  }
 
 
 
154
  }
155
 
156
  return $typekit_info;
38
  public function __construct() {
39
  require_once CUSTOM_TYPEKIT_FONTS_DIR . 'classes/class-custom-typekit-fonts-admin.php';
40
  require_once CUSTOM_TYPEKIT_FONTS_DIR . 'classes/class-custom-typekit-fonts-render.php';
41
+ require_once CUSTOM_TYPEKIT_FONTS_DIR . 'classes/class-custom-typekit-fonts-update.php';
42
 
43
  add_action( 'init', array( $this, 'options_setting' ) );
44
 
152
  $typekit_info[ $family_name ]['weights'][] = $weight;
153
  }
154
  }
155
+
156
+ $typekit_info[ $family_name ]['slug'] = $family['slug'];
157
+ $typekit_info[ $family_name ]['css_names'] = $family['css_names'];
158
  }
159
 
160
  return $typekit_info;
custom-typekit-fonts.php CHANGED
@@ -6,7 +6,7 @@
6
  * Author: Brainstorm Force
7
  * Author URI: http://www.brainstormforce.com
8
  * Text Domain: custom-typekit-fonts
9
- * Version: 1.0.7
10
  *
11
  * @package Typekit_Custom_Fonts
12
  */
@@ -25,7 +25,7 @@ define( 'CUSTOM_TYPEKIT_FONTS_FILE', __FILE__ );
25
  define( 'CUSTOM_TYPEKIT_FONTS_BASE', plugin_basename( CUSTOM_TYPEKIT_FONTS_FILE ) );
26
  define( 'CUSTOM_TYPEKIT_FONTS_DIR', plugin_dir_path( CUSTOM_TYPEKIT_FONTS_FILE ) );
27
  define( 'CUSTOM_TYPEKIT_FONTS_URI', plugins_url( '/', CUSTOM_TYPEKIT_FONTS_FILE ) );
28
- define( 'CUSTOM_TYPEKIT_FONTS_VER', '1.0.7' );
29
  /**
30
  * BSF Custom Fonts
31
  */
6
  * Author: Brainstorm Force
7
  * Author URI: http://www.brainstormforce.com
8
  * Text Domain: custom-typekit-fonts
9
+ * Version: 1.0.8
10
  *
11
  * @package Typekit_Custom_Fonts
12
  */
25
  define( 'CUSTOM_TYPEKIT_FONTS_BASE', plugin_basename( CUSTOM_TYPEKIT_FONTS_FILE ) );
26
  define( 'CUSTOM_TYPEKIT_FONTS_DIR', plugin_dir_path( CUSTOM_TYPEKIT_FONTS_FILE ) );
27
  define( 'CUSTOM_TYPEKIT_FONTS_URI', plugins_url( '/', CUSTOM_TYPEKIT_FONTS_FILE ) );
28
+ define( 'CUSTOM_TYPEKIT_FONTS_VER', '1.0.8' );
29
  /**
30
  * BSF Custom Fonts
31
  */
languages/custom-typekit-fonts.pot CHANGED
@@ -2,10 +2,10 @@
2
  # This file is distributed under the same license as the Custom Typekit Fonts package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Custom Typekit Fonts 1.0.6\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/custom-typekit-fonts\n"
8
- "POT-Creation-Date: 2018-07-20 10:19:02+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
@@ -23,7 +23,7 @@ msgstr ""
23
  "X-Poedit-SearchPath-0: .\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
- "X-Generator: grunt-wp-i18n1.0.2\n"
27
 
28
  #: classes/class-custom-typekit-fonts-admin.php:80
29
  #: templates/custom-typekit-fonts-options.php:27
@@ -39,7 +39,7 @@ msgid "Custom Typekit Fonts settings have been successfully saved."
39
  msgstr ""
40
 
41
  #: classes/class-custom-typekit-fonts-admin.php:106
42
- #: classes/class-custom-typekit-fonts-render.php:88
43
  #: templates/custom-typekit-fonts-options.php:11
44
  msgid "Typekit Fonts"
45
  msgstr ""
2
  # This file is distributed under the same license as the Custom Typekit Fonts package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Custom Typekit Fonts 1.0.8\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/custom-typekit-fonts\n"
8
+ "POT-Creation-Date: 2018-12-27 09:11:35+00:00\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=utf-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
23
  "X-Poedit-SearchPath-0: .\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
26
+ "X-Generator: grunt-wp-i18n 1.0.3\n"
27
 
28
  #: classes/class-custom-typekit-fonts-admin.php:80
29
  #: templates/custom-typekit-fonts-options.php:27
39
  msgstr ""
40
 
41
  #: classes/class-custom-typekit-fonts-admin.php:106
42
+ #: classes/class-custom-typekit-fonts-render.php:90
43
  #: templates/custom-typekit-fonts-options.php:11
44
  msgid "Typekit Fonts"
45
  msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpastra.com/
4
  Tags: custom typekit fonts, theme custom fonts, unlimited typekit custom fonts
5
  Requires at least: 4.4
6
  Tested up to: 5.0
7
- Stable tag: 1.0.7
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -49,30 +49,33 @@ If you're not using any of the supported plugins and theme, you can write the cu
49
 
50
  == Changelog ==
51
 
52
- v1.0.7
53
- * Improvement: Enqueue typekit fonts in the block editor.
54
 
55
- v1.0.6
56
- * Fixed: Update font name to correct font family to be rendered correctly for all the fonts.
57
- * Fixed: Typekit fonts not rendered ccorrectly in Beaver Builder and Elementor settings.
58
 
59
- v1.0.5
60
- * Fixed: Fatal error: Uncaught Error: Class ‘Bsf_Custom_Fonts_Taxonomy’ not found
 
61
 
62
- v1.0.4
63
- * Fixed: Added Fonts in separate group for Elementor fonts & global fonts selection.
64
 
65
- v1.0.3
66
- * New: Added compatibility with Beaver Builder Theme, Beaver Builder Plugin and Elementor.
67
 
68
- v1.0.2
69
- * Typekit fonts support added for all themes.
70
- * White Label support added from the [Astra Pro](https://wpastra.com/pro/) plugin.
71
 
72
- v1.0.1
73
- * Custom Typekit Fonts wp admin menu renamed to Typekit Fonts.
74
- * Empty Kit notice added if there is not fonts in the Kit.
75
- * Php waring if there is no font list handled.
76
 
77
- v1.0.0
78
- * Initial release
 
 
 
 
 
4
  Tags: custom typekit fonts, theme custom fonts, unlimited typekit custom fonts
5
  Requires at least: 4.4
6
  Tested up to: 5.0
7
+ Stable tag: 1.0.8
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
49
 
50
  == Changelog ==
51
 
52
+ = v1.0.8 =
53
+ - Fixed: A few TypeKit fonts not being rendered correctly.
54
 
55
+ = v1.0.7 =
56
+ - Improvement: Enqueue typekit fonts in the block editor.
 
57
 
58
+ = v1.0.6 =
59
+ - Fixed: Update font name to correct font family to be rendered correctly for all the fonts.
60
+ - Fixed: Typekit fonts not rendered ccorrectly in Beaver Builder and Elementor settings.
61
 
62
+ = v1.0.5 =
63
+ - Fixed: Fatal error: Uncaught Error: Class ‘Bsf_Custom_Fonts_Taxonomy’ not found
64
 
65
+ = v1.0.4 =
66
+ - Fixed: Added Fonts in separate group for Elementor fonts & global fonts selection.
67
 
68
+ = v1.0.3 =
69
+ - New: Added compatibility with Beaver Builder Theme, Beaver Builder Plugin and Elementor.
 
70
 
71
+ = v1.0.2 =
72
+ - Typekit fonts support added for all themes.
73
+ - White Label support added from the [Astra Pro](https://wpastra.com/pro/) plugin.
 
74
 
75
+ = v1.0.1 =
76
+ - Custom Typekit Fonts wp admin menu renamed to Typekit Fonts.
77
+ - Empty Kit notice added if there is not fonts in the Kit.
78
+ - Php waring if there is no font list handled.
79
+
80
+ = v1.0.0 =
81
+ - Initial release