Skip to content
Merged
2 changes: 1 addition & 1 deletion components/com_newsfeeds/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public function display($cachable = false, $urlparams = false)

$user = JFactory::getUser();

if ($user->get('id') || ($this->input->getMethod() == 'POST' && $vName == 'category' ))
if ($user->get('id') || ($this->input->getMethod() === 'POST' && $vName === 'category'))
{
$cachable = false;
}
Expand Down
6 changes: 3 additions & 3 deletions components/com_newsfeeds/helpers/association.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ abstract class NewsfeedsHelperAssociation extends CategoryHelperAssociation
public static function getAssociations($id = 0, $view = null)
{
$jinput = JFactory::getApplication()->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$view = $view === null ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;

if ($view == 'newsfeed')
if ($view === 'newsfeed')
{
if ($id)
{
Expand All @@ -53,7 +53,7 @@ public static function getAssociations($id = 0, $view = null)
}
}

if ($view == 'category' || $view == 'categories')
if ($view === 'category' || $view === 'categories')
{
return self::getCategoryAssociations($id, 'com_newsfeeds');
}
Expand Down
14 changes: 7 additions & 7 deletions components/com_newsfeeds/helpers/legacyrouter.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public function build(&$query, &$segments)
{
$view = $query['view'];

if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component != 'com_newsfeeds')
if (empty($menuItem) || $menuItem->component !== 'com_newsfeeds' || empty($query['Itemid']))
{
$segments[] = $query['view'];
}
Expand All @@ -86,18 +86,18 @@ public function build(&$query, &$segments)
}

// Are we dealing with an newsfeed that is attached to a menu item?
if (isset($query['view']) && ($mView == $query['view']) and isset($query['id']) and ($mId == (int) $query['id']))
if (isset($query['view'], $query['id']) && $mView == $query['view'] && $mId == (int) $query['id'])
{
unset($query['view'], $query['catid'], $query['id']);

return;
}

