Custom Fonts - Version 1.0.2

Version Description

Download this release

Release Info

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

Code changes from version 1.0.1 to 1.0.2

classes/class-bsf-custom-fonts-white-label.php ADDED
@@ -0,0 +1,193 @@
1
+ <?php
2
+ /**
3
+ * BSF Custom Fonts White Label
4
+ *
5
+ * @package Bsf_Custom_Fonts
6
+ * @since 1.0.2
7
+ */
8
+
9
+ if ( ! class_exists( 'Bsf_Custom_Fonts_White_Label' ) ) :
10
+
11
+ /**
12
+ * Bsf_Custom_Fonts_White_Label
13
+ *
14
+ * @since 1.0.2
15
+ */
16
+ class Bsf_Custom_Fonts_White_Label {
17
+
18
+ /**
19
+ * Instance
20
+ *
21
+ * @since 1.0.2
22
+ * @var object Class Object.
23
+ * @access private
24
+ */
25
+ private static $instance;
26
+
27
+ /**
28
+ * Member Variable
29
+ *
30
+ * @since 1.0.2
31
+ * @var array branding
32
+ * @access private
33
+ */
34
+ private static $branding;
35
+
36
+ /**
37
+ * Initiator
38
+ *
39
+ * @since 1.0.2
40
+ * @return object initialized object of class.
41
+ */
42
+ public static function set_instance() {
43
+ if ( ! isset( self::$instance ) ) {
44
+ self::$instance = new self;
45
+ }
46
+ return self::$instance;
47
+ }
48
+
49
+ /**
50
+ * Constructor
51
+ *
52
+ * @since 1.0.2
53
+ */
54
+ public function __construct() {
55
+
56
+ add_filter( 'all_plugins' , array( $this, 'plugins_page' ) );
57
+ add_filter( 'astra_addon_branding_options' , __CLASS__ . '::settings' );
58
+ add_action( 'astra_pro_white_label_add_form' , __CLASS__ . '::add_white_lavel_form' );
59
+
60
+ add_filter( 'bsf_custom_fonts_menu_title', array( $this, 'white_label_custom_fonts_title' ) );
61
+ if ( is_admin() ) {
62
+ // Display the link with the plugin meta.
63
+ add_filter( 'plugin_row_meta', array( $this, 'plugin_links' ), 10, 4 );
64
+ }
65
+ }
66
+
67
+ /**
68
+ * White labels the plugins page.
69
+ *
70
+ * @param array $plugins Plugins Array.
71
+ * @return array
72
+ */
73
+ function plugins_page( $plugins ) {
74
+
75
+ if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
76
+ return $plugins;
77
+ }
78
+
79
+ if ( ! isset( $plugins[ BSF_CUSTOM_FONTS_BASE ] ) ) {
80
+ return $plugins;
81
+ }
82
+
83
+ // Set White Labels.
84
+ $name = Astra_Ext_White_Label_Markup::get_white_label( 'bsf-custom-fonts', 'name' );
85
+ $description = Astra_Ext_White_Label_Markup::get_white_label( 'bsf-custom-fonts', 'description' );
86
+ $author = Astra_Ext_White_Label_Markup::get_white_label( 'astra-agency', 'author' );
87
+ $author_uri = Astra_Ext_White_Label_Markup::get_white_label( 'astra-agency', 'author_url' );
88
+
89
+ if ( ! empty( $name ) ) {
90
+ $plugins[ BSF_CUSTOM_FONTS_BASE ]['Name'] = $name;
91
+
92
+ // Remove Plugin URI if Agency White Label name is set.
93
+ $plugins[ BSF_CUSTOM_FONTS_BASE ]['PluginURI'] = '';
94
+ }
95
+
96
+ if ( ! empty( $description ) ) {
97
+ $plugins[ BSF_CUSTOM_FONTS_BASE ]['Description'] = $description;
98
+ }
99
+
100
+ if ( ! empty( $author ) ) {
101
+ $plugins[ BSF_CUSTOM_FONTS_BASE ]['Author'] = $author;
102
+ }
103
+
104
+ if ( ! empty( $author_uri ) ) {
105
+ $plugins[ BSF_CUSTOM_FONTS_BASE ]['AuthorURI'] = $author_uri;
106
+ }
107
+
108
+ return $plugins;
109
+ }
110
+
111
+ /**
112
+ * White labels the Custom fonts menu title
113
+ *
114
+ * @since 1.0.2
115
+ * @param string $title custom fonts menu title.
116
+ * @return string $title updated custom fonts menu title.
117
+ */
118
+ function white_label_custom_fonts_title( $title ) {
119
+
120
+ if ( is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
121
+ $name = Astra_Ext_White_Label_Markup::get_white_label( 'bsf-custom-fonts', 'name' );
122
+ if ( ! empty( $name ) ) {
123
+ $title = $name;
124
+ }
125
+ }
126
+ return $title;
127
+ }
128
+
129
+ /**
130
+ * Remove a "view details" link from the plugin list table
131
+ *
132
+ * @since 1.0.2
133
+ *
134
+ * @param array $plugin_meta List of links.
135
+ * @param string $plugin_file Relative path to the main plugin file from the plugins directory.
136
+ * @param array $plugin_data Data from the plugin headers.
137
+ * @return array
138
+ */
139
+ public function plugin_links( $plugin_meta, $plugin_file, $plugin_data ) {
140
+
141
+ if ( is_callable( 'Astra_Ext_White_Label_Markup::get_white_label' ) ) {
142
+ if ( BSF_CUSTOM_FONTS_BASE == $plugin_file ) {
143
+ // Set White Labels.
144
+ $name = Astra_Ext_White_Label_Markup::get_white_label( 'bsf-custom-fonts', 'name' );
145
+ $description = Astra_Ext_White_Label_Markup::get_white_label( 'bsf-custom-fonts', 'description' );
146
+
147
+ if ( ! empty( $name ) ) {
148
+ // Remove Plugin URI if Agency White Label name is set.
149
+ unset( $plugin_meta[2] );
150
+ }
151
+ }
152
+ }
153
+ return $plugin_meta;
154
+ }
155
+
156
+ /**
157
+ * Add White Label setting's
158
+ *
159
+ * @since 1.0.2
160
+ *
161
+ * @param array $settings White label setting.
162
+ * @return array
163
+ */
164
+ public static function settings( $settings = array() ) {
165
+
166
+ $settings['bsf-custom-fonts'] = array(
167
+ 'name' => '',
168
+ 'description' => '',
169
+ );
170
+
171
+ return $settings;
172
+ }
173
+
174
+ /**
175
+ * Add White Label form
176
+ *
177
+ * @since 1.0.2
178
+ *
179
+ * @param array $settings White label setting.
180
+ * @return void
181
+ */
182
+ public static function add_white_lavel_form( $settings = array() ) {
183
+ require_once BSF_CUSTOM_FONTS_DIR . 'includes/white-label.php';
184
+ }
185
+
186
+ }
187
+
188
+ /**
189
+ * Kicking this off by calling 'set_instance()' method
190
+ */
191
+ Bsf_Custom_Fonts_White_Label::set_instance();
192
+
193
+ endif;
classes/class-bsf-custom-fonts.php CHANGED
@@ -39,6 +39,7 @@ if ( ! class_exists( 'Bsf_Custom_Fonts' ) ) {
39
require_once BSF_CUSTOM_FONTS_DIR . 'includes/class-bsf-custom-fonts-admin.php';
40
41
require_once BSF_CUSTOM_FONTS_DIR . 'classes/class-bsf-custom-fonts-render.php';
42
}
43
}
44
39
require_once BSF_CUSTOM_FONTS_DIR . 'includes/class-bsf-custom-fonts-admin.php';
40
41
require_once BSF_CUSTOM_FONTS_DIR . 'classes/class-bsf-custom-fonts-render.php';
42
+ require_once BSF_CUSTOM_FONTS_DIR . 'classes/class-bsf-custom-fonts-white-label.php';
43
}
44
}
45
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.1
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.1' );
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.2
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.2' );
29
30
/**
31
* BSF Custom Fonts
includes/class-bsf-custom-fonts-admin.php CHANGED
@@ -73,10 +73,12 @@ if ( ! class_exists( 'Bsf_Custom_Fonts_Admin' ) ) :
73
* @since 1.0.0
74
*/
75
public function register_custom_fonts_menu() {
76
add_submenu_page(
77
$this->parent_menu_slug,
78
- __( 'Custom Fonts', 'custom-fonts' ),
79
- __( 'Custom Fonts', 'custom-fonts' ),
80
Bsf_Custom_Fonts_Taxonomy::$capability,
81
'edit-tags.php?taxonomy=' . Bsf_Custom_Fonts_Taxonomy::$register_taxonomy_slug
82
);
73
* @since 1.0.0
74
*/
75
public function register_custom_fonts_menu() {
76
+
77
+ $title = apply_filters( 'bsf_custom_fonts_menu_title', __( 'Custom Fonts', 'custom-fonts' ) );
78
add_submenu_page(
79
$this->parent_menu_slug,
80
+ $title,
81
+ $title,
82
Bsf_Custom_Fonts_Taxonomy::$capability,
83
'edit-tags.php?taxonomy=' . Bsf_Custom_Fonts_Taxonomy::$register_taxonomy_slug
84
);
includes/white-label.php ADDED
@@ -0,0 +1,36 @@
1
+ <?php
2
+ /**
3
+ * White Label Form
4
+ *
5
+ * @package Bsf_Custom_Fonts
6
+ */
7
+
8
+ ?>
9
+ <li>
10
+ <div class="branding-form postbox">
11
+ <button type="button" class="handlediv button-link" aria-expanded="true">
12
+ <span class="screen-reader-text"><?php _e( 'Custom Fonts Branding', 'custom-fonts' ); ?></span>
13
+ <span class="toggle-indicator" aria-hidden="true"></span>
14
+ </button>
15
+
16
+ <h2 class="hndle ui-sortable-handle">
17
+ <span><?php _e( 'Custom Fonts Branding', 'custom-fonts' ); ?></span>
18
+ </h2>
19
+
20
+ <div class="inside">
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( $settings['bsf-custom-fonts']['name'] ); ?>">
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( $settings['bsf-custom-fonts']['description'] ); ?></textarea>
30
+ </label>
31
+ </div>
32
+ <div class="clear"></div>
33
+ </div>
34
+ </div>
35
+ </div>
36
+ </li>
languages/custom-fonts.pot CHANGED
@@ -2,9 +2,9 @@
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.1\n"
6
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/custom-fonts\n"
7
- "POT-Creation-Date: 2017-08-16 08:50:20+00:00\n"
8
"MIME-Version: 1.0\n"
9
"Content-Type: text/plain; charset=utf-8\n"
10
"Content-Transfer-Encoding: 8bit\n"
@@ -132,6 +132,18 @@ msgstr ""
132
msgid "No fonts found"
133
msgstr ""
134
135
#. Plugin URI of the plugin/theme
136
msgid "http://www.wpastra.com/"
137
msgstr ""
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"
132
msgid "No fonts found"
133
msgstr ""
134
135
+ #: includes/white-label.php:12 includes/white-label.php:17
136
+ msgid "Custom Fonts Branding"
137
+ msgstr ""
138
+
139
+ #: includes/white-label.php:23
140
+ msgid "Plugin Name:"
141
+ msgstr ""
142
+
143
+ #: includes/white-label.php:28
144
+ msgid "Plugin Description:"
145
+ msgstr ""
146
+
147
#. Plugin URI of the plugin/theme
148
msgid "http://www.wpastra.com/"
149
msgstr ""
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://wpastra.com/
4
Tags: custom fonts, theme custom fonts, unlimited custom fonts, typography
5
Requires at least: 4.4
6
Tested up to: 4.8.1
7
- Stable tag: 1.0.1
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
@@ -40,6 +40,9 @@ This plugin is compatible with the [Astra](https://wpastra.com/) theme only.
40
41
== Changelog ==
42
43
v1.0.1
44
1. Improved the design of the Admin UI.
45
2. Changed the plugin name to be Custom Fonts instead of BSF Custom Fonts.
4
Tags: custom fonts, theme custom fonts, unlimited custom fonts, typography
5
Requires at least: 4.4
6
Tested up to: 4.8.1
7
+ Stable tag: 1.0.2
8
License: GPLv2 or later
9
License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
40
41
== Changelog ==
42
43
+ v1.0.2
44
+ * White Label support added from the [Astra Pro](https://wpastra.com/pro/) plugin.
45
+
46
v1.0.1
47
1. Improved the design of the Admin UI.
48
2. Changed the plugin name to be Custom Fonts instead of BSF Custom Fonts.