diff --git a/plugins/authentication/cookie/cookie.php b/plugins/authentication/cookie/cookie.php
index ae62957120b62..15b4454f3727c 100644
--- a/plugins/authentication/cookie/cookie.php
+++ b/plugins/authentication/cookie/cookie.php
@@ -269,7 +269,7 @@ public function onUserAfterLogin($options)
{
$results = $this->db->setQuery($query)->loadResult();
- if (is_null($results))
+ if ($results === null)
{
$unique = true;
}
diff --git a/plugins/authentication/gmail/gmail.php b/plugins/authentication/gmail/gmail.php
index 8e8cf2671eeaa..662f24625d0e9 100644
--- a/plugins/authentication/gmail/gmail.php
+++ b/plugins/authentication/gmail/gmail.php
@@ -65,7 +65,7 @@ public function onUserAuthenticate($credentials, $options, &$response)
}
// Check if we have a username and password
- if (strlen($credentials['username']) == 0 || strlen($credentials['password']) == 0)
+ if ($credentials['username'] === '' || $credentials['password'] === '')
{
$response->type = 'GMail';
$response->status = JAuthentication::STATUS_FAILURE;
diff --git a/plugins/authentication/joomla/joomla.php b/plugins/authentication/joomla/joomla.php
index f1614b005941a..7535ddc765517 100644
--- a/plugins/authentication/joomla/joomla.php
+++ b/plugins/authentication/joomla/joomla.php
@@ -92,7 +92,7 @@ public function onUserAuthenticate($credentials, $options, &$response)
}
// Check the two factor authentication
- if ($response->status == JAuthentication::STATUS_SUCCESS)
+ if ($response->status === JAuthentication::STATUS_SUCCESS)
{
$methods = JAuthenticationHelper::getTwoFactorMethods();
diff --git a/plugins/authentication/ldap/ldap.php b/plugins/authentication/ldap/ldap.php
index 49f4da3b0d7ec..2e8549e0151a9 100644
--- a/plugins/authentication/ldap/ldap.php
+++ b/plugins/authentication/ldap/ldap.php
@@ -72,7 +72,7 @@ public function onUserAuthenticate($credentials, $options, &$response)
{
// Bind using Connect Username/password
// Force anon bind to mitigate misconfiguration like [#7119]
- if (strlen($this->params->get('username')))
+ if ($this->params->get('username', '') !== '')
{
$bindtest = $ldap->bind();
}
@@ -86,7 +86,7 @@ public function onUserAuthenticate($credentials, $options, &$response)
// Search for users DN
$binddata = $ldap->simple_search(str_replace('[search]', $credentials['username'], $this->params->get('search_string')));
- if (isset($binddata[0]) && isset($binddata[0]['dn']))
+ if (isset($binddata[0], $binddata[0]['dn']))
{
// Verify Users Credentials
$success = $ldap->bind($binddata[0]['dn'], $credentials['password'], 1);
@@ -128,7 +128,7 @@ public function onUserAuthenticate($credentials, $options, &$response)
{
$response->status = JAuthentication::STATUS_FAILURE;
- if (!strlen($response->error_message))
+ if ($response->error_message === '')
{
$response->error_message = JText::_('JGLOBAL_AUTH_INCORRECT');
}
diff --git a/plugins/captcha/recaptcha/recaptcha.php b/plugins/captcha/recaptcha/recaptcha.php
index 2c0f6bfdc42cd..7caba5dd4aa04 100644
--- a/plugins/captcha/recaptcha/recaptcha.php
+++ b/plugins/captcha/recaptcha/recaptcha.php
@@ -40,7 +40,7 @@ public function onInit($id = 'dynamic_recaptcha_1')
{
$pubkey = $this->params->get('public_key', '');
- if ($pubkey == null || $pubkey == '')
+ if ($pubkey === '')
{
throw new Exception(JText::_('PLG_RECAPTCHA_ERROR_NO_PUBLIC_KEY'));
}
@@ -117,13 +117,13 @@ public function onCheckAnswer($code = null)
case '1.0':
$challenge = $input->get('recaptcha_challenge_field', '', 'string');
$response = $input->get('recaptcha_response_field', '', 'string');
- $spam = ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0);
+ $spam = ($challenge === '' || $response === '');
break;
case '2.0':
// Challenge Not needed in 2.0 but needed for getResponse call
$challenge = null;
$response = $input->get('g-recaptcha-response', '', 'string');
- $spam = ($response == null || strlen($response) == 0);
+ $spam = ($response === '');
break;
}
@@ -268,7 +268,7 @@ private function _recaptcha_http_post($host, $path, $data, $port = 80)
$response = '';
- if (($fs = @fsockopen($host, $port, $errno, $errstr, 10)) == false )
+ if (($fs = @fsockopen($host, $port, $errno, $errstr, 10)) === false)
{
die('Could not open socket');
}
diff --git a/plugins/captcha/recaptcha/recaptchalib.php b/plugins/captcha/recaptcha/recaptchalib.php
index aee249c9eb7c6..0f029ab46ce8b 100644
--- a/plugins/captcha/recaptcha/recaptchalib.php
+++ b/plugins/captcha/recaptcha/recaptchalib.php
@@ -53,7 +53,7 @@ class JReCaptcha
*/
public function __construct($secret)
{
- if ($secret == null || $secret === '')
+ if ($secret === null || $secret === '')
{
die("To use reCAPTCHA you must get an API key from " . self::$_signupUrl . "");
@@ -110,7 +110,7 @@ private function _submitHTTPGet($path, $data)
public function verifyResponse($remoteIp, $response)
{
// Discard empty solution submissions
- if ($response == null || strlen($response) == 0)
+ if ($response === null || $response === '')
{
$recaptchaResponse = new JReCaptchaResponse();
$recaptchaResponse->success = false;
@@ -131,7 +131,7 @@ public function verifyResponse($remoteIp, $response)
$answers = json_decode($getResponse, true);
$recaptchaResponse = new JReCaptchaResponse();
- if (trim($answers['success']) == true)
+ if (trim($answers['success']) !== '')
{
$recaptchaResponse->success = true;
}
diff --git a/plugins/content/pagebreak/pagebreak.php b/plugins/content/pagebreak/pagebreak.php
index f3b0336f110bb..3aa0c7094145a 100644
--- a/plugins/content/pagebreak/pagebreak.php
+++ b/plugins/content/pagebreak/pagebreak.php
@@ -92,7 +92,7 @@ public function onContentPrepare($context, &$row, &$params, $page = 0)
$page = 0;
}
- if ($params->get('intro_only') || $params->get('popup') || $full || $view !== 'article')
+ if ($full || $view !== 'article' || $params->get('intro_only') || $params->get('popup'))
{
$row->text = preg_replace($regex, '', $row->text);
@@ -144,19 +144,13 @@ public function onContentPrepare($context, &$row, &$params, $page = 0)
$hasToc = $this->params->get('multipage_toc', 1);
// Adds heading or title to Title.
- if ($title)
+ if ($title && $page && isset($matches[$page - 1], $matches[$page - 1][2]))
{
- if ($page)
- {
- if ($page && @$matches[$page - 1][2])
- {
- $attrs = JUtility::parseAttributes($matches[$page - 1][1]);
+ $attrs = JUtility::parseAttributes($matches[$page - 1][1]);
- if (@$attrs['title'])
- {
- $row->page_title = $attrs['title'];
- }
- }
+ if (isset($attrs['title']))
+ {
+ $row->page_title = $attrs['title'];
}
}
diff --git a/plugins/content/pagenavigation/pagenavigation.php b/plugins/content/pagenavigation/pagenavigation.php
index 62fbaf21b596e..cdc18723fd875 100644
--- a/plugins/content/pagenavigation/pagenavigation.php
+++ b/plugins/content/pagenavigation/pagenavigation.php
@@ -39,7 +39,7 @@ public function onContentBeforeDisplay($context, &$row, &$params, $page = 0)
return false;
}
- if (($context === 'com_content.article') && ($view === 'article') && $params->get('show_item_navigation'))
+ if ($context === 'com_content.article' && $view === 'article' && $params->get('show_item_navigation'))
{
$db = JFactory::getDbo();
$user = JFactory::getUser();
@@ -217,8 +217,6 @@ public function onContentBeforeDisplay($context, &$row, &$params, $page = 0)
$row->paginationrelative = $this->params->get('relative', 0);
}
}
-
- return;
}
/**
diff --git a/plugins/editors/codemirror/codemirror.php b/plugins/editors/codemirror/codemirror.php
index 4073e85110ade..1c3e22070f94f 100644
--- a/plugins/editors/codemirror/codemirror.php
+++ b/plugins/editors/codemirror/codemirror.php
@@ -78,7 +78,7 @@ public function onInit()
{
if (isset($fontInfo->url))
{
- $doc->addStylesheet($fontInfo->url);
+ $doc->addStyleSheet($fontInfo->url);
}
if (isset($fontInfo->css))
diff --git a/plugins/editors/tinymce/field/skins.php b/plugins/editors/tinymce/field/skins.php
index 6299e669ba0bd..da3e5ecd32b03 100644
--- a/plugins/editors/tinymce/field/skins.php
+++ b/plugins/editors/tinymce/field/skins.php
@@ -37,7 +37,7 @@ public function getOptions()
$directories = glob(JPATH_ROOT . '/media/editors/tinymce/skins' . '/*', GLOB_ONLYDIR);
- for ($i = 0; $i < count($directories); ++$i)
+ for ($i = 0, $iMax = count($directories); $i < $iMax; ++$i)
{
$dir = basename($directories[$i]);
$options[] = JHtml::_('select.option', $i, $dir);
diff --git a/plugins/editors/tinymce/tinymce.php b/plugins/editors/tinymce/tinymce.php
index 79c4dbe878dc0..3bb057d4c4c6b 100644
--- a/plugins/editors/tinymce/tinymce.php
+++ b/plugins/editors/tinymce/tinymce.php
@@ -760,7 +760,7 @@ private function tinyButtons($name, $excluded)
// Set some vars
$name = 'button-' . $i . str_replace(' ', '', $button->get('text'));
$title = $button->get('text');
- $onclick = $button->get('onclick') ? $button->get('onclick') : null;
+ $onclick = $button->get('onclick') ?: null;
$options = $button->get('options');
$icon = $button->get('name');
@@ -801,7 +801,7 @@ private function tinyButtons($name, $excluded)
icon: \"" . $icon . "\",
onclick: function () {";
- if ($button->get('modal') || $href)
+ if ($href || $button->get('modal'))
{
$tempConstructor .= "
var modalOptions = {
@@ -823,21 +823,21 @@ private function tinyButtons($name, $excluded)
if ($onclick && ($button->get('modal') || $href))
{
$tempConstructor .= "\r\n
- " . $onclick . "
- ";
+ " . $onclick . '
+ ';
}
}
else
{
$tempConstructor .= "\r\n
- " . $onclick . "
- ";
+ " . $onclick . '
+ ';
}
- $tempConstructor .= "
+ $tempConstructor .= '
}
});
- })();";
+ })();';
// The array with the toolbar buttons
$btnsNames[] = $name . ' | ';
diff --git a/plugins/extension/joomla/joomla.php b/plugins/extension/joomla/joomla.php
index cee6cef1f5f37..104cce0b070f9 100644
--- a/plugins/extension/joomla/joomla.php
+++ b/plugins/extension/joomla/joomla.php
@@ -254,7 +254,7 @@ private function processUpdateSites()
{
$data = trim((string) $updateservers);
- if (strlen($data))
+ if ($data !== '')
{
// We have a single entry in the update server line, let us presume this is an extension line
$this->addUpdateSite(JText::_('PLG_EXTENSION_JOOMLA_UNKNOWN_SITE'), 'extension', $data, true);
diff --git a/plugins/finder/content/content.php b/plugins/finder/content/content.php
index 6e1c6fac10fda..74633c98d823b 100644
--- a/plugins/finder/content/content.php
+++ b/plugins/finder/content/content.php
@@ -246,7 +246,7 @@ protected function index(FinderIndexerResult $item, $format = 'html')
$item->setLanguage();
// Check if the extension is enabled.
- if (JComponentHelper::isEnabled($this->extension) == false)
+ if (JComponentHelper::isEnabled($this->extension) === false)
{
return;
}
diff --git a/plugins/search/categories/categories.php b/plugins/search/categories/categories.php
index a922fe72ece2c..2ecbcf9043b92 100644
--- a/plugins/search/categories/categories.php
+++ b/plugins/search/categories/categories.php
@@ -65,12 +65,9 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
$groups = implode(',', $user->getAuthorisedViewLevels());
$searchText = $text;
- if (is_array($areas))
+ if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
- if (!array_intersect($areas, array_keys($this->onContentSearchAreas())))
- {
- return array();
- }
+ return array();
}
$sContent = $this->params->get('search_content', 1);
diff --git a/plugins/search/contacts/contacts.php b/plugins/search/contacts/contacts.php
index 4e6351677b461..a416e665740a9 100644
--- a/plugins/search/contacts/contacts.php
+++ b/plugins/search/contacts/contacts.php
@@ -64,12 +64,9 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
- if (is_array($areas))
+ if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
- if (!array_intersect($areas, array_keys($this->onContentSearchAreas())))
- {
- return array();
- }
+ return array();
}
$sContent = $this->params->get('search_content', 1);
diff --git a/plugins/search/content/content.php b/plugins/search/content/content.php
index af420272bc790..23d4877d10aaf 100644
--- a/plugins/search/content/content.php
+++ b/plugins/search/content/content.php
@@ -59,12 +59,9 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
$searchText = $text;
- if (is_array($areas))
+ if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
- if (!array_intersect($areas, array_keys($this->onContentSearchAreas())))
- {
- return array();
- }
+ return array();
}
$sContent = $this->params->get('search_content', 1);
diff --git a/plugins/search/newsfeeds/newsfeeds.php b/plugins/search/newsfeeds/newsfeeds.php
index 3eb5aacc5022e..8084344fb45df 100644
--- a/plugins/search/newsfeeds/newsfeeds.php
+++ b/plugins/search/newsfeeds/newsfeeds.php
@@ -62,12 +62,9 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
$user = JFactory::getUser();
$groups = implode(',', $user->getAuthorisedViewLevels());
- if (is_array($areas))
+ if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
- if (!array_intersect($areas, array_keys($this->onContentSearchAreas())))
- {
- return array();
- }
+ return array();
}
$sContent = $this->params->get('search_content', 1);
diff --git a/plugins/search/tags/tags.php b/plugins/search/tags/tags.php
index 2cc3656ba2d83..f026089bbafb8 100644
--- a/plugins/search/tags/tags.php
+++ b/plugins/search/tags/tags.php
@@ -66,12 +66,9 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu
$section = JText::_('PLG_SEARCH_TAGS_TAGS');
$limit = $this->params->def('search_limit', 50);
- if (is_array($areas))
+ if (is_array($areas) && !array_intersect($areas, array_keys($this->onContentSearchAreas())))
{
- if (!array_intersect($areas, array_keys($this->onContentSearchAreas())))
- {
- return array();
- }
+ return array();
}
$text = trim($text);
diff --git a/plugins/system/cache/cache.php b/plugins/system/cache/cache.php
index 236bb68eeca40..bbaf24e557ae4 100644
--- a/plugins/system/cache/cache.php
+++ b/plugins/system/cache/cache.php
@@ -157,7 +157,7 @@ protected function isExcluded()
foreach ($exclusions as $exclusion)
{
// Make sure the exclusion has some content
- if (strlen($exclusion))
+ if ($exclusion !== '')
{
if (preg_match('/' . $exclusion . '/is', $path, $match))
{
diff --git a/plugins/system/debug/debug.php b/plugins/system/debug/debug.php
index b07a05d6cdac8..003679fa664f0 100644
--- a/plugins/system/debug/debug.php
+++ b/plugins/system/debug/debug.php
@@ -241,8 +241,8 @@ public function onAfterRespond()
}
// No debug for Safari and Chrome redirection.
- if (strstr(strtolower(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''), 'webkit') !== false
- && substr($contents, 0, 50) === '' . $title . '';
}
- $htmlProfile = ($info[$id]->profile ? $info[$id]->profile : JText::_('PLG_DEBUG_NO_PROFILE'));
+ $htmlProfile = $info[$id]->profile ?: JText::_('PLG_DEBUG_NO_PROFILE');
$htmlAccordions = JHtml::_(
'bootstrap.startAccordion', 'dbg_query_' . $id, array(
@@ -1618,7 +1614,7 @@ protected function displayUntranslatedStrings()
if (is_array($occurance) && isset($occurance[0]))
{
$info = $occurance[0];
- $file = $info['file'] ? $info['file'] : '';
+ $file = $info['file'] ?: '';
if (!isset($guesses[$file]))
{
@@ -2026,10 +2022,9 @@ protected function writeToFile()
{
if (isset($timings[$id * 2 + 1]))
{
- $temp = str_replace('`', '', $log[$id]);
- $temp = str_replace("\t", ' ', $temp);
- $temp = str_replace("\n", ' ', $temp);
- $current .= str_replace("\r\n", ' ', $temp) . ";\n";
+ $temp = str_replace('`', '', $log[$id]);
+ $temp = str_replace(array("\t", "\n", "\r\n"), ' ', $temp);
+ $current .= $temp . ";\n";
}
}
diff --git a/plugins/system/highlight/highlight.php b/plugins/system/highlight/highlight.php
index e3b879ecb3d06..4c8f2e2c2a09d 100644
--- a/plugins/system/highlight/highlight.php
+++ b/plugins/system/highlight/highlight.php
@@ -46,7 +46,7 @@ public function onAfterDispatch()
}
// Check if the highlighter should be activated in this environment.
- if (JFactory::getDocument()->getType() !== 'html' || $input->get('tmpl', '', 'cmd') === 'component')
+ if ($input->get('tmpl', '', 'cmd') === 'component' || JFactory::getDocument()->getType() !== 'html')
{
return true;
}
diff --git a/plugins/system/languagefilter/languagefilter.php b/plugins/system/languagefilter/languagefilter.php
index 626bc30d9d87f..a0c8a5afc2120 100644
--- a/plugins/system/languagefilter/languagefilter.php
+++ b/plugins/system/languagefilter/languagefilter.php
@@ -308,7 +308,7 @@ public function parseRule(&$router, &$uri)
$lang_code = $this->default_lang;
}
- if ($this->params->get('remove_default_prefix', 0) && $lang_code == $this->default_lang)
+ if ($lang_code === $this->default_lang && $this->params->get('remove_default_prefix', 0))
{
$found = true;
}
@@ -321,8 +321,7 @@ public function parseRule(&$router, &$uri)
// If we found our language, but its the default language and we don't want a prefix for that, we are on a wrong URL.
// Or we try to change the language back to the default language. We need a redirect to the proper URL for the default language.
- if ($this->params->get('remove_default_prefix', 0)
- && $lang_code == $this->default_lang)
+ if ($lang_code === $this->default_lang && $this->params->get('remove_default_prefix', 0))
{
// Create a cookie.
$this->setLanguageCookie($lang_code);
@@ -352,7 +351,7 @@ public function parseRule(&$router, &$uri)
{
$lang_code = $this->getLanguageCookie();
- if ($this->params->get('detect_browser', 1) && !$lang_code)
+ if (!$lang_code && $this->params->get('detect_browser', 1))
{
$lang_code = JLanguageHelper::detectLanguage();
}
@@ -385,7 +384,7 @@ public function parseRule(&$router, &$uri)
$lang_code = $this->getLanguageCookie();
}
- if ($this->params->get('detect_browser', 1) && !$lang_code)
+ if (!$lang_code && $this->params->get('detect_browser', 1))
{
$lang_code = JLanguageHelper::detectLanguage();
}
@@ -423,8 +422,8 @@ public function parseRule(&$router, &$uri)
if ($this->mode_sef)
{
// Use the current language sef or the default one.
- if (!$this->params->get('remove_default_prefix', 0)
- || $lang_code != $this->default_lang)
+ if ($lang_code !== $this->default_lang
+ || !$this->params->get('remove_default_prefix', 0))
{
$path = $this->lang_codes[$lang_code]->sef . '/' . $path;
}
@@ -473,7 +472,7 @@ public function parseRule(&$router, &$uri)
$this->app->set('language', $lang_code);
$language = JFactory::getLanguage();
- if ($language->getTag() != $lang_code)
+ if ($language->getTag() !== $lang_code)
{
$newLang = JLanguage::getInstance($lang_code);
@@ -487,7 +486,7 @@ public function parseRule(&$router, &$uri)
}
// Create a cookie.
- if ($this->getLanguageCookie() != $lang_code)
+ if ($this->getLanguageCookie() !== $lang_code)
{
$this->setLanguageCookie($lang_code);
}
@@ -510,7 +509,7 @@ public function parseRule(&$router, &$uri)
*/
public function onUserBeforeSave($user, $isnew, $new)
{
- if ($this->params->get('automatic_change', '1') == '1' && key_exists('params', $user))
+ if (array_key_exists('params', $user) && $this->params->get('automatic_change', '1') == '1')
{
$registry = new Registry($user['params']);
$this->user_lang_code = $registry->get('language');
@@ -538,7 +537,7 @@ public function onUserBeforeSave($user, $isnew, $new)
*/
public function onUserAfterSave($user, $isnew, $success, $msg)
{
- if ($this->params->get('automatic_change', '1') == '1' && key_exists('params', $user) && $success)
+ if ($success && array_key_exists('params', $user) && $this->params->get('automatic_change', '1') == '1')
{
$registry = new Registry($user['params']);
$lang_code = $registry->get('language');
@@ -785,7 +784,7 @@ public function onAfterDispatch()
if (count($languages) > 1)
{
// Remove the sef from the default language if "Remove URL Language Code" is on
- if (isset($languages[$this->default_lang]) && $remove_default_prefix)
+ if ($remove_default_prefix && isset($languages[$this->default_lang]))
{
$languages[$this->default_lang]->link
= preg_replace('|/' . $languages[$this->default_lang]->sef . '/|', '/', $languages[$this->default_lang]->link, 1);
diff --git a/plugins/system/redirect/redirect.php b/plugins/system/redirect/redirect.php
index 142edb6a2fbf1..44378ed8a5f67 100644
--- a/plugins/system/redirect/redirect.php
+++ b/plugins/system/redirect/redirect.php
@@ -180,7 +180,7 @@ private static function doErrorHandling($error)
}
// A redirect object was found and, if published, will be used
- if (!is_null($redirect) && ((int) $redirect->published === 1))
+ if ($redirect !== null && ((int) $redirect->published === 1))
{
if (!$redirect->header || (bool) JComponentHelper::getParams('com_redirect')->get('mode', false) === false)
{
@@ -193,7 +193,7 @@ private static function doErrorHandling($error)
$oldUrlParts = parse_url($redirect->old_url);
- if (empty($oldUrlParts['query']) && $urlQuery !== '')
+ if ($urlQuery !== '' && empty($oldUrlParts['query']))
{
$redirect->new_url .= '?' . $urlQuery;
}
@@ -206,7 +206,7 @@ private static function doErrorHandling($error)
JErrorPage::render(new RuntimeException($error->getMessage(), $redirect->header, $error));
}
// No redirect object was found so we create an entry in the redirect table
- elseif (is_null($redirect))
+ elseif ($redirect === null)
{
$params = new Registry(JPluginHelper::getPlugin('system', 'redirect')->params);
@@ -234,7 +234,7 @@ private static function doErrorHandling($error)
// We have an unpublished redirect object, increment the hit counter
else
{
- $redirect->hits += 1;
+ $redirect->hits++;
try
{
diff --git a/plugins/system/stats/stats.php b/plugins/system/stats/stats.php
index 501e31f844eff..a6876b3965426 100644
--- a/plugins/system/stats/stats.php
+++ b/plugins/system/stats/stats.php
@@ -438,7 +438,7 @@ private function saveParams()
$this->params->set('lastrun', time());
$this->params->set('unique_id', $this->getUniqueId());
$interval = (int) $this->params->get('interval', 12);
- $this->params->set('interval', $interval ? $interval : 12);
+ $this->params->set('interval', $interval ?: 12);
$query = $this->db->getQuery(true)
->update($this->db->quoteName('#__extensions'))
diff --git a/plugins/user/joomla/joomla.php b/plugins/user/joomla/joomla.php
index 0ebc34cefbaf5..59f8ebbfbf496 100644
--- a/plugins/user/joomla/joomla.php
+++ b/plugins/user/joomla/joomla.php
@@ -169,7 +169,7 @@ public function onUserAfterSave($user, $isnew, $success, $msg)
}
// Set application language back to default if we changed it
- if ($userLocale != $defaultLocale)
+ if ($userLocale !== $defaultLocale)
{
$lang->setLanguage($defaultLocale);
}
diff --git a/plugins/user/profile/field/dob.php b/plugins/user/profile/field/dob.php
index 5076c70b9d53f..e56486c96db5d 100644
--- a/plugins/user/profile/field/dob.php
+++ b/plugins/user/profile/field/dob.php
@@ -50,7 +50,7 @@ protected function getLabel()
$view = $app->input->getString('view', '');
// Only display the tip when editing profile
- if ($app->isClient('administrator') || $view === 'profile' || $view === 'registration')
+ if ($view === 'registration' || $view === 'profile' || $app->isClient('administrator'))
{
$layout = new JLayoutFile('plugins.user.profile.fields.dob');
$info = $layout->render(array('text' => $text));
diff --git a/plugins/user/profile/field/tos.php b/plugins/user/profile/field/tos.php
index 03d25e79a1534..5654ee826c6b8 100644
--- a/plugins/user/profile/field/tos.php
+++ b/plugins/user/profile/field/tos.php
@@ -60,7 +60,7 @@ protected function getLabel()
// Build the class for the label.
$class = !empty($this->description) ? 'hasTooltip' : '';
- $class .= ' required';
+ $class = $class . ' required';
$class = !empty($this->labelClass) ? $class . ' ' . $this->labelClass : $class;
// Add the opening label tag and main attributes attributes.
diff --git a/plugins/user/profile/profile.php b/plugins/user/profile/profile.php
index ad61bbec258a2..fcbeb602f920b 100644
--- a/plugins/user/profile/profile.php
+++ b/plugins/user/profile/profile.php
@@ -70,7 +70,7 @@ public function onContentPrepareData($context, $data)
{
$userId = isset($data->id) ? $data->id : 0;
- if (!isset($data->profile) and $userId > 0)
+ if (!isset($data->profile) && $userId > 0)
{
// Load the profile data from the database.
$db = JFactory::getDbo();
@@ -148,7 +148,7 @@ public static function url($value)
// Convert website URL to utf8 for display
$value = JStringPunycode::urlToUTF8(htmlspecialchars($value));
- if (substr($value, 0, 4) === 'http')
+ if (strpos($value, 'http') === 0)
{
return '' . $value . '';
}
@@ -384,13 +384,10 @@ public function onUserBeforeSave($user, $isnew, $data)
$tosarticle = $this->params->get('register_tos_article');
$tosenabled = ($this->params->get('register-require_tos', 0) == 2);
- if (($task === 'register') && $tosenabled && $tosarticle && ($option === 'com_users'))
+ // Check that the tos is checked.
+ if ($task === 'register' && $tosenabled && $tosarticle && $option === 'com_users' && !$data['profile']['tos'])
{
- // Check that the tos is checked.
- if (!$data['profile']['tos'])
- {
- throw new InvalidArgumentException(JText::_('PLG_USER_PROFILE_FIELD_TOS_DESC_SITE'));
- }
+ throw new InvalidArgumentException(JText::_('PLG_USER_PROFILE_FIELD_TOS_DESC_SITE'));
}
return true;