Skip to content

Commit 52c9d68

Browse files
committed
Escaping Echos
1 parent 3ee7d28 commit 52c9d68

File tree

2 files changed

+16
-4
lines changed

2 files changed

+16
-4
lines changed

tootpress_blog.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ function tootpress_paint_toot( $mastodon_id, $date, $content, $media )
3434
$toot_html.='<div class="tootpress-toot"/>';
3535

3636
// Toot Symbol
37-
$toot_html.='<img class="tootpress-toot-symbol" src="'.plugins_url().'/tootpress/tootpress_toot.png" alt="Toot Symbol" width="35" height="37"/>';
37+
$toot_html.='<img class="tootpress-toot-symbol" src="'.esc_url(plugins_url()).'/tootpress/tootpress_toot.png" alt="Toot Symbol" width="35" height="37"/>';
3838

3939
// Toot Date
4040
if(tootpress_is_language_german()) {
@@ -43,15 +43,15 @@ function tootpress_paint_toot( $mastodon_id, $date, $content, $media )
4343
$date=tootpress_convert_mysqldate_to_international_format($date);
4444
}
4545

46-
$toot_html.='<div class="toot-date"><p>'.$date.'</p></div>';
46+
$toot_html.='<div class="toot-date"><p>'.esc_html($date).'</p></div>';
4747

4848
// Toot Content
4949
$content=tootpress_remove_target_blank($content);
50-
$toot_html.='<div class="toot-content">'.$content.'</div>';
50+
$toot_html.='<div class="toot-content">'.wp_kses($content, tootpress_escaping_allowed_html() ).'</div>';
5151

5252
// Toot Image
5353
if($media){
54-
$toot_html.=tootpress_paint_image($mastodon_id);
54+
$toot_html.=wp_kses(tootpress_paint_image($mastodon_id), tootpress_escaping_allowed_html() );
5555
}
5656

5757
// Toot End

tootpress_plugin.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,11 +74,23 @@ function tootpress_flag( $classes ) {
7474
function tootpress_escaping_allowed_html() {
7575
return array(
7676
'p' => array(),
77+
'div' => array(
78+
'class' => array(),
79+
),
80+
'img' => array(
81+
'src' => array(),
82+
'alt' => array(),
83+
),
7784
'br' => array(),
7885
'strong' => array(),
7986
'span' => array(
8087
'class' => array(),
8188
),
89+
'a' => array(
90+
'class' => array(),
91+
'href' => array(),
92+
'rel' => array(),
93+
),
8294
);
8395
}
8496

0 commit comments

Comments
 (0)