Skip to content

Commit c43ab7a

Browse files
committed
Updates with code review changes
1 parent 27c8b4e commit c43ab7a

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

include/lcp-catlist.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,8 @@ public function get_posts_terms($single, $tax) {
344344
private function get_pt_params($tax) {
345345
$taxonomies = ['cat' => 'category', 'tag' => 'post_tag'];
346346
$slug = array_key_exists($tax, $taxonomies) ? $taxonomies[$tax] : '';
347-
if ($this->params["posts_{$tax}s_inner"] == 'script' ) {
347+
if ( !empty( $this->params["posts_{$tax}s_inner"] ) &&
348+
strtolower( tag_escape( $this->params["posts_{$tax}s_inner"] ) ) == 'script' ) {
348349
$this->params["posts_{$tax}s_inner"] = null;
349350
}
350351
$this->params["posts_{$tax}s_inner"] = sanitize_text_field($this->params["posts_{$tax}s_inner"]);

include/lcp-thumbnail.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function get_thumbnail($single, $thumbnail, $thumbnail_size, $force_thumb
5858

5959
$lcp_thumbnail .= '<img src="' . esc_url($imgMatches[1]) . '" ';
6060
if ( $lcp_thumb_class != null ) { // thumbnail class passed as parameter to shortcode
61-
$lcp_thumbnail .= 'class="' . esc_html($lcp_thumb_class) . '" ';
61+
$lcp_thumbnail .= 'class="' . LcpUtils::sanitize_html_classes($lcp_thumb_class) . '" ';
6262
}
6363
else { // Otherwise, use this class name
6464
$lcp_thumbnail .= 'class="lcp_thumbnail" ';
@@ -74,7 +74,7 @@ public function get_thumbnail($single, $thumbnail, $thumbnail_size, $force_thumb
7474

7575
private function check_youtube_thumbnail($single, $lcp_thumb_class){
7676
$content = $single->content;
77-
77+
7878
# youtube.com/watch?v=id
7979
$yt_pattern = '/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/)([a-zA-Z0-9\-\_]{11})([^<\s]*)/';
8080
# youtube.com/v[id]
@@ -96,7 +96,7 @@ private function check_youtube_thumbnail($single, $lcp_thumb_class){
9696
$lcp_ytimage = '<img src="' . $imageurl . '" alt="' . $single->post_title . '" />';
9797

9898
if ($lcp_thumb_class != null){
99-
$thmbn_class = ' class="' . esc_html($lcp_thumb_class) . '" />';
99+
$thmbn_class = ' class="' . LcpUtils::sanitize_html_classes($lcp_thumb_class) . '" />';
100100
$lcp_ytimage = preg_replace("/\>/", $thmbn_class, $lcp_ytimage);
101101
}
102102
return '<a href="' . get_permalink($single->ID).'">' . $lcp_ytimage . '</a>';

0 commit comments

Comments
 (0)