Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails
WCEmailTemplateSelectiveApplier::normalize_for_comparison
Whitespace-normalize block markup for semantic comparison. Trims and collapses runs of whitespace adjacent to tag boundaries — covers the leading/trailing newlines and the spaces inside <div> ##WOO_CONTENT## </div> that serialize_blocks() reproduce from a hand-authored PHP template.
Метод класса: WCEmailTemplateSelectiveApplier{}
Хуков нет.
Возвращает
null. Ничего (null).
Использование
$result = WCEmailTemplateSelectiveApplier::normalize_for_comparison( $content ): string;
- $content(строка) (обязательный)
- Block markup.
Код WCEmailTemplateSelectiveApplier::normalize_for_comparison() WCEmailTemplateSelectiveApplier::normalize for comparison WC 11.2.2
private static function normalize_for_comparison( string $content ): string {
$content = trim( $content );
$content = (string) preg_replace( '/>\s+/', '>', $content );
$content = (string) preg_replace( '/\s+</', '<', $content );
return $content;
}