Skip to content

Commit

Permalink
DRY
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrammatiko committed Apr 2, 2017
1 parent 7b86433 commit 9e6415a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 12 deletions.
6 changes: 6 additions & 0 deletions plugins/editors/tinymce/field/uploaddirs.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ protected function getInput()
// Get the field options.
$options = (array) $this->getOptions();

// Reset the non selected value to null
if ($options[0]->value === '-1')
{
$options[0]->value = '';
}

// Create a regular list.
$html[] = JHtml::_('select.genericlist', $options, $this->name, '', 'value', 'text', $this->value, $this->id);

Expand Down
14 changes: 2 additions & 12 deletions plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,17 +596,12 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons
// Get specific path
$tempPath = $levelParams->get('path', '');

if ($dragdrop && !empty($tempPath) && $tempPath !== '-1')
if (!empty($tempPath))
{
// Remove the root images path
$tempPath = str_replace(JComponentHelper::getParams('com_media')->get('image_path') . '/', '', $tempPath);
}

if (isset($tempPath) && $tempPath === '-1')
{
$tempPath = '';
}

JText::script('PLG_TINY_ERR_UNSUPPORTEDBROWSER');

$scriptOptions['setCustomDir'] = $isSubDir;
Expand Down Expand Up @@ -1875,17 +1870,12 @@ private function onDisplayLegacy($name, $content, $width, $height, $col, $row, $
// Get specific path
$tempPath = $this->params->get('path', '');

if ($dragdrop && !empty($tempPath) && $tempPath === '-1')
if (!empty($tempPath))
{
// Remove the root images path
$tempPath = str_replace(JComponentHelper::getParams('com_media')->get('image_path') . '/', '', $tempPath);
}

if (isset($tempPath) && $tempPath !== '-1')
{
$tempPath = '';
}

JText::script('PLG_TINY_ERR_UNSUPPORTEDBROWSER');

$scriptOptions['setCustomDir'] = $isSubDir;
Expand Down

0 comments on commit 9e6415a

Please sign in to comment.