1
0
mirror of https://github.com/processwire/processwire.git synced 2025-08-16 03:34:33 +02:00
This commit is contained in:
Ryan Cramer
2019-03-28 05:52:44 -04:00
parent f7b99d7676
commit ce8c369510

View File

@@ -545,8 +545,8 @@ class WireMarkupRegions extends Wire {
$testStart = 0; $testStart = 0;
$doCnt = 0; $doCnt = 0;
$maxDoCnt = 100000; $maxDoCnt = 100000;
$openTag1 = "<$tagInfo[name]>"; $openTag = "<$tagInfo[name]";
$openTag2 = "<$tagInfo[name] "; $openTags = array("$openTag>", "$openTag ", "$openTag\n", "$openTag\r", "$openTag\t");
$fail = false; $fail = false;
do { do {
@@ -557,7 +557,10 @@ class WireMarkupRegions extends Wire {
break; break;
} }
$test = substr($region, 0, $testPos); $test = substr($region, 0, $testPos);
$openCnt = substr_count($test, $openTag1) + substr_count($test, $openTag2); $openCnt = 0;
foreach($openTags as $openTag) {
if(strpos($test, $openTag) !== false) $openCnt += substr_count($test, $openTag);
}
$closeCnt = substr_count($test, $tagInfo['close']); $closeCnt = substr_count($test, $tagInfo['close']);
if($openCnt == $closeCnt) { if($openCnt == $closeCnt) {
// open and close tags balance, meaning we've found our region // open and close tags balance, meaning we've found our region