[ Index ] |
PHP Cross Reference of DokuWiki |
[Summary view] [Print] [Text view]
1 <?php 2 3 namespace dokuwiki\plugin\config\core\Setting; 4 5 /** 6 * Class setting_dirchoice 7 */ 8 class SettingDirchoice extends SettingMultichoice { 9 10 protected $dir = ''; 11 12 /** @inheritdoc */ 13 public function initialize($default = null, $local = null, $protected = null) { 14 15 // populate $this->_choices with a list of directories 16 $list = array(); 17 18 if($dh = @opendir($this->dir)) { 19 while(false !== ($entry = readdir($dh))) { 20 if($entry == '.' || $entry == '..') continue; 21 if($this->pattern && !preg_match($this->pattern, $entry)) continue; 22 23 $file = (is_link($this->dir . $entry)) ? readlink($this->dir . $entry) : $this->dir . $entry; 24 if(is_dir($file)) $list[] = $entry; 25 } 26 closedir($dh); 27 } 28 sort($list); 29 $this->choices = $list; 30 31 parent::initialize($default, $local, $protected); 32 } 33 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body