Exemplo n.º 1
0
 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);
 }
Exemplo n.º 2
0
 /**
  * Receives current values for the setting $key
  *
  * @param mixed $default   default setting value
  * @param mixed $local     local setting value
  * @param mixed $protected protected setting value
  */
 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);
 }