Skip to content

Commit 1c3f4ba

Browse files
committed
Merge branch 'hotfix/v2.3.1'
2 parents c76b5df + 90958bf commit 1c3f4ba

18 files changed

Lines changed: 50 additions & 26 deletions

LICENSE.txt

100644100755
File mode changed.

includes/admin/settings/class-settings-api.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,12 @@ public function set_translation_strings( $strings ) {
235235
// Args prefixed with an underscore are reserved for internal use.
236236
$defaults = array(
237237
'page_header' => '',
238-
'reset_message' => __( 'Settings have been reset to their default values. Reload this page to view the updated settings.' ),
239-
'success_message' => __( 'Settings updated.' ),
240-
'save_changes' => __( 'Save Changes' ),
241-
'reset_settings' => __( 'Reset all settings' ),
242-
'reset_button_confirm' => __( 'Do you really want to reset all these settings to their default values?' ),
243-
'checkbox_modified' => __( 'Modified from default setting' ),
238+
'reset_message' => 'Settings have been reset to their default values. Reload this page to view the updated settings.',
239+
'success_message' => 'Settings updated.',
240+
'save_changes' => 'Save Changes',
241+
'reset_settings' => 'Reset all settings',
242+
'reset_button_confirm' => 'Do you really want to reset all these settings to their default values?',
243+
'checkbox_modified' => 'Modified from default setting',
244244
);
245245

246246
$strings = wp_parse_args( $strings, $defaults );
@@ -471,7 +471,7 @@ public function admin_enqueue_scripts( $hook ) {
471471
);
472472
wp_register_script(
473473
'wz-' . $this->prefix . '-codemirror',
474-
plugins_url( 'js/apply-codemirror' . $minimize . '.js', __FILE__ ),
474+
plugins_url( 'js/apply-cm' . $minimize . '.js', __FILE__ ),
475475
array( 'jquery' ),
476476
self::VERSION,
477477
true

includes/admin/settings/class-settings-form.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ protected function get_field_attributes( $args ) {
144144
*/
145145
public function callback_missing( $args ) {
146146
/* translators: 1: Code. */
147-
printf( esc_html__( 'The callback function used for the %1$s setting is missing.' ), '<strong>' . esc_attr( $args['id'] ) . '</strong>' );
147+
printf( 'The callback function used for the %1$s setting is missing.', '<strong>' . esc_attr( $args['id'] ) . '</strong>' );
148148
}
149149

150150
/**
@@ -514,7 +514,7 @@ public function callback_thumbsizes( $args ) {
514514
$name,
515515
(int) $option['width'],
516516
(int) $option['height'],
517-
(bool) $option['crop'] ? ' ' . __( 'cropped' ) : ''
517+
(bool) $option['crop'] ? ' cropped' : ''
518518
);
519519
}
520520

@@ -748,7 +748,7 @@ public function callback_file( $args ) {
748748
$value = isset( $args['value'] ) ? $args['value'] : $this->get_option( $args['id'], $args['options'] );
749749
$size = sanitize_html_class( isset( $args['size'] ) ? $args['size'] : 'regular' );
750750
$class = sanitize_html_class( $args['field_class'] );
751-
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : __( 'Choose File' );
751+
$label = isset( $args['options']['button_label'] ) ? $args['options']['button_label'] : 'Choose File';
752752

753753
$html = sprintf(
754754
'<input type="text" class="%1$s" id="%2$s[%3$s]" name="%2$s[%3$s]" value="%4$s"/>',
File renamed without changes.
File renamed without changes.

includes/frontend/class-breadcrumbs.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,16 @@ private static function get_hierarchical_term_trail_array( \WP_Term $taxonomy, $
192192
$defaults = array(
193193
'separator' => '»',
194194
);
195-
$args = wp_parse_args( $args, $defaults );
196-
$trail = array();
195+
196+
$args = wp_parse_args( $args, $defaults );
197+
198+
$output = '<li class="wzkb_breadcrumb-item" data-separator="' . esc_attr( $args['separator'] ) . '" itemprop="itemListElement" itemscope itemtype="https://schema.org/ListItem">';
199+
$output .= '<a href="' . esc_url( get_term_link( $taxonomy ) ) . '" itemprop="item" title="' . esc_attr( $taxonomy->name ) . '">';
200+
$output .= '<span itemprop="name">' . esc_html( $taxonomy->name ) . '</span>';
201+
$output .= '</a>';
202+
$output .= '<meta itemprop="position" content="' . intval( $position ) . '" />';
203+
$output .= '</li>';
204+
197205
if ( ! empty( $taxonomy->parent ) ) {
198206
$trail = array_merge(
199207
self::get_hierarchical_term_trail_array(

includes/frontend/templates/archive-wz_knowledgebase.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535
// If no content, include the "No posts found" template.
3636
else :
37-
esc_html_e( 'No results found', 'wzkb' );
37+
esc_html_e( 'No results found', 'knowledgebase' );
3838

3939
endif;
4040
?>
@@ -50,5 +50,3 @@
5050

5151
<?php
5252
get_footer();
53-
54-

includes/functions.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ function wzkb_get_alert( $args = array(), $content = '' ) {
108108
$args = wp_parse_args( $args, $defaults );
109109
$args = Helpers::sanitize_args( $args );
110110

111-
$type = 'wzkb-alert-' . $args['type'];
111+
$type = 'wzkb-alert-' . sanitize_html_class( $args['type'] );
112112

113113
$class = implode( ' ', explode( ',', $args['class'] ) );
114114
$class = $type . ' ' . $class;
@@ -166,6 +166,7 @@ function wzkb_get_the_post_thumbnail( $args = array() ) {
166166

167167
// Parse incomming $args into an array and merge it with $defaults.
168168
$args = wp_parse_args( $args, $defaults );
169+
$args = Helpers::sanitize_args( $args );
169170

170171
return Media_Handler::get_the_post_thumbnail( $args );
171172
}
@@ -185,6 +186,7 @@ function wzkb_related_articles( $args = array() ) {
185186
);
186187

187188
$args = wp_parse_args( $args, $defaults );
189+
$args = Helpers::sanitize_args( $args );
188190

189191
$related = Related::get_related_articles( $args );
190192

includes/options-api.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ function wz_tag_search() {
147147

148148
$s = isset( $_REQUEST['q'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['q'] ) ) : ''; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
149149

150-
$comma = _x( ',', 'tag delimiter' );
150+
$comma = _x( ',', 'tag delimiter', 'knowledgebase' );
151151
if ( ',' !== $comma ) {
152152
$s = str_replace( $comma, ',', $s );
153153
}

includes/util/class-helpers.php

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,26 @@ public static function get_credit_link() {
4848
/**
4949
* Sanitize args.
5050
*
51-
* @since 3.0.0
51+
* @since 2.3.1
5252
*
5353
* @param array $args Array of arguments.
5454
* @return array Sanitized array of arguments.
5555
*/
5656
public static function sanitize_args( $args ): array {
5757
foreach ( $args as $key => $value ) {
5858
if ( is_string( $value ) ) {
59-
$args[ $key ] = wp_kses_post( $value );
59+
switch ( $key ) {
60+
case 'class':
61+
case 'className':
62+
case 'extra_class':
63+
$classes = explode( ' ', $value );
64+
$sanitized_classes = array_map( 'sanitize_html_class', $classes );
65+
$args[ $key ] = implode( ' ', $sanitized_classes );
66+
break;
67+
default:
68+
$args[ $key ] = wp_kses_post( $value );
69+
break;
70+
}
6071
}
6172
}
6273
return $args;

0 commit comments

Comments
 (0)