функция
since 1.0.0
wp_kses_split()
Проверено на WordPress 6.9, обновлено Источник: WordPress Developer Resources.
Сигнатура
wp_kses_split( string $content, array[]|string $allowed_html, string[] $allowed_protocols ): string
Описание
Также сопоставляет одиночные символы >.
Оригинал (английский)
It also matches stray > characters.
Параметры
$content
string
обязательный
Содержимое для фильтрации.
$allowed_html
array[]|string
обязательный
Массив допустимых HTML-элементов и атрибутов либо имя контекста, например 'post'. Список допустимых имён контекстов см. в wp_kses_allowed_html().
$allowed_protocols
string[]
обязательный
Массив разрешённых URL-протоколов.
Возвращаемое значение
string
Исходный код
wp-includes/kses.php:1192
function wp_kses_split( $content, $allowed_html, $allowed_protocols ) {
global $pass_allowed_html, $pass_allowed_protocols;
$pass_allowed_html = $allowed_html;
$pass_allowed_protocols = $allowed_protocols;
$token_pattern = <<<REGEX
~
( # Detect comments of various flavors before attempting to find tags.
(<!--.*?(-->|)) # - Normative HTML comments.
|
</[^a-zA-Z][^>]*> # - Closing tags with invalid tag names.
|
<![^>]*> # - Invalid markup declaration nodes. Not all invalid nodes
# are matched so as to avoid breaking legacy behaviors.
)
|
(<[^>]*(>|)|>) # Tag-like spans of text.
~x
REGEX;
return preg_replace_callback( $token_pattern, '_wp_kses_split_callback', $content );
}
История изменений
| Версия | Описание |
|---|---|
| 6.6.0 | Recognize additional forms of invalid HTML which convert into comments. |
| 1.0.0 | Introduced. |

