mirror of
https://github.com/processwire/processwire.git
synced 2025-08-19 13:01:26 +02:00
Fix for debug mode warning in WireMarkupRegions plus other minor tweaks
This commit is contained in:
@@ -1140,8 +1140,10 @@ class WireMarkupRegions extends Wire {
|
|||||||
static $recursionLevel = 0;
|
static $recursionLevel = 0;
|
||||||
$recursionLevel++;
|
$recursionLevel++;
|
||||||
$leftoverMarkup = '';
|
$leftoverMarkup = '';
|
||||||
|
|
||||||
$debugLandmark = "<!--PW-REGION-DEBUG-->";
|
$debugLandmark = "<!--PW-REGION-DEBUG-->";
|
||||||
$debug = $this->wire('config')->debug || strpos($htmlDocument, $debugLandmark) !== false;
|
$hasDebugLandmark = strpos($htmlDocument, $debugLandmark) !== false;
|
||||||
|
$debug = $hasDebugLandmark && $this->wire('config')->debug;
|
||||||
$debugTimer = $debug ? Debug::timer() : 0;
|
$debugTimer = $debug ? Debug::timer() : 0;
|
||||||
|
|
||||||
if(is_array($htmlRegions)) {
|
if(is_array($htmlRegions)) {
|
||||||
@@ -1211,7 +1213,9 @@ class WireMarkupRegions extends Wire {
|
|||||||
($region['actionTarget'] != $pwid ? "(target=$region[actionTarget])" : "") .
|
($region['actionTarget'] != $pwid ? "(target=$region[actionTarget])" : "") .
|
||||||
"... $open" . ($region['close'] ? "[small]$debugBytes bytes[/small]$region[close]" : "");
|
"... $open" . ($region['close'] ? "[small]$debugBytes bytes[/small]$region[close]" : "");
|
||||||
$regionNote = "$regionKey. $region[note]";
|
$regionNote = "$regionKey. $region[note]";
|
||||||
}
|
} else {
|
||||||
|
$regionNote = '';
|
||||||
|
}
|
||||||
|
|
||||||
if(!$documentHasTarget) {
|
if(!$documentHasTarget) {
|
||||||
// if the id attribute doesn't appear in the html, skip it
|
// if the id attribute doesn't appear in the html, skip it
|
||||||
@@ -1263,6 +1267,8 @@ class WireMarkupRegions extends Wire {
|
|||||||
} else {
|
} else {
|
||||||
$htmlDocument .= "<!--" . $debugNotes . "\n-->";
|
$htmlDocument .= "<!--" . $debugNotes . "\n-->";
|
||||||
}
|
}
|
||||||
|
} else if($hasDebugLandmark) {
|
||||||
|
$htmlDocument = str_replace($debugLandmark, '', $htmlDocument);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(count($xregions) && $recursionLevel < 3) {
|
if(count($xregions) && $recursionLevel < 3) {
|
||||||
|
Reference in New Issue
Block a user