I'm not sure if patches to non-core plugins should be posted here, or in their respective bug-trackers? The attached patch modifies blogarchive and tag URLs so that clean URLs are used when $conf['userewrite']=1. This relies on some extra .htaccess content: RewriteRule ^tag/(.*)$ doku.php?id=$1&do=showtag [QSA,L] RewriteRule ^archive/(.*)$ doku.php?id=archive&blogarchive=$1 [QSA,L] For tags, I modified tags/action.php to use $ID instead of relying on $_REQUEST['tag'], to reduce the number of parameters with duplicated data. Logically, $conf['userewrite'] seems the correct thing to key off, but I'm not sure if changing the behavior of existing plugins based off that existing setting is the right thing to do? Anyway, what do people think about the concept of this patch? I also included a quick fix to tag/helper.php so it doesn't cause an issue if tagRefine() is used on a non-existant tag, since it was in the same file, so was a little harder to separate out.
diff -urN dokuwiki-orig/lib/plugins/blog/syntax/autoarchive.php dokuwiki-plugin-clean-urls/lib/plugins/blog/syntax/autoarchive.php --- dokuwiki-orig/lib/plugins/blog/syntax/autoarchive.php 2009-09-12 05:54:32.000000000 -0600 +++ dokuwiki-plugin-clean-urls/lib/plugins/blog/syntax/autoarchive.php 2010-03-02 22:12:00.000000000 -0700 @@ -119,6 +119,7 @@ */ function _buildTimeChooser(&$R, &$entries, $now){ global $ID; + global $conf; // get the months where posts exist $months = array(); @@ -147,7 +148,9 @@ $R->listitem_open(2); $R->listcontent_open(); if("$y-$m" == $now) $R->doc .= '<span class="cur">'; - $R->doc .= '<a href="'.wl($ID,array('blogarchive'=>"$y-$m")).'" class="wikilink1" title="'.$this->_posts($cnt,$m,$y).'">'; + if ($conf['userewrite'] == 1) $url = wl($ID.":$y-$m"); + else $url = wl($ID,array('blogarchive'=>"$y-$m")); + $R->doc .= '<a href="'.$url.'" class="wikilink1" title="'.$this->_posts($cnt,$m,$y).'">'; $R->doc .= $this->getLang('month_'.$m); $R->doc .= '</a>'; if("$y-$m" == $now){ diff -urN dokuwiki-orig/lib/plugins/cloud/syntax.php dokuwiki-plugin-clean-urls/lib/plugins/cloud/syntax.php --- dokuwiki-orig/lib/plugins/cloud/syntax.php 2009-09-12 06:07:39.000000000 -0600 +++ dokuwiki-plugin-clean-urls/lib/plugins/cloud/syntax.php 2010-03-02 22:09:32.000000000 -0700 @@ -87,7 +87,8 @@ $name = p_get_first_heading($id, false); } } else { - $link = wl($id, array('do'=>'showtag', 'tag'=>noNS($id))); + if ($conf['userewrite'] == 1) $link = wl($id); + else $link = wl($id, array('do'=>'showtag', 'tag'=>noNS($id))); } $title = $id; $class .= ($exists ? '_tag1' : '_tag2'); diff -urN dokuwiki-orig/lib/plugins/tag/action.php dokuwiki-plugin-clean-urls/lib/plugins/tag/action.php --- dokuwiki-orig/lib/plugins/tag/action.php 2009-04-27 13:56:32.000000000 -0600 +++ dokuwiki-plugin-clean-urls/lib/plugins/tag/action.php 2010-03-02 22:14:30.000000000 -0700 @@ -78,6 +78,7 @@ } function _handle_tpl_act(&$event, $param) { + global $ID; global $lang; if($event->data != 'showtag') return; @@ -86,7 +87,7 @@ $tagns = $this->getConf('namespace'); $flags = explode(',', trim($this->getConf('pagelist_flags'))); - $tag = trim(str_replace($this->getConf('namespace').':', '', $_REQUEST['tag'])); + $tag = trim(str_replace($this->getConf('namespace').':', '', $ID)); $ns = trim($_REQUEST['ns']); if ($helper =& plugin_load('helper', 'tag')) $pages = $helper->getTopic($ns, '', $tag); diff -urN dokuwiki-orig/lib/plugins/tag/helper.php dokuwiki-plugin-clean-urls/lib/plugins/tag/helper.php --- dokuwiki-orig/lib/plugins/tag/helper.php 2009-05-11 07:45:14.000000000 -0600 +++ dokuwiki-plugin-clean-urls/lib/plugins/tag/helper.php 2010-03-02 22:13:50.000000000 -0700 @@ -134,7 +134,8 @@ } } else { $class = 'wikilink1'; - $url = wl($tag, array('do'=>'showtag', 'tag'=>$tag)); + if ($conf['userewrite'] == 1) $url = wl($tag); + else $url = wl($tag, array('do'=>'showtag', 'tag'=>$tag)); } $links[] = '<a href="'.$url.'" class="'.$class.'" title="'.hsc($tag). '" rel="tag">'.hsc($title).'</a>'; @@ -232,6 +233,7 @@ if (!(($tag{0} == '+') || ($tag{0} == '-'))) continue; $cleaned_tag = substr($tag, 1); $tagpages = $this->topic_idx[$cleaned_tag]; + if (!$tagpages) $tagpages = array(); $and = ($tag{0} == '+'); foreach ($pages as $key => $page) { $cond = in_array($page['id'], $tagpages);