Skip to content

Commit 8025146

Browse files
committed
Allowed HTML in Component class
1 parent 05ec26c commit 8025146

File tree

4 files changed

+30
-10
lines changed

4 files changed

+30
-10
lines changed

includes/MslsAdminIcon.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,15 +243,16 @@ public function get_icon(): string {
243243
$icon = sprintf(
244244
'<span class="language-badge %s">%s</span>',
245245
esc_attr( $this->language ),
246-
wp_kses( $text, Component::get_allowed_html() )
246+
$text
247247
);
248+
248249
break;
249250
default:
250251
$class = empty( $this->href ) ? 'dashicons-plus' : 'dashicons-edit';
251252
$icon = sprintf( '<span class="dashicons %s"></span>', esc_attr( $class ) );
252253
}
253254

254-
return $icon;
255+
return wp_kses( $icon, Component::get_allowed_html() );
255256
}
256257

257258
/**

includes/MslsCustomColumn.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,13 @@ public function td( $column_name, $item_id ): void {
9393
$icon->set_href( (int) $mydata->$language );
9494
}
9595

96-
printf(
97-
'<span class="msls-icon-wrapper %1$s">%2$s</span>',
98-
esc_attr( $this->options->get_icon_type() ),
99-
wp_kses( $icon->get_a(), Component::get_allowed_html() )
96+
echo wp_kses(
97+
sprintf(
98+
'<span class="msls-icon-wrapper %1$s">%2$s</span>',
99+
esc_attr( $this->options->get_icon_type() ),
100+
$icon->get_a()
101+
),
102+
Component::get_allowed_html()
100103
);
101104

102105
restore_current_blog();

includes/MslsPostTag.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
namespace lloc\Msls;
1010

11+
use lloc\Msls\Component\Component;
12+
1113
/**
1214
* Post Tag
1315
*
@@ -160,7 +162,12 @@ public function the_input( ?\WP_Term $tag, string $title_format, string $item_fo
160162

161163
$this->maybe_set_linked_term( $mydata );
162164

163-
printf( wp_kses_post( $title_format ), esc_html( $this->get_select_title() ), esc_attr( $type ) );
165+
$allowed_html = Component::get_allowed_html();
166+
167+
echo wp_kses(
168+
sprintf( $title_format, esc_html( $this->get_select_title() ), esc_attr( $type ) ),
169+
$allowed_html
170+
);
164171

165172
foreach ( $blogs as $blog ) {
166173
switch_to_blog( $blog->userblog_id );
@@ -179,7 +186,10 @@ public function the_input( ?\WP_Term $tag, string $title_format, string $item_fo
179186
}
180187
}
181188

182-
printf( wp_kses_post( $item_format ), esc_attr( $blog->userblog_id ), wp_kses_post( $icon ), esc_attr( $language ), esc_attr( $value ), esc_attr( $title ) );
189+
echo wp_kses(
190+
sprintf( $item_format, esc_attr( $blog->userblog_id ), $icon, esc_attr( $language ), esc_attr( $value ), esc_attr( $title ) ),
191+
$allowed_html
192+
);
183193

184194
restore_current_blog();
185195
}

includes/MslsPostTagClassic.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,10 @@ public function the_input( ?\WP_Term $tag, string $title_format, string $item_fo
7979

8080
$this->maybe_set_linked_term( $mydata );
8181

82-
printf( wp_kses( $title_format, Component::get_allowed_html() ), esc_html( $this->get_select_title() ) );
82+
echo wp_kses(
83+
sprintf( $title_format, esc_html( $this->get_select_title() ), esc_attr( $type ) ),
84+
Component::get_allowed_html()
85+
);
8386

8487
foreach ( $blogs as $blog ) {
8588
$this->print_option( $blog, $type, $mydata, $item_format );
@@ -128,7 +131,10 @@ public function print_option( MslsBlog $blog, string $type, MslsOptionsTax $myda
128131
}
129132
}
130133

131-
printf( wp_kses_post( $item_format ), esc_attr( $language ), wp_kses_post( $icon ), wp_kses_post( $options ) );
134+
echo wp_kses(
135+
sprintf( $item_format, esc_attr( $language ), $icon, $options ),
136+
Component::get_allowed_html()
137+
);
132138

133139
restore_current_blog();
134140
}

0 commit comments

Comments
 (0)