Skip to content

Commit bacc1a3

Browse files
committed
Add escaping to variables, visibility identifier for functions according to PHPCS ruleset
1 parent eddc777 commit bacc1a3

7 files changed

+36
-36
lines changed

classes/class-custom-typekit-fonts-admin.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_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
/**
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -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.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/custom-typekit-fonts-options.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,14 @@
7272
foreach ( $kit_info['custom-typekit-font-details'] as $font ) :
7373

7474
echo '<tr>';
75-
echo '<td>' . $font['family'] . '</td>';
76-
echo '<td>' . $font['fallback'] . '</td>';
75+
echo '<td>' . esc_html( $font['family'] ) . '</td>';
76+
echo '<td>' . esc_html( $font['fallback'] ) . '</td>';
7777
echo '<td>';
7878
$comma_sep_arr = array();
7979
foreach ( $font['weights'] as $weight ) :
8080
$comma_sep_arr[] = $weight;
8181
endforeach;
82-
echo join( ', ', $comma_sep_arr );
82+
echo esc_html( join( ', ', $comma_sep_arr ) );
8383
echo '</td>';
8484
echo '</tr>';
8585

@@ -109,7 +109,7 @@
109109
<p>
110110
<?php
111111
/* translators: %1$s: typekit site url. */
112-
printf( __( 'You can get the Project ID <a href=%1$s target="_blank" >here</a> from your Typekit Account. <b>Project ID</b> can be found next to the kit names.', 'custom-typekit-fonts' ), 'https://fonts.adobe.com/my_fonts?browse_mode=all#web_projects-section' );
112+
printf( esc_html__( 'You can get the Project ID <a href=%1$s target="_blank" >here</a> from your Typekit Account. <b>Project ID</b> can be found next to the kit names.', 'custom-typekit-fonts' ), 'https://fonts.adobe.com/my_fonts?browse_mode=all#web_projects-section' );
113113
?>
114114
</p>
115115

@@ -127,7 +127,7 @@
127127
<p>
128128
<?php
129129
/* translators: %1$s: Astra Theme url. */
130-
printf( __( '1) Once you get the Kit Details, all the fonts will be listed in the customizer under typography for only <a href="%1$s" target="_blank" rel="noopener"> Astra </a> WordPress Theme users', 'custom-typekit-fonts' ), 'https://wpastra.com' );
130+
printf( esc_html__( '1) Once you get the Kit Details, all the fonts will be listed in the customizer under typography for only <a href="%1$s" target="_blank" rel="noopener"> Astra </a> WordPress Theme users', 'custom-typekit-fonts' ), 'https://wpastra.com' );
131131
?>
132132
</p>
133133
<p>

templates/white-label.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,23 +15,23 @@
1515
<li>
1616
<div class="branding-form postbox">
1717
<button type="button" class="handlediv button-link" aria-expanded="true">
18-
<span class="screen-reader-text"><?php _e( 'Custom Typekit Fonts Branding', 'custom-typekit-fonts' ); ?></span>
18+
<span class="screen-reader-text"><?php esc_html_e( 'Custom Typekit Fonts Branding', 'custom-typekit-fonts' ); ?></span>
1919
<span class="toggle-indicator" aria-hidden="true"></span>
2020
</button>
2121

2222
<h2 class="hndle ui-sortable-handle">
23-
<span><?php _e( 'Custom Typekit Fonts Branding', 'custom-typekit-fonts' ); ?></span>
23+
<span><?php esc_html_e( 'Custom Typekit Fonts Branding', 'custom-typekit-fonts' ); ?></span>
2424
</h2>
2525

2626
<div class="inside">
2727
<div class="form-wrap">
2828
<div class="form-field">
29-
<label><?php _e( 'Plugin Name:', 'custom-typekit-fonts' ); ?>
29+
<label><?php esc_html_e( 'Plugin Name:', 'custom-typekit-fonts' ); ?>
3030
<input type="text" name="ast_white_label[custom-typekit-fonts][name]" class="placeholder placeholder-active" <?php disabled( defined( Astra_Ext_White_Label_Markup::branding_key_to_constant( 'custom-typekit-fonts', 'name' ) ), true, true ); ?> value="<?php echo esc_attr( Astra_Ext_White_Label_Markup::get_whitelabel_string( 'custom-typekit-fonts', 'name' ) ); ?>">
3131
</label>
3232
</div>
3333
<div class="form-field">
34-
<label><?php _e( 'Plugin Description:', 'custom-typekit-fonts' ); ?>
34+
<label><?php esc_html_e( 'Plugin Description:', 'custom-typekit-fonts' ); ?>
3535
<textarea name="ast_white_label[custom-typekit-fonts][description]" class="placeholder placeholder-active" <?php disabled( defined( Astra_Ext_White_Label_Markup::branding_key_to_constant( 'custom-typekit-fonts', 'description' ) ), true, true ); ?> rows="2"><?php echo esc_attr( Astra_Ext_White_Label_Markup::get_whitelabel_string( 'custom-typekit-fonts', 'description' ) ); ?></textarea>
3636
</label>
3737
</div>

0 commit comments

Comments
 (0)