Skip to content
Merged
1 change: 0 additions & 1 deletion components/com_mailto/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ public function send()

// Build the message to send
$msg = JText::_('COM_MAILTO_EMAIL_MSG');
$link = $link;
$body = sprintf($msg, $SiteName, $sender, $from, $link);
Copy link
Contributor

Choose a reason for hiding this comment

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

nice one! 😉


// Clean the email data
Expand Down
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' ))
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove extra space '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
12 changes: 6 additions & 6 deletions components/com_newsfeeds/helpers/route.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public static function getNewsfeedRoute($id, $catid, $language = 0)
}
}

if ($language && $language != "*" && JLanguageMultilang::isEnabled())
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
$needles['language'] = $language;
Expand Down Expand Up @@ -100,7 +100,7 @@ public static function getCategoryRoute($catid, $language = 0)
$needles['category'] = $catids;
$needles['categories'] = $catids;

if ($language && $language != "*" && JLanguageMultilang::isEnabled())
if ($language && $language !== '*' && JLanguageMultilang::isEnabled())
{
$link .= '&lang=' . $language;
$needles['language'] = $language;
Expand Down Expand Up @@ -140,7 +140,7 @@ protected static function _findItem($needles = null)
$attributes = array('component_id');
$values = array($component->id);

if ($language != '*')
if ($language !== '*')
{
$attributes[] = 'language';
$values[] = array($needles['language'], '*');
Expand All @@ -150,7 +150,7 @@ protected static function _findItem($needles = null)

foreach ($items as $item)
{
if (isset($item->query) && isset($item->query['view']))
if (isset($item->query, $item->query['view']))
{
$view = $item->query['view'];

Expand All @@ -164,7 +164,7 @@ protected static function _findItem($needles = null)
/* Here it will become a bit tricky
language != * can override existing entries
language == * cannot override existing entries */
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
if ($item->language !== '*' || !isset(self::$lookup[$language][$view][$item->query['id']]))
{
self::$lookup[$language][$view][$item->query['id']] = $item->id;
}
Expand Down Expand Up @@ -193,7 +193,7 @@ protected static function _findItem($needles = null)
// Check if the active menuitem matches the requested language
$active = $menus->getActive();

if ($active && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
if ($active && ($language === '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled()))
{
return $active->id;
}
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)))
Copy link
Contributor

@Quy Quy May 28, 2017

Choose a reason for hiding this comment

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

Change (($data->published != $published) && ($data->published != $archived)) to $data->published != $published && $data->published != $archived.

{
JError::raiseError(404, JText::_('COM_NEWSFEEDS_ERROR_FEED_NOT_FOUND'));
}
Expand Down
29 changes: 13 additions & 16 deletions components/com_newsfeeds/router.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,14 @@ public function build(&$query)
$menuItem = $this->menu->getItem($query['Itemid']);
}

$mView = (empty($menuItem->query['view'])) ? null : $menuItem->query['view'];
$mId = (empty($menuItem->query['id'])) ? null : $menuItem->query['id'];
$mView = empty($menuItem->query['view']) ? null : $menuItem->query['view'];
$mId = empty($menuItem->query['id']) ? null : $menuItem->query['id'];

if (isset($query['view']))
{
$view = $query['view'];

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

// Are we dealing with a 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']))
Copy link
Contributor

@Quy Quy May 28, 2017

Choose a reason for hiding this comment

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

Change && ($mView == $query['view']) && ($mId == (int) $query['id']) to && $mView == $query['view'] && $mId == (int) $query['id'].

{
unset($query['view']);
unset($query['catid']);
unset($query['id']);
unset($query['view'], $query['catid'], $query['id']);

return $segments;
}

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

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

if ($view == 'newsfeed')
if ($view === 'newsfeed')
{
if ($advanced)
{
Expand All @@ -124,8 +122,7 @@ public function build(&$query)
}
}

unset($query['id']);
unset($query['catid']);
unset($query['id'], $query['catid']);
}

if (isset($query['layout']))
Expand All @@ -139,7 +136,7 @@ public function build(&$query)
}
else
{
if ($query['layout'] == 'default')
if ($query['layout'] === 'default')
{
unset($query['layout']);
}
Expand Down Expand Up @@ -217,7 +214,7 @@ public function parse(&$segments)
}
}

if ($found == 0)
if ($found === 0)
{
if ($advanced)
{
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 All @@ -33,7 +33,7 @@
<?php echo $item->numitems; ?>
</span>
<?php endif; ?>
<?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) : ?>
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) : ?>
<a id="category-btn-<?php echo $item->id;?>" href="#category-<?php echo $item->id;?>"
data-toggle="collapse" data-toggle="button" class="btn btn-mini pull-right"><span class="icon-plus"></span></a>
<?php endif;?>
Expand All @@ -46,7 +46,7 @@
<?php endif; ?>
<?php endif; ?>

<?php if (count($item->getChildren()) > 0 && $this->maxLevelcat > 1) :?>
<?php if ($this->maxLevelcat > 1 && count($item->getChildren()) > 0) :?>
<div class="collapse fade" id="category-<?php echo $item->id;?>">
<?php
$this->items[$item->id] = $item->getChildren();
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('filter_field') != '0')) || $this->params->get('show_pagination_limit')) :?>
<?php if ((($this->params->get('filter_field') !== 'hide') || ($this->params->get('filter_field') != '0')) || $this->params->get('show_pagination_limit')) :?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove parentheses.