if (isset($view) and ($view == 'category' or $view == 'newsfeed'))
if (isset($view) && ($view === 'category' || $view === 'newsfeed'))
{
if ($mId != (int) $query['id'] || $mView != $view)
{
if ($view == 'newsfeed' && isset($query['catid']))
if ($view === 'newsfeed' && isset($query['catid']))
{
$catid = $query['catid'];
}
Expand All @@ -119,7 +119,7 @@ public function build(&$query, &$segments)

foreach ($path as $id)
{
if ((int) $id == (int) $menuCatid)
if ((int) $id === (int) $menuCatid)
{
break;
}
Expand All @@ -135,7 +135,7 @@ public function build(&$query, &$segments)
$segments = array_merge($segments, array_reverse($array));
}

if ($view == 'newsfeed')
if ($view === 'newsfeed')
{
if ($advanced)
{
Expand Down Expand Up @@ -164,7 +164,7 @@ public function build(&$query, &$segments)
}
else
{
if ($query['layout'] == 'default')
if ($query['layout'] === 'default')
{
unset($query['layout']);
}
Expand Down
4 changes: 2 additions & 2 deletions components/com_newsfeeds/helpers/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function getNewsfeedRoute($id, $catid, $language = 0)
$link .= '&catid=' . $catid;
}

if ($language && $language != '*' && JLanguageMultilang::isEnabled())
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
Expand Down Expand Up @@ -71,7 +71,7 @@ public static function getCategoryRoute($catid, $language = 0)
// Create the link
$link = 'index.php?option=com_newsfeeds&view=category&id=' . $id;

if ($language && $language != '*' && JLanguageMultilang::isEnabled())
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
}
Expand Down
2 changes: 1 addition & 1 deletion components/com_newsfeeds/models/newsfeed.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function &getItem($pk = null)

// Check for published state if filter set.

if ((is_numeric($published) || is_numeric($archived)) && (($data->published != $published) && ($data->published != $archived)))
if ((is_numeric($published) || is_numeric($archived)) && $data->published != $published && $data->published != $archived)
{
JError::raiseError(404, JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
}
Expand Down
4 changes: 2 additions & 2 deletions components/com_newsfeeds/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -147,14 +147,14 @@ public function getCategoryId($segment, $query)
{
if ($this->noIDs)
{
if ($child->alias == $segment)
if ($child->alias === $segment)
{
return $child->id;
}
}
else
{
if ($child->id == (int) $segment)
if ($child->id === (int) $segment)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure. Will check. According to the property's docblock it is an integer, but I am not sure if we can trust that. See: https://github.com/joomla/joomla-cms/blob/staging/libraries/legacy/categories/categories.php#L395

{
return $child->id;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
JHtml::_('bootstrap.tooltip');

$class = ' class="first"';
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
?>
<?php foreach ($this->items[$this->parent->id] as $id => $item) : ?>
<?php
Expand Down
2 changes: 1 addition & 1 deletion components/com_newsfeeds/views/category/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

<?php echo $this->loadTemplate('items'); ?>

<?php if (!empty($this->children[$this->category->id]) && $this->maxLevel != 0) : ?>
<?php if ($this->maxLevel != 0 && !empty($this->children[$this->category->id])) : ?>
<div class="cat-children">
<h3><?php echo JText::_('JGLOBAL_SUBCATEGORIES'); ?></h3>
<?php echo $this->loadTemplate('children'); ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
defined('_JEXEC') or die;

$class = ' class="first"';
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
?>
<ul>
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
<?php else : ?>

<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString(), ENT_COMPAT, 'UTF-8'); ?>" method="post" name="adminForm" id="adminForm">
<?php if (($this->params->get('filter_field') != 'hide') || $this->params->get('show_pagination_limit')) : ?>
<?php if ($this->params->get('filter_field') !== 'hide' || $this->params->get('show_pagination_limit')) : ?>
<fieldset class="filters btn-toolbar">
<?php if (($this->params->get('filter_field') != 'hide') && ($this->params->get('filter_field') == '1')) : ?>
<?php if ($this->params->get('filter_field') !== 'hide' && $this->params->get('filter_field') == '1') : ?>
<div class="btn-group">
<label class="filter-search-lbl element-invisible" for="filter-search"><span class="label label-warning"><?php echo JText::_('JUNPUBLISHED'); ?></span><?php echo JText::_('COM_NEWSFEEDS_FILTER_LABEL') . '&#160;'; ?></label>
<input type="text" name="filter-search" id="filter-search" value="<?php echo $this->escape($this->state->get('list.filter')); ?>" class="inputbox" onchange="document.adminForm.submit();" title="<?php echo JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>" placeholder="<?php echo JText::_('COM_NEWSFEEDS_FILTER_SEARCH_DESC'); ?>" />
Expand Down
4 changes: 2 additions & 2 deletions components/com_newsfeeds/views/category/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,12 +72,12 @@ protected function prepareDocument()
$menu = $this->menu;
$id = (int) @$menu->query['id'];

if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $this->category->id))
if ($menu && ($menu->query['option'] !== 'com_newsfeeds' || $menu->query['view'] === 'newsfeed' || $id != $this->category->id))
{
$path = array(array('title' => $this->category->title, 'link' => ''));
$category = $this->category->getParent();

while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1)
while (($menu->query['option'] !== 'com_newsfeeds' || $menu->query['view'] === 'newsfeed' || $id != $category->id) && $category->id > 1)
{
$path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
Expand Down
16 changes: 9 additions & 7 deletions components/com_newsfeeds/views/newsfeed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
$myrtl = $this->newsfeed->rtl;
$direction = ' ';

if ($lang->isRtl() && $myrtl == 0)
$isRtl = $lang->isRtl();

if ($isRtl && $myrtl == 0)
{
$direction = ' redirect-rtl';
}
elseif ($lang->isRtl() && $myrtl == 1)
elseif ($isRtl && $myrtl == 1)
{
$direction = ' redirect-ltr';
}
elseif ($lang->isRtl() && $myrtl == 2)
elseif ($isRtl && $myrtl == 2)
{
$direction = ' redirect-rtl';
}
Expand Down Expand Up @@ -93,7 +95,7 @@
<?php endif; ?>

<!-- Show Image -->
<?php if (isset($this->rssDoc->image) && isset($this->rssDoc->imagetitle) && $this->params->get('show_feed_image')) : ?>
<?php if (isset($this->rssDoc->image, $this->rssDoc->imagetitle) && $this->params->get('show_feed_image')) : ?>
<div>
<img src="<?php echo $this->rssDoc->image; ?>" alt="<?php echo $this->rssDoc->image->decription; ?>" />
</div>
Expand All @@ -110,9 +112,9 @@
}
?>
<?php
$uri = !empty($this->rssDoc[$i]->guid) || !is_null($this->rssDoc[$i]->guid) ? trim($this->rssDoc[$i]->guid) : trim($this->rssDoc[$i]->uri);
$uri = substr($uri, 0, 4) != 'http' ? $this->item->link : $uri;
$text = !empty($this->rssDoc[$i]->content) || !is_null($this->rssDoc[$i]->content) ? trim($this->rssDoc[$i]->content) : trim($this->rssDoc[$i]->description);
$uri = !empty($this->rssDoc[$i]->guid) || $this->rssDoc[$i]->guid !== null ? trim($this->rssDoc[$i]->guid) : trim($this->rssDoc[$i]->uri);
$uri = strpos($uri, 'http') !== 0 ? $this->item->link : $uri;
$text = !empty($this->rssDoc[$i]->content) || $this->rssDoc[$i]->content !== null ? trim($this->rssDoc[$i]->content) : trim($this->rssDoc[$i]->description);
$title = trim($this->rssDoc[$i]->title);
?>
<li>
Expand Down
8 changes: 4 additions & 4 deletions components/com_newsfeeds/views/newsfeed/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public function display($tpl = null)
// Check the access to the newsfeed
$levels = $user->getAuthorisedViewLevels();

if (!in_array($item->access, $levels) or (in_array($item->access, $levels) and (!in_array($item->category_access, $levels))))
if (!in_array($item->access, $levels) || (in_array($item->access, $levels) && (!in_array($item->category_access, $levels))))
{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);
Expand Down Expand Up @@ -175,7 +175,7 @@ public function display($tpl = null)

$feed_display_order = $params->get('feed_display_order', 'des');

if ($feed_display_order == 'asc')
if ($feed_display_order === 'asc')
{
$this->rssDoc->reverseItems();
}
Expand Down Expand Up @@ -240,7 +240,7 @@ protected function _prepareDocument()
$id = (int) @$menu->query['id'];

// If the menu item does not concern this newsfeed
if ($menu && ($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] != 'newsfeed' || $id != $this->item->id))
if ($menu && ($menu->query['option'] !== 'com_newsfeeds' || $menu->query['view'] !== 'newsfeed' || $id != $this->item->id))
{
// If this is not a single newsfeed menu item, set the page title to the newsfeed title
if ($this->item->name)
Expand All @@ -251,7 +251,7 @@ protected function _prepareDocument()
$path = array(array('title' => $this->item->name, 'link' => ''));
$category = JCategories::getInstance('Newsfeeds')->get($this->item->catid);

while (($menu->query['option'] != 'com_newsfeeds' || $menu->query['view'] == 'newsfeed' || $id != $category->id) && $category->id > 1)
while (($menu->query['option'] !== 'com_newsfeeds' || $menu->query['view'] === 'newsfeed' || $id != $category->id) && $category->id > 1)
{
$path[] = array('title' => $category->title, 'link' => NewsfeedsHelperRoute::getCategoryRoute($category->id));
$category = $category->getParent();
Expand Down
4 changes: 2 additions & 2 deletions components/com_search/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function search()
$searchword = trim(str_replace($badchars, '', $this->input->getString('searchword', null, 'post')));

// If searchword enclosed in double quotes, strip quotes and do exact match
if (substr($searchword, 0, 1) == '"' && substr($searchword, -1) == '"')
if (substr($searchword, 0, 1) === '"' && substr($searchword, -1) === '"')
{
$post['searchword'] = substr($searchword, 1, -1);
$this->input->set('searchphrase', 'exact');
Expand Down Expand Up @@ -86,7 +86,7 @@ public function search()
$item = $menu->getItem($post['Itemid']);

// The requested Item is not a search page so we need to find one
if ($item && ($item->component != 'com_search' || $item->query['view'] != 'search'))
if ($item && ($item->component !== 'com_search' || $item->query['view'] !== 'search'))
{
// Get item based on component, not link. link is not reliable.
$item = $menu->getItems('component', 'com_search', true);
Expand Down
2 changes: 1 addition & 1 deletion components/com_search/models/search.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function setSearch($keyword, $match = 'all', $ordering = 'newest')

if ($match !== 'exact')
{
$keyword = preg_replace('#\xE3\x80\x80#s', ' ', $keyword);
$keyword = preg_replace('#\xE3\x80\x80#', ' ', $keyword);
}

$this->setState('keyword', $keyword);
Expand Down