Source for file truncate.php
Documentation is available at truncate.php
* Truncates a string at the given length
* * value : text to truncate
* * length : the maximum length for the string
* * etc : the characters that are added to show that the string was cut off
* * break : if true, the string will be cut off at the exact length, instead of cutting at the nearest space
* * middle : if true, the string will contain the beginning and the end, and the extra characters will be removed from the middle
* This software is provided 'as-is', without any express or implied warranty.
* In no event will the authors be held liable for any damages arising from the use of this software.
* @author Jordi Boggiano <j.boggiano@seld.be>
* @copyright Copyright (c) 2008, Jordi Boggiano
* @license http://dwoo.org/LICENSE Modified BSD License
function Dwoo_Plugin_truncate(Dwoo $dwoo, $value, $length=
80, $etc=
'...', $break=
false, $middle=
false)
$value = (string)
$value;
if (strlen($value) <
$length) {
if ($break ===
false &&
$middle ===
false) {
return substr($value, 0, $length) .
$etc;
Documentation generated on Sun, 07 Feb 2010 17:54:00 +0000 by phpDocumentor 1.4.0