diff --git a/components/com_ajax/ajax.php b/components/com_ajax/ajax.php index 6c469cf2f2686..fb3d837f8318b 100644 --- a/components/com_ajax/ajax.php +++ b/components/com_ajax/ajax.php @@ -82,7 +82,7 @@ $class = 'Mod' . ucfirst($module) . 'Helper'; } - $method = $input->get('method') ? $input->get('method') : 'get'; + $method = $input->get('method') ?: 'get'; if (is_file($helperFile)) { diff --git a/components/com_banners/models/banners.php b/components/com_banners/models/banners.php index aea8d854e4066..d5997298c221d 100644 --- a/components/com_banners/models/banners.php +++ b/components/com_banners/models/banners.php @@ -62,7 +62,7 @@ protected function getListQuery() $cid = $this->getState('filter.client_id'); $categoryId = $this->getState('filter.category_id'); $keywords = $this->getState('filter.keywords'); - $randomise = ($ordering == 'random'); + $randomise = ($ordering === 'random'); $nullDate = $db->quote($db->getNullDate()); $nowDate = $db->quote(JFactory::getDate()->toSql()); @@ -120,7 +120,7 @@ protected function getListQuery() $query->where($categoryEquals); } } - elseif ((is_array($categoryId)) && (count($categoryId) > 0)) + elseif (is_array($categoryId) && (count($categoryId) > 0)) { $categoryId = ArrayHelper::toInteger($categoryId); $categoryId = implode(',', $categoryId); @@ -134,7 +134,7 @@ protected function getListQuery() if ($tagSearch) { - if (count($keywords) == 0) + if (count($keywords) === 0) { $query->where('0'); } @@ -152,31 +152,44 @@ protected function getListQuery() foreach ($keywords as $keyword) { $keyword = trim($keyword); - $condition1 = "a.own_prefix=1 " - . " AND a.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH( a.metakey_prefix)) " - . " OR a.own_prefix=0 " - . " AND cl.own_prefix=1 " - . " AND cl.metakey_prefix=SUBSTRING(" . $db->quote($keyword) . ",1,LENGTH(cl.metakey_prefix)) " - . " OR a.own_prefix=0 " - . " AND cl.own_prefix=0 " - . " AND " . ($prefix == substr($keyword, 0, strlen($prefix)) ? '1' : '0'); - $condition2 = "a.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'"; + $quotedKeyword = $db->quote($keyword); + $prefixCondition = ($prefix === substr($keyword, 0, strlen($prefix)) ? '1' : '0'); + + $condition1 = /** @lang SQL */ + <<escape($keyword); + $condition2 = "a.metakey REGEXP '[[:<:]]" . $escapedKeyword . "[[:>:]]'"; if ($cid) { - $condition2 .= " OR cl.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'"; + $condition2 .= " OR cl.metakey REGEXP '[[:<:]]" . $escapedKeyword . "[[:>:]]'"; } if ($categoryId) { - $condition2 .= " OR cat.metakey REGEXP '[[:<:]]" . $db->escape($keyword) . "[[:>:]]'"; + $condition2 .= " OR cat.metakey REGEXP '[[:<:]]" . $escapedKeyword . "[[:>:]]'"; } - $temp[] = "($condition1) AND ($condition2)"; + $temp = "($condition1) AND ($condition2)"; } - $query->where('(' . implode(' OR ', $temp) . ')'); + $query->where($temp); } } @@ -288,7 +301,7 @@ public function impress() JError::raiseError(500, $e->getMessage()); } - if ($db->getAffectedRows() == 0) + if ($db->getAffectedRows() === 0) { // Insert new count $query->clear(); diff --git a/components/com_config/controller/config/display.php b/components/com_config/controller/config/display.php index 05ce1d580a6e9..125621161e10f 100644 --- a/components/com_config/controller/config/display.php +++ b/components/com_config/controller/config/display.php @@ -59,7 +59,7 @@ public function execute() if (class_exists($viewClass)) { - if ($viewName != 'close') + if ($viewName !== 'close') { $model = new $modelClass; diff --git a/components/com_config/controller/display.php b/components/com_config/controller/display.php index a9049444edd48..83d0eff450298 100644 --- a/components/com_config/controller/display.php +++ b/components/com_config/controller/display.php @@ -95,7 +95,7 @@ public function execute() $view->document = $document; // Reply for service requests - if ($viewFormat == 'json') + if ($viewFormat === 'json') { return $view->render(); } diff --git a/components/com_config/controller/helper.php b/components/com_config/controller/helper.php index 1799294ed91e0..8fef129d8150a 100644 --- a/components/com_config/controller/helper.php +++ b/components/com_config/controller/helper.php @@ -62,7 +62,7 @@ public function parseController($app) } } - if (empty($tasks[0]) || $tasks[0] == 'Config') + if (empty($tasks[0]) || $tasks[0] === 'Config') { $location = 'Config'; } @@ -90,7 +90,7 @@ public function parseController($app) // Some special handling for com_config administrator $option = $app->input->get('option'); - if ($app->isAdmin() && $option == 'com_config') + if ($option === 'com_config' && $app->isAdmin()) { $component = $app->input->get('component'); @@ -98,7 +98,7 @@ public function parseController($app) { $view = 'Component'; } - elseif ($option == 'com_config') + elseif ($option === 'com_config') { $view = 'Application'; } diff --git a/components/com_config/controller/templates/display.php b/components/com_config/controller/templates/display.php index ddd610247d2d2..2ee48e452acf4 100644 --- a/components/com_config/controller/templates/display.php +++ b/components/com_config/controller/templates/display.php @@ -62,7 +62,7 @@ public function execute() if (class_exists($viewClass)) { - if ($viewName != 'close') + if ($viewName !== 'close') { $model = new $modelClass; diff --git a/components/com_config/model/cms.php b/components/com_config/model/cms.php index f6966288ab1a2..29aa70375adf7 100644 --- a/components/com_config/model/cms.php +++ b/components/com_config/model/cms.php @@ -218,8 +218,8 @@ protected function cleanCache($group = null, $client_id = 0) $dispatcher = JEventDispatcher::getInstance(); $options = array( - 'defaultgroup' => ($group) ? $group : (isset($this->option) ? $this->option : JFactory::getApplication()->input->get('option')), - 'cachebase' => ($client_id) ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache')); + 'defaultgroup' => $group ?: (isset($this->option) ? $this->option : JFactory::getApplication()->input->get('option')), + 'cachebase' => $client_id ? JPATH_ADMINISTRATOR . '/cache' : $conf->get('cache_path', JPATH_SITE . '/cache')); $cache = JCache::getInstance('callback', $options); $cache->clean(); diff --git a/components/com_config/model/templates.php b/components/com_config/model/templates.php index fa11999839f0c..fc3485ef90d6f 100644 --- a/components/com_config/model/templates.php +++ b/components/com_config/model/templates.php @@ -108,13 +108,10 @@ protected function preprocessForm(JForm $form, $data, $group = 'content') $formFile = JPath::clean(JPATH_BASE . '/templates/' . $template . '/templateDetails.xml'); } - if (file_exists($formFile)) + // Get the template form. + if (file_exists($formFile) && !$form->loadFile($formFile, false, '//config')) { - // Get the template form. - if (!$form->loadFile($formFile, false, '//config')) - { throw new Exception(JText::_('JERROR_LOADFILE_FAILED')); - } } // Attempt to load the xml file. diff --git a/components/com_config/view/cms/html.php b/components/com_config/view/cms/html.php index 6699fef2d6fed..1c9b680b19d58 100644 --- a/components/com_config/view/cms/html.php +++ b/components/com_config/view/cms/html.php @@ -126,8 +126,7 @@ public function loadTemplate($tpl = null) if ($this->_template != false) { // Unset so as not to introduce into template scope - unset($tpl); - unset($file); + unset($tpl, $file); // Never allow a 'this' property if (isset($this->this)) diff --git a/components/com_config/view/modules/tmpl/default.php b/components/com_config/view/modules/tmpl/default.php index 06c7ee3ab4f13..0a1bb7ca95e2c 100644 --- a/components/com_config/view/modules/tmpl/default.php +++ b/components/com_config/view/modules/tmpl/default.php @@ -15,7 +15,7 @@ JHtml::_('behavior.combobox'); JHtml::_('formbehavior.chosen', 'select'); -$hasContent = empty($this->item['module']) || $this->item['module'] == 'custom' || $this->item['module'] == 'mod_custom'; +$hasContent = empty($this->item['module']) || $this->item['module'] === 'custom' || $this->item['module'] === 'mod_custom'; // If multi-language site, make language read-only if (JLanguageMultilang::isEnabled()) diff --git a/components/com_config/view/modules/tmpl/default_options.php b/components/com_config/view/modules/tmpl/default_options.php index 0589a9f31f911..41ed53b7a2688 100644 --- a/components/com_config/view/modules/tmpl/default_options.php +++ b/components/com_config/view/modules/tmpl/default_options.php @@ -37,7 +37,7 @@
item['module'] == 'mod_menu' && $field->getAttribute('name') == 'menutype') + if (JLanguageMultilang::isEnabled() && $this->item['module'] === 'mod_menu' && $field->getAttribute('name') === 'menutype') { $field->__set('readonly', true); } diff --git a/components/com_contact/controllers/contact.php b/components/com_contact/controllers/contact.php index 4b6e4b6f77da0..8993230bc55dd 100644 --- a/components/com_contact/controllers/contact.php +++ b/components/com_contact/controllers/contact.php @@ -59,7 +59,7 @@ public function submit() // Check for a valid session cookie if ($params->get('validate_session', 0)) { - if (JFactory::getSession()->getState() != 'active') + if (JFactory::getSession()->getState() !== 'active') { JError::raiseWarning(403, JText::_('JLIB_ENVIRONMENT_SESSION_INVALID')); diff --git a/components/com_contact/helpers/association.php b/components/com_contact/helpers/association.php index 2f2be6c3956ae..a3b8ad9338a39 100644 --- a/components/com_contact/helpers/association.php +++ b/components/com_contact/helpers/association.php @@ -33,10 +33,10 @@ abstract class ContactHelperAssociation 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 == 'contact') + if ($view === 'contact') { 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_contact'); } diff --git a/components/com_contact/helpers/route.php b/components/com_contact/helpers/route.php index 6b3f210238c14..2b3394e498f6e 100644 --- a/components/com_contact/helpers/route.php +++ b/components/com_contact/helpers/route.php @@ -54,7 +54,7 @@ public static function getContactRoute($id, $catid, $language = 0) } } - if ($language && $language != "*" && JLanguageMultilang::isEnabled()) + if ($language && $language !== '*' && JLanguageMultilang::isEnabled()) { $link .= '&lang=' . $language; $needles['language'] = $language; @@ -106,7 +106,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; @@ -145,7 +145,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'], '*'); @@ -155,7 +155,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']; @@ -171,7 +171,7 @@ protected static function _findItem($needles = null) * 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; } @@ -199,7 +199,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; } diff --git a/components/com_contact/models/category.php b/components/com_contact/models/category.php index 044d42b783d74..57976cd3e6de3 100644 --- a/components/com_contact/models/category.php +++ b/components/com_contact/models/category.php @@ -159,7 +159,7 @@ protected function getListQuery() // Join over the users for the author and modified_by names. $query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author") - ->select("ua.email AS author_email") + ->select('ua.email AS author_email') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by') ->join('LEFT', '#__users AS uam ON uam.id = a.modified_by'); @@ -201,7 +201,7 @@ protected function getListQuery() } // Set sortname ordering if selected - if ($this->getState('list.ordering') == 'sortname') + if ($this->getState('list.ordering') === 'sortname') { $query->order($db->escape('a.sortname1') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))) ->order($db->escape('a.sortname2') . ' ' . $db->escape($this->getState('list.direction', 'ASC'))) @@ -235,7 +235,7 @@ protected function populateState($ordering = null, $direction = null) // List state information $format = $app->input->getWord('format'); - if ($format == 'feed') + if ($format === 'feed') { $limit = $app->get('feed_limit'); } diff --git a/components/com_contact/models/contact.php b/components/com_contact/models/contact.php index 32f5e535183ed..f19e65b89179b 100644 --- a/components/com_contact/models/contact.php +++ b/components/com_contact/models/contact.php @@ -199,7 +199,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_CONTACT_ERROR_CONTACT_NOT_FOUND')); } diff --git a/components/com_contact/router.php b/components/com_contact/router.php index 3de9dc7910d1c..fa36616019695 100644 --- a/components/com_contact/router.php +++ b/components/com_contact/router.php @@ -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_contact') + if (empty($query['Itemid']) || empty($menuItem) || $menuItem->component !== 'com_contact') { $segments[] = $query['view']; } @@ -58,19 +58,17 @@ public function build(&$query) } // Are we dealing with a contact that is attached to a menu item? - if (isset($view) && ($mView == $view) and (isset($query['id'])) and ($mId == (int) $query['id'])) + if (isset($view, $query['id']) && ($mView == $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 == 'contact')) + if (isset($view) && ($view === 'category' || $view === 'contact')) { - if ($mId != (int) $query['id'] || $mView != $view) + if ($mView != $view || $mId != (int) $query['id']) { - if ($view == 'contact' && isset($query['catid'])) + if ($view === 'contact' && isset($query['catid'])) { $catid = $query['catid']; } @@ -92,7 +90,7 @@ public function build(&$query) foreach ($path as $id) { - if ((int) $id == (int) $menuCatid) + if ((int) $id === (int) $menuCatid) { break; } @@ -108,7 +106,7 @@ public function build(&$query) $segments = array_merge($segments, array_reverse($array)); } - if ($view == 'contact') + if ($view === 'contact') { if ($advanced) { @@ -123,8 +121,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']); } @@ -196,7 +193,7 @@ public function parse(&$segments) $contactCategory = JCategories::getInstance('Contact')->get($id); - $categories = ($contactCategory) ? $contactCategory->getChildren() : array(); + $categories = $contactCategory ? $contactCategory->getChildren() : array(); $vars['catid'] = $id; $vars['id'] = $id; $found = 0; @@ -218,7 +215,7 @@ public function parse(&$segments) } } - if ($found == 0) + if ($found === 0) { if ($advanced) { diff --git a/components/com_contact/views/categories/tmpl/default_items.php b/components/com_contact/views/categories/tmpl/default_items.php index 2d718bf1f5c83..041ea24a2f232 100644 --- a/components/com_contact/views/categories/tmpl/default_items.php +++ b/components/com_contact/views/categories/tmpl/default_items.php @@ -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) : ?> items[$this->parent->id] as $id => $item) : ?> numitems; ?> - getChildren()) > 0 && $this->maxLevelcat > 1) : ?> + maxLevelcat > 1 && count($item->getChildren()) > 0) : ?> @@ -46,7 +46,7 @@ - getChildren()) > 0 && $this->maxLevelcat > 1) :?> + maxLevelcat > 1 && count($item->getChildren()) > 0) :?>
items[$item->id] = $item->getChildren(); diff --git a/components/com_contact/views/category/tmpl/default_children.php b/components/com_contact/views/category/tmpl/default_children.php index 11e0fed99afaf..b7bba546b9222 100644 --- a/components/com_contact/views/category/tmpl/default_children.php +++ b/components/com_contact/views/category/tmpl/default_children.php @@ -9,7 +9,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) : ?>
    children[$this->category->id] as $id => $child) : ?> diff --git a/components/com_contact/views/category/view.html.php b/components/com_contact/views/category/view.html.php index 1dde9a62c0988..49fa1643d5062 100644 --- a/components/com_contact/views/category/view.html.php +++ b/components/com_contact/views/category/view.html.php @@ -62,7 +62,7 @@ public function display($tpl = null) $item->slug = $item->alias ? ($item->id . ':' . $item->alias) : $item->id; $temp = new Registry; $temp->loadString($item->params); - $item->params = clone($this->params); + $item->params = clone$this->params; $item->params->merge($temp); if ($item->params->get('show_email_headings', 0) == 1) @@ -100,7 +100,7 @@ protected function prepareDocument() $path = array(array('title' => $this->category->title, 'link' => '')); $category = $this->category->getParent(); - while (($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1) + while (($menu->query['option'] !== 'com_contact' || $menu->query['view'] === 'contact' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($category->id)); $category = $category->getParent(); diff --git a/components/com_contact/views/contact/tmpl/default.php b/components/com_contact/views/contact/tmpl/default.php index ce35f95861ea7..3ee38a51e745a 100644 --- a/components/com_contact/views/contact/tmpl/default.php +++ b/components/com_contact/views/contact/tmpl/default.php @@ -34,11 +34,11 @@ get('show_contact_category'); ?> - +

    contact->category_title; ?>

    - + contact->catid); ?>

    @@ -65,13 +65,13 @@ get('presentation_style'); ?> - + 'basic-details')); ?> - + 'basic-details')); ?> - + ' . JText::_('COM_CONTACT_DETAILS') . '

    '; ?> @@ -97,26 +97,26 @@ - + - + get('show_email_form') && ($this->contact->email_to || $this->contact->user_id)) : ?> - + - + - + ' . JText::_('COM_CONTACT_EMAIL_FORM') . ''; ?> loadTemplate('form'); ?> - + - + @@ -126,47 +126,47 @@ get('show_articles') && $this->contact->user_id && $this->contact->articles) : ?> - + - + - + ' . JText::_('JGLOBAL_ARTICLES') . ''; ?> loadTemplate('articles'); ?> - + - + get('show_profile') && $this->contact->user_id && JPluginHelper::isEnabled('user', 'profile')) : ?> - + - + - + ' . JText::_('COM_CONTACT_PROFILE') . ''; ?> loadTemplate('profile'); ?> - + - + contact->misc && $tparams->get('show_misc')) : ?> - + - + - + ' . JText::_('COM_CONTACT_OTHER_INFORMATION') . ''; ?> @@ -185,16 +185,16 @@
