From 1886f132b571b132a0aebc47418e2e8ca360443d Mon Sep 17 00:00:00 2001 From: Ryan Cramer Date: Sun, 29 Jan 2017 07:08:18 -0500 Subject: [PATCH] Fix for debug mode warning in WireMarkupRegions plus other minor tweaks --- wire/core/WireMarkupRegions.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/wire/core/WireMarkupRegions.php b/wire/core/WireMarkupRegions.php index 321cddcc..fa1f6e0c 100644 --- a/wire/core/WireMarkupRegions.php +++ b/wire/core/WireMarkupRegions.php @@ -1140,8 +1140,10 @@ class WireMarkupRegions extends Wire { static $recursionLevel = 0; $recursionLevel++; $leftoverMarkup = ''; + $debugLandmark = ""; - $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; if(is_array($htmlRegions)) { @@ -1211,7 +1213,9 @@ class WireMarkupRegions extends Wire { ($region['actionTarget'] != $pwid ? "(target=$region[actionTarget])" : "") . "... $open" . ($region['close'] ? "[small]$debugBytes bytes[/small]$region[close]" : ""); $regionNote = "$regionKey. $region[note]"; - } + } else { + $regionNote = ''; + } if(!$documentHasTarget) { // if the id attribute doesn't appear in the html, skip it @@ -1263,6 +1267,8 @@ class WireMarkupRegions extends Wire { } else { $htmlDocument .= ""; } + } else if($hasDebugLandmark) { + $htmlDocument = str_replace($debugLandmark, '', $htmlDocument); } if(count($xregions) && $recursionLevel < 3) {