mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-11-16 10:05:14 +00:00
Check for incorrect EOL
This commit is contained in:
parent
778ece5631
commit
9c6295231e
@ -80,6 +80,7 @@ COM_JEDCHECKER_DELETE_SUCCESS="Temporary folder deleted!"
|
|||||||
COM_JEDCHECKER_EMPTY_UPLOAD_FIELD="Please, select a zipped file to be uploaded"
|
COM_JEDCHECKER_EMPTY_UPLOAD_FIELD="Please, select a zipped file to be uploaded"
|
||||||
COM_JEDCHECKER_LANG="Language files"
|
COM_JEDCHECKER_LANG="Language files"
|
||||||
COM_JEDCHECKER_LANG_DESC="Validates language files"
|
COM_JEDCHECKER_LANG_DESC="Validates language files"
|
||||||
|
COM_JEDCHECKER_LANG_INCORRECT_EOL="Incorrect end-of-line character found. Convert file to Unix EOL (\n) format."
|
||||||
COM_JEDCHECKER_LANG_BOM_FOUND="The byte order mark (BOM) is detected"
|
COM_JEDCHECKER_LANG_BOM_FOUND="The byte order mark (BOM) is detected"
|
||||||
COM_JEDCHECKER_LANG_INCORRECT_COMMENT="Incorrect comment character, use ';' instead"
|
COM_JEDCHECKER_LANG_INCORRECT_COMMENT="Incorrect comment character, use ';' instead"
|
||||||
COM_JEDCHECKER_LANG_WRONG_LINE="Incorrect line without '=' character"
|
COM_JEDCHECKER_LANG_WRONG_LINE="Incorrect line without '=' character"
|
||||||
|
@ -79,6 +79,19 @@ class JedcheckerRulesLanguage extends JEDcheckerRule
|
|||||||
*/
|
*/
|
||||||
protected function find($file, $tag)
|
protected function find($file, $tag)
|
||||||
{
|
{
|
||||||
|
$content = file_get_contents($file);
|
||||||
|
|
||||||
|
if ($content === false)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check EOL format is \n (not \r or \n\r)
|
||||||
|
if (strpos($content, "\r") !== false)
|
||||||
|
{
|
||||||
|
$this->report->addWarning($file, JText::_('COM_JEDCHECKER_LANG_INCORRECT_EOL'));
|
||||||
|
}
|
||||||
|
|
||||||
$lines = file($file);
|
$lines = file($file);
|
||||||
$nLines = count($lines);
|
$nLines = count($lines);
|
||||||
$keys = array();
|
$keys = array();
|
||||||
|
Loading…
Reference in New Issue
Block a user