summaryrefslogtreecommitdiff
path: root/lib/plugins
diff options
context:
space:
mode:
authorEsther Brunner <esther@kaffeehaus.ch>2006-03-22 15:05:25 +0100
committerEsther Brunner <esther@kaffeehaus.ch>2006-03-22 15:05:25 +0100
commit4a778400790148873f7f17dd7df42ca018b60e36 (patch)
tree24e8d14fec1d14e4e9602ca7b948b3cbca065da9 /lib/plugins
parent78d4e784c199ffdd0540a1fc96b6b41ff2c8e0ec (diff)
downloadrpg-4a778400790148873f7f17dd7df42ca018b60e36.tar.gz
rpg-4a778400790148873f7f17dd7df42ca018b60e36.tar.bz2
changes to config plugin needed for template and plugin configuration
darcs-hash:20060322140525-283c4-54953a1954beba0e78c896610b33a6f3c953cbb6.gz
Diffstat (limited to 'lib/plugins')
-rw-r--r--lib/plugins/config/admin.php18
-rw-r--r--lib/plugins/config/settings/config.class.php52
2 files changed, 55 insertions, 15 deletions
diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php
index 05e4a8029..5b44dece5 100644
--- a/lib/plugins/config/admin.php
+++ b/lib/plugins/config/admin.php
@@ -184,14 +184,12 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
}
- function _setup_localised_plugin_prompts() {
+ function _setup_localised_plugintpl_prompts() {
global $conf;
$langfile = '/lang/'.$conf[lang].'/settings.php';
$enlangfile = '/lang/en/settings.php';
- $lang = array();
-
if ($dh = opendir(DOKU_PLUGIN)) {
while (false !== ($plugin = readdir($dh))) {
if ($plugin == '.' || $plugin == '..' || $plugin == 'tmp' || $plugin == 'config') continue;
@@ -208,7 +206,19 @@ class admin_plugin_config extends DokuWiki_Admin_Plugin {
}
closedir($dh);
}
-
+
+ // the same for the active template
+ $tpl = $conf['template'];
+
+ if (@file_exists(DOKU_TPLINC.$enlangfile)){
+ $lang = array();
+ @include(DOKU_TPLINC.$enlangfile);
+ if ($conf['lang'] != 'en') @include(DOKU_TPLINC.$langfile);
+ foreach ($lang as $key => $value){
+ $this->lang['tpl'.CM_KEYMARKER.$tpl.CM_KEYMARKER.$key] = $value;
+ }
+ }
+
return true;
}
diff --git a/lib/plugins/config/settings/config.class.php b/lib/plugins/config/settings/config.class.php
index 48931bfc3..f3d0811b7 100644
--- a/lib/plugins/config/settings/config.class.php
+++ b/lib/plugins/config/settings/config.class.php
@@ -26,6 +26,7 @@ if (!class_exists('configuration')) {
* constructor
*/
function configuration($datafile) {
+ global $conf;
if (!@file_exists($datafile)) {
msg('No configuration metadata found at - '.htmlspecialchars($datafile),-1);
@@ -43,15 +44,16 @@ if (!class_exists('configuration')) {
$this->locked = $this->_is_locked();
- $this->_metadata = array_merge($meta, $this->get_plugin_metadata());
+ $this->_metadata = array_merge($meta, $this->get_plugintpl_metadata($conf['template']));
$this->retrieve_settings();
}
function retrieve_settings() {
+ global $conf;
if (!$this->_loaded) {
- $default = array_merge($this->_read_config($this->_default_file), $this->get_plugin_default());
+ $default = array_merge($this->_read_config($this->_default_file), $this->get_plugintpl_default($conf['template']));
$local = $this->_read_config($this->_local_file);
$protected = $this->_read_config($this->_protected_file);
@@ -206,11 +208,11 @@ if (!class_exists('configuration')) {
}
/**
- * load metadata for plugin settings
+ * load metadata for plugin and template settings
*/
- function get_plugin_metadata(){
- $file = '/settings/config.metadata.php';
- $meta = array();
+ function get_plugintpl_metadata($tpl){
+ $file = '/conf/metadata.php';
+ $metadata = array();
if ($dh = opendir(DOKU_PLUGIN)) {
while (false !== ($plugin = readdir($dh))) {
@@ -218,29 +220,57 @@ if (!class_exists('configuration')) {
if (is_file(DOKU_PLUGIN.$plugin)) continue;
if (@file_exists(DOKU_PLUGIN.$plugin.$file)){
+ $meta = array();
@include(DOKU_PLUGIN.$plugin.$file);
+ foreach ($meta as $key => $value){
+ $metadata['plugin'.CM_KEYMARKER.$plugin.CM_KEYMARKER.$key] = $value;
+ }
}
}
closedir($dh);
}
- return $meta;
+
+ // the same for the active template
+ if (@file_exists(DOKU_TPLINC.$file)){
+ $meta = array();
+ @include(DOKU_TPLINC.$file);
+ foreach ($meta as $key => $value){
+ $metadata['tpl'.CM_KEYMARKER.$tpl.CM_KEYMARKER.$key] = $value;
+ }
+ }
+
+ return $metadata;
}
/**
- * load default settings for plugins
+ * load default settings for plugins and templates
*/
- function get_plugin_default(){
- $file = '/settings/config.default.php';
+ function get_plugintpl_default($tpl){
+ $file = '/conf/default.php';
$default = array();
if ($dh = opendir(DOKU_PLUGIN)) {
while (false !== ($plugin = readdir($dh))) {
if (@file_exists(DOKU_PLUGIN.$plugin.$file)){
- $default = array_merge($default, $this->_read_config("DOKU_PLUGIN.'".$plugin.$file."'"));
+ $conf = array();
+ @include(DOKU_PLUGIN.$plugin.$file);
+ foreach ($conf as $key => $value){
+ $default['plugin'.CM_KEYMARKER.$plugin.CM_KEYMARKER.$key] = $value;
+ }
}
}
closedir($dh);
}
+
+ // the same for the active template
+ if (@file_exists(DOKU_TPLINC.$file)){
+ $conf = array();
+ @include(DOKU_TPLINC.$file);
+ foreach ($conf as $key => $value){
+ $default['tpl'.CM_KEYMARKER.$tpl.CM_KEYMARKER.$key] = $value;
+ }
+ }
+
return $default;
}