mirror of
https://github.com/joomla-extensions/jedchecker.git
synced 2024-12-31 21:51:46 +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)
|
if (!$parse)
|
||||||
{
|
{
|
||||||
return str_repeat("\n", substr_count($content, "\n"));
|
return self::cleanLines($content);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pos = 0;
|
$pos = 0;
|
||||||
@ -312,7 +312,7 @@ abstract class JEDCheckerHelper
|
|||||||
while (preg_match('/\n|\\\\|\{\$|\$\{/', $content, $match, PREG_OFFSET_CAPTURE, $pos))
|
while (preg_match('/\n|\\\\|\{\$|\$\{/', $content, $match, PREG_OFFSET_CAPTURE, $pos))
|
||||||
{
|
{
|
||||||
$foundPos = $match[0][1];
|
$foundPos = $match[0][1];
|
||||||
$cleanContent .= substr($content, $pos, $foundPos - $pos);
|
$cleanContent .= self::cleanLines(substr($content, $pos, $foundPos - $pos));
|
||||||
$pos = $foundPos;
|
$pos = $foundPos;
|
||||||
|
|
||||||
switch ($match[0][0])
|
switch ($match[0][0])
|
||||||
@ -384,4 +384,17 @@ abstract class JEDCheckerHelper
|
|||||||
|
|
||||||
return $cleanContent;
|
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