diff --git a/libraries/cms/component/router/rules/standard.php b/libraries/cms/component/router/rules/standard.php index 2542a0c040236..93350a238c88b 100644 --- a/libraries/cms/component/router/rules/standard.php +++ b/libraries/cms/component/router/rules/standard.php @@ -220,9 +220,7 @@ public function build(&$query, &$segments) { if (isset($item->query['layout']) && isset($query['layout']) && $item->query['layout'] == $query['layout']) { - unset($query['view']); - unset($query['layout']); - + unset($query['view'], $query['layout']); return; } } @@ -292,9 +290,7 @@ public function build(&$query, &$segments) if ($found) { - unset($query['layout']); - unset($query[$views[$query['view']]->key]); - unset($query['view']); + unset($query['layout'], $query[$views[$query['view']]->key], $query['view']); } } } diff --git a/libraries/cms/html/behavior.php b/libraries/cms/html/behavior.php index 2a4ccf365feef..05b07728bb8ca 100644 --- a/libraries/cms/html/behavior.php +++ b/libraries/cms/html/behavior.php @@ -89,8 +89,6 @@ public static function core() JHtml::_('script', 'system/core.js', array('version' => 'auto', 'relative' => true)); static::$loaded[__METHOD__] = true; - - return; } /** @@ -287,16 +285,16 @@ public static function tooltip($selector = '.hasTip', $params = array()) static::framework(true); // Setup options object - $opt['maxTitleChars'] = (isset($params['maxTitleChars']) && $params['maxTitleChars']) ? (int) $params['maxTitleChars'] : 50; + $opt['maxTitleChars'] = isset($params['maxTitleChars']) && $params['maxTitleChars'] ? (int) $params['maxTitleChars'] : 50; // Offsets needs an array in the format: array('x'=>20, 'y'=>30) - $opt['offset'] = (isset($params['offset']) && (is_array($params['offset']))) ? $params['offset'] : null; - $opt['showDelay'] = (isset($params['showDelay'])) ? (int) $params['showDelay'] : null; - $opt['hideDelay'] = (isset($params['hideDelay'])) ? (int) $params['hideDelay'] : null; - $opt['className'] = (isset($params['className'])) ? $params['className'] : null; - $opt['fixed'] = (isset($params['fixed']) && ($params['fixed'])) ? true : false; - $opt['onShow'] = (isset($params['onShow'])) ? '\\' . $params['onShow'] : null; - $opt['onHide'] = (isset($params['onHide'])) ? '\\' . $params['onHide'] : null; + $opt['offset'] = isset($params['offset']) && is_array($params['offset']) ? $params['offset'] : null; + $opt['showDelay'] = isset($params['showDelay']) ? (int) $params['showDelay'] : null; + $opt['hideDelay'] = isset($params['hideDelay']) ? (int) $params['hideDelay'] : null; + $opt['className'] = isset($params['className']) ? $params['className'] : null; + $opt['fixed'] = isset($params['fixed']) && $params['fixed']; + $opt['onShow'] = isset($params['onShow']) ? '\\' . $params['onShow'] : null; + $opt['onHide'] = isset($params['onHide']) ? '\\' . $params['onHide'] : null; $options = JHtml::getJSObject($opt); @@ -372,14 +370,14 @@ public static function modal($selector = 'a.modal', $params = array()) JLog::add('JHtmlBehavior::modal is deprecated. Use the modal equivalent from bootstrap.', JLog::WARNING, 'deprecated'); // Setup options object - $opt['ajaxOptions'] = (isset($params['ajaxOptions']) && is_array($params['ajaxOptions'])) ? $params['ajaxOptions'] : null; + $opt['ajaxOptions'] = isset($params['ajaxOptions']) && is_array($params['ajaxOptions']) ? $params['ajaxOptions'] : null; $opt['handler'] = isset($params['handler']) ? $params['handler'] : null; $opt['parseSecure'] = isset($params['parseSecure']) ? (bool) $params['parseSecure'] : null; $opt['closable'] = isset($params['closable']) ? (bool) $params['closable'] : null; $opt['closeBtn'] = isset($params['closeBtn']) ? (bool) $params['closeBtn'] : null; $opt['iframePreload'] = isset($params['iframePreload']) ? (bool) $params['iframePreload'] : null; - $opt['iframeOptions'] = (isset($params['iframeOptions']) && is_array($params['iframeOptions'])) ? $params['iframeOptions'] : null; - $opt['size'] = (isset($params['size']) && is_array($params['size'])) ? $params['size'] : null; + $opt['iframeOptions'] = isset($params['iframeOptions']) && is_array($params['iframeOptions']) ? $params['iframeOptions'] : null; + $opt['size'] = isset($params['size']) && is_array($params['size']) ? $params['size'] : null; $opt['shadow'] = isset($params['shadow']) ? $params['shadow'] : null; $opt['overlay'] = isset($params['overlay']) ? $params['overlay'] : null; $opt['onOpen'] = isset($params['onOpen']) ? $params['onOpen'] : null; @@ -896,17 +894,12 @@ public static function tabstate() */ public static function polyfill($polyfillTypes = null, $conditionalBrowser = null) { - if (is_null($polyfillTypes)) + if ($polyfillTypes === null) { - return false; - } - - if (!is_array($polyfillTypes)) - { - $polyfillTypes = array($polyfillTypes); + return; } - foreach ($polyfillTypes as $polyfillType) + foreach ((array) $polyfillTypes as $polyfillType) { $sig = md5(serialize(array($polyfillType, $conditionalBrowser))); diff --git a/libraries/cms/html/bootstrap.php b/libraries/cms/html/bootstrap.php index 67646466a4486..636344b63f14b 100644 --- a/libraries/cms/html/bootstrap.php +++ b/libraries/cms/html/bootstrap.php @@ -597,7 +597,7 @@ public static function startAccordion($selector = 'myAccordian', $params = array // Setup options object $opt['parent'] = isset($params['parent']) ? ($params['parent'] == true ? '#' . $selector : $params['parent']) : false; - $opt['toggle'] = isset($params['toggle']) ? (boolean) $params['toggle'] : ($opt['parent'] === false || isset($params['active']) ? false : true); + $opt['toggle'] = isset($params['toggle']) ? (boolean) $params['toggle'] : !($opt['parent'] === false || isset($params['active'])); $onShow = isset($params['onShow']) ? (string) $params['onShow'] : null; $onShown = isset($params['onShown']) ? (string) $params['onShown'] : null; $onHide = isset($params['onHide']) ? (string) $params['onHide'] : null; diff --git a/libraries/cms/html/html.php b/libraries/cms/html/html.php index 0dc2945ad7c92..a0c5dbabe794a 100644 --- a/libraries/cms/html/html.php +++ b/libraries/cms/html/html.php @@ -1088,11 +1088,8 @@ public static function calendar($value, $name, $id, $format = '%Y-%m-%d', $attri */ public static function addIncludePath($path = '') { - // Force path to array - settype($path, 'array'); - // Loop through the path directories - foreach ($path as $dir) + foreach ((array) $path as $dir) { if (!empty($dir) && !in_array($dir, static::$includePaths)) { diff --git a/libraries/cms/html/tabs.php b/libraries/cms/html/tabs.php index 74a726052408f..2228c027fdd54 100644 --- a/libraries/cms/html/tabs.php +++ b/libraries/cms/html/tabs.php @@ -91,7 +91,7 @@ protected static function loadBehavior($group, $params = array()) $opt['descriptionSelector'] = 'dd.tabs'; // When use storage is set and value is false - By default we allow to use storage - $opt['useStorage'] = (isset($params['useCookie']) && !$params['useCookie']) ? false : true; + $opt['useStorage'] = !(isset($params['useCookie']) && !$params['useCookie']); $options = JHtml::getJSObject($opt); diff --git a/libraries/cms/menu/site.php b/libraries/cms/menu/site.php index b1e412d539d85..a2139f44d1f52 100644 --- a/libraries/cms/menu/site.php +++ b/libraries/cms/menu/site.php @@ -168,8 +168,7 @@ public function getItems($attributes, $values, $firstonly = false) } elseif ($values[$key] === null) { - unset($attributes[$key]); - unset($values[$key]); + unset($attributes[$key], $values[$key]); } // Filter by access level if not set @@ -180,8 +179,7 @@ public function getItems($attributes, $values, $firstonly = false) } elseif ($values[$key] === null) { - unset($attributes[$key]); - unset($values[$key]); + unset($attributes[$key], $values[$key]); } } diff --git a/libraries/cms/search/helper.php b/libraries/cms/search/helper.php index 0389d2f08f438..5ea5cdcf592f5 100644 --- a/libraries/cms/search/helper.php +++ b/libraries/cms/search/helper.php @@ -43,7 +43,7 @@ public static function logSearch($term, $component) ->from($db->quoteName('#__core_log_searches')) ->where($db->quoteName('search_term') . ' = ' . $db->quote($search_term)); $db->setQuery($query); - $hits = intval($db->loadResult()); + $hits = (int) $db->loadResult(); // Reset the $query object $query->clear(); diff --git a/libraries/cms/toolbar/toolbar.php b/libraries/cms/toolbar/toolbar.php index c39ee8e6bdf8c..558fabd680367 100644 --- a/libraries/cms/toolbar/toolbar.php +++ b/libraries/cms/toolbar/toolbar.php @@ -288,11 +288,8 @@ public function loadButtonType($type, $new = false) */ public function addButtonPath($path) { - // Just force path to array. - settype($path, 'array'); - // Loop through the path directories. - foreach ($path as $dir) + foreach ((array) $path as $dir) { // No surrounding spaces allowed! $dir = trim($dir);