summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2011-11-13 12:18:09 +0100
committerAndreas Gohr <andi@splitbrain.org>2011-11-13 12:18:09 +0100
commit2adaf2b8a608f4a1ac3fe0dba94ff28d7a0d48e5 (patch)
tree0672eeed0d0e8911d4f7a3f6bbe6e4bfd9589bfc /inc
parent21bdc90cffbfd11da3453fb3622c90613ff8a0c4 (diff)
downloadrpg-2adaf2b8a608f4a1ac3fe0dba94ff28d7a0d48e5.tar.gz
rpg-2adaf2b8a608f4a1ac3fe0dba94ff28d7a0d48e5.tar.bz2
allow non-txt extensions when accessing locales
Diffstat (limited to 'inc')
-rw-r--r--inc/common.php4
-rw-r--r--inc/pageutils.php16
2 files changed, 11 insertions, 9 deletions
diff --git a/inc/common.php b/inc/common.php
index b624c334c..1d8061ab0 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 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;