diff --git a/inc/render/class-leaflet-map-block.php b/inc/render/class-leaflet-map-block.php index 7369fe9db..154e53262 100644 --- a/inc/render/class-leaflet-map-block.php +++ b/inc/render/class-leaflet-map-block.php @@ -33,7 +33,7 @@ public function render( $attributes ) { } // Set the ID and the class name. - $id = isset( $attributes['id'] ) ? $attributes['id'] : 'wp-block-themeisle-blocks-map-' . wp_rand( 10, 100 ); + $id = isset( $attributes['id'] ) ? esc_attr( $attributes['id'] ) : 'wp-block-themeisle-blocks-map-' . wp_rand( 10, 100 ); $class = ''; $style = ''; @@ -58,7 +58,7 @@ public function render( $attributes ) { $output .= '' . "\n"; diff --git a/inc/render/class-masonry-variant.php b/inc/render/class-masonry-variant.php index 97e1d8f63..51f68d1a3 100644 --- a/inc/render/class-masonry-variant.php +++ b/inc/render/class-masonry-variant.php @@ -60,7 +60,7 @@ public function render_blocks( $block_content, $block ) { wp_script_add_data( 'otter-masonry', 'defer', true ); - $margin = isset( $block['attrs']['margin'] ) ? $block['attrs']['margin'] : 10; + $margin = isset( $block['attrs']['margin'] ) ? esc_attr( $block['attrs']['margin'] ) : 10; $style = ''; diff --git a/inc/render/class-posts-grid-block.php b/inc/render/class-posts-grid-block.php index d519ccaf9..1a525f53f 100644 --- a/inc/render/class-posts-grid-block.php +++ b/inc/render/class-posts-grid-block.php @@ -119,7 +119,7 @@ function ( $x ) use ( $sticky_posts_id ) { $wrapper_attributes, isset( $attributes['id'] ) ? $attributes['id'] : '', isset( $attributes['enableFeaturedPost'] ) && $attributes['enableFeaturedPost'] && isset( $recent_posts[0] ) ? $this->render_featured_post( $recent_posts[0], $attributes ) : '', - trim( $class ), + esc_attr( trim( $class ) ), $list_items_markup, $has_pagination ? $this->render_pagination( $page_number, $total_posts ) : '' ); diff --git a/inc/render/class-review-block.php b/inc/render/class-review-block.php index f682983e7..12663936e 100644 --- a/inc/render/class-review-block.php +++ b/inc/render/class-review-block.php @@ -39,7 +39,7 @@ function() use ( $attributes, $post_id ) { ); } - $id = isset( $attributes['id'] ) ? $attributes['id'] : 'wp-block-themeisle-blocks-review-' . wp_rand( 10, 100 ); + $id = isset( $attributes['id'] ) ? esc_attr( $attributes['id'] ) : 'wp-block-themeisle-blocks-review-' . wp_rand( 10, 100 ); $class = ''; $details_class = ( isset( $attributes['image'] ) && isset( $attributes['description'] ) && ! empty( $attributes['description'] ) ) ? '' : 'is-single '; $scale = get_option( 'themeisle_blocks_settings_review_scale', false ) ? 2 : 1; @@ -70,11 +70,11 @@ function() use ( $attributes, $post_id ) { $is_one_colum_layout = strpos( $wrapper_attributes, 'is-style-single-column' ) !== false; $is_inline_features = strpos( $wrapper_attributes, 'is-style-inline-features' ) !== false; - $main_heading = isset( $attributes['mainHeading'] ) ? $attributes['mainHeading'] : 'h2'; - $sub_heading = isset( $attributes['subHeading'] ) ? $attributes['subHeading'] : 'h3'; + $main_heading = isset( $attributes['mainHeading'] ) ? esc_attr( $attributes['mainHeading'] ) : 'h2'; + $sub_heading = isset( $attributes['subHeading'] ) ? esc_attr( $attributes['subHeading'] ) : 'h3'; $html = '
' . $attributes['description'] . '
'; + $html .= '' . esc_html( $attributes['description'] ) . '
'; } $html .= '