diff options
Diffstat (limited to 'inc/pageutils.php')
-rw-r--r-- | inc/pageutils.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/inc/pageutils.php b/inc/pageutils.php index 31b5f9ff9..c355d4894 100644 --- a/inc/pageutils.php +++ b/inc/pageutils.php @@ -347,27 +347,29 @@ function mediaFN($id, $rev=''){ if(empty($rev)){ $fn = $conf['mediadir'].'/'.utf8_encodeFN($id); }else{ - $ext = mimetype($id); - $name = substr($id,0, -1*strlen($ext[0])-1); + $ext = mimetype($id); + $name = substr($id,0, -1*strlen($ext[0])-1); $fn = $conf['mediaolddir'].'/'.utf8_encodeFN($name .'.'.( (int) $rev ).'.'.$ext[0]); } return $fn; } /** - * Returns the full filepath to a localized textfile if local + * Returns the full filepath to a localized file if local * version isn't found the english one is returned * + * @param string $id The id of the local file + * @param string $ext The file extension (usually txt) * @author Andreas Gohr <andi@splitbrain.org> */ -function localeFN($id){ +function localeFN($id,$ext='txt'){ global $conf; - $file = DOKU_CONF.'/lang/'.$conf['lang'].'/'.$id.'.txt'; + $file = DOKU_CONF.'/lang/'.$conf['lang'].'/'.$id.'.'.$ext; if(!@file_exists($file)){ - $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.txt'; + $file = DOKU_INC.'inc/lang/'.$conf['lang'].'/'.$id.'.'.$ext; if(!@file_exists($file)){ //fall back to english - $file = DOKU_INC.'inc/lang/en/'.$id.'.txt'; + $file = DOKU_INC.'inc/lang/en/'.$id.'.'.$ext; } } return $file; |