10 defined(
'JPATH_PLATFORM') or die;
12 jimport('joomla.filesystem.folder');
13 jimport('joomla.filesystem.file');
31 protected $type =
'FileList';
55 protected $hideNone =
false;
63 protected $hideDefault =
false;
71 protected $stripExt =
false;
90 public function __get($name)
103 return parent::__get($name);
116 public function __set($name, $value)
123 $this->$name = (string) $value;
129 $value = (string) $value;
130 $this->$name = ($value ===
'true' || $value === $name || $value ===
'1');
134 parent::__set($name, $value);
152 public function setup(SimpleXMLElement $element, $value, $group = null)
154 $return = parent::setup($element, $value, $group);
158 $this->filter = (string) $this->element[
'filter'];
159 $this->exclude = (string) $this->element[
'exclude'];
161 $hideNone = (string) $this->element[
'hide_none'];
162 $this->hideNone = ($hideNone ==
'true' || $hideNone ==
'hideNone' || $hideNone ==
'1');
164 $hideDefault = (string) $this->element[
'hide_default'];
165 $this->hideDefault = ($hideDefault ==
'true' || $hideDefault ==
'hideDefault' || $hideDefault ==
'1');
167 $stripExt = (string) $this->element[
'stripext'];
168 $this->stripExt = ($stripExt ==
'true' || $stripExt ==
'stripExt' || $stripExt ==
'1');
171 $this->directory = (string) $this->element[
'directory'];
187 protected function getOptions()
191 $path = $this->directory;
195 $path = JPATH_ROOT .
'/' . $path;
199 if (!$this->hideNone)
201 $options[] = JHtml::_(
'select.option',
'-1',
JText::alt(
'JOPTION_DO_NOT_USE', preg_replace(
'/[^a-zA-Z0-9_\-]/',
'_', $this->fieldname)));
204 if (!$this->hideDefault)
206 $options[] = JHtml::_(
'select.option',
'',
JText::alt(
'JOPTION_USE_DEFAULT', preg_replace(
'/[^a-zA-Z0-9_\-]/',
'_', $this->fieldname)));
213 if (is_array($files))
215 foreach ($files as $file)
220 if (preg_match(chr(1) . $this->exclude . chr(1), $file))
232 $options[] = JHtml::_(
'select.option', $file, $file);
237 $options = array_merge(parent::getOptions(), $options);