Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replaced unnecessary double quotes in plugins #13211

Merged
merged 2 commits into from
Dec 18, 2016
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugins/authentication/ldap/ldap.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']))
{
Expand Down Expand Up @@ -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
{
Expand Down
2 changes: 1 addition & 1 deletion plugins/captcha/recaptcha/recaptcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ private function getResponse($privatekey, $remoteip, $response, $challenge = nul
*/
private function _recaptcha_qsencode($data)
{
$req = "";
$req = '';

foreach ($data as $key => $value)
{
Expand Down
10 changes: 5 additions & 5 deletions plugins/captcha/recaptcha/recaptchalib.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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 <a href='"
. self::$_signupUrl . "'>" . self::$_signupUrl . "</a>");
Expand All @@ -70,7 +70,7 @@ public function __construct($secret)
*/
private function _encodeQS($data)
{
$req = "";
$req = '';
foreach ($data as $key => $value)
{
$req .= $key . '=' . urlencode(stripslashes($value)) . '&';
Expand Down
6 changes: 3 additions & 3 deletions plugins/content/emailcloak/emailcloak.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 += '<a '", ".innerHTML += '<a {$before}'", $jsEmail);
}

if ($after !== "")
if ($after !== '')
{
$after = str_replace("'", "\'", $after);
$jsEmail = str_replace("'\'>'", "'\'{$after}>'", $jsEmail);
Expand Down Expand Up @@ -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 = "(<img[^>]+>)";
$searchImage = '(<img[^>]+>)';

// Any Text with <span or <strong
$searchTextSpan = '(<span[^>]+>|<span>|<strong>|<strong><span[^>]+>|<strong><span>)' . $searchText . '(</span>|</strong>|</span></strong>)';
Expand Down
2 changes: 1 addition & 1 deletion plugins/content/pagenavigation/pagenavigation.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
2 changes: 1 addition & 1 deletion plugins/content/vote/vote.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
{
Expand Down
4 changes: 2 additions & 2 deletions plugins/editors/codemirror/codemirror.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
20 changes: 10 additions & 10 deletions plugins/editors/tinymce/tinymce.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}
}

Expand Down Expand Up @@ -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();
Expand All @@ -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(
Expand Down Expand Up @@ -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))
{
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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');
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/search/contacts/contacts.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
6 changes: 3 additions & 3 deletions plugins/search/content/content.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'
)
Expand Down Expand Up @@ -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);
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/search/newsfeeds/newsfeeds.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
2 changes: 1 addition & 1 deletion plugins/search/tags/tags.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 6 additions & 6 deletions plugins/system/debug/debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) == '<html><head><meta http-equiv="refresh" content="0;')
{
echo $contents;
Expand Down Expand Up @@ -989,8 +989,8 @@ protected function displayQueries()
}

$fromString = substr($query, 0, $whereStart);
$fromString = str_replace("\t", " ", $fromString);
$fromString = str_replace("\n", " ", $fromString);
$fromString = str_replace("\t", ' ', $fromString);
$fromString = str_replace("\n", ' ', $fromString);
$fromString = trim($fromString);

// Initialise the select/other query type counts the first time.
Expand Down Expand Up @@ -2094,9 +2094,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("\t", ' ', $temp);
$temp = str_replace("\n", ' ', $temp);
$current .= str_replace("\r\n", ' ', $temp) . ";\n";
}
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/system/languagefilter/languagefilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ public function parseRule(&$router, &$uri)

// We are called via POST. We don't care about the language
// and simply set the default language as our current language.
if ($this->app->input->getMethod() == "POST"
if ($this->app->input->getMethod() == 'POST'
|| count($this->app->input->post) > 0
|| count($this->app->input->files) > 0)
{
Expand Down
6 changes: 3 additions & 3 deletions plugins/system/log/log.php
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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;
}
Expand Down
8 changes: 4 additions & 4 deletions plugins/system/sef/sef.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion plugins/system/stats/stats.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public function onAfterInitialise()
return;
}

if (JUri::getInstance()->getVar("tmpl") === "component")
if (JUri::getInstance()->getVar('tmpl') === 'component')
{
return;
}
Expand Down
4 changes: 2 additions & 2 deletions plugins/user/joomla/joomla.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions plugins/user/profile/field/tos.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;}
$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;}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space after margin: and width: in two lines

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed it.

#jform_profile_tos label {margin:0 15px 0 0 !important; width:auto;}
";
';
$doc->addStyleDeclaration($css);
JHtml::_('behavior.modal');

Expand Down
2 changes: 1 addition & 1 deletion plugins/user/profile/profile.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 '<a href="' . $value . '">' . $value . '</a>';
}
Expand Down