diff --git a/lib/plugins/config/admin.php b/lib/plugins/config/admin.php index 05e4a80293fd8a85bfbe0d080735bce72c4ab108..5b44dece5dac21b1f343c5f6eaba7a31a8a984c5 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 48931bfc377230019abe78127c2b5232a9b1c5e9..f3d0811b760f3abb4665a7e18f979e33bed40890 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; }