mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2025-01-03 22:57:21 +00:00
parse multiline values
This commit is contained in:
parent
ab4acc2bba
commit
2e54c9fc7e
@ -87,6 +87,7 @@ COM_JEDCHECKER_LANG_KEY_EMPTY="Empty key name"
|
|||||||
COM_JEDCHECKER_LANG_KEY_WHITESPACE="Whitespace in the key is not allowed"
|
COM_JEDCHECKER_LANG_KEY_WHITESPACE="Whitespace in the key is not allowed"
|
||||||
COM_JEDCHECKER_LANG_KEY_INVALID_CHARACTER="Incorrect character in the key name"
|
COM_JEDCHECKER_LANG_KEY_INVALID_CHARACTER="Incorrect character in the key name"
|
||||||
COM_JEDCHECKER_LANG_KEY_RESERVED="Reserved keyword in the key name"
|
COM_JEDCHECKER_LANG_KEY_RESERVED="Reserved keyword in the key name"
|
||||||
|
COM_JEDCHECKER_LANG_TRANSLATION_ERROR="Incorrect translation string"
|
||||||
COM_JEDCHECKER_LANG_TRANSLATION_QUOTES="All translation strings should be in double quotation marks"
|
COM_JEDCHECKER_LANG_TRANSLATION_QUOTES="All translation strings should be in double quotation marks"
|
||||||
COM_JEDCHECKER_LANG_TRANSLATION_EMPTY="Empty translation string"
|
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_QQ_DEPRECATED="Usage of \"_QQ_\" is deprecated since Joomla! 3.9. Use escaped double quotes (\\\") instead"
|
||||||
|
@ -145,6 +145,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$value = trim($matches[1]);
|
||||||
// Check for empty value
|
// Check for empty value
|
||||||
if ($value === '""')
|
if ($value === '""')
|
||||||
{
|
{
|
||||||
@ -152,6 +153,7 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (strlen($value) < 2 || $value[0] !== '"' || substr($value, -1) !== '"')
|
||||||
// Remove quotes around
|
// Remove quotes around
|
||||||
$value = substr($value, 1, -1);
|
$value = substr($value, 1, -1);
|
||||||
|
|
||||||
@ -160,6 +162,17 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
|||||||
{
|
{
|
||||||
$this->report->addInfo($file, JText::_('COM_JEDCHECKER_LANG_QQ_DEPRECATED'), $lineno, $line);
|
$this->report->addInfo($file, JText::_('COM_JEDCHECKER_LANG_QQ_DEPRECATED'), $lineno, $line);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Count %... formats in the string
|
||||||
|
$count1 = preg_match_all('/(?<=^|[^%])%(?=[-+0 ]?\w)/', $value);
|
||||||
|
|
||||||
|
// Count %n$... (argnum) formats in the string
|
||||||
|
$count2 = preg_match_all('/(?<=^|[^%])%\d+\$/', $value);
|
||||||
|
|
||||||
|
if ($count1 > 1 && $count2 < $count1) {
|
||||||
|
// @todo It's not mentioned in docs
|
||||||
|
$this->report->addInfo($file, JText::_('COM_JEDCHECKER_LANG_RECOMMEND_ARGNUM'), $startLineno, $line);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// All checks passed. Return true
|
// All checks passed. Return true
|
||||||
|
Loading…
Reference in New Issue
Block a user