diff options
author | zotlabs <mike@macgirvin.com> | 2017-03-21 20:11:48 -0700 |
---|---|---|
committer | Mario Vavti <mario@mariovavti.com> | 2017-03-29 14:09:19 +0200 |
commit | b03cd330e5fe4ede362d77aa2269a3d0dccde62d (patch) | |
tree | 680b2a383c81ed1ae090513a02b75e509d7580c1 /include/text.php | |
parent | 542fa4a08c3f58d60c729ee166a2c4dc92f7524e (diff) | |
download | volse-hubzilla-b03cd330e5fe4ede362d77aa2269a3d0dccde62d.tar.gz volse-hubzilla-b03cd330e5fe4ede362d77aa2269a3d0dccde62d.tar.bz2 volse-hubzilla-b03cd330e5fe4ede362d77aa2269a3d0dccde62d.zip |
begin the process of using the relevant attach directory/path for photo albums instead of an album basename which may not be unique. Created an 'ellipsify()' function to shorten long names and keep the beginning and end intact
Diffstat (limited to 'include/text.php')
-rw-r--r-- | include/text.php | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php index c02499625..0a2073272 100644 --- a/include/text.php +++ b/include/text.php @@ -3130,3 +3130,14 @@ function array_escape_tags(&$v,$k) { $v = escape_tags($v); } +function ellipsify($s,$maxlen) { + if($maxlen & 1) + $maxlen --; + if($maxlen < 4) + $maxlen = 4; + + if(mb_strlen($s) < $maxlen) + return $s; + + return mb_substr($s,0,$maxlen / 2) . '...' . mb_substr($s,mb_strlen($s) - ($maxlen / 2)); +}
\ No newline at end of file |