diff options
Diffstat (limited to 'lib/plugins/config/settings/extra.class.php')
-rw-r--r-- | lib/plugins/config/settings/extra.class.php | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/lib/plugins/config/settings/extra.class.php b/lib/plugins/config/settings/extra.class.php index 8e1e49acb..d85c17fcd 100644 --- a/lib/plugins/config/settings/extra.class.php +++ b/lib/plugins/config/settings/extra.class.php @@ -114,3 +114,43 @@ if (!class_exists('setting_compression')) { } } } + +if (!class_exists('setting_renderer')) { + class setting_renderer extends setting_multichoice { + var $_prompts = array(); + + function initialize($default,$local,$protected) { + $format = $this->_format; + + foreach (plugin_list('renderer') as $plugin) { + $renderer =& plugin_load('renderer',$plugin); + if (method_exists($renderer,'canRender') && $renderer->canRender($format)) { + $this->_choices[] = $plugin; + + $info = $renderer->getInfo(); + $this->_prompts[$plugin] = $info['name']; + } + } + + parent::initialize($default,$local,$protected); + } + + function html(&$plugin, $echo=false) { + + // make some language adjustments (there must be a better way) + // transfer some plugin names to the config plugin + if (!$plugin->localised) $this->setupLocale(); + + foreach ($this->_choices as $choice) { + if (!isset($plugin->lang[$this->_key.'_o_'.$choice])) { + if (!isset($this->_prompts[$choice])) { + $plugin->lang[$this->_key.'_o_'.$choice] = sprintf($plugin->lang['renderer__core'],$choice); + } else { + $plugin->lang[$this->_key.'_o_'.$choice] = sprintf($plugin->lang['renderer__plugin'],$this->_prompts[$choice]); + } + } + } + return parent::html($plugin, $echo); + } + } +} |