Skip to content

Commit

Permalink
Simplified spaghetti code
Browse files Browse the repository at this point in the history
Removed duplicated code
  • Loading branch information
demis-palma committed Nov 26, 2015
1 parent 3f984e5 commit 9e4dac8
Showing 1 changed file with 6 additions and 21 deletions.
27 changes: 6 additions & 21 deletions plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,30 +54,15 @@ public function onInit()
// List the skins
$skindirs = glob(JPATH_ROOT . '/media/editors/tinymce/skins' . '/*', GLOB_ONLYDIR);

// Set the selected skin
if ($app->isSite())
// Set the selected skin in the current side, front-end or back-end
$side = $app->getClientId() ? 'skin_admin' : 'skin';
if ((int) $this->params->get($side, 0) < count($skindirs))
{
if ((int) $this->params->get('skin', 0) < count($skindirs))
{
$skin = 'skin : "' . basename($skindirs[(int) $this->params->get('skin', 0)]) . '",';
}
else
{
$skin = 'skin : "lightgray",';
}
$skin = 'skin : "' . basename($skindirs[(int) $this->params->get($side, 0)]) . '",';
}

// Set the selected administrator skin
elseif ($app->isAdmin())
else
{
if ((int) $this->params->get('skin_admin', 0) < count($skindirs))
{
$skin = 'skin : "' . basename($skindirs[(int) $this->params->get('skin_admin', 0)]) . '",';
}
else
{
$skin = 'skin : "lightgray",';
}
$skin = 'skin : "lightgray",';
}

$entity_encoding = $this->params->get('entity_encoding', 'raw');
Expand Down

0 comments on commit 9e4dac8

Please sign in to comment.