- + - + - + - + diff --git a/components/com_contact/views/contact/tmpl/default_form.php b/components/com_contact/views/contact/tmpl/default_form.php index 31b0e2b282b99..ef21ae02405cd 100644 --- a/components/com_contact/views/contact/tmpl/default_form.php +++ b/components/com_contact/views/contact/tmpl/default_form.php @@ -22,7 +22,7 @@ form->getFieldset($fieldset->name); ?>
- label) && strlen($legend = trim(JText::_($fieldset->label)))) : ?> + label) && ($legend = trim(JText::_($fieldset->label))) !== '') : ?> diff --git a/components/com_contact/views/contact/tmpl/default_links.php b/components/com_contact/views/contact/tmpl/default_links.php index 4a38c96c5f9d1..8f7ecddb9171b 100644 --- a/components/com_contact/views/contact/tmpl/default_links.php +++ b/components/com_contact/views/contact/tmpl/default_links.php @@ -10,13 +10,13 @@ defined('_JEXEC') or die; ?> -params->get('presentation_style') == 'sliders') : ?> +params->get('presentation_style') === 'sliders') : ?> -params->get('presentation_style') == 'tabs') : ?> +params->get('presentation_style') === 'tabs') : ?> -params->get('presentation_style') == 'plain'):?> +params->get('presentation_style') === 'plain'):?> ' . JText::_('COM_CONTACT_LINKS') . ''; ?> @@ -36,7 +36,7 @@ $link = (0 === strpos($link, 'http')) ? $link : 'http://' . $link; // If no label is present, take the link - $label = ($label) ? $label : $link; + $label = $label ?: $link; ?>
  • ' . JStringPunycode::urlToUTF8($profile->text) . '
    '; else : echo '
    ' . JStringPunycode::urlToUTF8($profile->text) . '
    '; endif; break; - case "profile_dob": + case 'profile_dob': echo '
    ' . JHtml::_('date', $profile->text, JText::_('DATE_FORMAT_LC4'), false) . '
    '; break; diff --git a/components/com_contact/views/contact/view.html.php b/components/com_contact/views/contact/view.html.php index 174c5b37d5fc8..fc23735bc935a 100644 --- a/components/com_contact/views/contact/view.html.php +++ b/components/com_contact/views/contact/view.html.php @@ -138,12 +138,12 @@ public function display($tpl = null) { case 1 : // Text - $params->set('marker_address', JText::_('COM_CONTACT_ADDRESS') . ": "); - $params->set('marker_email', JText::_('JGLOBAL_EMAIL') . ": "); - $params->set('marker_telephone', JText::_('COM_CONTACT_TELEPHONE') . ": "); - $params->set('marker_fax', JText::_('COM_CONTACT_FAX') . ": "); - $params->set('marker_mobile', JText::_('COM_CONTACT_MOBILE') . ": "); - $params->set('marker_misc', JText::_('COM_CONTACT_OTHER_INFORMATION') . ": "); + $params->set('marker_address', JText::_('COM_CONTACT_ADDRESS') . ': '); + $params->set('marker_email', JText::_('JGLOBAL_EMAIL') . ': '); + $params->set('marker_telephone', JText::_('COM_CONTACT_TELEPHONE') . ': '); + $params->set('marker_fax', JText::_('COM_CONTACT_FAX') . ': '); + $params->set('marker_mobile', JText::_('COM_CONTACT_MOBILE') . ': '); + $params->set('marker_misc', JText::_('COM_CONTACT_OTHER_INFORMATION') . ': '); $params->set('marker_class', 'jicons-text'); break; @@ -161,60 +161,60 @@ public function display($tpl = null) default : if ($params->get('icon_address')) { - $image1 = JHtml::_('image', $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS') . ": ", null, false); + $image1 = JHtml::_('image', $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS') . ': ', null, false); } else { - $image1 = JHtml::_('image', 'contacts/' . $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS') . ": ", null, true); + $image1 = JHtml::_('image', 'contacts/' . $params->get('icon_address', 'con_address.png'), JText::_('COM_CONTACT_ADDRESS') . ': ', null, true); } if ($params->get('icon_email')) { - $image2 = JHtml::_('image', $params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL') . ": ", null, false); + $image2 = JHtml::_('image', $params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL') . ': ', null, false); } else { - $image2 = JHtml::_('image', 'contacts/' . $params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL') . ": ", null, true); + $image2 = JHtml::_('image', 'contacts/' . $params->get('icon_email', 'emailButton.png'), JText::_('JGLOBAL_EMAIL') . ': ', null, true); } if ($params->get('icon_telephone')) { - $image3 = JHtml::_('image', $params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE') . ": ", null, false); + $image3 = JHtml::_('image', $params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE') . ': ', null, false); } else { - $image3 = JHtml::_('image', 'contacts/' . $params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE') . ": ", null, true); + $image3 = JHtml::_('image', 'contacts/' . $params->get('icon_telephone', 'con_tel.png'), JText::_('COM_CONTACT_TELEPHONE') . ': ', null, true); } if ($params->get('icon_fax')) { - $image4 = JHtml::_('image', $params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX') . ": ", null, false); + $image4 = JHtml::_('image', $params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX') . ': ', null, false); } else { - $image4 = JHtml::_('image', 'contacts/' . $params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX') . ": ", null, true); + $image4 = JHtml::_('image', 'contacts/' . $params->get('icon_fax', 'con_fax.png'), JText::_('COM_CONTACT_FAX') . ': ', null, true); } if ($params->get('icon_misc')) { - $image5 = JHtml::_('image', $params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION') . ": ", null, false); + $image5 = JHtml::_('image', $params->get('icon_misc', 'con_info.png'), JText::_('COM_CONTACT_OTHER_INFORMATION') . ': ', null, false); } else { $image5 = JHtml::_( 'image', 'contacts/' . $params->get('icon_misc', 'con_info.png'), - JText::_('COM_CONTACT_OTHER_INFORMATION') . ": ", null, true + JText::_('COM_CONTACT_OTHER_INFORMATION') . ': ', null, true ); } if ($params->get('icon_mobile')) { - $image6 = JHtml::_('image', $params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE') . ": ", null, false); + $image6 = JHtml::_('image', $params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE') . ': ', null, false); } else { - $image6 = JHtml::_('image', 'contacts/' . $params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE') . ": ", null, true); + $image6 = JHtml::_('image', 'contacts/' . $params->get('icon_mobile', 'con_mobile.png'), JText::_('COM_CONTACT_MOBILE') . ': ', null, true); } $params->set('marker_address', $image1); @@ -344,7 +344,7 @@ protected function _prepareDocument() $id = (int) @$menu->query['id']; // If the menu item does not concern this contact - if ($menu && ($menu->query['option'] != 'com_contact' || $menu->query['view'] != 'contact' || $id != $this->item->id)) + if ($menu && ($menu->query['option'] !== 'com_contact' || $menu->query['view'] !== 'contact' || $id != $this->item->id)) { // If this is not a single contact menu item, set the page title to the contact title if ($this->item->name) @@ -355,7 +355,7 @@ protected function _prepareDocument() $path = array(array('title' => $this->contact->name, 'link' => '')); $category = JCategories::getInstance('Contact')->get($this->contact->catid); - while ($category && ($menu->query['option'] != 'com_contact' || $menu->query['view'] == 'contact' || $id != $category->id) && $category->id > 1) + while ($category && ($menu->query['option'] !== 'com_contact' || $menu->query['view'] === 'contact' || $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => ContactHelperRoute::getCategoryRoute($this->contact->catid)); $category = $category->getParent(); diff --git a/components/com_contact/views/featured/tmpl/default_items.php b/components/com_contact/views/featured/tmpl/default_items.php index 0e5d96a2a2086..04654ae96441b 100644 --- a/components/com_contact/views/featured/tmpl/default_items.php +++ b/components/com_contact/views/featured/tmpl/default_items.php @@ -95,7 +95,7 @@ items as $i => $item) : ?> - " itemscope itemtype="https://schema.org/Person"> + diff --git a/components/com_content/controller.php b/components/com_content/controller.php index ae86b40a271b4..efaf6c087d4ca 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 be4ebf16b112d..a86c062355348 100644 --- a/components/com_content/controllers/article.php +++ b/components/com_content/controllers/article.php @@ -286,7 +286,6 @@ protected function getReturnPage() */ protected function postSaveHook(JModelLegacy $model, $validData = array()) { - return; } /** diff --git a/components/com_content/helpers/association.php b/components/com_content/helpers/association.php index 278cdbeb5e8b5..bea3aca6295b8 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') + if ($view === 'article') { 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/icon.php b/components/com_content/helpers/icon.php index a0a034fca05f6..84eb0d5332ed0 100644 --- a/components/com_content/helpers/icon.php +++ b/components/com_content/helpers/icon.php @@ -55,7 +55,7 @@ public static function create($category, $params, $attribs = array(), $legacy = // Add the button classes to the attribs array if (isset($attribs['class'])) { - $attribs['class'] = $attribs['class'] . ' btn btn-primary'; + $attribs['class'] .= ' btn btn-primary'; } else { @@ -111,9 +111,7 @@ public static function email($article, $params, $attribs = array(), $legacy = fa $attribs['onclick'] = "window.open(this.href,'win2','" . $status . "'); return false;"; $attribs['rel'] = 'nofollow'; - $output = JHtml::_('link', JRoute::_($url), $text, $attribs); - - return $output; + return JHtml::_('link', JRoute::_($url), $text, $attribs); } /** @@ -190,7 +188,7 @@ public static function edit($article, $params, $attribs = array(), $legacy = fal } $date = JHtml::_('date', $article->created); - $author = $article->created_by_alias ? $article->created_by_alias : $article->author; + $author = $article->created_by_alias ?: $article->author; $overlib .= '<br />'; $overlib .= $date; diff --git a/components/com_content/helpers/query.php b/components/com_content/helpers/query.php index bcb789bc03142..4b4d25247eaeb 100644 --- a/components/com_content/helpers/query.php +++ b/components/com_content/helpers/query.php @@ -180,9 +180,7 @@ public static function buildVotingQuery($params = null) $join = ''; } - $results = array ('select' => $select, 'join' => $join); - - return $results; + return array ('select' => $select, 'join' => $join); } /** diff --git a/components/com_content/helpers/route.php b/components/com_content/helpers/route.php index 5dece4143a292..be3434a5f7681 100644 --- a/components/com_content/helpers/route.php +++ b/components/com_content/helpers/route.php @@ -51,7 +51,7 @@ public static function getArticleRoute($id, $catid = 0, $language = 0) } } - if ($language && $language != "*" && JLanguageMultilang::isEnabled()) + if ($language && $language !== '*' && JLanguageMultilang::isEnabled()) { $link .= '&lang=' . $language; $needles['language'] = $language; @@ -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; @@ -164,7 +164,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'], '*'); @@ -174,7 +174,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']; @@ -190,7 +190,7 @@ protected static function _findItem($needles = null) * 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; } @@ -220,8 +220,8 @@ protected static function _findItem($needles = null) $active = $menus->getActive(); if ($active - && $active->component == 'com_content' - && ($language == '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) + && $active->component === 'com_content' + && ($language === '*' || in_array($active->language, array('*', $language)) || !JLanguageMultilang::isEnabled())) { return $active->id; } diff --git a/components/com_content/models/article.php b/components/com_content/models/article.php index b72a4de0a3b40..29addb74d8781 100644 --- a/components/com_content/models/article.php +++ b/components/com_content/models/article.php @@ -164,7 +164,7 @@ public function getItem($pk = null) } // Check for published state if filter set. - if (((is_numeric($published)) || (is_numeric($archived))) && (($data->state != $published) && ($data->state != $archived))) + if ((is_numeric($published) || is_numeric($archived)) && (($data->state != $published) && ($data->state != $archived))) { return JError::raiseError(404, JText::_('COM_CONTENT_ERROR_ARTICLE_NOT_FOUND')); } @@ -333,7 +333,7 @@ public function storeVote($pk = 0, $rate = 0) } else { - if ($userIP != ($rating->lastip)) + if ($userIP != $rating->lastip) { $query = $db->getQuery(true); diff --git a/components/com_content/models/articles.php b/components/com_content/models/articles.php index 15d0fa8f61967..813e81a0541e0 100644 --- a/components/com_content/models/articles.php +++ b/components/com_content/models/articles.php @@ -224,7 +224,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'); } @@ -233,7 +233,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'); } @@ -244,7 +244,7 @@ protected function getListQuery() // Join over the users for the author and modified_by names. $query->select("CASE WHEN a.created_by_alias > ' ' THEN a.created_by_alias ELSE ua.name END AS author") - ->select("ua.email AS author_email") + ->select('ua.email AS author_email') ->join('LEFT', '#__users AS ua ON ua.id = a.created_by') ->join('LEFT', '#__users AS uam ON uam.id = a.modified_by'); @@ -498,7 +498,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 = JString::strtolower($filter); @@ -587,8 +587,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 5906a59c090e1..a2035f7d10160 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')); @@ -457,9 +457,10 @@ 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', ($params->get('orderby_pri') === 'alpha') ? 1 : (-1)); } } diff --git a/components/com_content/models/form.php b/components/com_content/models/form.php index c39be47a16b08..3833b225e8a34 100644 --- a/components/com_content/models/form.php +++ b/components/com_content/models/form.php @@ -179,17 +179,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) { $associations[$tag] = (int) $associated->id; } $data['associations'] = $associations; - } } return parent::save($data); diff --git a/components/com_content/router.php b/components/com_content/router.php index 9a7ef6e7583fa..c803e122081a8 100644 --- a/components/com_content/router.php +++ b/components/com_content/router.php @@ -52,7 +52,7 @@ public function build(&$query) } // Check again - if ($menuItemGiven && isset($menuItem) && $menuItem->component != 'com_content') + if ($menuItemGiven && isset($menuItem) && $menuItem->component !== 'com_content') { $menuItemGiven = false; unset($query['Itemid']); @@ -91,7 +91,7 @@ public function build(&$query) return $segments; } - if ($view == 'category' || $view == 'article') + if ($view === 'category' || $view === 'article') { if (!$menuItemGiven) { @@ -100,9 +100,9 @@ public function build(&$query) unset($query['view']); - if ($view == 'article') + if ($view === 'article') { - if (isset($query['id']) && isset($query['catid']) && $query['catid']) + if (isset($query['id'], $query['catid']) && $query['catid']) { $catid = $query['catid']; @@ -162,7 +162,7 @@ public function build(&$query) foreach ($path as $id) { - if ((int) $id == (int) $mCatid) + if ((int) $id === (int) $mCatid) { break; } @@ -181,7 +181,7 @@ public function build(&$query) $segments = array_merge($segments, $array); - if ($view == 'article') + if ($view === 'article') { if ($advanced) { @@ -195,13 +195,12 @@ public function build(&$query) $segments[] = $id; } - unset($query['id']); - unset($query['catid']); + unset($query['id'], $query['catid']); } - if ($view == 'archive') + if ($view === 'archive') { - if (!$menuItemGiven || $menuItem->query['view'] != 'archive') + if (!$menuItemGiven || $menuItem->query['view'] !== 'archive') { // Did not work without removing Itemid if (isset($menuItem)) @@ -227,7 +226,7 @@ public function build(&$query) } } - if ($view == 'featured') + if ($view === 'featured') { if (!$menuItemGiven) { @@ -252,7 +251,7 @@ public function build(&$query) } else { - if ($query['layout'] == 'default') + if ($query['layout'] === 'default') { unset($query['layout']); } @@ -306,7 +305,7 @@ public function parse(&$segments) $vars['view'] = $segments[0]; // Called if no menu item created - if ($vars['view'] == 'archive') + if ($vars['view'] === 'archive') { $vars['year'] = $count >= 2 ? $segments[$count - 2] : null; $vars['month'] = $segments[$count - 1]; @@ -324,7 +323,7 @@ public function parse(&$segments) * We test it first to see if it is a category. If the id and alias match a category, * then we assume it is a category. If they don't we assume it is an article */ - if ($count == 1) + if ($count === 1) { // We check to see if an alias is given. If not, we assume it is an article if (strpos($segments[0], ':') === false) @@ -429,7 +428,7 @@ public function parse(&$segments) } } - if ($found == 0) + if ($found === 0) { if ($advanced) { diff --git a/components/com_content/views/archive/tmpl/default.php b/components/com_content/views/archive/tmpl/default.php index f14093209c2e8..252e8710cbc78 100644 --- a/components/com_content/views/archive/tmpl/default.php +++ b/components/com_content/views/archive/tmpl/default.php @@ -24,7 +24,7 @@