Skip to content

Commit

Permalink
Merge pull request #114 from brainstormforce/hotfix-2.1.3
Browse files Browse the repository at this point in the history
Hotfix Release - v2.1.3
  • Loading branch information
imnavanath authored Jan 16, 2024
2 parents bb1f85e + 368e5e0 commit ae4bbc7
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 37 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:** typography, fonts, custom fonts, Google Fonts, performance, privacy, full site editing, adobe fonts, GDPR
**Requires at least:** 5.0
**Tested up to:** 6.4
**Stable tag:** 2.1.2
**Stable tag:** 2.1.3
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -151,6 +151,9 @@ Yes, Custom Fonts is completely free to use, without any limitation.


## Changelog ##
### 2.1.3 ###
- Fix: Resolved issue with local fonts not rendering properly on the frontend.

### 2.1.2 ###
- Fix: Resolve PHP Warning 'Cannot modify header information' during post content editing in Gutenberg.
- Fix: Thrive product created layout's changes not saved due to Custom fonts plugin conflicts.
Expand Down
45 changes: 13 additions & 32 deletions classes/class-bsf-custom-fonts-render.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,15 +105,6 @@ public static function get_instance() {
return self::$instance;
}

/**
* Check if either 'Thrive_Product_Manager' or 'TVA_Const' classes exist.
*
* @return bool
*/
public static function is_thrive_or_tva_active() {
return class_exists( 'Thrive_Product_Manager' ) || class_exists( 'TVA_Const' );
}

/**
* Constructor.
*
Expand All @@ -140,11 +131,10 @@ public function __construct() {
add_filter( 'fl_theme_system_fonts', array( $this, 'bb_custom_fonts' ) );
add_filter( 'fl_builder_font_families_system', array( $this, 'bb_custom_fonts' ) );

// Add font file styles.
add_action( 'wp_head', array( $this, 'add_style' ) );
// Add font files style.
add_action( 'wp_enqueue_scripts', array( $this, 'preload_styles' ), 1 );

add_action( 'init', array( $this, 'add_block_assets_style' ) );

add_filter( 'elementor/fonts/groups', array( $this, 'elementor_group' ) );
add_filter( 'elementor/fonts/additional_fonts', array( $this, 'add_elementor_fonts' ) );
// Astra filter before creating google fonts URL.
Expand Down Expand Up @@ -287,24 +277,20 @@ public function enque_data() {
* @since 1.0.4
*/
public function add_style() {
$font_styles = '';
$query_posts = $this->get_existing_font_posts();

if ( self::is_thrive_or_tva_active() ) {

$font_styles = '';
$query_posts = $this->get_existing_font_posts();

if ( $query_posts ) {
foreach ( $query_posts as $key => $post_id ) {
$font_styles .= get_post_meta( $post_id, 'fonts-face', true );
}
wp_reset_postdata();
if ( $query_posts ) {
foreach ( $query_posts as $key => $post_id ) {
$font_styles .= get_post_meta( $post_id, 'fonts-face', true );
}
wp_reset_postdata();
}

if ( ! empty( $font_styles ) ) {
wp_register_style( 'cf-frontend-style', false, array(), BSF_CUSTOM_FONTS_VER );
wp_enqueue_style( 'cf-frontend-style' );
wp_add_inline_style( 'cf-frontend-style', wp_strip_all_tags( $font_styles ) );
}
if ( ! empty( $font_styles ) ) {
wp_register_style( 'cf-frontend-style', false, array(), BSF_CUSTOM_FONTS_VER );
wp_enqueue_style( 'cf-frontend-style' );
wp_add_inline_style( 'cf-frontend-style', wp_strip_all_tags( $font_styles ) );
}
}

Expand All @@ -314,11 +300,6 @@ public function add_style() {
* @since x.x.x
*/
public function preload_styles() {

if ( self::is_thrive_or_tva_active() ) {
return;
}

$font_urls = get_option( 'bcf_font_urls', array() );

if ( true === (bool) get_option( 'bcf_preloading_fonts', false ) && ! empty( $font_urls ) ) {
Expand Down
4 changes: 2 additions & 2 deletions custom-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-fonts
* Version: 2.1.2
* Version: 2.1.3
*
* @package Bsf_Custom_Fonts
*/
Expand All @@ -25,7 +25,7 @@
define( 'BSF_CUSTOM_FONTS_BASE', plugin_basename( BSF_CUSTOM_FONTS_FILE ) );
define( 'BSF_CUSTOM_FONTS_DIR', plugin_dir_path( BSF_CUSTOM_FONTS_FILE ) );
define( 'BSF_CUSTOM_FONTS_URI', plugins_url( '/', BSF_CUSTOM_FONTS_FILE ) );
define( 'BSF_CUSTOM_FONTS_VER', '2.1.2' );
define( 'BSF_CUSTOM_FONTS_VER', '2.1.3' );
define( 'BSF_CUSTOM_FONTS_POST_TYPE', 'bsf_custom_fonts' );
define( 'BSF_CUSTOM_FONTS_ADMIN_PAGE', 'bsf-custom-fonts' );

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-fonts",
"version": "2.1.2",
"version": "2.1.3",
"main": "Gruntfile.js",
"author": "Brainstorm Force",
"workspaces": [
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://www.paypal.me/BrainstormForce
Tags: typography, fonts, custom fonts, Google Fonts, performance, privacy, full site editing, adobe fonts, GDPR
Requires at least: 5.0
Tested up to: 6.4
Stable tag: 2.1.2
Stable tag: 2.1.3
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -151,6 +151,9 @@ Yes, Custom Fonts is completely free to use, without any limitation.


== Changelog ==
= 2.1.3 =
- Fix: Resolved issue with local fonts not rendering properly on the frontend.

= 2.1.2 =
- Fix: Resolve PHP Warning 'Cannot modify header information' during post content editing in Gutenberg.
- Fix: Thrive product created layout's changes not saved due to Custom fonts plugin conflicts.
Expand Down

0 comments on commit ae4bbc7

Please sign in to comment.