mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-29 04:42:36 +00:00
fix cleaning of string content
This commit is contained in:
parent
227b182bd7
commit
7ae3b1d399
@ -303,7 +303,7 @@ abstract class JEDCheckerHelper
|
||||
{
|
||||
if (!$parse)
|
||||
{
|
||||
return str_repeat("\n", substr_count($content, "\n"));
|
||||
return self::cleanLines($content);
|
||||
}
|
||||
|
||||
$pos = 0;
|
||||
@ -312,7 +312,7 @@ abstract class JEDCheckerHelper
|
||||
while (preg_match('/\n|\\\\|\{\$|\$\{/', $content, $match, PREG_OFFSET_CAPTURE, $pos))
|
||||
{
|
||||
$foundPos = $match[0][1];
|
||||
$cleanContent .= substr($content, $pos, $foundPos - $pos);
|
||||
$cleanContent .= self::cleanLines(substr($content, $pos, $foundPos - $pos));
|
||||
$pos = $foundPos;
|
||||
|
||||
switch ($match[0][0])
|
||||
@ -384,4 +384,17 @@ abstract class JEDCheckerHelper
|
||||
|
||||
return $cleanContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove all content except of EOLs to preserve line numbers
|
||||
*
|
||||
* @param string $content
|
||||
*
|
||||
* @return string
|
||||
* @since 2.4.2
|
||||
*/
|
||||
protected static function cleanLines($content)
|
||||
{
|
||||
return str_repeat("\n", substr_count($content, "\n"));
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user