Custom Fonts - Version 1.0.5

Version Description

Download this release

Release Info

Developer Nikschavan
Plugin Icon 128x128 Custom Fonts
Version 1.0.5
Comparing to
See all releases

Code changes from version 1.0.4 to 1.0.5

assets/js/bsf-custom-fonts.js CHANGED
@@ -32,7 +32,7 @@
32
  {
33
  var file_frame;
34
  window.inputWrapper = '';
35
- $( document.body ).on('click', '.bsf-custom-fonts-upload', function(e) {
36
  event.preventDefault();
37
  var button = $(this),
38
  button_type = button.data('upload-type');
32
  {
33
  var file_frame;
34
  window.inputWrapper = '';
35
+ $( document.body ).on('click', '.bsf-custom-fonts-upload', function(event) {
36
  event.preventDefault();
37
  var button = $(this),
38
  button_type = button.data('upload-type');
classes/class-bsf-custom-fonts-render.php CHANGED
@@ -23,6 +23,16 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Render' ) ) :
23
  */
24
  private static $_instance = null;
25
 
 
 
 
 
 
 
 
 
 
 
26
  /**
27
  * Member Varible
28
  *
@@ -71,11 +81,46 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Render' ) ) :
71
  add_filter( 'fl_theme_system_fonts', array( $this, 'bb_custom_fonts' ) );
72
  add_filter( 'fl_builder_font_families_system', array( $this, 'bb_custom_fonts' ) );
73
 
74
- // Elementor page builder.
75
- add_action( 'elementor/controls/controls_registered', array( $this, 'elementor_custom_fonts' ), 10, 1 );
76
-
77
  // Add font files style.
78
  add_action( 'wp_head', array( $this, 'add_style' ) );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  }
80
 
81
 
@@ -89,38 +134,18 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Render' ) ) :
89
 
90
  $fonts = Bsf_Custom_Fonts_Taxonomy::get_fonts();
91
  $custom_fonts = array();
92
- if ( ! empty( $fonts ) ) :
93
- foreach ( $fonts as $font_family_name => $fonts_url ) :
94
  $custom_fonts[ $font_family_name ] = array(
95
  'fallback' => 'Verdana, Arial, sans-serif',
96
  'weights' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900' ),
97
  );
98
- endforeach;
99
- endif;
100
 
101
  return array_merge( $bb_fonts, $custom_fonts );
102
  }
103
 
104
- /**
105
- * Add Custom Font list to Elementor Page Builder
106
- *
107
- * @since 1.0.4
108
- * @param array $controls_registry font families added by elementor.
109
- */
110
- function elementor_custom_fonts( $controls_registry ) {
111
- $fonts = Bsf_Custom_Fonts_Taxonomy::get_fonts();
112
- $fonts_elementor = array( 'Use Any Fonts' => array() );
113
- if ( ! empty( $fonts ) ) :
114
- foreach ( $fonts as $font_family_name => $fonts_url ) :
115
- $fonts_elementor[ $font_family_name ] = 'system';
116
- endforeach;
117
- endif;
118
-
119
- $fonts = $controls_registry->get_control( 'font' )->get_settings( 'options' );
120
- $new_fonts = array_merge( $fonts, $fonts_elementor );
121
- $controls_registry->get_control( 'font' )->set_settings( 'options', $new_fonts );
122
- }
123
-
124
  /**
125
  * Enqueue Scripts
126
  *
@@ -132,7 +157,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Render' ) ) :
132
  foreach ( $fonts as $load_font_name => $load_font ) {
133
  $this->render_font_css( $load_font_name );
134
  }
135
- ?>
136
  <style type="text/css">
137
  <?php echo $this->font_css; ?>
138
  </style>
@@ -254,7 +279,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Render' ) ) :
254
  function theme_update_notice() {
255
  if ( defined( 'ASTRA_THEME_VERSION' ) ) {
256
  if ( version_compare( ASTRA_THEME_VERSION, '1.0.16', '<' ) ) {
257
- ?>
258
  <div class="notice notice-error is-dismissible">
259
  <p>
260
  <?php
@@ -266,7 +291,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Render' ) ) :
266
  ?>
267
  </p>
268
  </div>
269
- <?php
270
  }
271
  }
272
  }
23
  */
24
  private static $_instance = null;
25
 
26
+ /**
27
+ * Font base.
28
+ *
29
+ * This is used in case of Elementor's Font param
30
+ *
31
+ * @since 1.0.5
32
+ * @var string
33
+ */
34
+ private static $font_base = 'bsf-custom-fonts';
35
+
36
  /**
37
  * Member Varible
38
  *
81
  add_filter( 'fl_theme_system_fonts', array( $this, 'bb_custom_fonts' ) );
82
  add_filter( 'fl_builder_font_families_system', array( $this, 'bb_custom_fonts' ) );
83
 
 
 
 
84
  // Add font files style.
85
  add_action( 'wp_head', array( $this, 'add_style' ) );
86
+
87
+ add_filter( 'elementor/fonts/groups', array( $this, 'elementor_group' ) );
88
+ add_filter( 'elementor/fonts/additional_fonts', array( $this, 'add_elementor_fonts' ) );
89
+ }
90
+
91
+ /**
92
+ * Add Custom Font group to elementor font list.
93
+ *
94
+ * Group name "Custom" is added as the first element in the array.
95
+ *
96
+ * @since 1.0.5
97
+ * @param Array $font_groups default font groups in elementor.
98
+ * @return Array Modified font groups with newly added font group.
99
+ */
100
+ public function elementor_group( $font_groups ) {
101
+ $new_group[ self::$font_base ] = __( 'Custom', 'custom-fonts' );
102
+ $font_groups = $new_group + $font_groups;
103
+
104
+ return $font_groups;
105
+ }
106
+
107
+ /**
108
+ * Add Custom Fonts to the Elementor Page builder's font param.
109
+ *
110
+ * @since 1.0.5
111
+ * @param Array $fonts Custom Font's array.
112
+ */
113
+ public function add_elementor_fonts( $fonts ) {
114
+
115
+ $all_fonts = Bsf_Custom_Fonts_Taxonomy::get_fonts();
116
+
117
+ if ( ! empty( $all_fonts ) ) {
118
+ foreach ( $all_fonts as $font_family_name => $fonts_url ) {
119
+ $fonts[ $font_family_name ] = self::$font_base;
120
+ }
121
+ }
122
+
123
+ return $fonts;
124
  }
125
 
126
 
134
 
135
  $fonts = Bsf_Custom_Fonts_Taxonomy::get_fonts();
136
  $custom_fonts = array();
137
+ if ( ! empty( $fonts ) ) {
138
+ foreach ( $fonts as $font_family_name => $fonts_url ) {
139
  $custom_fonts[ $font_family_name ] = array(
140
  'fallback' => 'Verdana, Arial, sans-serif',
141
  'weights' => array( '100', '200', '300', '400', '500', '600', '700', '800', '900' ),
142
  );
143
+ }
144
+ }
145
 
146
  return array_merge( $bb_fonts, $custom_fonts );
147
  }
148
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
149
  /**
150
  * Enqueue Scripts
151
  *
157
  foreach ( $fonts as $load_font_name => $load_font ) {
158
  $this->render_font_css( $load_font_name );
159
  }
160
+ ?>
161
  <style type="text/css">
162
  <?php echo $this->font_css; ?>
163
  </style>
279
  function theme_update_notice() {
280
  if ( defined( 'ASTRA_THEME_VERSION' ) ) {
281
  if ( version_compare( ASTRA_THEME_VERSION, '1.0.16', '<' ) ) {
282
+ ?>
283
  <div class="notice notice-error is-dismissible">
284
  <p>
285
  <?php
291
  ?>
292
  </p>
293
  </div>
294
+ <?php
295
  }
296
  }
297
  }
classes/class-bsf-custom-fonts.php CHANGED
@@ -47,4 +47,4 @@ if ( ! class_exists( 'Bsf_Custom_Fonts' ) ) {
47
  * Kicking this off by calling 'get_instance()' method
48
  */
49
  Bsf_Custom_Fonts::get_instance();
50
- }// End if().
47
  * Kicking this off by calling 'get_instance()' method
48
  */
49
  Bsf_Custom_Fonts::get_instance();
50
+ }
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.4
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.4' );
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.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.0.5' );
29
 
30
  /**
31
  * BSF Custom Fonts
languages/custom-fonts.pot CHANGED
@@ -1,30 +1,34 @@
1
- # Copyright (C) 2017 Brainstorm Force
2
  # This file is distributed under the same license as the Custom Fonts package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Custom Fonts 1.0.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/custom-fonts\n"
7
- "POT-Creation-Date: 2017-09-28 05:54:30+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2017-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
- "X-Generator: grunt-wp-i18n 0.5.4\n"
15
- "X-Poedit-KeywordsList: "
16
- "__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
17
- "attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
18
  "Language: en\n"
19
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
20
  "X-Poedit-Country: United States\n"
21
  "X-Poedit-SourceCharset: UTF-8\n"
 
 
 
22
  "X-Poedit-Basepath: ../\n"
23
  "X-Poedit-SearchPath-0: .\n"
24
  "X-Poedit-Bookmarks: \n"
25
  "X-Textdomain-Support: yes\n"
 
 
 
 
 
26
 
27
- #: classes/class-bsf-custom-fonts-render.php:194
28
  #. translators: 1: Astra theme from wordpress.org
29
  msgid "Custom Fonts Plugin requires minimum 1.0.16 version of the Astra Theme."
30
  msgstr ""
@@ -33,62 +37,62 @@ msgstr ""
33
  msgid "Custom Fonts"
34
  msgstr ""
35
 
36
- #: includes/class-bsf-custom-fonts-admin.php:103
37
  msgid "The name of the font as it appears in the customizer options."
38
  msgstr ""
39
 
40
- #: includes/class-bsf-custom-fonts-admin.php:137
41
- #: includes/class-bsf-custom-fonts-admin.php:152
42
  msgid "Font .woff2"
43
  msgstr ""
44
 
45
- #: includes/class-bsf-custom-fonts-admin.php:137
46
- #: includes/class-bsf-custom-fonts-admin.php:152
47
  msgid "Upload the font's woff2 file or enter the URL."
48
  msgstr ""
49
 
50
- #: includes/class-bsf-custom-fonts-admin.php:138
51
- #: includes/class-bsf-custom-fonts-admin.php:153
52
  msgid "Font .woff"
53
  msgstr ""
54
 
55
- #: includes/class-bsf-custom-fonts-admin.php:138
56
- #: includes/class-bsf-custom-fonts-admin.php:153
57
  msgid "Upload the font's woff file or enter the URL."
58
  msgstr ""
59
 
60
- #: includes/class-bsf-custom-fonts-admin.php:139
61
- #: includes/class-bsf-custom-fonts-admin.php:154
62
  msgid "Font .ttf"
63
  msgstr ""
64
 
65
- #: includes/class-bsf-custom-fonts-admin.php:139
66
- #: includes/class-bsf-custom-fonts-admin.php:154
67
  msgid "Upload the font's ttf file or enter the URL."
68
  msgstr ""
69
 
70
- #: includes/class-bsf-custom-fonts-admin.php:140
71
- #: includes/class-bsf-custom-fonts-admin.php:155
72
  msgid "Font .eot"
73
  msgstr ""
74
 
75
- #: includes/class-bsf-custom-fonts-admin.php:140
76
- #: includes/class-bsf-custom-fonts-admin.php:155
77
  msgid "Upload the font's eot file or enter the URL."
78
  msgstr ""
79
 
80
- #: includes/class-bsf-custom-fonts-admin.php:141
81
- #: includes/class-bsf-custom-fonts-admin.php:156
82
  msgid "Font .svg"
83
  msgstr ""
84
 
85
- #: includes/class-bsf-custom-fonts-admin.php:141
86
- #: includes/class-bsf-custom-fonts-admin.php:156
87
  msgid "Upload the font's svg file or enter the URL."
88
  msgstr ""
89
 
90
- #: includes/class-bsf-custom-fonts-admin.php:174
91
- #: includes/class-bsf-custom-fonts-admin.php:199
92
  msgid "Upload"
93
  msgstr ""
94
 
1
+ # Copyright (C) 2018 Brainstorm Force
2
  # This file is distributed under the same license as the Custom Fonts package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Custom Fonts 1.0.5\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/custom-fonts\n"
7
+ "POT-Creation-Date: 2018-08-03 13:21:42+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2018-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
 
 
 
 
14
  "Language: en\n"
15
  "Plural-Forms: nplurals=2; plural=(n != 1);\n"
16
  "X-Poedit-Country: United States\n"
17
  "X-Poedit-SourceCharset: UTF-8\n"
18
+ "X-Poedit-KeywordsList: "
19
+ "__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
20
+ "attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
21
  "X-Poedit-Basepath: ../\n"
22
  "X-Poedit-SearchPath-0: .\n"
23
  "X-Poedit-Bookmarks: \n"
24
  "X-Textdomain-Support: yes\n"
25
+ "X-Generator: grunt-wp-i18n1.0.2\n"
26
+
27
+ #: classes/class-bsf-custom-fonts-render.php:101
28
+ msgid "Custom"
29
+ msgstr ""
30
 
31
+ #: classes/class-bsf-custom-fonts-render.php:288
32
  #. translators: 1: Astra theme from wordpress.org
33
  msgid "Custom Fonts Plugin requires minimum 1.0.16 version of the Astra Theme."
34
  msgstr ""
37
  msgid "Custom Fonts"
38
  msgstr ""
39
 
40
+ #: includes/class-bsf-custom-fonts-admin.php:105
41
  msgid "The name of the font as it appears in the customizer options."
42
  msgstr ""
43
 
44
+ #: includes/class-bsf-custom-fonts-admin.php:139
45
+ #: includes/class-bsf-custom-fonts-admin.php:154
46
  msgid "Font .woff2"
47
  msgstr ""
48
 
49
+ #: includes/class-bsf-custom-fonts-admin.php:139
50
+ #: includes/class-bsf-custom-fonts-admin.php:154
51
  msgid "Upload the font's woff2 file or enter the URL."
52
  msgstr ""
53
 
54
+ #: includes/class-bsf-custom-fonts-admin.php:140
55
+ #: includes/class-bsf-custom-fonts-admin.php:155
56
  msgid "Font .woff"
57
  msgstr ""
58
 
59
+ #: includes/class-bsf-custom-fonts-admin.php:140
60
+ #: includes/class-bsf-custom-fonts-admin.php:155
61
  msgid "Upload the font's woff file or enter the URL."
62
  msgstr ""
63
 
64
+ #: includes/class-bsf-custom-fonts-admin.php:141
65
+ #: includes/class-bsf-custom-fonts-admin.php:156
66
  msgid "Font .ttf"
67
  msgstr ""
68
 
69
+ #: includes/class-bsf-custom-fonts-admin.php:141
70
+ #: includes/class-bsf-custom-fonts-admin.php:156
71
  msgid "Upload the font's ttf file or enter the URL."
72
  msgstr ""
73
 
74
+ #: includes/class-bsf-custom-fonts-admin.php:142
75
+ #: includes/class-bsf-custom-fonts-admin.php:157
76
  msgid "Font .eot"
77
  msgstr ""
78
 
79
+ #: includes/class-bsf-custom-fonts-admin.php:142
80
+ #: includes/class-bsf-custom-fonts-admin.php:157
81
  msgid "Upload the font's eot file or enter the URL."
82
  msgstr ""
83
 
84
+ #: includes/class-bsf-custom-fonts-admin.php:143
85
+ #: includes/class-bsf-custom-fonts-admin.php:158
86
  msgid "Font .svg"
87
  msgstr ""
88
 
89
+ #: includes/class-bsf-custom-fonts-admin.php:143
90
+ #: includes/class-bsf-custom-fonts-admin.php:158
91
  msgid "Upload the font's svg file or enter the URL."
92
  msgstr ""
93
 
94
+ #: includes/class-bsf-custom-fonts-admin.php:176
95
+ #: includes/class-bsf-custom-fonts-admin.php:201
96
  msgid "Upload"
97
  msgstr ""
98
 
readme.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: brainstormforce
3
  Donate link: https://wpastra.com/
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: 4.9.4
7
- Stable tag: 1.0.4
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
  v1.0.4
47
  * New: Added compatibility with Beaver Builder Theme, Beaver Builder Plugin and Elementor.
48
 
3
  Donate link: https://wpastra.com/
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: 4.9.8
7
+ Stable tag: 1.0.5
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
43
 
44
  == Changelog ==
45
 
46
+ v1.0.5
47
+ * Fix: JavaScript error in the Firefox browser not allowing to upload any fonts.
48
+
49
  v1.0.4
50
  * New: Added compatibility with Beaver Builder Theme, Beaver Builder Plugin and Elementor.
51