summaryrefslogtreecommitdiff
path: root/inc/confutils.php
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2009-01-27 17:10:35 +0100
committerAndreas Gohr <andi@splitbrain.org>2009-01-27 17:10:35 +0100
commit4c6a5ecc2b270cdbcf9d23697f99fb13f101ffbd (patch)
treec3c84d634db621d9c83580d61b03afba70a3afc5 /inc/confutils.php
parent430aa6b6a455dbfbef55333735adf8be9b9dbfbd (diff)
downloadrpg-4c6a5ecc2b270cdbcf9d23697f99fb13f101ffbd.tar.gz
rpg-4c6a5ecc2b270cdbcf9d23697f99fb13f101ffbd.tar.bz2
fixed interwiki links with uppercase letters in the shortcut FS#1577
Ignore-this: 6f2e5648f5822cae5b038c1bc50ce9ad darcs-hash:20090127161035-7ad00-1d8a1f022ca8933d05fd7befbbe7054508d9d84e.gz
Diffstat (limited to 'inc/confutils.php')
-rw-r--r--inc/confutils.php37
1 files changed, 20 insertions, 17 deletions
diff --git a/inc/confutils.php b/inc/confutils.php
index 53db69565..14b2ad727 100644
--- a/inc/confutils.php
+++ b/inc/confutils.php
@@ -91,7 +91,7 @@ function getEntities() {
function getInterwiki() {
static $wikis = NULL;
if ( !$wikis ) {
- $wikis = retrieveConfig('interwiki','confToHash');
+ $wikis = retrieveConfig('interwiki','confToHash',array(true));
}
//add sepecial case 'this'
$wikis['this'] = DOKU_URL.'{NAME}';
@@ -156,23 +156,26 @@ function confToHash($file,$lower=false) {
/**
* Retrieve the requested configuration information
- *
+ *
* @author Chris Smith <chris@jalakai.co.uk>
*
* @param string $type the configuration settings to be read, must correspond to a key/array in $config_cascade
* @param callback $fn the function used to process the configuration file into an array
+ * @param array $param optional additional params to pass to the callback
* @return array configuration values
*/
-function retrieveConfig($type,$fn) {
+function retrieveConfig($type,$fn,$params=null) {
global $config_cascade;
+ if(!is_array($params)) $params = array();
+
$combined = array();
if (!is_array($config_cascade[$type])) trigger_error('Missing config cascade for "'.$type.'"',E_USER_WARNING);
foreach (array('default','local','protected') as $config_group) {
if (empty($config_cascade[$type][$config_group])) continue;
foreach ($config_cascade[$type][$config_group] as $file) {
if (@file_exists($file)) {
- $config = $fn($file);
+ $config = call_user_func_array($fn,array_merge(array($file),$params));
$combined = array_merge($combined, $config);
}
}
@@ -196,7 +199,7 @@ function getConfigFiles($type) {
if (!is_array($config_cascade[$type])) trigger_error('Missing config cascade for "'.$type.'"',E_USER_WARNING);
foreach (array('default','local','protected') as $config_group) {
if (empty($config_cascade[$type][$config_group])) continue;
- $files = array_merge($files, $config_cascade[$type][$config_group]);
+ $files = array_merge($files, $config_cascade[$type][$config_group]);
}
return $files;
@@ -231,7 +234,7 @@ function actionOK($action){
/**
* check if headings should be used as link text for the specified link type
*
- * @author Chris Smith <chris@jalakai.co.uk>
+ * @author Chris Smith <chris@jalakai.co.uk>
*
* @param string $linktype 'content'|'navigation', content applies to links in wiki text
* navigation applies to all other links
@@ -268,11 +271,11 @@ function useHeading($linktype) {
*/
function conf_encodeString($str,$code) {
switch ($code) {
- case 'base64' : return '<b>'.base64_encode($str);
- case 'uuencode' : return '<u>'.convert_uuencode($str);
- case 'plain':
- default:
- return $str;
+ case 'base64' : return '<b>'.base64_encode($str);
+ case 'uuencode' : return '<u>'.convert_uuencode($str);
+ case 'plain':
+ default:
+ return $str;
}
}
/**
@@ -282,11 +285,11 @@ function conf_encodeString($str,$code) {
* @return string plain text
*/
function conf_decodeString($str) {
- switch (substr($str,0,3)) {
- case '<b>' : return base64_decode(substr($str,3));
- case '<u>' : return convert_uudecode(substr($str,3));
- default: // not encode (or unknown)
- return $str;
- }
+ switch (substr($str,0,3)) {
+ case '<b>' : return base64_decode(substr($str,3));
+ case '<u>' : return convert_uudecode(substr($str,3));
+ default: // not encode (or unknown)
+ return $str;
+ }
}
//Setup VIM: ex: et ts=2 enc=utf-8 :