From 6e3ed4e8823e0cb72684fd4a8fdea7872c7048b8 Mon Sep 17 00:00:00 2001 From: Yogesh Date: Tue, 16 Jan 2024 10:18:33 +0530 Subject: [PATCH] chore:reverted thrive chnages --- README.md | 4 +- classes/class-bsf-custom-fonts-render.php | 45 +++++++---------------- custom-fonts.php | 4 +- package.json | 2 +- readme.txt | 3 ++ 5 files changed, 22 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 9e0743d..ada55dc 100644 --- a/README.md +++ b/README.md @@ -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 @@ -152,6 +152,8 @@ Yes, Custom Fonts is completely free to use, without any limitation. ## Changelog ## ### 2.1.2 ### +- 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. diff --git a/classes/class-bsf-custom-fonts-render.php b/classes/class-bsf-custom-fonts-render.php index 79682b4..af8f9ee 100644 --- a/classes/class-bsf-custom-fonts-render.php +++ b/classes/class-bsf-custom-fonts-render.php @@ -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. * @@ -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. @@ -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 ) ); } } @@ -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 ) ) { diff --git a/custom-fonts.php b/custom-fonts.php index d7a8710..e2c24c5 100644 --- a/custom-fonts.php +++ b/custom-fonts.php @@ -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 */ @@ -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' ); diff --git a/package.json b/package.json index 59245bd..6bf53a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "custom-fonts", - "version": "2.1.2", + "version": "2.1.3", "main": "Gruntfile.js", "author": "Brainstorm Force", "workspaces": [ diff --git a/readme.txt b/readme.txt index 21710f6..2931d6d 100644 --- a/readme.txt +++ b/readme.txt @@ -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.