aboutsummaryrefslogtreecommitdiff
path: root/library/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'library/functions.php')
-rw-r--r--library/functions.php15
1 files changed, 15 insertions, 0 deletions
diff --git a/library/functions.php b/library/functions.php
new file mode 100644
index 0000000..ee3a0d0
--- /dev/null
+++ b/library/functions.php
@@ -0,0 +1,15 @@
+<?php
+session_start();
+
+function truncate($text, $chars = 25) {
+ if (strlen($text) <= $chars) {
+ return $text;
+ }
+ $text = $text." ";
+ $text = substr($text,0,$chars);
+ $text = substr($text,0,strrpos($text,' '));
+ $text = $text."...";
+ return $text;
+}
+?>
+