aboutsummaryrefslogtreecommitdiff
path: root/functions.inc.php
diff options
context:
space:
mode:
authormensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-04-18 10:29:09 +0000
committermensonge <mensonge@b3834d28-1941-0410-a4f8-b48e95affb8f>2008-04-18 10:29:09 +0000
commit81478ceba0c1bbdaa43679b72ec6d4fd603f5d17 (patch)
tree70f2d5ca67d97301645f3981e135a0f3138a3223 /functions.inc.php
parent74fb49098eb52b8f42110713caa3892572305cf3 (diff)
downloadsemanticscuttle-81478ceba0c1bbdaa43679b72ec6d4fd603f5d17.tar.gz
semanticscuttle-81478ceba0c1bbdaa43679b72ec6d4fd603f5d17.tar.bz2
Interface design: shorten too long URLs in the displayed bookmarks
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@115 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'functions.inc.php')
-rw-r--r--functions.inc.php11
1 files changed, 11 insertions, 0 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.'));