mirror of
https://github.com/smarty-php/smarty.git
synced 2025-08-04 18:34:27 +02:00
removed tabs
This commit is contained in:
@@ -12,7 +12,7 @@
|
|||||||
* Type: modifier<br>
|
* Type: modifier<br>
|
||||||
* Name: truncate<br>
|
* Name: truncate<br>
|
||||||
* Purpose: Truncate a string to a certain length if necessary,
|
* Purpose: Truncate a string to a certain length if necessary,
|
||||||
* optionally splitting in the middle of a word, and
|
* optionally splitting in the middle of a word, and
|
||||||
* appending the $etc string.
|
* appending the $etc string.
|
||||||
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
|
* @link http://smarty.php.net/manual/en/language.modifier.truncate.php
|
||||||
* truncate (Smarty online manual)
|
* truncate (Smarty online manual)
|
||||||
@@ -29,9 +29,9 @@ function smarty_modifier_truncate($string, $length = 80, $etc = '...',
|
|||||||
return '';
|
return '';
|
||||||
|
|
||||||
if (strlen($string) > $length) {
|
if (strlen($string) > $length) {
|
||||||
$length -= strlen($etc);
|
$length -= strlen($etc);
|
||||||
if (!$break_words)
|
if (!$break_words)
|
||||||
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
|
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length+1));
|
||||||
|
|
||||||
return substr($string, 0, $length).$etc;
|
return substr($string, 0, $length).$etc;
|
||||||
} else
|
} else
|
||||||
|
Reference in New Issue
Block a user