| Conditions | 9 |
| Paths | 2 |
| Total Lines | 20 |
| Code Lines | 12 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 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 | } |
||
| 34 |