Skip to content

Commit 778153e

Browse files
frankmayerrdeutz
authored andcommitted
Cleanups, fixes and a bit of optimizations for site/components batch #4 (#12293)
* Cleanups, fixes and a bit of optimizations for site/components batch #4 - com_mailto - com_newsfeeds - com_search Note: This is a single commit bundling all types of changes, since PR #12261 which had detailed commits, was rejected as a whole * Missed to convert `and` and `or` * Some more fixes after conflict resolution * - Changed some things according to reviewer's suggestions - Some more changes in updated stuff * Reversed a change according to reviewer's correct comment.
1 parent d434df3 commit 778153e

File tree

15 files changed

+38
-36
lines changed

15 files changed

+38
-36
lines changed

components/com_newsfeeds/controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public function display($cachable = false, $urlparams = false)
3636

3737
$user = JFactory::getUser();
3838

39-
if ($user->get('id') || ($this->input->getMethod() == 'POST' && $vName == 'category' ))
39+
if ($user->get('id') || ($this->input->getMethod() === 'POST' && $vName === 'category'))
4040
{
4141
$cachable = false;
4242
}

components/com_newsfeeds/helpers/association.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,10 +33,10 @@ abstract class NewsfeedsHelperAssociation extends CategoryHelperAssociation
3333
public static function getAssociations($id = 0, $view = null)
3434
{
3535
$jinput = JFactory::getApplication()->input;
36-
$view = is_null($view) ? $jinput->get('view') : $view;
36+
$view = $view === null ? $jinput->get('view') : $view;
3737
$id = empty($id) ? $jinput->getInt('id') : $id;
3838

39-
if ($view == 'newsfeed')
39+
if ($view === 'newsfeed')
4040
{
4141
if ($id)
4242
{
@@ -53,7 +53,7 @@ public static function getAssociations($id = 0, $view = null)
5353
}
5454
}
5555

56-
if ($view == 'category' || $view == 'categories')
56+
if ($view === 'category' || $view === 'categories')
5757
{
5858
return self::getCategoryAssociations($id, 'com_newsfeeds');
5959
}

components/com_newsfeeds/helpers/legacyrouter.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ public function build(&$query, &$segments)
7777
{
7878
$view = $query['view'];
7979

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

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

9393
return;
9494
}
9595

96-
if (isset($view) and ($view == 'category' or $view == 'newsfeed'))
96+
if (isset($view) && ($view === 'category' || $view === 'newsfeed'))
9797
{
9898
if ($mId != (int) $query['id'] || $mView != $view)
9999
{
100-
if ($view == 'newsfeed' && isset($query['catid']))
100+
if ($view === 'newsfeed' && isset($query['catid']))
101101
{
102102
$catid = $query['catid'];
103103
}
@@ -119,7 +119,7 @@ public function build(&$query, &$segments)
119119

120120
foreach ($path as $id)
121121
{
122-
if ((int) $id == (int) $menuCatid)
122+
if ((int) $id === (int) $menuCatid)
123123
{
124124
break;
125125
}
@@ -135,7 +135,7 @@ public function build(&$query, &$segments)
135135
$segments = array_merge($segments, array_reverse($array));
136136
}
137137

138-
if ($view == 'newsfeed')
138+
if ($view === 'newsfeed')
139139
{
140140
if ($advanced)
141141
{
@@ -164,7 +164,7 @@ public function build(&$query, &$segments)
164164
}
165165
else
166166
{
167-
if ($query['layout'] == 'default')
167+
if ($query['layout'] === 'default')
168168
{
169169
unset($query['layout']);
170170
}

components/com_newsfeeds/helpers/route.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public static function getNewsfeedRoute($id, $catid, $language = 0)
3535
$link .= '&catid=' . $catid;
3636
}
3737

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

74-
if ($language && $language != '*' && JLanguageMultilang::isEnabled())
74+
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
7575
{
7676
$link .= '&lang=' . $language;
7777
}

components/com_newsfeeds/models/newsfeed.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ public function &getItem($pk = null)
127127

128128
// Check for published state if filter set.
129129

130-
if ((is_numeric($published) || is_numeric($archived)) && (($data->published != $published) && ($data->published != $archived)))
130+
if ((is_numeric($published) || is_numeric($archived)) && $data->published != $published && $data->published != $archived)
131131
{
132132
JError::raiseError(404, JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
133133
}

components/com_newsfeeds/router.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ public function getCategoryId($segment, $query)
147147
{
148148
if ($this->noIDs)
149149
{
150-
if ($child->alias == $segment)
150+
if ($child->alias === $segment)
151151
{
152152
return $child->id;
153153
}

components/com_newsfeeds/views/categories/tmpl/default_items.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
JHtml::_('bootstrap.tooltip');
1313

1414
$class = ' class="first"';
15-
if (count($this->items[$this->parent->id]) > 0 && $this->maxLevelcat != 0) :
15+
if ($this->maxLevelcat != 0 && count($this->items[$this->parent->id]) > 0) :
1616
?>
1717
<?php foreach ($this->items[$this->parent->id] as $id => $item) : ?>
1818
<?php

components/com_newsfeeds/views/category/tmpl/default.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

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

49-
<?php if (!empty($this->children[$this->category->id]) && $this->maxLevel != 0) : ?>
49+
<?php if ($this->maxLevel != 0 && !empty($this->children[$this->category->id])) : ?>
5050
<div class="cat-children">
5151
<h3><?php echo JText::_('JGLOBAL_SUBCATEGORIES'); ?></h3>
5252
<?php echo $this->loadTemplate('children'); ?>

components/com_newsfeeds/views/category/tmpl/default_children.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
defined('_JEXEC') or die;
1111

1212
$class = ' class="first"';
13-
if (count($this->children[$this->category->id]) > 0 && $this->maxLevel != 0) :
13+
if ($this->maxLevel != 0 && count($this->children[$this->category->id]) > 0) :
1414
?>
1515
<ul>
1616
<?php foreach ($this->children[$this->category->id] as $id => $child) : ?>

components/com_newsfeeds/views/category/tmpl/default_items.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@
2020
<?php else : ?>
2121

2222
<form action="<?php echo htmlspecialchars(JUri::getInstance()->toString(), ENT_COMPAT, 'UTF-8'); ?>" method="post" name="adminForm" id="adminForm">
23-
<?php if (($this->params->get('filter_field') != 'hide') || $this->params->get('show_pagination_limit')) : ?>
23+
<?php if ($this->params->get('filter_field') !== 'hide' || $this->params->get('show_pagination_limit')) : ?>
2424
<fieldset class="filters btn-toolbar">
25-
<?php if (($this->params->get('filter_field') != 'hide') && ($this->params->get('filter_field') == '1')) : ?>
25+
<?php if ($this->params->get('filter_field') !== 'hide' && $this->params->get('filter_field') == '1') : ?>
2626
<div class="btn-group">
2727
<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>
2828
<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'); ?>" />

0 commit comments

Comments
 (0)