Automattic\WooCommerce\Internal\EmailEditor\WCTransactionalEmails

WCEmailTemplateChangeSummary::truncate_text │ private static │ WC 1.0

UTF-8-safe truncation to {@see self::COPY_TRUNCATE_CHARS}.

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

Хуков нет.

Возвращает

null. Ничего (null).

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

$result = WCEmailTemplateChangeSummary::truncate_text( $text ): string;
$text(строка) (обязательный)
Cleaned inner-text candidate.

Код WCEmailTemplateChangeSummary::truncate_text() WC 11.2.2

private static function truncate_text( string $text ): string {
	$limit = self::COPY_TRUNCATE_CHARS;
	if ( function_exists( 'mb_strlen' ) && function_exists( 'mb_substr' ) ) {
		if ( mb_strlen( $text ) <= $limit ) {
			return $text;
		}
		return rtrim( mb_substr( $text, 0, $limit ) ) . '…';
	}
	if ( strlen( $text ) <= $limit ) {
		return $text;
	}
	return rtrim( substr( $text, 0, $limit ) ) . '…';
}