-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Cleanups, fixes and a bit of optimizations for site/components batch #4 #12293
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
25ca8c7
c34e7bf
eef4864
2b4d825
8864cff
59ff2e6
6cc4c65
2748148
5b88330
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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')); | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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']; | ||
| } | ||
|
|
@@ -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'])) | ||
|
||
| { | ||
| 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']; | ||
| } | ||
|
|
@@ -93,7 +91,7 @@ public function build(&$query) | |
|
|
||
| foreach ($path as $id) | ||
| { | ||
| if ((int) $id == (int) $menuCatid) | ||
| if ((int) $id === (int) $menuCatid) | ||
| { | ||
| break; | ||
| } | ||
|
|
@@ -109,7 +107,7 @@ public function build(&$query) | |
| $segments = array_merge($segments, array_reverse($array)); | ||
| } | ||
|
|
||
| if ($view == 'newsfeed') | ||
| if ($view === 'newsfeed') | ||
| { | ||
| if ($advanced) | ||
| { | ||
|
|
@@ -124,8 +122,7 @@ public function build(&$query) | |
| } | ||
| } | ||
|
|
||
| unset($query['id']); | ||
| unset($query['catid']); | ||
| unset($query['id'], $query['catid']); | ||
| } | ||
|
|
||
| if (isset($query['layout'])) | ||
|
|
@@ -139,7 +136,7 @@ public function build(&$query) | |
| } | ||
| else | ||
| { | ||
| if ($query['layout'] == 'default') | ||
| if ($query['layout'] === 'default') | ||
| { | ||
| unset($query['layout']); | ||
| } | ||
|
|
@@ -217,7 +214,7 @@ public function parse(&$segments) | |
| } | ||
| } | ||
|
|
||
| if ($found == 0) | ||
| if ($found === 0) | ||
| { | ||
| if ($advanced) | ||
| { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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')) :?> | ||
|
||
| <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')) :?> | ||
|
||
| <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') . ' '; ?></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'); ?>" /> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -17,31 +17,33 @@ | |
| { | ||
| $lang = JFactory::getLanguage(); | ||
| $myrtl = $this->newsfeed->rtl; | ||
| $direction = " "; | ||
| $direction = ' '; | ||
|
|
||
| if ($lang->isRtl() && $myrtl == 0) | ||
| $isRtl= $lang->isRtl(); | ||
|
||
|
|
||
| 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); | ||
| ?> | ||
|
|
@@ -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') . '"'; | ||
|
|
@@ -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) . '"'; | ||
|
|
@@ -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> | ||
|
|
@@ -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> | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
|
|
@@ -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))) | ||
|
||
| { | ||
| $app->enqueueMessage(JText::_('JERROR_ALERTNOAUTHOR'), 'error'); | ||
| $app->setHeader('status', 403, true); | ||
|
|
@@ -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(); | ||
| } | ||
|
|
@@ -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) | ||
|
|
@@ -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(); | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice one! 😉