| @@ -1,18 +1,55 @@ | ||
| 1 | -<figure class="mgl-item"<?php echo esc_attr( $attributes ) ?>> | |
| 1 | +<figure class="mgl-item"<?php echo wp_kses_post( $attributes ) ?>> | |
| 2 | 2 | <div class="mgl-icon"> |
| 3 | 3 | <div class="mgl-img-container"> |
| 4 | 4 | <?php if ( !$isPreview && $linkUrl ): ?> |
| 5 | 5 | <a href="<?php echo esc_url( $linkUrl ) ?>"> |
| 6 | - <?php echo wp_kses_post( $imgSrc ) ?> | |
| 6 | + <?= | |
| 7 | + wp_kses( $imgSrc, [ | |
| 8 | + 'img' => [ | |
| 9 | + 'src' => true, | |
| 10 | + 'srcset' => true, | |
| 11 | + 'loading' => true, | |
| 12 | + 'sizes' => true, | |
| 13 | + 'class' => true, | |
| 14 | + 'id' => true, | |
| 15 | + 'width' => true, | |
| 16 | + 'height' => true, | |
| 17 | + 'alt' => true, | |
| 18 | + 'align' => true, | |
| 19 | + ] | |
| 20 | + ] | |
| 21 | + ); | |
| 22 | + ?> | |
| 7 | 23 | </a> |
| 8 | 24 | <?php else: ?> |
| 9 | - <?php echo wp_kses_post( $imgSrc ) ?> | |
| 25 | + <?= | |
| 26 | + wp_kses( $imgSrc, [ | |
| 27 | + 'img' => [ | |
| 28 | + 'src' => true, | |
| 29 | + 'srcset' => true, | |
| 30 | + 'loading' => true, | |
| 31 | + 'sizes' => true, | |
| 32 | + 'class' => true, | |
| 33 | + 'id' => true, | |
| 34 | + 'width' => true, | |
| 35 | + 'height' => true, | |
| 36 | + 'alt' => true, | |
| 37 | + 'align' => true, | |
| 38 | + ] | |
| 39 | + ] | |
| 40 | + ); | |
| 41 | + ?> | |
| 10 | 42 | <?php endif; ?> |
| 11 | 43 | </div> |
| 12 | 44 | </div> |
| 13 | - <?php if ( $caption ): ?> | |
| 45 | + <?php if ( !empty( $caption ) ): ?> | |
| 14 | 46 | <figcaption class="mgl-caption"> |
| 15 | - <p><?php echo wp_kses_post( $caption ) ?></p> | |
| 47 | + <p><?php echo wp_kses($caption, [ | |
| 48 | + 'strong' => [], // Bold | |
| 49 | + 'b' => [], // Bold alternative | |
| 50 | + 'em' => [], // Italic | |
| 51 | + 'i' => [] // Italic alternative | |
| 52 | + ]) ?></p> | |
| 16 | 53 | </figcaption> |
| 17 | 54 | <?php endif; ?> |
| 18 | 55 | </figure> |