Skip to content

Commit

Permalink
Merge pull request #15 from brainstormforce/typekit-googlefont-url-fix
Browse files Browse the repository at this point in the history
Version 1.0.10

- Remove Typekit font from the Google URL using astra_google_fonts URL.
  • Loading branch information
Nikschavan authored Jan 22, 2019
2 parents 0ecd619 + aa0d61b commit e44c171
Show file tree
Hide file tree
Showing 6 changed files with 40 additions and 11 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
**Tags:** custom typekit fonts, theme custom fonts, unlimited typekit custom fonts
**Requires at least:** 4.4
**Tested up to:** 5.0
**Stable tag:** 1.0.9
**Stable tag:** 1.0.10
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -49,6 +49,9 @@ If you're not using any of the supported plugins and theme, you can write the cu

## Changelog ##

### v1.0.10 ###
- Fix: Remove typekit font from the Astra Theme's google fonts URL.

### v1.0.9 ###
- Improvement: Use CSS embed method for enqueueing TypeKit fonts. This should remove the slight delay in displaying the TypeKit fonts on the page,
- Fix: Post URL in the Block Editor goes behind the Editor Top Bar.
Expand Down
25 changes: 24 additions & 1 deletion classes/class-custom-typekit-fonts-render.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public static function get_instance() {
public function __construct() {

add_action( 'wp_enqueue_scripts', array( $this, 'typekit_embed_css' ) );
// add Custom Font list into Astra customizer.
// Add Custom Font list into Astra customizer.
add_action( 'astra_customizer_font_list', array( $this, 'add_customizer_font_list' ) );
add_action( 'astra_render_fonts', array( $this, 'render_fonts' ) );
add_filter( 'astra_custom_fonts', array( $this, 'add_typekit_fonts' ) );
Expand All @@ -77,6 +77,8 @@ public function __construct() {
add_filter( 'elementor/fonts/additional_fonts', array( $this, 'add_elementor_fonts' ) );

add_action( 'enqueue_block_editor_assets', array( $this, 'typekit_embed_css' ) );
// Astra filter before creating google fonts URL.
add_filter( 'astra_google_fonts', array( $this, 'remove_typekit_font_google_url' ) );
}

/**
Expand Down Expand Up @@ -229,6 +231,27 @@ function bb_custom_fonts( $bb_fonts ) {

return array_merge( $bb_fonts, $custom_fonts );
}

/**
* Remove Typekit Font from Google Font URL.
*
* @since 1.1.0
* @param array $fonts font families selected.
*/
function remove_typekit_font_google_url( $fonts ) {

$kit_list = get_option( 'custom-typekit-fonts', array() );
if ( ! empty( $kit_list['custom-typekit-font-details'] ) ) {
foreach ( $kit_list['custom-typekit-font-details'] as $key => $value ) {
$font_key = "'" . $value['family'] . "'" . ',' . $value['fallback'];
if ( array_key_exists( $font_key, $fonts ) ) {
unset( $fonts[ $font_key ] );
}
}
}

return $fonts;
}
}

/**
Expand Down
4 changes: 2 additions & 2 deletions custom-typekit-fonts.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* Author: Brainstorm Force
* Author URI: http://www.brainstormforce.com
* Text Domain: custom-typekit-fonts
* Version: 1.0.9
* Version: 1.0.10
*
* @package Typekit_Custom_Fonts
*/
Expand All @@ -25,7 +25,7 @@
define( 'CUSTOM_TYPEKIT_FONTS_BASE', plugin_basename( CUSTOM_TYPEKIT_FONTS_FILE ) );
define( 'CUSTOM_TYPEKIT_FONTS_DIR', plugin_dir_path( CUSTOM_TYPEKIT_FONTS_FILE ) );
define( 'CUSTOM_TYPEKIT_FONTS_URI', plugins_url( '/', CUSTOM_TYPEKIT_FONTS_FILE ) );
define( 'CUSTOM_TYPEKIT_FONTS_VER', '1.0.9' );
define( 'CUSTOM_TYPEKIT_FONTS_VER', '1.0.10' );
/**
* BSF Custom Fonts
*/
Expand Down
10 changes: 5 additions & 5 deletions languages/custom-typekit-fonts.pot
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
# Copyright (C) 2018 Brainstorm Force
# Copyright (C) 2019 Brainstorm Force
# This file is distributed under the same license as the Custom Typekit Fonts package.
msgid ""
msgstr ""
"Project-Id-Version: Custom Typekit Fonts 1.0.8\n"
"Project-Id-Version: Custom Typekit Fonts 1.0.10\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/custom-typekit-fonts\n"
"POT-Creation-Date: 2018-12-27 09:11:35+00:00\n"
"POT-Creation-Date: 2019-01-22 02:37:10+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
"PO-Revision-Date: 2019-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\n"
"Language: en\n"
Expand Down Expand Up @@ -39,7 +39,7 @@ msgid "Custom Typekit Fonts settings have been successfully saved."
msgstr ""

#: classes/class-custom-typekit-fonts-admin.php:106
#: classes/class-custom-typekit-fonts-render.php:90
#: classes/class-custom-typekit-fonts-render.php:94
#: templates/custom-typekit-fonts-options.php:11
msgid "Typekit Fonts"
msgstr ""
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "custom-typekit-fonts",
"version": "1.0.9",
"version": "1.0.10",
"main": "Gruntfile.js",
"author": "YOUR NAME HERE",
"devDependencies": {
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Donate link: https://wpastra.com/
Tags: custom typekit fonts, theme custom fonts, unlimited typekit custom fonts
Requires at least: 4.4
Tested up to: 5.0
Stable tag: 1.0.9
Stable tag: 1.0.10
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -49,6 +49,9 @@ If you're not using any of the supported plugins and theme, you can write the cu

== Changelog ==

= v1.0.10 =
- Fix: Remove typekit font from the Astra Theme's google fonts URL.

= v1.0.9 =
- Improvement: Use CSS embed method for enqueueing TypeKit fonts. This should remove the slight delay in displaying the TypeKit fonts on the page,
- Fix: Post URL in the Block Editor goes behind the Editor Top Bar.
Expand Down

0 comments on commit e44c171

Please sign in to comment.