From 0ceb549d0a022569a0e99a34e362f15d4703fb9d Mon Sep 17 00:00:00 2001 From: Chris Smith <chris.eureka@jalakai.co.uk> Date: Thu, 13 Mar 2008 21:45:05 +0100 Subject: [PATCH] Add metadata, settings class and language strings for $conf['renderer_xhtml'] darcs-hash:20080313204505-f07c6-ad0d4b9f155117f6be01925a8bfece1e35efa39f.gz --- lib/plugins/config/lang/en/lang.php | 3 ++ .../config/settings/config.metadata.php | 1 + lib/plugins/config/settings/extra.class.php | 40 +++++++++++++++++++ 3 files changed, 44 insertions(+) diff --git a/lib/plugins/config/lang/en/lang.php b/lib/plugins/config/lang/en/lang.php index ad6480bb4..7d880dd3e 100644 --- a/lib/plugins/config/lang/en/lang.php +++ b/lib/plugins/config/lang/en/lang.php @@ -127,6 +127,9 @@ $lang['sitemap'] = 'Generate Google sitemap (days)'; $lang['broken_iua'] = 'Is the ignore_user_abort function broken on your system? This could cause a non working search index. IIS+PHP/CGI is known to be broken. See <a href="http://bugs.splitbrain.org/?do=details&task_id=852">Bug 852</a> for more info.'; $lang['xsendfile'] = 'Use the X-Sendfile header to let the webserver deliver static files? Your webserver needs to support this.'; $lang['xmlrpc'] = 'Enable/disable XML-RPC interface.'; +$lang['renderer_xhtml'] = 'Renderer to use for main (xhtml) wiki output'; +$lang['renderer__core'] = '%s (dokuwiki core)'; +$lang['renderer__plugin'] = '%s (plugin)'; $lang['rss_type'] = 'XML feed type'; $lang['rss_linkto'] = 'XML feed links to'; diff --git a/lib/plugins/config/settings/config.metadata.php b/lib/plugins/config/settings/config.metadata.php index 9bb37d2ef..7ddce104b 100644 --- a/lib/plugins/config/settings/config.metadata.php +++ b/lib/plugins/config/settings/config.metadata.php @@ -173,6 +173,7 @@ $meta['rss_show_summary'] = array('onoff'); $meta['broken_iua'] = array('onoff'); $meta['xsendfile'] = array('multichoice','_choices' => array(0,1,2)); $meta['xmlrpc'] = array('onoff'); +$meta['renderer_xhtml'] = array('renderer','_format' => 'xhtml','_choices' => array('xhtml')); $meta['_network'] = array('fieldset'); $meta['proxy____host'] = array('string','_pattern' => '#^(|[a-z0-9\-\.+]+)$#i'); 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); + } + } +} -- GitLab