Version Description
- Fix: Font display not added properly.
Download this release
Release Info
Developer | brainstormworg |
Plugin | Custom Fonts |
Version | 1.2.5 |
Comparing to | |
See all releases |
Code changes from version 1.2.4 to 1.2.5
classes/class-bsf-custom-fonts.php
CHANGED
@@ -35,6 +35,8 @@ if ( ! class_exists( 'Bsf_Custom_Fonts' ) ) {
|
|
35 |
* Constructor function that initializes required actions and hooks
|
36 |
*/
|
37 |
public function __construct() {
|
|
|
|
|
38 |
require_once BSF_CUSTOM_FONTS_DIR . 'includes/class-bsf-custom-fonts-taxonomy.php';
|
39 |
require_once BSF_CUSTOM_FONTS_DIR . 'classes/class-bsf-custom-fonts-render.php';
|
40 |
|
@@ -44,6 +46,16 @@ if ( ! class_exists( 'Bsf_Custom_Fonts' ) ) {
|
|
44 |
}
|
45 |
|
46 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
}
|
48 |
|
49 |
/**
|
35 |
* Constructor function that initializes required actions and hooks
|
36 |
*/
|
37 |
public function __construct() {
|
38 |
+
|
39 |
+
$this->custom_fonts_update();
|
40 |
require_once BSF_CUSTOM_FONTS_DIR . 'includes/class-bsf-custom-fonts-taxonomy.php';
|
41 |
require_once BSF_CUSTOM_FONTS_DIR . 'classes/class-bsf-custom-fonts-render.php';
|
42 |
|
46 |
}
|
47 |
|
48 |
}
|
49 |
+
|
50 |
+
/**
|
51 |
+
* Run the update functions.
|
52 |
+
*
|
53 |
+
* @since 1.2.5
|
54 |
+
* @return void
|
55 |
+
*/
|
56 |
+
public function custom_fonts_update() {
|
57 |
+
require_once BSF_CUSTOM_FONTS_DIR . 'includes/plugin-update/class-custom-fonts-update.php';
|
58 |
+
}
|
59 |
}
|
60 |
|
61 |
/**
|
custom-fonts.php
CHANGED
@@ -6,7 +6,7 @@
|
|
6 |
* Author: Brainstorm Force
|
7 |
* Author URI: http://www.brainstormforce.com
|
8 |
* Text Domain: custom-fonts
|
9 |
-
* Version: 1.2.
|
10 |
*
|
11 |
* @package Bsf_Custom_Fonts
|
12 |
*/
|
@@ -25,7 +25,7 @@ define( 'BSF_CUSTOM_FONTS_FILE', __FILE__ );
|
|
25 |
define( 'BSF_CUSTOM_FONTS_BASE', plugin_basename( BSF_CUSTOM_FONTS_FILE ) );
|
26 |
define( 'BSF_CUSTOM_FONTS_DIR', plugin_dir_path( BSF_CUSTOM_FONTS_FILE ) );
|
27 |
define( 'BSF_CUSTOM_FONTS_URI', plugins_url( '/', BSF_CUSTOM_FONTS_FILE ) );
|
28 |
-
define( 'BSF_CUSTOM_FONTS_VER', '1.2.
|
29 |
|
30 |
/**
|
31 |
* BSF Custom Fonts
|
6 |
* Author: Brainstorm Force
|
7 |
* Author URI: http://www.brainstormforce.com
|
8 |
* Text Domain: custom-fonts
|
9 |
+
* Version: 1.2.5
|
10 |
*
|
11 |
* @package Bsf_Custom_Fonts
|
12 |
*/
|
25 |
define( 'BSF_CUSTOM_FONTS_BASE', plugin_basename( BSF_CUSTOM_FONTS_FILE ) );
|
26 |
define( 'BSF_CUSTOM_FONTS_DIR', plugin_dir_path( BSF_CUSTOM_FONTS_FILE ) );
|
27 |
define( 'BSF_CUSTOM_FONTS_URI', plugins_url( '/', BSF_CUSTOM_FONTS_FILE ) );
|
28 |
+
define( 'BSF_CUSTOM_FONTS_VER', '1.2.5' );
|
29 |
|
30 |
/**
|
31 |
* BSF Custom Fonts
|
includes/class-bsf-custom-fonts-admin.php
CHANGED
@@ -167,6 +167,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
|
|
167 |
* @param object $term taxonomy terms.
|
168 |
*/
|
169 |
public function edit_taxonomy_data( $term ) {
|
|
|
170 |
$data = Bsf_Custom_Fonts_Taxonomy::get_font_links( $term->term_id );
|
171 |
$this->font_file_edit_field( 'font_woff_2', __( 'Font .woff2', 'custom-fonts' ), $data['font_woff_2'], __( 'Upload the font\'s woff2 file or enter the URL.', 'custom-fonts' ) );
|
172 |
$this->font_file_edit_field( 'font_woff', __( 'Font .woff', 'custom-fonts' ), $data['font_woff'], __( 'Upload the font\'s woff file or enter the URL.', 'custom-fonts' ) );
|
@@ -306,7 +307,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
|
|
306 |
}
|
307 |
|
308 |
if ( isset( $_POST[ Bsf_Custom_Fonts_Taxonomy::$register_taxonomy_slug ] ) ) {// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
309 |
-
$value = array_map( '
|
310 |
Bsf_Custom_Fonts_Taxonomy::update_font_links( $value, $term_id );
|
311 |
}
|
312 |
}
|
167 |
* @param object $term taxonomy terms.
|
168 |
*/
|
169 |
public function edit_taxonomy_data( $term ) {
|
170 |
+
|
171 |
$data = Bsf_Custom_Fonts_Taxonomy::get_font_links( $term->term_id );
|
172 |
$this->font_file_edit_field( 'font_woff_2', __( 'Font .woff2', 'custom-fonts' ), $data['font_woff_2'], __( 'Upload the font\'s woff2 file or enter the URL.', 'custom-fonts' ) );
|
173 |
$this->font_file_edit_field( 'font_woff', __( 'Font .woff', 'custom-fonts' ), $data['font_woff'], __( 'Upload the font\'s woff file or enter the URL.', 'custom-fonts' ) );
|
307 |
}
|
308 |
|
309 |
if ( isset( $_POST[ Bsf_Custom_Fonts_Taxonomy::$register_taxonomy_slug ] ) ) {// phpcs:ignore WordPress.Security.NonceVerification.Missing
|
310 |
+
$value = array_map( 'esc_attr', $_POST[ Bsf_Custom_Fonts_Taxonomy::$register_taxonomy_slug ] ); // phpcs:ignore WordPress.Security.NonceVerification.Missing
|
311 |
Bsf_Custom_Fonts_Taxonomy::update_font_links( $value, $term_id );
|
312 |
}
|
313 |
}
|
includes/plugin-update/class-custom-fonts-update.php
ADDED
@@ -0,0 +1,132 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Bsf Custom Fonts update class
|
4 |
+
*
|
5 |
+
* @since 1.2.5
|
6 |
+
* @package Bsf_Custom_Fonts
|
7 |
+
*/
|
8 |
+
|
9 |
+
if ( ! defined( 'ABSPATH' ) ) {
|
10 |
+
exit; // Exit if accessed directly.
|
11 |
+
}
|
12 |
+
/**
|
13 |
+
* Custom_Fonts_Update initial setup
|
14 |
+
*
|
15 |
+
* @since 1.2.5
|
16 |
+
*/
|
17 |
+
class Custom_Fonts_Update {
|
18 |
+
|
19 |
+
/**
|
20 |
+
* Member Variable
|
21 |
+
*
|
22 |
+
* @var instance
|
23 |
+
*/
|
24 |
+
private static $instance;
|
25 |
+
|
26 |
+
/**
|
27 |
+
* Option key for stored version number.
|
28 |
+
*
|
29 |
+
* @var instance
|
30 |
+
*/
|
31 |
+
private $db_version_key = '_custom_fonts_db_version';
|
32 |
+
|
33 |
+
/**
|
34 |
+
* Initiator
|
35 |
+
*/
|
36 |
+
public static function get_instance() {
|
37 |
+
if ( ! isset( self::$instance ) ) {
|
38 |
+
self::$instance = new self();
|
39 |
+
}
|
40 |
+
return self::$instance;
|
41 |
+
}
|
42 |
+
|
43 |
+
/**
|
44 |
+
* Constructor
|
45 |
+
*/
|
46 |
+
public function __construct() {
|
47 |
+
|
48 |
+
// Plugin updates.
|
49 |
+
if ( is_admin() ) {
|
50 |
+
add_action( 'admin_init', array( $this, 'init' ), 5 );
|
51 |
+
} else {
|
52 |
+
add_action( 'wp', array( $this, 'init' ), 5 );
|
53 |
+
}
|
54 |
+
}
|
55 |
+
|
56 |
+
/**
|
57 |
+
* Implement plugin update logic.
|
58 |
+
*
|
59 |
+
* @since 1.2.5
|
60 |
+
*/
|
61 |
+
public function init() {
|
62 |
+
do_action( 'custom_fonts_update_before' );
|
63 |
+
|
64 |
+
if ( ! $this->needs_db_update() ) {
|
65 |
+
return;
|
66 |
+
}
|
67 |
+
|
68 |
+
$db_version = get_option( $this->db_version_key, false );
|
69 |
+
|
70 |
+
if ( version_compare( $db_version, '1.2.4', '<=' ) ) {
|
71 |
+
$this->v_1_2_5();
|
72 |
+
}
|
73 |
+
|
74 |
+
$this->update_db_version();
|
75 |
+
|
76 |
+
do_action( 'custom_fonts_update_after' );
|
77 |
+
}
|
78 |
+
|
79 |
+
/**
|
80 |
+
* Removes the http:// from the font display property.
|
81 |
+
*
|
82 |
+
* @since 1.2.5
|
83 |
+
*/
|
84 |
+
public function v_1_2_5() {
|
85 |
+
|
86 |
+
$terms = get_terms(
|
87 |
+
'bsf_custom_fonts',
|
88 |
+
array(
|
89 |
+
'hide_empty' => false,
|
90 |
+
)
|
91 |
+
);
|
92 |
+
|
93 |
+
if ( ! empty( $terms ) ) {
|
94 |
+
foreach ( $terms as $term ) {
|
95 |
+
$font_links = Bsf_Custom_Fonts_Taxonomy::get_font_links( $term->term_id );
|
96 |
+
|
97 |
+
$font_links['font-display'] = str_replace( 'http://', '', $font_links['font-display'] );
|
98 |
+
|
99 |
+
Bsf_Custom_Fonts_Taxonomy::update_font_links( $font_links, $term->term_id );
|
100 |
+
}
|
101 |
+
}
|
102 |
+
|
103 |
+
}
|
104 |
+
|
105 |
+
/**
|
106 |
+
* Check if db upgrade is required.
|
107 |
+
*
|
108 |
+
* @since 1.2.5
|
109 |
+
* @return true|false True if stored database version is lower than constant; false if otherwise.
|
110 |
+
*/
|
111 |
+
private function needs_db_update() {
|
112 |
+
$db_version = get_option( $this->db_version_key, false );
|
113 |
+
|
114 |
+
if ( false === $db_version || version_compare( $db_version, BSF_CUSTOM_FONTS_VER, '!=' ) ) {
|
115 |
+
return true;
|
116 |
+
}
|
117 |
+
|
118 |
+
return false;
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Update DB version.
|
123 |
+
*
|
124 |
+
* @since 1.2.5
|
125 |
+
* @return void
|
126 |
+
*/
|
127 |
+
private function update_db_version() {
|
128 |
+
update_option( '_custom_fonts_db_version', BSF_CUSTOM_FONTS_VER );
|
129 |
+
}
|
130 |
+
|
131 |
+
}
|
132 |
+
Custom_Fonts_Update::get_instance();
|
readme.txt
CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.me/BrainstormForce
|
|
4 |
Tags: Beaver Builder, Elementor, Astra, woff2, woff, ttf, svg, eot, otf, Custom Fonts, Font, Typography
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.5.1
|
7 |
-
Stable tag: 1.2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -43,6 +43,9 @@ If you're not using any of the supported plugins and theme, you can write the cu
|
|
43 |
|
44 |
== Changelog ==
|
45 |
|
|
|
|
|
|
|
46 |
= 1.2.4 =
|
47 |
- Improvement: Hardened the security of plugin
|
48 |
|
4 |
Tags: Beaver Builder, Elementor, Astra, woff2, woff, ttf, svg, eot, otf, Custom Fonts, Font, Typography
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.5.1
|
7 |
+
Stable tag: 1.2.5
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= 1.2.5 =
|
47 |
+
- Fix: Font display not added properly.
|
48 |
+
|
49 |
= 1.2.4 =
|
50 |
- Improvement: Hardened the security of plugin
|
51 |
|