diff options
author | Ben Coburn <btcoburn@silicodon.net> | 2006-04-05 04:56:21 +0200 |
---|---|---|
committer | Ben Coburn <btcoburn@silicodon.net> | 2006-04-05 04:56:21 +0200 |
commit | f5c2808ff13d9b9dce9a6e2f2ea3989ef686c15c (patch) | |
tree | 267ee76eed45da9b355ae424302446c0b16fcd4d /inc/common.php | |
parent | d519720692b97f1c1705a3cce804749068fea697 (diff) | |
download | rpg-f5c2808ff13d9b9dce9a6e2f2ea3989ef686c15c.tar.gz rpg-f5c2808ff13d9b9dce9a6e2f2ea3989ef686c15c.tar.bz2 |
rewrite export URLs
This patch rewrites export urls so that robots.txt can be used
to request that some (or all) export types are ignored by
robots when indexing the wiki.
For example:
User-agent: *
Disallow: _export/
or for example:
User-agent: *
Disallow: _export/raw/
Note: This rewriting is only done when $conf['userewrite'] is
set to '1' for using the rewrite rules from '.htaccess.dist'.
darcs-hash:20060405025621-05dcb-b1b5f48681f78d75d25b1e75fab79346fcc8b84e.gz
Diffstat (limited to 'inc/common.php')
-rw-r--r-- | inc/common.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/inc/common.php b/inc/common.php index 8af63002c..ca05bd3e7 100644 --- a/inc/common.php +++ b/inc/common.php @@ -315,6 +315,43 @@ function wl($id='',$more='',$abs=false,$sep='&'){ } /** + * This builds a link to an alternate page format + * + * Handles URL rewriting if enabled. Follows the style of wl(). + * + * @author Ben Coburn <btcoburn@silicodon.net> + */ +function exportlink($id='',$format='raw',$more='',$abs=false,$sep='&'){ + global $conf; + if(is_array($more)){ + $more = buildURLparams($more,$sep); + }else{ + $more = str_replace(',',$sep,$more); + } + + $format = rawurlencode($format); + $id = idfilter($id); + if($abs){ + $xlink = DOKU_URL; + }else{ + $xlink = DOKU_BASE; + } + + if($conf['userewrite'] == 2){ + $xlink .= DOKU_SCRIPT.'/'.$id.'?do=export_'.$format; + if($more) $xlink .= $sep.$more; + }elseif($conf['userewrite'] == 1){ + $xlink .= '_export/'.$format.'/'.$id; + if($more) $xlink .= '?'.$more; + }else{ + $xlink .= DOKU_SCRIPT.'?do=export_'.$format.$sep.'id='.$id; + if($more) $xlink .= $sep.$more; + } + + return $xlink; +} + +/** * Build a link to a media file * * Will return a link to the detail page if $direct is false |