Skip to content

Commit 576f89f

Browse files
author
Uttam Sharma
authored
Merge pull request #29 from brainstormforce/phpcs-ruleset
fix: Added wordpress-extra ruleset to PHPCS
2 parents f5f6090 + 7bc9ba9 commit 576f89f

12 files changed

+101
-83
lines changed

README.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
**Donate link:** https://www.paypal.me/BrainstormForce
44
**Tags:** custom adobe fonts, theme custom fonts, unlimited typekit custom fonts
55
**Requires at least:** 4.4
6-
**Tested up to:** 5.2
7-
**Stable tag:** 1.0.13
6+
**Tested up to:** 5.3.2
7+
**Stable tag:** 1.0.14
88
**License:** GPLv2 or later
99
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html
1010

@@ -49,6 +49,10 @@ If you're not using any of the supported plugins and theme, you can write the cu
4949

5050
## Changelog ##
5151

52+
### v1.0.14 ###
53+
- Improvement: Hardened the security of plugin
54+
- Improvement: Compatibility with latest WordPress PHP_CodeSniffer rules
55+
5256
### v1.0.13 ###
5357
- Fix: Console errors in customizer & frontend on adobe font(TypeKit) selection.
5458

classes/class-custom-typekit-fonts-admin.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @package Bsf_Custom_Fonts
77
*/
88

9-
defined( 'ABSPATH' ) or exit;
9+
defined( 'ABSPATH' ) || exit;
1010

1111
if ( ! class_exists( 'Custom_Typekit_Fonts_Admin' ) ) :
1212

