Automattic\WooCommerce\EmailEditor\Engine\Renderer

Html2Text::render_text │ private static │ WC 1.0

Replace any special characters with simple text versions

This prevents output issues:

  • Convert non-breaking spaces to regular spaces; and
  • Convert zero-width non-joiners to '' (nothing).

This is to match our goal of rendering documents as they would be rendered by a browser.

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

Хуков нет.

Возвращает

string. The processed text.

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

$result = Html2Text::render_text( $text ): string;
$text(строка) (обязательный)
The text to process.

Код Html2Text::render_text() WC 11.2.2

private static function render_text( string $text ): string {
	$text = str_replace( self::nbsp_codes(), ' ', $text );
	$text = str_replace( self::zwnj_codes(), '', $text );
	return $text;
}