function initialize($default, $local, $protected) { // populate $this->_choices with a list of directories $list = array(); if ($dh = @opendir($this->_dir)) { while (false !== ($entry = readdir($dh))) { if ($entry == '.' || $entry == '..') { continue; } if ($this->_pattern && !preg_match($this->_pattern, $entry)) { continue; } $file = is_link($this->_dir . $entry) ? readlink($this->_dir . $entry) : $entry; if (is_dir($this->_dir . $file)) { $list[] = $entry; } } closedir($dh); } sort($list); $this->_choices = $list; parent::initialize($default, $local, $protected); }
/** * Build html for label and input of setting * * @param DokuWiki_Plugin $plugin object of config plugin * @param bool $echo true: show inputted value, when error occurred, otherwise the stored setting * @return array with content array(string $label_html, string $input_html) */ 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) { $plugin->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); }