aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 16:26:50 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-06-27 16:26:50 +0000
commit078906f1d511eebf070307a5222cce004bcb4037 (patch)
tree13c20009683f9fea78b8e0bfdcf1b70412edb71d /engine/lib
parent76a925cfa0915e3d515886f97c4fbb03c03bc0ca (diff)
downloadelgg-078906f1d511eebf070307a5222cce004bcb4037.tar.gz
elgg-078906f1d511eebf070307a5222cce004bcb4037.tar.bz2
Introducing friendly_title
git-svn-id: https://code.elgg.org/elgg/trunk@1192 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/elgglib.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/engine/lib/elgglib.php b/engine/lib/elgglib.php
index 74fec6712..7b05ca9f6 100644
--- a/engine/lib/elgglib.php
+++ b/engine/lib/elgglib.php
@@ -648,7 +648,19 @@
}
-
+ /**
+ * When given a title, returns a version suitable for inclusion in a URL
+ *
+ * @param string $title The title
+ * @return string The optimised title
+ */
+ function friendly_title($title) {
+ $title = trim($title);
+ $title = strtolower($title);
+ $title = preg_replace("/[^\w ]/","",$title);
+ $title = str_replace(" ","-",$title);
+ return $title;
+ }
/**
* Library loading and handling