Custom Adobe Fonts (Typekit) - Version 1.0.6

Version Description

Download this release

Release Info

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

Code changes from version 1.0.5 to 1.0.6

classes/class-custom-typekit-fonts-admin.php CHANGED
@@ -79,10 +79,9 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
79
  <div class="notice notice-error is-dismissible">
80
  <p><?php _e( 'Please Enter the Valid Kit ID to get the kit details.', 'custom-typekit-fonts' ); ?></p>
81
  </div>
82
- <?php
83
- } // Kit is empty.
84
- elseif ( isset( $_POST['custom-typekit-empty-notice'] ) && $_POST['custom-typekit-empty-notice'] ) {
85
- ?>
86
  <div class="notice notice-warning is-dismissible">
87
  <p><?php _e( 'This Kit is empty. Please add some fonts in it.', 'custom-typekit-fonts' ); ?></p>
88
  </div>
@@ -133,6 +132,10 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
133
  */
134
  public function enqueue_scripts() {
135
 
 
 
 
 
136
  wp_enqueue_style( 'custom-typekit-fonts-css', CUSTOM_TYPEKIT_FONTS_URI . 'assets/css/custom-typekit-fonts.css', array(), CUSTOM_TYPEKIT_FONTS_VER );
137
 
138
  wp_enqueue_script( 'custom-typekit-fonts-js', CUSTOM_TYPEKIT_FONTS_URI . 'assets/js/custom-typekit-fonts.js', array( 'jquery-ui-tooltip' ), CUSTOM_TYPEKIT_FONTS_VER );
79
  <div class="notice notice-error is-dismissible">
80
  <p><?php _e( 'Please Enter the Valid Kit ID to get the kit details.', 'custom-typekit-fonts' ); ?></p>
81
  </div>
82
+ <?php
83
+ } elseif ( isset( $_POST['custom-typekit-empty-notice'] ) && $_POST['custom-typekit-empty-notice'] ) {
84
+ ?>
 
85
  <div class="notice notice-warning is-dismissible">
86
  <p><?php _e( 'This Kit is empty. Please add some fonts in it.', 'custom-typekit-fonts' ); ?></p>
87
  </div>
132
  */
133
  public function enqueue_scripts() {
134
 
135
+ if ( 'appearance_page_custom-typekit-fonts' !== get_current_screen()->id ) {
136
+ return;
137
+ }
138
+
139
  wp_enqueue_style( 'custom-typekit-fonts-css', CUSTOM_TYPEKIT_FONTS_URI . 'assets/css/custom-typekit-fonts.css', array(), CUSTOM_TYPEKIT_FONTS_VER );
140
 
141
  wp_enqueue_script( 'custom-typekit-fonts-js', CUSTOM_TYPEKIT_FONTS_URI . 'assets/js/custom-typekit-fonts.js', array( 'jquery-ui-tooltip' ), CUSTOM_TYPEKIT_FONTS_VER );
classes/class-custom-typekit-fonts-render.php CHANGED
@@ -87,7 +87,6 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Render' ) ) :
87
  public function elementor_group( $font_groups ) {
88
  $new_group[ self::$font_base ] = __( 'Typekit Fonts', 'custom-typekit-fonts' );
89
  $font_groups = $new_group + $font_groups;
90
-
91
  return $font_groups;
92
  }
93
 
@@ -99,16 +98,15 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Render' ) ) :
99
  */
100
  public function add_elementor_fonts( $fonts ) {
101
 
102
- $kit_list = get_option( 'custom-typekit-fonts' );
103
- $fonts = $kit_list['custom-typekit-font-details'];
104
-
105
- if ( ! empty( $fonts ) ) {
106
- foreach ( $fonts as $font_family_name => $fonts_url ) {
107
- $fonts[ $font_family_name ] = self::$font_base;
108
  }
109
  }
110
-
111
- return $fonts;
112
  }
113
 
114
  /**
87
  public function elementor_group( $font_groups ) {
88
  $new_group[ self::$font_base ] = __( 'Typekit Fonts', 'custom-typekit-fonts' );
89
  $font_groups = $new_group + $font_groups;
 
90
  return $font_groups;
91
  }
92
 
98
  */
99
  public function add_elementor_fonts( $fonts ) {
100
 
101
+ $kit_list = get_option( 'custom-typekit-fonts' );
102
+ $all_fonts = $kit_list['custom-typekit-font-details'];
103
+ $custom_fonts = array();
104
+ if ( ! empty( $all_fonts ) ) {
105
+ foreach ( $all_fonts as $font_family_name => $fonts_url ) {
106
+ $custom_fonts[ strtolower( str_replace( ' ', '-', $font_family_name ) ) ] = self::$font_base;
107
  }
108
  }
109
+ return array_merge( $fonts, $custom_fonts );
 
110
  }
111
 
112
  /**
classes/class-custom-typekit-fonts.php CHANGED
@@ -122,15 +122,17 @@ if ( ! class_exists( 'Custom_Typekit_Fonts' ) ) {
122
  $data = json_decode( wp_remote_retrieve_body( $response ), true );
123
  $families = $data['kit']['families'];
124
 
125
- foreach ( $families as $family ) :
126
 
127
- $typekit_info[ $family['name'] ] = array(
128
- 'family' => $family['name'],
 
 
129
  'fallback' => str_replace( '"', '', $family['css_stack'] ),
130
  'weights' => array(),
131
  );
132
 
133
- foreach ( $family['variations'] as $variation ) :
134
 
135
  $variations = str_split( $variation );
136
 
@@ -145,13 +147,11 @@ if ( ! class_exists( 'Custom_Typekit_Fonts' ) ) {
145
 
146
  $weight = $variations[1] . '00';
147
 
148
- if ( ! in_array( $weight, $typekit_info[ $family['name'] ]['weights'] ) ) {
149
- $typekit_info[ $family['name'] ]['weights'][] = $weight;
150
  }
151
-
152
- endforeach;
153
-
154
- endforeach;
155
 
156
  return $typekit_info;
157
  }
122
  $data = json_decode( wp_remote_retrieve_body( $response ), true );
123
  $families = $data['kit']['families'];
124
 
125
+ foreach ( $families as $family ) {
126
 
127
+ $family_name = str_replace( ' ', '-', $family['name'] );
128
+
129
+ $typekit_info[ $family_name ] = array(
130
+ 'family' => $family_name,
131
  'fallback' => str_replace( '"', '', $family['css_stack'] ),
132
  'weights' => array(),
133
  );
134
 
135
+ foreach ( $family['variations'] as $variation ) {
136
 
137
  $variations = str_split( $variation );
138
 
147
 
148
  $weight = $variations[1] . '00';
149
 
150
+ if ( ! in_array( $weight, $typekit_info[ $family_name ]['weights'] ) ) {
151
+ $typekit_info[ $family_name ]['weights'][] = $weight;
152
  }
153
+ }
154
+ }
 
 
155
 
156
  return $typekit_info;
157
  }
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.5
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.5' );
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.6
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.6' );
29
  /**
30
  * BSF Custom Fonts
31
  */
languages/custom-typekit-fonts.pot CHANGED
@@ -2,48 +2,46 @@
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.3\n"
6
  "Report-Msgid-Bugs-To: "
7
  "https://wordpress.org/support/plugin/custom-typekit-fonts\n"
8
- "POT-Creation-Date: 2018-02-21 07:44: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"
12
  "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "X-Generator: grunt-wp-i18n 0.5.4\n"
16
- "X-Poedit-KeywordsList: "
17
- "__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
18
- "attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
19
  "Language: en\n"
20
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
21
  "X-Poedit-Country: United States\n"
22
  "X-Poedit-SourceCharset: UTF-8\n"
 
 
 
23
  "X-Poedit-Basepath: ../\n"
24
  "X-Poedit-SearchPath-0: .\n"
25
  "X-Poedit-Bookmarks: \n"
26
  "X-Textdomain-Support: yes\n"
 
27
 
28
  #: classes/class-custom-typekit-fonts-admin.php:80
29
  #: templates/custom-typekit-fonts-options.php:27
30
  msgid "Please Enter the Valid Kit ID to get the kit details."
31
  msgstr ""
32
 
33
- #: classes/class-custom-typekit-fonts-admin.php:87
34
  msgid "This Kit is empty. Please add some fonts in it."
35
  msgstr ""
36
 
37
- #: classes/class-custom-typekit-fonts-admin.php:91
38
  msgid "Custom Typekit Fonts settings have been successfully saved."
39
  msgstr ""
40
 
41
- #: classes/class-custom-typekit-fonts-admin.php:107
42
- msgid "Typekit Fonts"
43
- msgstr ""
44
-
45
  #: templates/custom-typekit-fonts-options.php:11
46
- msgid "Typekit"
47
  msgstr ""
48
 
49
  #: templates/custom-typekit-fonts-options.php:17
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"
12
  "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
13
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
  "Language-Team: LANGUAGE <LL@li.org>\n"
 
 
 
 
15
  "Language: en\n"
16
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
17
  "X-Poedit-Country: United States\n"
18
  "X-Poedit-SourceCharset: UTF-8\n"
19
+ "X-Poedit-KeywordsList: "
20
+ "__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
21
+ "attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
22
  "X-Poedit-Basepath: ../\n"
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
30
  msgid "Please Enter the Valid Kit ID to get the kit details."
31
  msgstr ""
32
 
33
+ #: classes/class-custom-typekit-fonts-admin.php:86
34
  msgid "This Kit is empty. Please add some fonts in it."
35
  msgstr ""
36
 
37
+ #: classes/class-custom-typekit-fonts-admin.php:90
38
  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 ""
46
 
47
  #: templates/custom-typekit-fonts-options.php:17
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: brainstormforce, rushijagani
3
  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: 4.9.4
7
- Stable tag: 1.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -49,6 +49,10 @@ If you're not using any of the supported plugins and theme, you can write the cu
49
 
50
  == Changelog ==
51
 
 
 
 
 
52
  v1.0.5
53
  * Fixed: Fatal error: Uncaught Error: Class ‘Bsf_Custom_Fonts_Taxonomy’ not found
54
 
3
  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: 4.9.7
7
+ Stable tag: 1.0.6
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.6
53
+ * Fixed: Update font name to correct font family to be rendered correctly for all the fonts.
54
+ * Fixed: Typekit fonts not rendered ccorrectly in Beaver Builder and Elementor settings.
55
+
56
  v1.0.5
57
  * Fixed: Fatal error: Uncaught Error: Class ‘Bsf_Custom_Fonts_Taxonomy’ not found
58
 
templates/custom-typekit-fonts-options.php CHANGED
@@ -128,7 +128,7 @@ $kit_info = get_option( 'custom-typekit-fonts' );
128
  <?php
129
  /* translators: %1$s: Astra Theme url. */
130
  printf( __( '1) Once you get the Kit Details, all the fonts will be listed in the customizer under typography for only <a href="%1$s" target="_blank" rel="noopener"> Astra </a> WordPress Theme users', 'custom-typekit-fonts' ), 'https://wpastra.com' );
131
- ?>
132
  </p>
133
  <p>
134
  <?php esc_html_e( '2) Select the Font Family and start using it into your custom CSS.', 'custom-typekit-fonts' ); ?>
128
  <?php
129
  /* translators: %1$s: Astra Theme url. */
130
  printf( __( '1) Once you get the Kit Details, all the fonts will be listed in the customizer under typography for only <a href="%1$s" target="_blank" rel="noopener"> Astra </a> WordPress Theme users', 'custom-typekit-fonts' ), 'https://wpastra.com' );
131
+ ?>
132
  </p>
133
  <p>
134
  <?php esc_html_e( '2) Select the Font Family and start using it into your custom CSS.', 'custom-typekit-fonts' ); ?>