aboutsummaryrefslogtreecommitdiffstats
path: root/include/text.php
diff options
context:
space:
mode:
authorzotlabs <mike@macgirvin.com>2017-03-21 20:11:48 -0700
committerzotlabs <mike@macgirvin.com>2017-03-21 20:11:48 -0700
commitbedc39342514a37d311274210f30a4abd14284fa (patch)
tree09bdc14e4126ceff42ff2eb91638742cd482f4d1 /include/text.php
parentc1cc7bfc945e4da4150c9ed99dc11981767b4ccb (diff)
downloadvolse-hubzilla-bedc39342514a37d311274210f30a4abd14284fa.tar.gz
volse-hubzilla-bedc39342514a37d311274210f30a4abd14284fa.tar.bz2
volse-hubzilla-bedc39342514a37d311274210f30a4abd14284fa.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.php11
1 files changed, 11 insertions, 0 deletions
diff --git a/include/text.php b/include/text.php
index 500c87ad5..49b588f13 100644
--- a/include/text.php
+++ b/include/text.php
@@ -3113,3 +3113,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