From 773cdf1bd0abf63a95053b8595f686a58a141167 Mon Sep 17 00:00:00 2001 From: Alex Pott <alex.a.pott@googlemail.com> Date: Mon, 3 Nov 2014 17:43:01 +0000 Subject: [PATCH] Issue #2361747 by rpayanm: Remove truncate_utf8. --- core/includes/unicode.inc | 41 --------------------------------------- 1 file changed, 41 deletions(-) diff --git a/core/includes/unicode.inc b/core/includes/unicode.inc index c9e7246f1596..fc79daf7498d 100644 --- a/core/includes/unicode.inc +++ b/core/includes/unicode.inc @@ -153,47 +153,6 @@ function drupal_truncate_bytes($string, $len) { return Unicode::truncateBytes($string, $len); } -/** - * Truncates a UTF-8-encoded string safely to a number of characters. - * - * @param $string - * The string to truncate. - * @param $max_length - * An upper limit on the returned string length, including trailing ellipsis - * if $add_ellipsis is TRUE. - * @param $wordsafe - * If TRUE, attempt to truncate on a word boundary. Word boundaries are - * spaces, punctuation, and Unicode characters used as word boundaries in - * non-Latin languages; see Unicode::PREG_CLASS_WORD_BOUNDARY for more - * information. If a word boundary cannot be found that would make the length - * of the returned string fall within length guidelines (see parameters - * $max_length and $min_wordsafe_length), word boundaries are ignored. - * @param $add_ellipsis - * If TRUE, add t('...') to the end of the truncated string (defaults to - * FALSE). The string length will still fall within $max_length. - * @param $min_wordsafe_length - * If $wordsafe is TRUE, the minimum acceptable length for truncation (before - * adding an ellipsis, if $add_ellipsis is TRUE). Has no effect if $wordsafe - * is FALSE. This can be used to prevent having a very short resulting string - * that will not be understandable. For instance, if you are truncating the - * string "See myverylongurlexample.com for more information" to a word-safe - * return length of 20, the only available word boundary within 20 characters - * is after the word "See", which wouldn't leave a very informative string. If - * you had set $min_wordsafe_length to 10, though, the function would realise - * that "See" alone is too short, and would then just truncate ignoring word - * boundaries, giving you "See myverylongurl..." (assuming you had set - * $add_ellipses to TRUE). - * - * @return string - * The truncated string. - * - * @deprecated in Drupal 8.x-dev, will be removed before Drupal 8.0.0. - * Use \Drupal\Component\Utility\Unicode::truncate(). - */ -function truncate_utf8($string, $max_length, $wordsafe = FALSE, $add_ellipsis = FALSE, $min_wordsafe_length = 1) { - return Unicode::truncate($string, $max_length, $wordsafe, $add_ellipsis, $min_wordsafe_length); -} - /** * Encodes MIME/HTTP header values that contain incorrectly encoded characters. * -- GitLab