@@ -21,7 +21,7 @@ class Custom_Typekit_Fonts_Admin {
2121
* @since 1.0.0
2222
* @var (Object) Custom_Typekit_Fonts_Admin
2323
*/
24-
private static $_instance = null;
24+
private static $instance = null;
2525

2626
/**
2727
* Parent Menu Slug
@@ -39,11 +39,11 @@ class Custom_Typekit_Fonts_Admin {
3939
* @return object Class object.
4040
*/
4141
public static function get_instance() {
42-
if ( ! isset( self::$_instance ) ) {
43-
self::$_instance = new self;
42+
if ( ! isset( self::$instance ) ) {
43+
self::$instance = new self();
4444
}
4545

46-
return self::$_instance;
46+
return self::$instance;
4747
}
4848

4949
/**
@@ -65,7 +65,7 @@ public function __construct() {
6565
*/
6666
public function set_custom_typekit_fonts_notice() {
6767

68-
// Notice for Custom Typekit Fonts action.
68+
// Notice for the Custom Typekit Fonts action.
6969
if ( isset( $_POST['custom-typekit-fonts-nonce'] ) && wp_verify_nonce( $_POST['custom-typekit-fonts-nonce'], 'custom-typekit-fonts' ) ) {
7070

7171
if ( isset( $_POST['custom-typekit-fonts-submitted'] ) ) {
@@ -77,17 +77,17 @@ public function set_custom_typekit_fonts_notice() {
7777
if ( isset( $_POST['custom-typekit-id-notice'] ) && $_POST['custom-typekit-id-notice'] ) {
7878
?>
7979
<div class="notice notice-error is-dismissible">
80-
<p><?php _e( 'Please Enter the Valid Kit ID to get the kit details.', 'custom-typekit-fonts' ); ?></p>
80+
<p><?php esc_html_e( 'Please Enter the Valid Kit ID to get the kit details.', 'custom-typekit-fonts' ); ?></p>
8181
</div>
8282
<?php
8383
} elseif ( isset( $_POST['custom-typekit-empty-notice'] ) && $_POST['custom-typekit-empty-notice'] ) {
8484
?>
8585
<div class="notice notice-warning is-dismissible">
86-
<p><?php _e( 'This Kit is empty. Please add some fonts in it.', 'custom-typekit-fonts' ); ?></p>
86+
<p><?php esc_html_e( 'This Kit is empty. Please add some fonts in it.', 'custom-typekit-fonts' ); ?></p>
8787
</div>
8888
<?php } else { ?>
8989
<div class="notice notice-success is-dismissible">
90-
<p><?php _e( 'Custom Typekit Fonts settings have been successfully saved.', 'custom-typekit-fonts' ); ?></p>
90+
<p><?php esc_html_e( 'Custom Typekit Fonts settings have been successfully saved.', 'custom-typekit-fonts' ); ?></p>
9191
</div>
9292
<?php
9393
}
@@ -138,7 +138,7 @@ public function enqueue_scripts() {
138138

139139
wp_enqueue_style( 'custom-typekit-fonts-css', CUSTOM_TYPEKIT_FONTS_URI . 'assets/css/custom-typekit-fonts.css', array(), CUSTOM_TYPEKIT_FONTS_VER );
140140

141-
wp_enqueue_script( 'custom-typekit-fonts-js', CUSTOM_TYPEKIT_FONTS_URI . 'assets/js/custom-typekit-fonts.js', array( 'jquery-ui-tooltip' ), CUSTOM_TYPEKIT_FONTS_VER );
141+
wp_enqueue_script( 'custom-typekit-fonts-js', CUSTOM_TYPEKIT_FONTS_URI . 'assets/js/custom-typekit-fonts.js', array( 'jquery-ui-tooltip' ), CUSTOM_TYPEKIT_FONTS_VER, false );
142142

143143
}
144144

classes/class-custom-typekit-fonts-render.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* @package Bsf_Custom_Fonts
77
*/
88

9-
defined( 'ABSPATH' ) or exit;
9+
defined( 'ABSPATH' ) || exit;
1010

1111
if ( ! class_exists( 'Custom_Typekit_Fonts_Render' ) ) :
1212

@@ -23,7 +23,7 @@ class Custom_Typekit_Fonts_Render {
2323
* @since 1.0.0
2424
* @var (Object) Custom_Typekit_Fonts_Render
2525
*/
26-
private static $_instance = null;
26+
private static $instance = null;
2727

2828
/**
2929
* Member Varible
@@ -50,11 +50,11 @@ class Custom_Typekit_Fonts_Render {
5050
* @return object Class object.
5151
*/
5252
public static function get_instance() {
53-
if ( ! isset( self::$_instance ) ) {
54-
self::$_instance = new self();
53+
if ( ! isset( self::$instance ) ) {
54+
self::$instance = new self();
5555
}
5656

57-
return self::$_instance;
57+
return self::$instance;
5858
}
5959

6060
/**
@@ -127,7 +127,7 @@ public function add_elementor_fonts( $fonts ) {
127127
public function typekit_embed_css() {
128128

129129
if ( false !== $this->get_typekit_embed_url() ) {
130-
wp_enqueue_style( 'custom-typekit-css', $this->get_typekit_embed_url(), array() );
130+
wp_enqueue_style( 'custom-typekit-css', $this->get_typekit_embed_url(), array(), CUSTOM_TYPEKIT_FONTS_VER );
131131
}
132132

133133
}
@@ -153,7 +153,7 @@ private function get_typekit_embed_url() {
153153
*
154154
* @param array $custom_fonts custom fonts.
155155
*/
156-
function add_typekit_fonts( $custom_fonts ) {
156+
public function add_typekit_fonts( $custom_fonts ) {
157157

158158
$kit_info = get_option( 'custom-typekit-fonts' );
159159
if ( empty( $kit_info['custom-typekit-font-details'] ) ) {
@@ -217,7 +217,7 @@ public function add_customizer_font_list( $value ) {
217217
* @since 1.0.3
218218
* @param array $bb_fonts font families added by bb.
219219
*/
220-
function bb_custom_fonts( $bb_fonts ) {
220+
public function bb_custom_fonts( $bb_fonts ) {
221221

222222
$kit_list = get_option( 'custom-typekit-fonts' );
223223
$fonts = $kit_list['custom-typekit-font-details'];
@@ -243,7 +243,7 @@ function bb_custom_fonts( $bb_fonts ) {
243243
* @since 1.1.0
244244
* @param array $fonts font families selected.
245245
*/
246-
function remove_typekit_font_google_url( $fonts ) {
246+
public function remove_typekit_font_google_url( $fonts ) {
247247

248248
$kit_list = get_option( 'custom-typekit-fonts', array() );
249249
if ( ! empty( $kit_list['custom-typekit-font-details'] ) ) {

classes/class-custom-typekit-fonts.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class Custom_Typekit_Fonts {
2626
*/
2727
public static function get_instance() {
2828
if ( ! isset( self::$instance ) ) {
29-
self::$instance = new self;
29+
self::$instance = new self();
3030
}
3131

3232
return self::$instance;
@@ -104,7 +104,7 @@ public function options_setting() {
104104
*
105105
* @param string $kit_id Typekit ID.
106106
*/
107-
function get_custom_typekit_details( $kit_id ) {
107+
public function get_custom_typekit_details( $kit_id ) {
108108

109109
$typekit_info = array();
110110
$typekit_uri = 'https://typekit.com/api/v1/json/kits/' . $kit_id . '/published';
@@ -178,7 +178,7 @@ private function load_files() {
178178
*
179179
* @since 1.0.0
180180
*/
181-
function load_textdomain() {
181+
public function load_textdomain() {
182182
load_plugin_textdomain( 'custom-typekit-fonts' );
183183
}
184184

classes/class-typekit-fonts-white-label.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ class Typekit_Fonts_White_Label {
4141
*/
4242
public static function set_instance() {
4343
if ( ! isset( self::$instance ) ) {
44-
self::$instance = new self;
44+
self::$instance = new self();
4545
}
4646
return self::$instance;
4747
}
@@ -70,7 +70,7 @@ public function __construct() {
7070
* @param array $plugins Plugins Array.
7171
* @return array
7272
*/
73-
function plugins_page( $plugins ) {
73+
public function plugins_page( $plugins ) {
7474

7575
if ( ! is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
7676
return $plugins;
@@ -115,7 +115,7 @@ function plugins_page( $plugins ) {
115115
* @param string $title custom typekit fonts menu title.
116116
* @return string $title updated custom typekit fonts menu
117117
*/
118-
function white_label_custom_typekit_fonts_title( $title ) {
118+
public function white_label_custom_typekit_fonts_title( $title ) {
119119

120120
if ( is_callable( 'Astra_Ext_White_Label_Markup::get_whitelabel_string' ) ) {
121121
$name = Astra_Ext_White_Label_Markup::get_whitelabel_string( 'custom-typekit-fonts', 'name' );

composer.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
{
2+
"name": "brainstormforce/custom-typekit-fonts",
3+
"description": "Custom Adobe Fonts allows you to extends the fonts supports from the Adobe Fonts.",
24
"require-dev": {
35
"dealerdirect/phpcodesniffer-composer-installer": "^0.4.4",
46
"wp-coding-standards/wpcs": "dev-master",
57
"phpcompatibility/phpcompatibility-wp": "*"
68
},
7-
"require": {
9+
"scripts": {
10+
"format": "phpcbf --standard=phpcs.xml.dist --report-summary --report-source",
11+
"lint": "phpcs --standard=phpcs.xml.dist --report-summary --report-source"
812
}
913
}
14+

0 commit comments

Comments
 (0)