Skip to content

Commit e21ba1d

Browse files
committed
Better Escaping
1 parent fbd00ea commit e21ba1d

File tree

2 files changed

+7
-9
lines changed

2 files changed

+7
-9
lines changed

tootpress_blog.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ function tootpress_paint_toot( $mastodon_id, $date, $content, $media , $instance
4444

4545
// Toot Content
4646
$content=tootpress_remove_target_blank($content);
47-
$content=wp_kses($content, tootpress_escaping_allowed_html() );
48-
$content=tootpress_toot_content_filter_apply($content);
49-
$toot_html.='<div class="toot-content">'.$content.'</div>';
47+
$content=tootpress_toot_content_filter_apply($content);
48+
$toot_html.='<div class="toot-content">'.wp_kses_post($content).'</div>';
5049

5150
// Toot Image
5251
if($media){
53-
$toot_html.=wp_kses(tootpress_paint_image($mastodon_id), tootpress_escaping_allowed_html() );
52+
$toot_html.=tootpress_paint_image($mastodon_id);
5453
}
5554

5655
// Toot End
@@ -87,15 +86,15 @@ function tootpress_paint_image($tootid){
8786
if($amount_of_images>1) {
8887
// Galleries
8988
$image_html.='toot-image-gallery ';
90-
$image_html.='toot-image-gallery-'.$amount_of_images.' ';
91-
$image_html.='toot-image-'.($i+1);
89+
$image_html.='toot-image-gallery-'.(int) $amount_of_images.' ';
90+
$image_html.='toot-image-'.(int) ($i+1);
9291
} else {
9392
// Single Images
9493
$image_html.='toot-image-single ';
9594
}
9695

9796
$image_html.='">';
98-
$image_html.=tootpress_create_image_tag($toot_image[$i]['attachment_file'],$toot_image[$i]['attachment_description'],$amount_of_images,($i+1));
97+
$image_html.=tootpress_paint_image_tag($toot_image[$i]['attachment_file'],$toot_image[$i]['attachment_description'],$amount_of_images,($i+1));
9998
$image_html.='</div>';
10099

101100
}
@@ -115,7 +114,7 @@ function tootpress_paint_image($tootid){
115114
* @return string Image Tag
116115
*/
117116

118-
function tootpress_create_image_tag($filename, $description, $amount_of_images, $image_number) {
117+
function tootpress_paint_image_tag($filename, $description, $amount_of_images, $image_number) {
119118

120119
$image_tag='<img ';
121120
$image_tag.='src="';

tootpress_plugin.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,6 @@ function tootpress_escaping_allowed_html() {
8787
'img' => array(
8888
'src' => array(),
8989
'alt' => array(),
90-
'class' => array(),
9190
),
9291
'br' => array(),
9392
'strong' => array(),

0 commit comments

Comments
 (0)