WP_Icons_Registry::sanitize_icon_content
Sanitizes the icon SVG content.
Logic borrowed from twentytwenty.
Метод класса: WP_Icons_Registry{}
Хуков нет.
Возвращает
string. The sanitized icon SVG content.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->sanitize_icon_content( $icon_content );
- $icon_content(строка) (обязательный)
- The icon SVG content to sanitize.
Заметки
| Смотрите: twentytwenty_get_theme_svg |
Список изменений
| С версии 7.0.0 | Введена. |
Код WP_Icons_Registry::sanitize_icon_content() WP Icons Registry::sanitize icon content WP 7.1.2
protected function sanitize_icon_content( $icon_content ) {
$allowed_tags = array(
'svg' => array(
'class' => true,
'xmlns' => true,
'width' => true,
'height' => true,
'viewbox' => true,
'aria-hidden' => true,
'role' => true,
'focusable' => true,
),
'path' => array(
'fill' => true,
'fill-rule' => true,
'd' => true,
'transform' => true,
),
'polygon' => array(
'fill' => true,
'fill-rule' => true,
'points' => true,
'transform' => true,
'focusable' => true,
),
);
return wp_kses( $icon_content, $allowed_tags );
}