summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjoe.lapp <joe.lapp@pobox.com>2005-09-15 03:29:47 +0200
committerjoe.lapp <joe.lapp@pobox.com>2005-09-15 03:29:47 +0200
commit4b5db43bf44da083be4a4729be07d770aca09ea3 (patch)
tree4983543df2efce3c99dd0f7a24eb7882d251c896
parent49b58ab1fcb55fbf32a2a9a2d29852bfd699fe9f (diff)
downloadrpg-4b5db43bf44da083be4a4729be07d770aca09ea3.tar.gz
rpg-4b5db43bf44da083be4a4729be07d770aca09ea3.tar.bz2
$conf['sepchar'] support
Allows user to select the word separation character in page names. darcs-hash:20050915012947-36b45-3d6b53cda05a7d7c2eb3497f4732f7492a63e9aa.gz
-rw-r--r--conf/dokuwiki.php2
-rw-r--r--inc/pageutils.php10
2 files changed, 10 insertions, 2 deletions
diff --git a/conf/dokuwiki.php b/conf/dokuwiki.php
index b7850d760..77b56fbc3 100644
--- a/conf/dokuwiki.php
+++ b/conf/dokuwiki.php
@@ -60,6 +60,8 @@ $conf['superuser'] = '!!not set!!'; //The admin can be user or @group
/* Advanced Options */
$conf['userewrite'] = 0; //this makes nice URLs: 0: off 1: .htaccess 2: internal
$conf['useslash'] = 0; //use slash instead of colon? only when rewrite is on
+$conf['sepchar'] = '_'; //word separator character in page names; may be a
+ // letter, a digit, '_', '-', or '.'.
$conf['canonical'] = 0; //Should all URLs use full canonical http://... style?
$conf['autoplural'] = 0; //try (non)plural form of nonexisting files?
$conf['usegzip'] = 1; //gzip old revisions?
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);