Synced
0dabcea0aa88012f6ae20861450b8ac713d52b5fd2b0a414ad6086c63148
This commit is contained in:
parent
89471a3c4b
commit
0c23ab35bd
1 changed files with 187 additions and 326 deletions
|
|
@ -553,28 +553,21 @@ class fuckhtml{
|
|||
|
||||
case "\"":
|
||||
case "'":
|
||||
if(
|
||||
$i !== 0 && // only check if a quote could be there
|
||||
(
|
||||
(
|
||||
$json[$i - 1] === "\\" &&
|
||||
(
|
||||
$i === 2 ||
|
||||
$json[$i - 2] === "\\"
|
||||
)
|
||||
) ||
|
||||
$json[$i - 1] !== "\\"
|
||||
)
|
||||
){
|
||||
// found a non-escaped quote
|
||||
|
||||
// count preceding backslashes
|
||||
$bsCount = 0;
|
||||
$j = $i - 1;
|
||||
|
||||
while($j >= 0 && $json[$j] === "\\"){
|
||||
$bsCount++;
|
||||
$j--;
|
||||
}
|
||||
|
||||
// quote is NOT escaped if even number of backslashes
|
||||
if($bsCount % 2 === 0){
|
||||
if($in_quote === null){
|
||||
|
||||
// open quote
|
||||
$in_quote = $json[$i];
|
||||
|
||||
}elseif($in_quote === $json[$i]){
|
||||
|
||||
// close quote
|
||||
$in_quote = null;
|
||||
}
|
||||
|
|
@ -632,4 +625,4 @@ class fuckhtml{
|
|||
// fallback
|
||||
return "[]";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue