mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-28 12:30:44 +00:00
separate check for left and right quotes (for convenience)
This commit is contained in:
parent
566ce26d11
commit
adb548249d
@ -93,7 +93,9 @@ COM_JEDCHECKER_LANG_KEY_NOT_UPPERCASE="The key name is not uppercase"
|
||||
COM_JEDCHECKER_LANG_KEY_DUPLICATED="The key name was declared previously on line %d"
|
||||
COM_JEDCHECKER_LANG_TRANSLATION_ERROR="Invalid translation string"
|
||||
COM_JEDCHECKER_LANG_INVALID_UTF8="Invalid UTF8 string"
|
||||
COM_JEDCHECKER_LANG_TRANSLATION_QUOTES="All translation strings should be enclosed in double quotation marks"
|
||||
COM_JEDCHECKER_LANG_TRANSLATION_QUOTES="All translation strings should be enclosed in double quotation marks."
|
||||
COM_JEDCHECKER_LANG_TRANSLATION_MISSED_LEFT_QUOTE="You have missed the left quote."
|
||||
COM_JEDCHECKER_LANG_TRANSLATION_MISSED_RIGTH_QUOTE="You have missed the right quote"
|
||||
COM_JEDCHECKER_LANG_TRANSLATION_EMPTY="Empty translation string"
|
||||
COM_JEDCHECKER_LANG_QQ_DEPRECATED="Usage of \"_QQ_\" is deprecated since Joomla! 3.9. Use escaped double quotes (\\\") instead"
|
||||
COM_JEDCHECKER_LANG_UNESCAPED_QUOTE="Unescaped double quotation mark found"
|
||||
|
@ -234,12 +234,27 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
||||
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_INVALID_UTF8'), $startLineno, $line);
|
||||
}
|
||||
|
||||
if (strlen($value) < 2 || $value[0] !== '"' || substr($value, -1) !== '"')
|
||||
// Check for unquoted values
|
||||
if (strlen($value) < 2 || ($value[0] !== '"' && substr($value, -1) !== '"'))
|
||||
{
|
||||
$this->report->addError($file, JText::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES'), $startLineno, $line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($value[0] !== '"')
|
||||
{
|
||||
$msg = JText::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES') . ' ' . JText::_('COM_JEDCHECKER_LANG_TRANSLATION_MISSED_LEFT_QUOTE');
|
||||
$this->report->addError($file, $msg, $startLineno, $line);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (substr($value, -1) !== '"')
|
||||
{
|
||||
$msg = JText::_('COM_JEDCHECKER_LANG_TRANSLATION_QUOTES') . ' ' . JText::_('COM_JEDCHECKER_LANG_TRANSLATION_MISSED_RIGHT_QUOTE');
|
||||
$this->report->addError($file, $msg, $startLineno, $line);
|
||||
continue;
|
||||
}
|
||||
|
||||
// // Remove quotes around
|
||||
$value = substr($value, 1, -1);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user