aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--functions.inc.php11
-rw-r--r--templates/bookmarks.tpl.php2
2 files changed, 12 insertions, 1 deletions
diff --git a/functions.inc.php b/functions.inc.php
index 63b789a..35f0fed 100644
--- a/functions.inc.php
+++ b/functions.inc.php
@@ -92,6 +92,17 @@ function createURL($page = '', $ending = '') {
return $root . $page .'/'. $ending;
}
+/* Shorten a string like a URL for example by cutting the middle of it */
+function shortenString($string, $maxSize=75) {
+ $output = '';
+ if(strlen($string) > $maxSize) {
+ $output = substr($string, 0, $maxSize/2).'...'.substr($string, -$maxSize/2);
+ } else {
+ $output = $string;
+ }
+ return $output;
+}
+
function message_die($msg_code, $msg_text = '', $msg_title = '', $err_line = '', $err_file = '', $sql = '', $db = NULL) {
if(defined('HAS_DIED'))
die(T_('message_die() was called multiple times.'));
diff --git a/templates/bookmarks.tpl.php b/templates/bookmarks.tpl.php
index 556d92e..cc4743c 100644
--- a/templates/bookmarks.tpl.php
+++ b/templates/bookmarks.tpl.php
@@ -171,7 +171,7 @@ window.onload = playerLoad;
}
echo '<div class="description">'. filter($row['bDescription']) ."</div>\n";
if(!isset($hash)) {
- echo '<div class="address">'.$address.'</div>';
+ echo '<div class="address">'.shortenString($address).'</div>';
}
echo '<div class="meta">'. date($GLOBALS['shortdate'], strtotime($row['bDatetime'])) . $cats . $copy . $edit ."</div>\n";