Yoast\WP\SEO\Helpers\Schema

HTML_Helper::sanitize()publicYoast 1.0

Sanitizes a HTML string by stripping all tags except headings, breaks, lists, links, paragraphs and formatting.

Метод класса: HTML_Helper{}

Хуков нет.

Возвращает

Строку. The sanitized HTML.

Использование

$HTML_Helper = new HTML_Helper();
$HTML_Helper->sanitize( $html );
$html(строка) (обязательный)
The original HTML.

Код HTML_Helper::sanitize() Yoast 22.4

public function sanitize( $html ) {
	if ( ! $this->is_non_empty_string_or_stringable( $html ) ) {
		if ( \is_int( $html ) || \is_float( $html ) ) {
			return (string) $html;
		}

		return '';
	}

	return \strip_tags( $html, '<h1><h2><h3><h4><h5><h6><br><ol><ul><li><a><p><b><strong><i><em>' );
}