- md5
- 20a6d6e14b7bd36ed2f3d5b841a0899f
- sha1
- 46c542643130795f09e14b59d97d8beb0eca23bc
- sha256
- da112db714cb1f48ccc5986bfc8d4c0a0b34b723e5f643530f0aa929b1d49b83
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
<?php
/**
* @package Joomla.Administrator
* @subpackage com_finder
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('_JEXEC') or die;
JFormHelper::loadFieldClass('list');
// Load the base adapter.
JLoader::register('FinderIndexerAdapter', JPATH_ADMINISTRATOR . '/components/com_finder/helpers/indexer/adapter.php');
/**
* Renders a list of directories.
*
* @since 2.5
*/
class JFormFieldDirectories extends JFormFieldList
{
/**
* The form field type.
*
* @var string
* @since 2.5
*/
protected $type = 'Directories';
/**
* Method to get the field options.
*
* @return array The field option objects.
*
* @since 2.5
*/
public function getOptions()
{
$values = array();
$options = array();
$exclude = array(
JPATH_ADMINISTRATOR,
JPATH_INSTALLATION,
JPATH_LIBRARIES,
JPATH_PLUGINS,
JPATH_SITE . '/cache',
JPATH_SITE . '/components',
JPATH_SITE . '/includes',
JPATH_SITE . '/language',
JPATH_SITE . '/modules',
JPATH_THEMES,
JFactory::getApplication()->get('log_path'),
JFactory::getApplication()->get('tmp_path')
);
// Get the base directories.
jimport('joomla.filesystem.folder');
$dirs = JFolder::folders(JPATH_SITE, '.', false, true);
// Iterate through the base directories and find the subdirectories.
foreach ($dirs as $dir)
{
// Check if the directory should be excluded.
if (in_array($dir, $exclude))
{
continue;
}
// Get the child directories.
$return = JFolder::folders($dir, '.', true, true);
// Merge the directories.
if (is_array($return))
{
$values[] = $dir;
$values = array_merge($values, $return);
}
}
// Convert the values to options.
foreach ($values as $value)
{
$options[] = JHtml::_('select.option', str_replace(JPATH_SITE . '/', '', $value), str_replace(JPATH_SITE . '/', '', $values));
}
// Add a null option.
array_unshift($options, JHtml::_('select.option', '', '- ' . JText::_('JNONE') . ' -'));
return $options;
}
}
The same content is in 10 releases, Joomla 3.6.1-rc1 to 3.6.5. See them all, or every version of this file.