Automattic\WooCommerce\Vendor\Pelago\Emogrifier\HtmlProcessor

AbstractHtmlProcessor::ensurePhpUnrecognizedSelfClosingTagsAreXmlprivateWC 1.0

Makes sure that any self-closing tags not recognized as such by PHP's DOMDocument implementation have a self-closing slash.

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

Хуков нет.

Возвращает

string. HTML with problematic tags converted.

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

// private - только в коде основоного (родительского) класса
$result = $this->ensurePhpUnrecognizedSelfClosingTagsAreXml( $html ): string;
$html(строка) (обязательный)
.

Код AbstractHtmlProcessor::ensurePhpUnrecognizedSelfClosingTagsAreXml() WC 11.1.1

private function ensurePhpUnrecognizedSelfClosingTagsAreXml(string $html): string
{
    return (new Preg())->replace(
        '%<' . self::PHP_UNRECOGNIZED_VOID_TAGNAME_MATCHER . '\\b[^>]*+(?<!/)(?=>)%',
        '$0/',
        $html
    );
}