| 1 |
<?php |
| 2 |
declare( strict_types=1 ); |
| 3 |
|
| 4 |
namespace GutSlider\Icons; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
/** |
| 11 |
* Defines allowed SVG tags for wp_kses sanitization. |
| 12 |
* |
| 13 |
* Provides the allowed tags and attributes configuration used when |
| 14 |
* rendering SVG icons through WordPress's wp_kses() function. |
| 15 |
* |
| 16 |
* @package GutSlider\Icons |
| 17 |
* @since 3.0.0 |
| 18 |
*/ |
| 19 |
final class AllowedSvg { |
| 20 |
|
| 21 |
/** |
| 22 |
* Get the allowed SVG tag configuration for wp_kses. |
| 23 |
* |
| 24 |
* @since 3.0.0 |
| 25 |
* |
| 26 |
* @return array<string, array<string, bool>> Allowed tags and their attributes. |
| 27 |
*/ |
| 28 |
public static function tags(): array { |
| 29 |
return array( |
| 30 |
'svg' => array( |
| 31 |
'class' => true, |
| 32 |
'aria-hidden' => true, |
| 33 |
'aria-labelledby' => true, |
| 34 |
'role' => true, |
| 35 |
'xmlns' => true, |
| 36 |
'width' => true, |
| 37 |
'height' => true, |
| 38 |
'viewbox' => true, |
| 39 |
'fill' => true, |
| 40 |
), |
| 41 |
'g' => array( 'fill' => true ), |
| 42 |
'title' => array( 'title' => true ), |
| 43 |
'path' => array( |
| 44 |
'd' => true, |
| 45 |
'fill' => true, |
| 46 |
'fill-rule' => true, |
| 47 |
), |
| 48 |
); |
| 49 |
} |
| 50 |
} |
| 51 |
|