<fieldset class="filters btn-toolbar">
<?php if (($this->params->get('filter_field') != 'hide') || ($this->params->get('filter_field') != '0')) :?>
<?php if (($this->params->get('filter_field') !== 'hide') || ($this->params->get('filter_field') != '0')) :?>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove parentheses

<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 @@ -74,12 +74,12 @@ protected function prepareDocument()

$menu = $this->menu;

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
34 changes: 18 additions & 16 deletions components/com_newsfeeds/views/newsfeed/tmpl/default.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,31 +17,33 @@
{
$lang = JFactory::getLanguage();
$myrtl = $this->newsfeed->rtl;
$direction = " ";
$direction = ' ';

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

Choose a reason for hiding this comment

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

Align =


if ($isRtl && $myrtl == 0)
{
$direction = " redirect-rtl";
$direction = ' redirect-rtl';
}
elseif ($lang->isRtl() && $myrtl == 1)
elseif ($isRtl && $myrtl == 1)
{
$direction = " redirect-ltr";
$direction = ' redirect-ltr';
}
elseif ($lang->isRtl() && $myrtl == 2)
elseif ($isRtl && $myrtl == 2)
{
$direction = " redirect-rtl";
$direction = ' redirect-rtl';
}
elseif ($myrtl == 0)
{
$direction = " redirect-ltr";
$direction = ' redirect-ltr';
}
elseif ($myrtl == 1)
{
$direction = " redirect-ltr";
$direction = ' redirect-ltr';
}
elseif ($myrtl == 2)
{
$direction = " redirect-rtl";
$direction = ' redirect-rtl';
}
$images = json_decode($this->item->images);
?>
Expand All @@ -66,7 +68,7 @@

<!-- Show Images from Component -->
<?php if (isset($images->image_first) and !empty($images->image_first)) : ?>
<?php $imgfloat = (empty($images->float_first)) ? $this->params->get('float_first') : $images->float_first; ?>
<?php $imgfloat = empty($images->float_first) ? $this->params->get('float_first') : $images->float_first; ?>
<div class="img-intro-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?>"> <img
<?php if ($images->image_first_caption):
echo 'class="caption"' . ' title="' . htmlspecialchars($images->image_first_caption, ENT_COMPAT, 'UTF-8') . '"';
Expand All @@ -75,7 +77,7 @@
<?php endif; ?>

<?php if (isset($images->image_second) and !empty($images->image_second)) : ?>
<?php $imgfloat = (empty($images->float_second)) ? $this->params->get('float_second') : $images->float_second; ?>
<?php $imgfloat = empty($images->float_second) ? $this->params->get('float_second') : $images->float_second; ?>
<div class="pull-<?php echo htmlspecialchars($imgfloat, ENT_COMPAT, 'UTF-8'); ?> item-image"> <img
<?php if ($images->image_second_caption):
echo 'class="caption"' . ' title="' . htmlspecialchars($images->image_second_caption) . '"';
Expand All @@ -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
10 changes: 5 additions & 5 deletions components/com_newsfeeds/views/newsfeed/view.html.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function display($tpl = null)
$currentLink = $active->link;

// If the current view is the active item and an newsfeed view for this feed, then the menu item params take priority
if (strpos($currentLink, 'view=newsfeed') && (strpos($currentLink, '&id=' . (string) $item->id)))
if (strpos($currentLink, 'view=newsfeed') && strpos($currentLink, '&id=' . (string) $item->id))
{
// $item->params are the newsfeed params, $temp are the menu item params
// Merge so that the menu item params take priority
Expand Down 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) or in_array($item->access, $levels) and (!in_array($item->category_access, $levels)))
Copy link
Contributor

Choose a reason for hiding this comment

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

why not replace the and and or here?

Copy link
Contributor Author

@frankmayer frankmayer Oct 3, 2016

Choose a reason for hiding this comment

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

Slipped through...

Copy link
Contributor

Choose a reason for hiding this comment

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

also maybe you need to add one parenthisis here. not sure tough

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, precedence maybe.. I mostly picked low hanging fruit.. That's possibly why this one "slipped through" 😄

{
$app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error');
$app->setHeader('status', 403, true);
Expand Down Expand Up @@ -177,7 +177,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 @@ -242,7 +242,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 @@ -253,7 +253,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
Loading