add php-doc for ellipsis
This commit is contained in:
parent
28671d92c0
commit
0ce5e9257e
|
@ -713,7 +713,13 @@ class OC_Helper {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Shortens str to maxlen by replacing characters in the middle with '...', eg.
|
||||||
|
* ellipsis('a very long string with lots of useless info to make a better example', 14) becomes 'a very ...example'
|
||||||
|
* @param string $str the string
|
||||||
|
* @param string $maxlen the maximum length of the result
|
||||||
|
* @return string with at most maxlen characters
|
||||||
|
*/
|
||||||
public static function ellipsis($str, $maxlen) {
|
public static function ellipsis($str, $maxlen) {
|
||||||
if (strlen($str) > $maxlen) {
|
if (strlen($str) > $maxlen) {
|
||||||
$characters = floor($maxlen / 2);
|
$characters = floor($maxlen / 2);
|
||||||
|
|
Loading…
Reference in New Issue