Version Description
Download this release
Release Info
Developer | Nikschavan |
Plugin | Custom Fonts |
Version | 1.0.8 |
Comparing to | |
See all releases |
Code changes from version 1.0.7 to 1.0.8
classes/class-bsf-custom-fonts-render.php
CHANGED
@@ -238,6 +238,9 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Render' ) ) :
|
|
238 |
if ( $links['font_ttf'] ) {
|
239 |
$arr[] = 'url(' . esc_url( $links['font_ttf'] ) . ") format('truetype')";
|
240 |
}
|
|
|
|
|
|
|
241 |
if ( $links['font_svg'] ) {
|
242 |
$arr[] = 'url(' . esc_url( $links['font_svg'] ) . '#' . esc_attr( strtolower( str_replace( ' ', '_', $font ) ) ) . ") format('svg')";
|
243 |
}
|
238 |
if ( $links['font_ttf'] ) {
|
239 |
$arr[] = 'url(' . esc_url( $links['font_ttf'] ) . ") format('truetype')";
|
240 |
}
|
241 |
+
if ( $links['font_otf'] ) {
|
242 |
+
$arr[] = 'url(' . esc_url( $links['font_otf'] ) . ") format('opentype')";
|
243 |
+
}
|
244 |
if ( $links['font_svg'] ) {
|
245 |
$arr[] = 'url(' . esc_url( $links['font_svg'] ) . '#' . esc_attr( strtolower( str_replace( ' ', '_', $font ) ) ) . ") format('svg')";
|
246 |
}
|
classes/class-bsf-custom-fonts-white-label.php
CHANGED
@@ -72,7 +72,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_White_Label' ) ) :
|
|
72 |
*/
|
73 |
function plugins_page( $plugins ) {
|
74 |
|
75 |
-
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::
|
76 |
return $plugins;
|
77 |
}
|
78 |
|
@@ -81,10 +81,10 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_White_Label' ) ) :
|
|
81 |
}
|
82 |
|
83 |
// Set White Labels.
|
84 |
-
$name = Astra_Ext_White_Label_Markup::
|
85 |
-
$description = Astra_Ext_White_Label_Markup::
|
86 |
-
$author = Astra_Ext_White_Label_Markup::
|
87 |
-
$author_uri = Astra_Ext_White_Label_Markup::
|
88 |
|
89 |
if ( ! empty( $name ) ) {
|
90 |
$plugins[ BSF_CUSTOM_FONTS_BASE ]['Name'] = $name;
|
@@ -117,8 +117,8 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_White_Label' ) ) :
|
|
117 |
*/
|
118 |
function white_label_custom_fonts_title( $title ) {
|
119 |
|
120 |
-
if ( is_callable( 'Astra_Ext_White_Label_Markup::
|
121 |
-
$name = Astra_Ext_White_Label_Markup::
|
122 |
if ( ! empty( $name ) ) {
|
123 |
$title = $name;
|
124 |
}
|
@@ -138,11 +138,11 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_White_Label' ) ) :
|
|
138 |
*/
|
139 |
public function plugin_links( $plugin_meta, $plugin_file, $plugin_data ) {
|
140 |
|
141 |
-
if ( is_callable( 'Astra_Ext_White_Label_Markup::
|
142 |
if ( BSF_CUSTOM_FONTS_BASE == $plugin_file ) {
|
143 |
// Set White Labels.
|
144 |
-
$name = Astra_Ext_White_Label_Markup::
|
145 |
-
$description = Astra_Ext_White_Label_Markup::
|
146 |
|
147 |
if ( ! empty( $name ) ) {
|
148 |
// Remove Plugin URI if Agency White Label name is set.
|
72 |
*/
|
73 |
function plugins_page( $plugins ) {
|
74 |
|
75 |
+
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
|
76 |
return $plugins;
|
77 |
}
|
78 |
|
81 |
}
|
82 |
|
83 |
// Set White Labels.
|
84 |
+
$name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'bsf-custom-fonts', 'name' );
|
85 |
+
$description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'bsf-custom-fonts', 'description' );
|
86 |
+
$author = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author' );
|
87 |
+
$author_uri = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-agency', 'author_url' );
|
88 |
|
89 |
if ( ! empty( $name ) ) {
|
90 |
$plugins[ BSF_CUSTOM_FONTS_BASE ]['Name'] = $name;
|
117 |
*/
|
118 |
function white_label_custom_fonts_title( $title ) {
|
119 |
|
120 |
+
if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
|
121 |
+
$name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'bsf-custom-fonts', 'name' );
|
122 |
if ( ! empty( $name ) ) {
|
123 |
$title = $name;
|
124 |
}
|
138 |
*/
|
139 |
public function plugin_links( $plugin_meta, $plugin_file, $plugin_data ) {
|
140 |
|
141 |
+
if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
|
142 |
if ( BSF_CUSTOM_FONTS_BASE == $plugin_file ) {
|
143 |
// Set White Labels.
|
144 |
+
$name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'bsf-custom-fonts', 'name' );
|
145 |
+
$description = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'bsf-custom-fonts', 'description' );
|
146 |
|
147 |
if ( ! empty( $name ) ) {
|
148 |
// Remove Plugin URI if Agency White Label name is set.
|
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.0.
|
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.0.
|
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.0.8
|
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.0.8' );
|
29 |
|
30 |
/**
|
31 |
* BSF Custom Fonts
|
includes/class-bsf-custom-fonts-admin.php
CHANGED
@@ -40,7 +40,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
|
|
40 |
*/
|
41 |
public static function get_instance() {
|
42 |
if ( ! isset( self::$_instance ) ) {
|
43 |
-
self::$_instance = new self;
|
44 |
}
|
45 |
|
46 |
return self::$_instance;
|
@@ -64,7 +64,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
|
|
64 |
add_action( 'create_' . Bsf_Custom_Fonts_Taxonomy::$register_taxonomy_slug, array( $this, 'save_metadata' ) );
|
65 |
|
66 |
add_filter( 'upload_mimes', array( $this, 'add_fonts_to_allowed_mimes' ) );
|
67 |
-
|
68 |
}
|
69 |
|
70 |
/**
|
@@ -141,6 +141,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
|
|
141 |
$this->font_file_new_field( 'font_ttf', __( 'Font .ttf', 'custom-fonts' ), __( 'Upload the font\'s ttf file or enter the URL.', 'custom-fonts' ) );
|
142 |
$this->font_file_new_field( 'font_eot', __( 'Font .eot', 'custom-fonts' ), __( 'Upload the font\'s eot file or enter the URL.', 'custom-fonts' ) );
|
143 |
$this->font_file_new_field( 'font_svg', __( 'Font .svg', 'custom-fonts' ), __( 'Upload the font\'s svg file or enter the URL.', 'custom-fonts' ) );
|
|
|
144 |
}
|
145 |
|
146 |
/**
|
@@ -156,6 +157,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
|
|
156 |
$this->font_file_edit_field( 'font_ttf', __( 'Font .ttf', 'custom-fonts' ), $data['font_ttf'], __( 'Upload the font\'s ttf file or enter the URL.', 'custom-fonts' ) );
|
157 |
$this->font_file_edit_field( 'font_eot', __( 'Font .eot', 'custom-fonts' ), $data['font_eot'], __( 'Upload the font\'s eot file or enter the URL.', 'custom-fonts' ) );
|
158 |
$this->font_file_edit_field( 'font_svg', __( 'Font .svg', 'custom-fonts' ), $data['font_svg'], __( 'Upload the font\'s svg file or enter the URL.', 'custom-fonts' ) );
|
|
|
159 |
}
|
160 |
|
161 |
/**
|
@@ -232,9 +234,35 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
|
|
232 |
$mimes['ttf'] = 'application/x-font-ttf';
|
233 |
$mimes['svg'] = 'image/svg+xml';
|
234 |
$mimes['eot'] = 'application/vnd.ms-fontobject';
|
|
|
|
|
235 |
return $mimes;
|
236 |
}
|
237 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
238 |
}
|
239 |
|
240 |
|
40 |
*/
|
41 |
public static function get_instance() {
|
42 |
if ( ! isset( self::$_instance ) ) {
|
43 |
+
self::$_instance = new self();
|
44 |
}
|
45 |
|
46 |
return self::$_instance;
|
64 |
add_action( 'create_' . Bsf_Custom_Fonts_Taxonomy::$register_taxonomy_slug, array( $this, 'save_metadata' ) );
|
65 |
|
66 |
add_filter( 'upload_mimes', array( $this, 'add_fonts_to_allowed_mimes' ) );
|
67 |
+
add_filter( 'wp_check_filetype_and_ext', array( $this, 'update_mime_types' ), 10, 3 );
|
68 |
}
|
69 |
|
70 |
/**
|
141 |
$this->font_file_new_field( 'font_ttf', __( 'Font .ttf', 'custom-fonts' ), __( 'Upload the font\'s ttf file or enter the URL.', 'custom-fonts' ) );
|
142 |
$this->font_file_new_field( 'font_eot', __( 'Font .eot', 'custom-fonts' ), __( 'Upload the font\'s eot file or enter the URL.', 'custom-fonts' ) );
|
143 |
$this->font_file_new_field( 'font_svg', __( 'Font .svg', 'custom-fonts' ), __( 'Upload the font\'s svg file or enter the URL.', 'custom-fonts' ) );
|
144 |
+
$this->font_file_new_field( 'font_otf', __( 'Font .otf', 'custom-fonts' ), __( 'Upload the font\'s otf file or enter the URL.', 'custom-fonts' ) );
|
145 |
}
|
146 |
|
147 |
/**
|
157 |
$this->font_file_edit_field( 'font_ttf', __( 'Font .ttf', 'custom-fonts' ), $data['font_ttf'], __( 'Upload the font\'s ttf file or enter the URL.', 'custom-fonts' ) );
|
158 |
$this->font_file_edit_field( 'font_eot', __( 'Font .eot', 'custom-fonts' ), $data['font_eot'], __( 'Upload the font\'s eot file or enter the URL.', 'custom-fonts' ) );
|
159 |
$this->font_file_edit_field( 'font_svg', __( 'Font .svg', 'custom-fonts' ), $data['font_svg'], __( 'Upload the font\'s svg file or enter the URL.', 'custom-fonts' ) );
|
160 |
+
$this->font_file_edit_field( 'font_otf', __( 'Font .otf', 'custom-fonts' ), $data['font_otf'], __( 'Upload the font\'s otf file or enter the URL.', 'custom-fonts' ) );
|
161 |
}
|
162 |
|
163 |
/**
|
234 |
$mimes['ttf'] = 'application/x-font-ttf';
|
235 |
$mimes['svg'] = 'image/svg+xml';
|
236 |
$mimes['eot'] = 'application/vnd.ms-fontobject';
|
237 |
+
$mimes['otf'] = 'font/otf';
|
238 |
+
|
239 |
return $mimes;
|
240 |
}
|
241 |
|
242 |
+
/**
|
243 |
+
* Correct the mome types and extension for the font types.
|
244 |
+
*
|
245 |
+
* @param array $defaults File data array containing 'ext', 'type', and
|
246 |
+
* 'proper_filename' keys.
|
247 |
+
* @param string $file Full path to the file.
|
248 |
+
* @param string $filename The name of the file (may differ from $file due to
|
249 |
+
* $file being in a tmp directory).
|
250 |
+
* @return Array File data array containing 'ext', 'type', and
|
251 |
+
*/
|
252 |
+
public function update_mime_types( $defaults, $file, $filename ) {
|
253 |
+
if ( 'ttf' === pathinfo( $filename, PATHINFO_EXTENSION ) ) {
|
254 |
+
$defaults['type'] = 'application/x-font-ttf';
|
255 |
+
$defaults['ext'] = 'ttf';
|
256 |
+
}
|
257 |
+
|
258 |
+
if ( 'otf' === pathinfo( $filename, PATHINFO_EXTENSION ) ) {
|
259 |
+
$defaults['type'] = 'application/x-font-otf';
|
260 |
+
$defaults['ext'] = 'otf';
|
261 |
+
}
|
262 |
+
|
263 |
+
return $defaults;
|
264 |
+
}
|
265 |
+
|
266 |
}
|
267 |
|
268 |
|
includes/class-bsf-custom-fonts-taxonomy.php
CHANGED
@@ -78,7 +78,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Taxonomy' ) ) :
|
|
78 |
public function create_custom_fonts_taxonomies() {
|
79 |
// Taxonomy: bsf_custom_fonts.
|
80 |
$labels = array(
|
81 |
-
'name' => __( 'Custom Fonts', 'custom-fonts' ),
|
82 |
'singular_name' => __( 'Font', 'custom-fonts' ),
|
83 |
'menu_name' => _x( 'Custom Fonts', 'Admin menu name', 'custom-fonts' ),
|
84 |
'search_items' => __( 'Search Fonts', 'custom-fonts' ),
|
@@ -125,6 +125,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Taxonomy' ) ) :
|
|
125 |
'font_ttf' => '',
|
126 |
'font_svg' => '',
|
127 |
'font_eot' => '',
|
|
|
128 |
)
|
129 |
);
|
130 |
}
|
78 |
public function create_custom_fonts_taxonomies() {
|
79 |
// Taxonomy: bsf_custom_fonts.
|
80 |
$labels = array(
|
81 |
+
'name' => apply_filters( 'bsf_custom_fonts_menu_title', __( 'Custom Fonts', 'custom-fonts' ) ),
|
82 |
'singular_name' => __( 'Font', 'custom-fonts' ),
|
83 |
'menu_name' => _x( 'Custom Fonts', 'Admin menu name', 'custom-fonts' ),
|
84 |
'search_items' => __( 'Search Fonts', 'custom-fonts' ),
|
125 |
'font_ttf' => '',
|
126 |
'font_svg' => '',
|
127 |
'font_eot' => '',
|
128 |
+
'font_otf' => '',
|
129 |
)
|
130 |
);
|
131 |
}
|
includes/white-label.php
CHANGED
@@ -5,6 +5,12 @@
|
|
5 |
* @package Bsf_Custom_Fonts
|
6 |
*/
|
7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
8 |
?>
|
9 |
<li>
|
10 |
<div class="branding-form postbox">
|
@@ -21,12 +27,12 @@
|
|
21 |
<div class="form-wrap">
|
22 |
<div class="form-field">
|
23 |
<label><?php _e( 'Plugin Name:', 'custom-fonts' ); ?>
|
24 |
-
<input type="text" name="ast_white_label[bsf-custom-fonts][name]" class="placeholder placeholder-active" value="<?php echo esc_attr(
|
25 |
</label>
|
26 |
</div>
|
27 |
<div class="form-field">
|
28 |
<label><?php _e( 'Plugin Description:', 'custom-fonts' ); ?>
|
29 |
-
<textarea name="ast_white_label[bsf-custom-fonts][description]" class="placeholder placeholder-active" rows="2"><?php echo esc_attr(
|
30 |
</label>
|
31 |
</div>
|
32 |
<div class="clear"></div>
|
5 |
* @package Bsf_Custom_Fonts
|
6 |
*/
|
7 |
|
8 |
+
?>
|
9 |
+
<?php
|
10 |
+
// Bail from displaying settings screen if Astra Pro is older version.
|
11 |
+
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::branding_key_to_constant' ) ) {
|
12 |
+
return;
|
13 |
+
}
|
14 |
?>
|
15 |
<li>
|
16 |
<div class="branding-form postbox">
|
27 |
<div class="form-wrap">
|
28 |
<div class="form-field">
|
29 |
<label><?php _e( 'Plugin Name:', 'custom-fonts' ); ?>
|
30 |
+
<input type="text" name="ast_white_label[bsf-custom-fonts][name]" class="placeholder placeholder-active" <?php disabled( defined( Astra_Ext_White_Label_Markup::branding_key_to_constant( 'bsf-custom-fonts', 'name' ) ), true, true ); ?> value="<?php echo esc_attr( Astra_Ext_White_Label_Markup::get_whitelabel_string( 'bsf-custom-fonts', 'name' ) ); ?>">
|
31 |
</label>
|
32 |
</div>
|
33 |
<div class="form-field">
|
34 |
<label><?php _e( 'Plugin Description:', 'custom-fonts' ); ?>
|
35 |
+
<textarea name="ast_white_label[bsf-custom-fonts][description]" class="placeholder placeholder-active" <?php disabled( defined( Astra_Ext_White_Label_Markup::branding_key_to_constant( 'bsf-custom-fonts', 'description' ) ), true, true ); ?> rows="2"><?php echo esc_attr( Astra_Ext_White_Label_Markup::get_whitelabel_string( 'astra-sites', 'description' ) ); ?></textarea>
|
36 |
</label>
|
37 |
</div>
|
38 |
<div class="clear"></div>
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
=== Custom Fonts ===
|
2 |
Contributors: brainstormforce
|
3 |
Donate link: https://www.paypal.me/BrainstormForce
|
4 |
-
Tags: Beaver Builder, Elementor, Astra, woff2, woff, ttf, svg, eot, Custom Fonts, Font, Typography
|
5 |
Requires at least: 4.4
|
6 |
Tested up to: 5.1
|
7 |
-
Stable tag: 1.0.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -12,7 +12,7 @@ Custom Fonts allows you to add more fonts that extend formatting options in your
|
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
-
This plugin helps you easily embed custom fonts files (woff2, woff, ttf, svg, eot) easily in your WordPress website.
|
16 |
|
17 |
Currently, it works with:
|
18 |
|
@@ -33,7 +33,7 @@ If you're not using any of the supported plugins and theme, you can write the cu
|
|
33 |
|
34 |
1. Upload the plugin files to the `/wp-content/plugins/custom-fonts` directory, or install the plugin through the WordPress plugins screen directly.
|
35 |
2. Activate the plugin through the 'Plugins' screen in WordPress
|
36 |
-
3. Use the Appearance -> Custom Fonts -> Add Custom Fonts name, woff2, woff, ttf, eot and svg files.
|
37 |
|
38 |
== Screenshots ==
|
39 |
|
@@ -43,6 +43,10 @@ If you're not using any of the supported plugins and theme, you can write the cu
|
|
43 |
|
44 |
== Changelog ==
|
45 |
|
|
|
|
|
|
|
|
|
46 |
= v1.0.7 =
|
47 |
- Fix: Custom Fonts loading the Block Editor breaking styling of the editor.
|
48 |
|
1 |
=== Custom Fonts ===
|
2 |
Contributors: brainstormforce
|
3 |
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.1
|
7 |
+
Stable tag: 1.0.8
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
12 |
|
13 |
== Description ==
|
14 |
|
15 |
+
This plugin helps you easily embed custom fonts files (woff2, woff, ttf, svg, eot, otf) easily in your WordPress website.
|
16 |
|
17 |
Currently, it works with:
|
18 |
|
33 |
|
34 |
1. Upload the plugin files to the `/wp-content/plugins/custom-fonts` directory, or install the plugin through the WordPress plugins screen directly.
|
35 |
2. Activate the plugin through the 'Plugins' screen in WordPress
|
36 |
+
3. Use the Appearance -> Custom Fonts -> Add Custom Fonts name, woff2, woff, ttf, eot, otf and svg files.
|
37 |
|
38 |
== Screenshots ==
|
39 |
|
43 |
|
44 |
== Changelog ==
|
45 |
|
46 |
+
= v1.0.8 =
|
47 |
+
- New: Now you can also upload otf fonts.
|
48 |
+
- Fix: ttf fonts not being uploaded in WordPress media library.
|
49 |
+
|
50 |
= v1.0.7 =
|
51 |
- Fix: Custom Fonts loading the Block Editor breaking styling of the editor.
|
52 |
|