From cc931059c64376c2b2cb13ae4451133d83fe3598 Mon Sep 17 00:00:00 2001 From: Frank Mayer Date: Sun, 18 Dec 2016 12:56:56 +0200 Subject: [PATCH] Replaced unnecessary double quotes in plugins (#13211) * Replaced unnecessary double quotes in plugins * spaces --- plugins/authentication/ldap/ldap.php | 4 ++-- plugins/captcha/recaptcha/recaptcha.php | 2 +- plugins/captcha/recaptcha/recaptchalib.php | 10 +++++----- plugins/content/emailcloak/emailcloak.php | 6 +++--- .../content/pagenavigation/pagenavigation.php | 2 +- plugins/content/vote/vote.php | 2 +- plugins/editors/codemirror/codemirror.php | 4 ++-- plugins/editors/tinymce/tinymce.php | 20 +++++++++---------- plugins/search/contacts/contacts.php | 4 ++-- plugins/search/content/content.php | 6 +++--- plugins/search/newsfeeds/newsfeeds.php | 4 ++-- plugins/search/tags/tags.php | 2 +- plugins/system/debug/debug.php | 12 +++++------ .../system/languagefilter/languagefilter.php | 2 +- plugins/system/log/log.php | 6 +++--- plugins/system/sef/sef.php | 8 ++++---- plugins/system/stats/stats.php | 2 +- plugins/user/joomla/joomla.php | 4 ++-- plugins/user/profile/field/tos.php | 8 ++++---- plugins/user/profile/profile.php | 2 +- 20 files changed, 55 insertions(+), 55 deletions(-) diff --git a/plugins/authentication/ldap/ldap.php b/plugins/authentication/ldap/ldap.php index 34b7204b5822c..26a834906b42a 100644 --- a/plugins/authentication/ldap/ldap.php +++ b/plugins/authentication/ldap/ldap.php @@ -82,7 +82,7 @@ public function onUserAuthenticate($credentials, $options, &$response) if ($bindtest) { // Search for users DN - $binddata = $ldap->simple_search(str_replace("[search]", $credentials['username'], $this->params->get('search_string'))); + $binddata = $ldap->simple_search(str_replace('[search]', $credentials['username'], $this->params->get('search_string'))); if (isset($binddata[0]) && isset($binddata[0]['dn'])) { @@ -112,7 +112,7 @@ public function onUserAuthenticate($credentials, $options, &$response) if ($success) { - $userdetails = $ldap->simple_search(str_replace("[search]", $credentials['username'], $this->params->get('search_string'))); + $userdetails = $ldap->simple_search(str_replace('[search]', $credentials['username'], $this->params->get('search_string'))); } else { diff --git a/plugins/captcha/recaptcha/recaptcha.php b/plugins/captcha/recaptcha/recaptcha.php index 223c1bf83448d..92dca795e8676 100644 --- a/plugins/captcha/recaptcha/recaptcha.php +++ b/plugins/captcha/recaptcha/recaptcha.php @@ -226,7 +226,7 @@ private function getResponse($privatekey, $remoteip, $response, $challenge = nul */ private function _recaptcha_qsencode($data) { - $req = ""; + $req = ''; foreach ($data as $key => $value) { diff --git a/plugins/captcha/recaptcha/recaptchalib.php b/plugins/captcha/recaptcha/recaptchalib.php index f7be8997a0841..1596193ad0c13 100644 --- a/plugins/captcha/recaptcha/recaptchalib.php +++ b/plugins/captcha/recaptcha/recaptchalib.php @@ -41,10 +41,10 @@ class JReCaptchaResponse class JReCaptcha { - private static $_signupUrl = "https://www.google.com/recaptcha/admin"; - private static $_siteVerifyUrl = "https://www.google.com/recaptcha/api/siteverify"; + private static $_signupUrl = 'https://www.google.com/recaptcha/admin'; + private static $_siteVerifyUrl = 'https://www.google.com/recaptcha/api/siteverify'; private $_secret; - private static $_version = "php_1.0"; + private static $_version = 'php_1.0'; /** * Constructor. @@ -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 . ""); @@ -70,7 +70,7 @@ public function __construct($secret) */ private function _encodeQS($data) { - $req = ""; + $req = ''; foreach ($data as $key => $value) { $req .= $key . '=' . urlencode(stripslashes($value)) . '&'; diff --git a/plugins/content/emailcloak/emailcloak.php b/plugins/content/emailcloak/emailcloak.php index 78fef9396eaf7..950a3c8a4e469 100644 --- a/plugins/content/emailcloak/emailcloak.php +++ b/plugins/content/emailcloak/emailcloak.php @@ -70,13 +70,13 @@ protected function _getPattern ($link, $text) */ protected function _addAttributesToEmail($jsEmail, $before, $after) { - if ($before !== "") + if ($before !== '') { $before = str_replace("'", "\'", $before); $jsEmail = str_replace(".innerHTML += ''", "'\'{$after}>'", $jsEmail); @@ -125,7 +125,7 @@ protected function _cloak(&$text, &$params) $searchText = '((?:[\x20-\x7f]|[\xA1-\xFF]|[\xC2-\xDF][\x80-\xBF]|[\xE0-\xEF][\x80-\xBF]{2}|[\xF0-\xF4][\x80-\xBF]{3})[^<>]+)'; // Any Image link - $searchImage = "(]+>)"; + $searchImage = '(]+>)'; // Any Text with ||)'; diff --git a/plugins/content/pagenavigation/pagenavigation.php b/plugins/content/pagenavigation/pagenavigation.php index aac9b8fbeb4a9..a6003894848b0 100644 --- a/plugins/content/pagenavigation/pagenavigation.php +++ b/plugins/content/pagenavigation/pagenavigation.php @@ -139,7 +139,7 @@ public function onContentBeforeDisplay($context, &$row, &$params, $page = 0) ->join('LEFT', '#__categories AS cc ON cc.id = a.catid') ->where( 'a.catid = ' . (int) $row->catid . ' AND a.state = ' . (int) $row->state - . ($canPublish ? '' : ' AND a.access IN (' . implode(",", JAccess::getAuthorisedViewLevels($user->id)) . ') ') . $xwhere + . ($canPublish ? '' : ' AND a.access IN (' . implode(',', JAccess::getAuthorisedViewLevels($user->id)) . ') ') . $xwhere ); $query->order($orderby); diff --git a/plugins/content/vote/vote.php b/plugins/content/vote/vote.php index f13e2fe2789d8..7f2ff9a165ceb 100644 --- a/plugins/content/vote/vote.php +++ b/plugins/content/vote/vote.php @@ -105,7 +105,7 @@ public function onContentAfterDisplay($context, &$row, &$params, $page = 0) */ private function displayVotingData($context, &$row, &$params, $page) { - $parts = explode(".", $context); + $parts = explode('.', $context); if ($parts[0] != 'com_content') { diff --git a/plugins/editors/codemirror/codemirror.php b/plugins/editors/codemirror/codemirror.php index ad28f3efb46a8..c7fadf211da54 100644 --- a/plugins/editors/codemirror/codemirror.php +++ b/plugins/editors/codemirror/codemirror.php @@ -148,9 +148,9 @@ public function onGetInsertMethod() $done = true; - JFactory::getDocument()->addScriptDeclaration(" + JFactory::getDocument()->addScriptDeclaration(' ;function jInsertEditorText(text, editor) { Joomla.editors.instances[editor].replaceSelection(text); } - "); + '); return true; } diff --git a/plugins/editors/tinymce/tinymce.php b/plugins/editors/tinymce/tinymce.php index 0b22651f2f2cd..f3e15262495eb 100644 --- a/plugins/editors/tinymce/tinymce.php +++ b/plugins/editors/tinymce/tinymce.php @@ -218,17 +218,17 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons if ($langMode) { - if (file_exists(JPATH_ROOT . "/media/editors/tinymce/langs/" . $language->getTag() . ".js")) + if (file_exists(JPATH_ROOT . '/media/editors/tinymce/langs/' . $language->getTag() . '.js')) { $langPrefix = $language->getTag(); } - elseif (file_exists(JPATH_ROOT . "/media/editors/tinymce/langs/" . substr($language->getTag(), 0, strpos($language->getTag(), '-')) . ".js")) + elseif (file_exists(JPATH_ROOT . '/media/editors/tinymce/langs/' . substr($language->getTag(), 0, strpos($language->getTag(), '-')) . '.js')) { $langPrefix = substr($language->getTag(), 0, strpos($language->getTag(), '-')); } else { - $langPrefix = "en"; + $langPrefix = 'en'; } } @@ -421,10 +421,10 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons if (!empty($allButtons['template'])) { // Note this check for the template_list.js file will be removed in Joomla 4.0 - if (is_file(JPATH_ROOT . "/media/editors/tinymce/templates/template_list.js")) + if (is_file(JPATH_ROOT . '/media/editors/tinymce/templates/template_list.js')) { // If using the legacy file we need to include and input the files the new way - $str = file_get_contents(JPATH_ROOT . "/media/editors/tinymce/templates/template_list.js"); + $str = file_get_contents(JPATH_ROOT . '/media/editors/tinymce/templates/template_list.js'); // Find from one [ to the last ] $matches = array(); @@ -435,7 +435,7 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons { $values = array(); preg_match_all('/\".*\"/', $match, $values); - $result = trim($values["0"]["0"], '"'); + $result = trim($values['0']['0'], '"'); $final_result = explode(',', $result); $templates[] = array( @@ -506,7 +506,7 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons // We shall put the XTD button inside tinymce $btns = $this->tinyButtons($id, $buttons); $btnsNames = $btns['names']; - $tinyBtns = implode("; ", $btns['script']); + $tinyBtns = implode('; ', $btns['script']); if (!empty($btnsNames)) { @@ -655,7 +655,7 @@ public function onDisplay($name, $content, $width, $height, $col, $row, $buttons $options['tinyMCE']['default'] = $scriptOptions; - $doc->addStyleDeclaration(".mce-in { padding: 5px 10px !important;}"); + $doc->addStyleDeclaration('.mce-in { padding: 5px 10px !important;}'); $doc->addScriptOptions('plg_editor_tinymce', $options); return $editor; @@ -696,13 +696,13 @@ private function tinyButtons($name, $excluded) if ($button->get('name')) { // Set some vars - $name = 'button-' . $i . str_replace(" ", "", $button->get('text')); + $name = 'button-' . $i . str_replace(' ', '', $button->get('text')); $title = $button->get('text'); $onclick = ($button->get('onclick')) ? $button->get('onclick') : null; $options = $button->get('options'); $icon = $button->get('name'); - if ($button->get('link') != "#") + if ($button->get('link') != '#') { $href = JUri::base() . $button->get('link'); } diff --git a/plugins/search/contacts/contacts.php b/plugins/search/contacts/contacts.php index 80017f72e35c0..244f81793cd21 100644 --- a/plugins/search/contacts/contacts.php +++ b/plugins/search/contacts/contacts.php @@ -142,8 +142,8 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu $query->select( 'a.name AS title, \'\' AS created, a.con_position, a.misc, ' . $case_when . ',' . $case_when1 . ', ' - . $query->concatenate(array("a.name", "a.con_position", "a.misc"), ",") . ' AS text,' - . $query->concatenate(array($db->quote($section), "c.title"), " / ") . ' AS section,' + . $query->concatenate(array('a.name', 'a.con_position', 'a.misc'), ',') . ' AS text,' + . $query->concatenate(array($db->quote($section), 'c.title'), ' / ') . ' AS section,' . '\'2\' AS browsernav' ); $query->from('#__contact_details AS a') diff --git a/plugins/search/content/content.php b/plugins/search/content/content.php index 039831955ae7c..ad0b43ea4114c 100644 --- a/plugins/search/content/content.php +++ b/plugins/search/content/content.php @@ -242,7 +242,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu $query->select( 'a.title AS title, a.metadesc, a.metakey, a.created AS created, ' - . $query->concatenate(array("a.introtext", "a.fulltext")) . ' AS text,' + . $query->concatenate(array('a.introtext', 'a.fulltext')) . ' AS text,' . $case_when . ',' . $case_when1 . ', ' . 'c.title AS section, \'2\' AS browsernav' ) @@ -291,8 +291,8 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu { $date = JFactory::getDate($item->created); - $created_month = $date->format("n"); - $created_year = $date->format("Y"); + $created_month = $date->format('n'); + $created_year = $date->format('Y'); $list3[$key]->href = JRoute::_('index.php?option=com_content&view=archive&year=' . $created_year . '&month=' . $created_month . $itemid); } diff --git a/plugins/search/newsfeeds/newsfeeds.php b/plugins/search/newsfeeds/newsfeeds.php index 320e3024d41fe..dbaa2327591bf 100644 --- a/plugins/search/newsfeeds/newsfeeds.php +++ b/plugins/search/newsfeeds/newsfeeds.php @@ -164,8 +164,8 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu $case_when1 .= ' ELSE '; $case_when1 .= $c_id . ' END as catslug'; - $query->select('a.name AS title, \'\' AS created, a.link AS text, ' . $case_when . "," . $case_when1) - ->select($query->concatenate(array($db->quote($searchNewsfeeds), 'c.title'), " / ") . ' AS section') + $query->select('a.name AS title, \'\' AS created, a.link AS text, ' . $case_when . ',' . $case_when1) + ->select($query->concatenate(array($db->quote($searchNewsfeeds), 'c.title'), ' / ') . ' AS section') ->select('\'1\' AS browsernav') ->from('#__newsfeeds AS a') ->join('INNER', '#__categories as c ON c.id = a.catid') diff --git a/plugins/search/tags/tags.php b/plugins/search/tags/tags.php index c01b15e768405..d9098f09ccecd 100644 --- a/plugins/search/tags/tags.php +++ b/plugins/search/tags/tags.php @@ -156,7 +156,7 @@ public function onContentSearch($text, $phrase = '', $ordering = '', $areas = nu foreach ($rows as $key => $row) { $rows[$key]->href = TagsHelperRoute::getTagRoute($row->id); - $rows[$key]->text = ($row->description != "" ? $row->description : $row->title); + $rows[$key]->text = ($row->description != '' ? $row->description : $row->title); $rows[$key]->text .= $row->note; $rows[$key]->section = $section; $rows[$key]->created = $row->created; diff --git a/plugins/system/debug/debug.php b/plugins/system/debug/debug.php index b152211d5d299..b1c45a8ca4d80 100644 --- a/plugins/system/debug/debug.php +++ b/plugins/system/debug/debug.php @@ -241,7 +241,7 @@ public function onAfterRespond() } // No debug for Safari and Chrome redirection. - if (strstr(strtolower(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ""), 'webkit') !== false + if (strstr(strtolower(isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : ''), 'webkit') !== false && substr($contents, 0, 50) == 'app->input->getMethod() == "POST" + if ($this->app->input->getMethod() == 'POST' || count($this->app->input->post) > 0 || count($this->app->input->files) > 0) { diff --git a/plugins/system/log/log.php b/plugins/system/log/log.php index 83267025f9e8b..b41ac345f9058 100644 --- a/plugins/system/log/log.php +++ b/plugins/system/log/log.php @@ -32,12 +32,12 @@ public function onUserLoginFailure($response) switch ($response['status']) { case JAuthentication::STATUS_SUCCESS: - $errorlog['status'] = $response['type'] . " CANCELED: "; + $errorlog['status'] = $response['type'] . ' CANCELED: '; $errorlog['comment'] = $response['error_message']; break; case JAuthentication::STATUS_FAILURE: - $errorlog['status'] = $response['type'] . " FAILURE: "; + $errorlog['status'] = $response['type'] . ' FAILURE: '; if ($this->params->get('log_username', 0)) { @@ -50,7 +50,7 @@ public function onUserLoginFailure($response) break; default: - $errorlog['status'] = $response['type'] . " UNKNOWN ERROR: "; + $errorlog['status'] = $response['type'] . ' UNKNOWN ERROR: '; $errorlog['comment'] = $response['error_message']; break; } diff --git a/plugins/system/sef/sef.php b/plugins/system/sef/sef.php index 8622cddfbec9a..3b0d59929dee5 100644 --- a/plugins/system/sef/sef.php +++ b/plugins/system/sef/sef.php @@ -198,16 +198,16 @@ private function checkBuffer($buffer) switch (preg_last_error()) { case PREG_BACKTRACK_LIMIT_ERROR: - $message = "PHP regular expression limit reached (pcre.backtrack_limit)"; + $message = 'PHP regular expression limit reached (pcre.backtrack_limit)'; break; case PREG_RECURSION_LIMIT_ERROR: - $message = "PHP regular expression limit reached (pcre.recursion_limit)"; + $message = 'PHP regular expression limit reached (pcre.recursion_limit)'; break; case PREG_BAD_UTF8_ERROR: - $message = "Bad UTF8 passed to PCRE function"; + $message = 'Bad UTF8 passed to PCRE function'; break; default: - $message = "Unknown PCRE error calling PCRE function"; + $message = 'Unknown PCRE error calling PCRE function'; } throw new RuntimeException($message); diff --git a/plugins/system/stats/stats.php b/plugins/system/stats/stats.php index 5242d51dfd830..592cb023bafee 100644 --- a/plugins/system/stats/stats.php +++ b/plugins/system/stats/stats.php @@ -86,7 +86,7 @@ public function onAfterInitialise() return; } - if (JUri::getInstance()->getVar("tmpl") === "component") + if (JUri::getInstance()->getVar('tmpl') === 'component') { return; } diff --git a/plugins/user/joomla/joomla.php b/plugins/user/joomla/joomla.php index a0004f6ac5953..59531a8827bb9 100644 --- a/plugins/user/joomla/joomla.php +++ b/plugins/user/joomla/joomla.php @@ -258,7 +258,7 @@ public function onUserLogin($user, $options = array()) if ($this->app->isSite()) { - $this->app->input->cookie->set("joomla_user_state", "logged_in", 0, $cookie_path, $cookie_domain, 0); + $this->app->input->cookie->set('joomla_user_state', 'logged_in', 0, $cookie_path, $cookie_domain, 0); } return true; @@ -327,7 +327,7 @@ public function onUserLogout($user, $options = array()) if ($this->app->isSite()) { - $this->app->input->cookie->set("joomla_user_state", "", time() - 86400, $cookie_path, $cookie_domain, 0); + $this->app->input->cookie->set('joomla_user_state', '', time() - 86400, $cookie_path, $cookie_domain, 0); } return true; diff --git a/plugins/user/profile/field/tos.php b/plugins/user/profile/field/tos.php index 59b0b56df5dd3..9359c56098192 100644 --- a/plugins/user/profile/field/tos.php +++ b/plugins/user/profile/field/tos.php @@ -51,10 +51,10 @@ protected function getLabel() // Add CSS and JS for the TOS field $doc = JFactory::getDocument(); - $css = "#jform_profile_tos {width: 18em; margin: 0 !important; padding: 0 2px !important;} - #jform_profile_tos input {margin:0 5px 0 0 !important; width:10px !important;} - #jform_profile_tos label {margin:0 15px 0 0 !important; width:auto;} - "; + $css = '#jform_profile_tos {width: 18em; margin: 0 !important; padding: 0 2px !important;} + #jform_profile_tos input {margin: 0 5px 0 0 !important; width: 10px !important;} + #jform_profile_tos label {margin: 0 15px 0 0 !important; width: auto;} + '; $doc->addStyleDeclaration($css); JHtml::_('behavior.modal'); diff --git a/plugins/user/profile/profile.php b/plugins/user/profile/profile.php index 05fce9e23a191..6164a8c51f48e 100644 --- a/plugins/user/profile/profile.php +++ b/plugins/user/profile/profile.php @@ -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 (substr($value, 0, 4) == 'http') { return '' . $value . ''; }