diff --git a/inc/common.php b/inc/common.php index b624c334cefbf39e926685c9490750d8d15b4f89..1d8061ab04e47209494912ca2b59b38a09cf849b 100644 --- a/inc/common.php +++ b/inc/common.php @@ -789,8 +789,8 @@ function formText($text){ * * @author Andreas Gohr <andi@splitbrain.org> */ -function rawLocale($id){ - return io_readFile(localeFN($id)); +function rawLocale($id,$ext='txt'){ + return io_readFile(localeFN($id,$ext)); } /** diff --git a/inc/pageutils.php b/inc/pageutils.php index 31b5f9ff94ac9de58479d29b610352ee9ab2b106..c355d4894a7ac6ab7a4e791ae104f32d0625be46 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;