Custom Adobe Fonts (Typekit) - Version 1.0.1

Version Description

Download this release

Release Info

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

Code changes from version 1.0.0 to 1.0.1

classes/class-custom-typekit-fonts-admin.php CHANGED
@@ -75,6 +75,20 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
75
  </div>
76
  <?php
77
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
78
  }
79
 
80
  // Notice for Custom Typekit Fonts action.
@@ -85,13 +99,20 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
85
  ?>
86
 
87
  <?php
88
- // if Kit ID not validated show notice.
89
- if ( isset( $_POST['custom-typekit-font-notice'] ) && $_POST['custom-typekit-font-notice'] ) {
90
  ?>
91
  <div class="notice notice-error is-dismissible">
92
  <p><?php _e( 'Please Enter the Valid Kit ID to get the kit details.', 'custom-typekit-fonts' ); ?></p>
93
  </div>
94
- <?php } else { ?>
 
 
 
 
 
 
 
95
  <div class="notice notice-success is-dismissible">
96
  <p><?php _e( 'Custom Typekit Fonts settings have been successfully saved.', 'custom-typekit-fonts' ); ?></p>
97
  </div>
@@ -109,8 +130,8 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
109
  */
110
  public function register_custom_fonts_menu() {
111
  add_options_page(
112
- __( 'Custom Typekit Fonts', 'custom-typekit-fonts' ),
113
- __( 'Custom Typekit Fonts', 'custom-typekit-fonts' ),
114
  'edit_theme_options',
115
  'custom-typekit-fonts',
116
  array( $this, 'typekit_options_page' )
@@ -118,8 +139,8 @@ if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
118
 
119
  add_submenu_page(
120
  'themes.php',
121
- __( 'Custom Typekit Fonts', 'custom-typekit-fonts' ),
122
- __( 'Custom Typekit Fonts', 'custom-typekit-fonts' ),
123
  'edit_theme_options',
124
  'custom-typekit-fonts',
125
  array( $this, 'typekit_options_page' )
75
  </div>
76
  <?php
77
  }
78
+ } else {
79
+ ?>
80
+ <div class="notice notice-error is-dismissible">
81
+ <p>
82
+ <?php
83
+ printf(
84
+ /* translators: 1: theme.php file*/
85
+ __( 'Astra Theme needs to be active for you to use currently installed "Custom TypeKit Fonts" plugin. <a href="%1$s">Install & Activate Now</a>', 'custom-typekit-fonts' ),
86
+ esc_url( admin_url( 'themes.php?theme=astra' ) )
87
+ );
88
+ ?>
89
+ </p>
90
+ </div>
91
+ <?php
92
  }
93
 
94
  // Notice for Custom Typekit Fonts action.
99
  ?>
100
 
101
  <?php
102
+ // Kit ID is not valid.
103
+ if ( isset( $_POST['custom-typekit-id-notice'] ) && $_POST['custom-typekit-id-notice'] ) {
104
  ?>
105
  <div class="notice notice-error is-dismissible">
106
  <p><?php _e( 'Please Enter the Valid Kit ID to get the kit details.', 'custom-typekit-fonts' ); ?></p>
107
  </div>
108
+ <?php
109
+ } // Kit is empty.
110
+ elseif ( isset( $_POST['custom-typekit-empty-notice'] ) && $_POST['custom-typekit-empty-notice'] ) {
111
+ ?>
112
+ <div class="notice notice-warning is-dismissible">
113
+ <p><?php _e( 'This Kit is empty. Please add some fonts in it.', 'custom-typekit-fonts' ); ?></p>
114
+ </div>
115
+ <?php } else { ?>
116
  <div class="notice notice-success is-dismissible">
117
  <p><?php _e( 'Custom Typekit Fonts settings have been successfully saved.', 'custom-typekit-fonts' ); ?></p>
118
  </div>
130
  */
131
  public function register_custom_fonts_menu() {
132
  add_options_page(
133
+ __( 'Typekit Fonts', 'custom-typekit-fonts' ),
134
+ __( 'Typekit Fonts', 'custom-typekit-fonts' ),
135
  'edit_theme_options',
136
  'custom-typekit-fonts',
137
  array( $this, 'typekit_options_page' )
139
 
140
  add_submenu_page(
141
  'themes.php',
142
+ __( 'Typekit Fonts', 'custom-typekit-fonts' ),
143
+ __( 'Typekit Fonts', 'custom-typekit-fonts' ),
144
  'edit_theme_options',
145
  'custom-typekit-fonts',
146
  array( $this, 'typekit_options_page' )
classes/class-custom-typekit-fonts.php CHANGED
@@ -59,7 +59,7 @@ if ( ! class_exists( 'Custom_Typekit_Fonts' ) ) {
59
  $option['custom-typekit-font-details'] = $this->get_custom_typekit_details( $option['custom-typekit-font-id'] );
60
 
61
  if ( empty( $option['custom-typekit-font-details'] ) ) {
62
- $_POST['custom-typekit-font-notice'] = true;
63
 
64
  // Get all stored typekit fonts.
65
  // Search it in 'get_option( ASTRA_THEME_SETTINGS )'.
@@ -70,11 +70,13 @@ if ( ! class_exists( 'Custom_Typekit_Fonts' ) ) {
70
  $options = get_option( ASTRA_THEME_SETTINGS );
71
  $custom_typekit = get_option( 'custom-typekit-fonts' );
72
  foreach ( $options as $key => $value ) {
73
- $font_arr = explode( ',', $value );
74
- $font_name = $font_arr[0];
75
- if ( isset( $custom_typekit['custom-typekit-font-details'][ $font_name ] ) ) {
76
- // set default inherit if custom font is deleted.
77
- $options[ $key ] = 'inherit';
 
 
78
  }
79
  }
80
  // update astra options.
@@ -108,6 +110,7 @@ if ( ! class_exists( 'Custom_Typekit_Fonts' ) ) {
108
  );
109
 
110
  if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
 
111
  return $typekit_info;
112
  }
113
 
59
  $option['custom-typekit-font-details'] = $this->get_custom_typekit_details( $option['custom-typekit-font-id'] );
60
 
61
  if ( empty( $option['custom-typekit-font-details'] ) ) {
62
+ $_POST['custom-typekit-empty-notice'] = true;
63
 
64
  // Get all stored typekit fonts.
65
  // Search it in 'get_option( ASTRA_THEME_SETTINGS )'.
70
  $options = get_option( ASTRA_THEME_SETTINGS );
71
  $custom_typekit = get_option( 'custom-typekit-fonts' );
72
  foreach ( $options as $key => $value ) {
73
+ if ( ! is_array( $value ) ) {
74
+ $font_arr = explode( ',', $value );
75
+ $font_name = $font_arr[0];
76
+ if ( isset( $custom_typekit['custom-typekit-font-details'][ $font_name ] ) ) {
77
+ // set default inherit if custom font is deleted.
78
+ $options[ $key ] = 'inherit';
79
+ }
80
  }
81
  }
82
  // update astra options.
110
  );
111
 
112
  if ( is_wp_error( $response ) || wp_remote_retrieve_response_code( $response ) !== 200 ) {
113
+ $_POST['custom-typekit-id-notice'] = true;
114
  return $typekit_info;
115
  }
116
 
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.0
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.0' );
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.1
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.1' );
29
  /**
30
  * BSF Custom Fonts
31
  */
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: 4.8.1
7
- Stable tag: 1.0.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -14,6 +14,8 @@ Custom Typekit Fonts allows you to extends the fonts supports from the Typekit.
14
 
15
  Custom Typekit Fonts allows you to extends the fonts supports from the Typekit.
16
 
 
 
17
  You don't need to include any code to get the Typekit Fonts. You can directly add Typekit ID and start using the fonts of your choice. Select any published kit font into the customizer.
18
 
19
  Get more details from [Typekit](https://typekit.com/).
@@ -33,5 +35,10 @@ Get more details from [Typekit](https://typekit.com/).
33
 
34
  == Changelog ==
35
 
 
 
 
 
 
36
  v1.0.0
37
- * Initial release
4
  Tags: custom typekit fonts, theme custom fonts, unlimited typekit custom fonts
5
  Requires at least: 4.4
6
  Tested up to: 4.8.1
7
+ Stable tag: 1.0.1
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
14
 
15
  Custom Typekit Fonts allows you to extends the fonts supports from the Typekit.
16
 
17
+ Works only with the <a href="https://wpastra.com/">Astra</a> WordPress theme.
18
+
19
  You don't need to include any code to get the Typekit Fonts. You can directly add Typekit ID and start using the fonts of your choice. Select any published kit font into the customizer.
20
 
21
  Get more details from [Typekit](https://typekit.com/).
35
 
36
  == Changelog ==
37
 
38
+ v1.0.1
39
+ * Custom Typekit Fonts wp admin menu renamed to Typekit Fonts.
40
+ * Empty Kit notice added if there is not fonts in the Kit.
41
+ * Php waring if there is no font list handled.
42
+
43
  v1.0.0
44
+ * Initial release