-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
3 changed files
with
82 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
<?php | ||
/** | ||
* @package Joomla.Plugin | ||
* @subpackage Editors.tinymce | ||
* | ||
* @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. | ||
* @license GNU General Public License version 2 or later; see LICENSE.txt | ||
*/ | ||
|
||
defined('_JEXEC') or die; | ||
|
||
jimport('joomla.form.helper'); | ||
|
||
JFormHelper::loadFieldClass('list'); | ||
|
||
/** | ||
* Generates the list of directories available for drag and drop upload. | ||
* | ||
* @package Joomla.Plugin | ||
* @subpackage Editors.tinymce | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
class JFormFieldUploaddirs extends JFormFieldList | ||
{ | ||
protected $type = 'uploaddirs'; | ||
|
||
/** | ||
* Method to get the directories options. | ||
* | ||
* @return array The skins option objects. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
public function getOptions() | ||
{ | ||
$options = array(); | ||
$root = JComponentHelper::getParams('com_media')->get('image_path'); | ||
|
||
|
||
$directories = glob(JPATH_ROOT . '/' . $root . '/*', GLOB_ONLYDIR); | ||
|
||
$options[] = JHtml::_('select.option', '', ''); | ||
|
||
for ($i = 0; $i < count($directories); ++$i) | ||
{ | ||
$dir = basename($directories[$i]); | ||
$options[] = JHtml::_('select.option', $i, $dir); | ||
} | ||
|
||
$options = array_merge(parent::getOptions(), $options); | ||
|
||
return $options; | ||
} | ||
|
||
/** | ||
* Method to get the field input markup for the list of directories. | ||
* | ||
* @return string The field input markup. | ||
* | ||
* @since __DEPLOY_VERSION__ | ||
*/ | ||
protected function getInput() | ||
{ | ||
$html = array(); | ||
|
||
// Get the field options. | ||
$options = (array) $this->getOptions(); | ||
|
||
// Create a regular list. | ||
$html[] = JHtml::_('select.genericlist', $options, $this->name, '', 'value', 'text', $this->value, $this->id); | ||
|
||
return implode($html); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters