diff --git a/components/com_content/controller.php b/components/com_content/controller.php index 5a92a7f5beb58..4963dcf66f2fc 100644 --- a/components/com_content/controller.php +++ b/components/com_content/controller.php @@ -70,8 +70,8 @@ public function display($cachable = false, $urlparams = false) $user = JFactory::getUser(); if ($user->get('id') - || ($this->input->getMethod() == 'POST' - && (($vName == 'category' && $this->input->get('layout') != 'blog') || $vName == 'archive' ))) + || ($this->input->getMethod() === 'POST' + && (($vName === 'category' && $this->input->get('layout') !== 'blog') || $vName === 'archive' ))) { $cachable = false; } @@ -95,13 +95,13 @@ public function display($cachable = false, $urlparams = false) 'Itemid' => 'INT'); // Check for edit form. - if ($vName == 'form' && !$this->checkEditId('com_content.edit.article', $id)) + if ($vName === 'form' && !$this->checkEditId('com_content.edit.article', $id)) { // Somehow the person just went to the form - we don't allow that. return JError::raiseError(403, JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id)); } - if ($vName == 'article') + if ($vName === 'article') { // Get/Create the model if ($model = $this->getModel($vName)) diff --git a/components/com_content/controllers/article.php b/components/com_content/controllers/article.php index c28a71d7237a0..8bbadce50117b 100644 --- a/components/com_content/controllers/article.php +++ b/components/com_content/controllers/article.php @@ -274,21 +274,6 @@ protected function getReturnPage() } } - /** - * Function that allows child controller access to model data after the data has been saved. - * - * @param JModelLegacy $model The data model object. - * @param array $validData The validated data. - * - * @return void - * - * @since 1.6 - */ - protected function postSaveHook(JModelLegacy $model, $validData = array()) - { - return; - } - /** * Method to save a record. * diff --git a/components/com_content/helpers/association.php b/components/com_content/helpers/association.php index 112434a8326de..f186189461b91 100644 --- a/components/com_content/helpers/association.php +++ b/components/com_content/helpers/association.php @@ -33,10 +33,10 @@ abstract class ContentHelperAssociation 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 == 'article' || $view == 'category' || $view == 'featured') + if ($view === 'article' || $view === 'category' || $view === 'featured') { if ($id) { @@ -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_content'); } diff --git a/components/com_content/helpers/query.php b/components/com_content/helpers/query.php index b2ba240441099..03de25d175e51 100644 --- a/components/com_content/helpers/query.php +++ b/components/com_content/helpers/query.php @@ -212,7 +212,7 @@ public static function buildVotingQuery($params = null) $join = ''; } - return array ('select' => $select, 'join' => $join); + return array('select' => $select, 'join' => $join); } /** diff --git a/components/com_content/helpers/route.php b/components/com_content/helpers/route.php index 9521af51ff7a6..8bcf7d671e952 100644 --- a/components/com_content/helpers/route.php +++ b/components/com_content/helpers/route.php @@ -37,7 +37,7 @@ public static function getArticleRoute($id, $catid = 0, $language = 0) $link .= '&catid=' . $catid; } - if ($language && $language != '*' && JLanguageMultilang::isEnabled()) + if ($language && $language !== '*' && JLanguageMultilang::isEnabled()) { $link .= '&lang=' . $language; } @@ -74,7 +74,7 @@ public static function getCategoryRoute($catid, $language = 0) { $link = 'index.php?option=com_content&view=category&id=' . $id; - if ($language && $language != '*' && JLanguageMultilang::isEnabled()) + if ($language && $language !== '*' && JLanguageMultilang::isEnabled()) { $link .= '&lang=' . $language; } diff --git a/components/com_content/models/articles.php b/components/com_content/models/articles.php index 5b4c838bb0af7..b415ba10608ce 100644 --- a/components/com_content/models/articles.php +++ b/components/com_content/models/articles.php @@ -225,7 +225,7 @@ protected function getListQuery() // Join over the frontpage articles if required. if ($this->getState('filter.frontpage')) { - if ($orderby_sec == 'front') + if ($orderby_sec === 'front') { $query->join('INNER', '#__content_frontpage AS fp ON fp.content_id = a.id'); } @@ -234,7 +234,7 @@ protected function getListQuery() $query->where('a.featured = 1'); } } - elseif ($orderby_sec == 'front' || $this->getState('list.ordering') == 'fp.ordering') + elseif ($orderby_sec === 'front' || $this->getState('list.ordering') === 'fp.ordering') { $query->join('LEFT', '#__content_frontpage AS fp ON fp.content_id = a.id'); } @@ -503,7 +503,7 @@ protected function getListQuery() } // Process the filter for list views with user-entered filters - if (is_object($params) && ($params->get('filter_field') != 'hide') && ($filter = $this->getState('list.filter'))) + if (is_object($params) && ($params->get('filter_field') !== 'hide') && ($filter = $this->getState('list.filter'))) { // Clean filter variable $filter = StringHelper::strtolower($filter); @@ -591,8 +591,8 @@ public function getItems() /*For blogs, article params override menu item params only if menu param = 'use_article' Otherwise, menu item params control the layout If menu item is 'use_article' and there is no article param, use global*/ - if (($input->getString('layout') == 'blog') || ($input->getString('view') == 'featured') - || ($this->getState('params')->get('layout_type') == 'blog')) + if (($input->getString('layout') === 'blog') || ($input->getString('view') === 'featured') + || ($this->getState('params')->get('layout_type') === 'blog')) { // Create an array of just the params set to 'use_article' $menuParamsArray = $this->getState('params')->toArray(); diff --git a/components/com_content/models/category.php b/components/com_content/models/category.php index 20d1204f81d04..f8e6166526395 100644 --- a/components/com_content/models/category.php +++ b/components/com_content/models/category.php @@ -187,7 +187,7 @@ protected function populateState($ordering = null, $direction = null) $this->setState('list.start', $app->input->get('limitstart', 0, 'uint')); // Set limit for query. If list, use parameter. If blog, add blog parameters for limit. - if (($app->input->get('layout') == 'blog') || $params->get('layout_type') == 'blog') + if (($app->input->get('layout') === 'blog') || $params->get('layout_type') === 'blog') { $limit = $params->get('num_leading_articles') + $params->get('num_intro_articles') + $params->get('num_links'); $this->setState('list.links', $params->get('num_links')); @@ -458,9 +458,11 @@ public function &getChildren() { $params = $this->getState()->get('params'); - if ($params->get('orderby_pri') == 'alpha' || $params->get('orderby_pri') == 'ralpha') + $orderByPri = $params->get('orderby_pri'); + + if ($orderByPri === 'alpha' || $orderByPri === 'ralpha') { - $this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($params->get('orderby_pri') == 'alpha') ? 1 : (-1)); + $this->_children = ArrayHelper::sortObjects($this->_children, 'title', ($orderByPri === 'alpha') ? 1 : (-1)); } } diff --git a/components/com_content/models/form.php b/components/com_content/models/form.php index f8301e312381d..8477d820c3172 100644 --- a/components/com_content/models/form.php +++ b/components/com_content/models/form.php @@ -177,17 +177,15 @@ public function getReturnPage() public function save($data) { // Associations are not edited in frontend ATM so we have to inherit them - if (JLanguageAssociations::isEnabled() && !empty($data['id'])) + if (JLanguageAssociations::isEnabled() && !empty($data['id']) + && $associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $data['id'])) { - if ($associations = JLanguageAssociations::getAssociations('com_content', '#__content', 'com_content.item', $data['id'])) + foreach ($associations as $tag => $associated) { - foreach ($associations as $tag => $associated) - { - $associations[$tag] = (int) $associated->id; - } - - $data['associations'] = $associations; + $associations[$tag] = (int) $associated->id; } + + $data['associations'] = $associations; } return parent::save($data); diff --git a/components/com_content/views/archive/tmpl/default.php b/components/com_content/views/archive/tmpl/default.php index f00671c0102ae..211404eb073a5 100644 --- a/components/com_content/views/archive/tmpl/default.php +++ b/components/com_content/views/archive/tmpl/default.php @@ -24,7 +24,7 @@