/contentmanager/code/trunk/administrator/components/com_contentmanager/libraries/jxtended/form/fields/files.php
PHP | 61 lines | 38 code | 7 blank | 16 comment | 4 complexity | 9aa1fd72c24e53378206b4f6341af24d MD5 | raw file
- <?php
- /**
- * @version $Id: files.php 160 2009-07-09 00:06:09Z eddieajau $
- * @package JXtended.Libraries
- * @subpackage Form
- * @copyright Copyright (C) 2008 - 2009 JXtended, LLC. All rights reserved.
- * @license GNU General Public License <http://www.gnu.org/copyleft/gpl.html>
- * @link http://jxtended.com
- */
- defined('JPATH_BASE') or die;
- jimport('joomla.html.html');
- jximport2('jxtended.form.field');
- jximport2('jxtended.form.fields.list');
- /**
- * JXtended Form Field Type Class for a list of files.
- *
- * @package JXtended.Libraries
- * @subpackage Form
- * @version 1.0
- */
- class JXFieldTypeFiles extends JXFieldTypeList
- {
- function _getOptions(&$node)
- {
- jximport2('joomla.filesystem.folder');
- jximport2('joomla.filesystem.file');
- // path to images directory
- $path = JPATH_ROOT.DS.$node->attributes('directory');
- $filter = $node->attributes('filter');
- $exclude = $node->attributes('exclude');
- $stripExt = $node->attributes('stripext');
- $files = JFolder::files($path, $filter);
- $options = array ();
- if (is_array($files))
- {
- foreach ($files as $file)
- {
- if ($exclude)
- {
- if (preg_match(chr(1) . $exclude . chr(1), $file))
- {
- continue;
- }
- }
- if ($stripExt)
- {
- $file = JFile::stripExt($file);
- }
- $options[] = JHTML::_('select.option', $file, $file);
- }
- }
- return $options;
- }
- }