10 defined(
'JPATH_PLATFORM') or die;
12 jimport('joomla.filesystem.folder');
30 protected $type =
'FolderList';
54 protected $hideNone =
false;
62 protected $hideDefault =
false;
81 public function __get($name)
93 return parent::__get($name);
106 public function __set($name, $value)
113 $this->$name = (string) $value;
118 $value = (string) $value;
119 $this->$name = ($value ===
'true' || $value === $name || $value ===
'1');
123 parent::__set($name, $value);
141 public function setup(SimpleXMLElement $element, $value, $group = null)
143 $return = parent::setup($element, $value, $group);
147 $this->filter = (string) $this->element[
'filter'];
148 $this->exclude = (string) $this->element[
'exclude'];
150 $hideNone = (string) $this->element[
'hide_none'];
151 $this->hideNone = ($hideNone ==
'true' || $hideNone ==
'hideNone' || $hideNone ==
'1');
153 $hideDefault = (string) $this->element[
'hide_default'];
154 $this->hideDefault = ($hideDefault ==
'true' || $hideDefault ==
'hideDefault' || $hideDefault ==
'1');
157 $this->directory = (string) $this->element[
'directory'];
170 protected function getOptions()
174 $path = $this->directory;
178 $path = JPATH_ROOT .
'/' . $path;
182 if (!$this->hideNone)
184 $options[] = JHtml::_(
'select.option',
'-1',
JText::alt(
'JOPTION_DO_NOT_USE', preg_replace(
'/[^a-zA-Z0-9_\-]/',
'_', $this->fieldname)));
187 if (!$this->hideDefault)
189 $options[] = JHtml::_(
'select.option',
'',
JText::alt(
'JOPTION_USE_DEFAULT', preg_replace(
'/[^a-zA-Z0-9_\-]/',
'_', $this->fieldname)));
196 if (is_array($folders))
198 foreach ($folders as $folder)
203 if (preg_match(chr(1) . $this->exclude . chr(1), $folder))
209 $options[] = JHtml::_(
'select.option', $folder, $folder);
214 $options = array_merge(parent::getOptions(), $options);