Skip to content

Commit

Permalink
Cleanups, fixes and a bit of optimizations for site/components batch #1
Browse files Browse the repository at this point in the history
… (#12290)

* Cleanups, fixes and a bit of optimizations for site/components batch #1

- com_ajax
- com_banners
- com_config
Note: This is a single commit bundling all types of changes, since PR #12261 which had detailed commits, was rejected as a whole

* Ch-Ch-Changes!

* Removed the query changes

* Fix for wrong merge resolve
  • Loading branch information
frankmayer authored and wilsonge committed Dec 18, 2016
1 parent 8d237c3 commit edcd907
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 18 deletions.
8 changes: 4 additions & 4 deletions components/com_banners/models/banners.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ protected function getListQuery()
$cid = $this->getState('filter.client_id');
$categoryId = $this->getState('filter.category_id');
$keywords = $this->getState('filter.keywords');
$randomise = ($ordering == 'random');
$randomise = ($ordering === 'random');
$nullDate = $db->quote($db->getNullDate());
$nowDate = $db->quote(JFactory::getDate()->toSql());

Expand Down Expand Up @@ -134,7 +134,7 @@ protected function getListQuery()

if ($tagSearch)
{
if (count($keywords) == 0)
if (count($keywords) === 0)
{
$query->where('0');
}
Expand Down Expand Up @@ -231,7 +231,7 @@ public function impress()
{
return;
}

foreach ($items as $item)
{
$bid[] = (int) $item->id;
Expand Down Expand Up @@ -291,7 +291,7 @@ public function impress()
JError::raiseError(500, $e->getMessage());
}

if ($db->getAffectedRows() == 0)
if ($db->getAffectedRows() === 0)
{
// Insert new count
$query->clear();
Expand Down
2 changes: 1 addition & 1 deletion components/com_config/controller/config/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public function execute()

if (class_exists($viewClass))
{
if ($viewName != 'close')
if ($viewName !== 'close')
{
$model = new $modelClass;

Expand Down
2 changes: 1 addition & 1 deletion components/com_config/controller/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public function execute()
$view->document = $document;

// Reply for service requests
if ($viewFormat == 'json')
if ($viewFormat === 'json')
{
return $view->render();
}
Expand Down
6 changes: 3 additions & 3 deletions components/com_config/controller/helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function parseController($app)
}
}

if (empty($tasks[0]) || $tasks[0] == 'Config')
if (empty($tasks[0]) || $tasks[0] === 'Config')
{
$location = 'Config';
}
Expand Down Expand Up @@ -90,15 +90,15 @@ public function parseController($app)
// Some special handling for com_config administrator
$option = $app->input->get('option');

if ($app->isAdmin() && $option == 'com_config')
if ($option === 'com_config' && $app->isAdmin())
{
$component = $app->input->get('component');

if (!empty($component))
{
$view = 'Component';
}
elseif ($option == 'com_config')
elseif ($option === 'com_config')
{
$view = 'Application';
}
Expand Down
2 changes: 1 addition & 1 deletion components/com_config/controller/templates/display.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function execute()

if (class_exists($viewClass))
{
if ($viewName != 'close')
if ($viewName !== 'close')
{
$model = new $modelClass;

Expand Down
9 changes: 3 additions & 6 deletions components/com_config/model/templates.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,13 +108,10 @@ protected function preprocessForm(JForm $form, $data, $group = 'content')
$formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/templateDetails.xml');
}

if (file_exists($formFile))
// Get the template form.
if (file_exists($formFile) && !$form->loadFile($formFile, false, '//config'))
{
// Get the template form.
if (!$form->loadFile($formFile, false, '//config'))
{
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
}
throw new Exception(JText::_('JERROR_LOADFILE_FAILED'));
}

// Attempt to load the xml file.
Expand Down
2 changes: 1 addition & 1 deletion components/com_config/view/modules/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
JHtml::_('behavior.combobox');
JHtml::_('formbehavior.chosen', 'select');

$hasContent = empty($this->item['module']) || $this->item['module'] == 'custom' || $this->item['module'] == 'mod_custom';
$hasContent = empty($this->item['module']) || $this->item['module'] === 'custom' || $this->item['module'] === 'mod_custom';

// If multi-language site, make language read-only
if (JLanguageMultilang::isEnabled())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<div class="controls">
<?php
// If multi-language site, make menu-type selection read-only
if (JLanguageMultilang::isEnabled() && $this->item['module'] == 'mod_menu' && $field->getAttribute('name') == 'menutype')
if (JLanguageMultilang::isEnabled() && $this->item['module'] === 'mod_menu' && $field->getAttribute('name') === 'menutype')
{
$field->__set('readonly', true);
}
Expand Down

0 comments on commit edcd907

Please sign in to comment.