From 4b5db43bf44da083be4a4729be07d770aca09ea3 Mon Sep 17 00:00:00 2001 From: "joe.lapp" Date: Thu, 15 Sep 2005 03:29:47 +0200 Subject: $conf['sepchar'] support Allows user to select the word separation character in page names. darcs-hash:20050915012947-36b45-3d6b53cda05a7d7c2eb3497f4732f7492a63e9aa.gz --- inc/pageutils.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'inc') diff --git a/inc/pageutils.php b/inc/pageutils.php index 20e0fbcb4..9b1d9621a 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -66,6 +66,12 @@ function getID($param='id'){ function cleanID($id){ global $conf; global $lang; + static $sepcharpat = null; + + $sepchar = $conf['sepchar']; + if($sepcharpat == null) // build string only once to save clock cycles + $sepcharpat = '#\\'.$sepchar.'+#'; + $id = trim($id); $id = utf8_strtolower($id); @@ -80,10 +86,10 @@ function cleanID($id){ if($conf['deaccent']) $id = utf8_deaccent($id,-1); //remove specials - $id = utf8_stripspecials($id,'_'); + $id = utf8_stripspecials($id,$sepchar); //clean up - $id = preg_replace('#_+#','_',$id); + $id = preg_replace($sepcharpat,$sepchar,$id); $id = preg_replace('#:+#',':',$id); $id = trim($id,':._-'); $id = preg_replace('#:[:\._\-]+#',':',$id); -- cgit v1.2.3