From 1dc0d613386c7c06b3e6ec6040247b9f57c383a3 Mon Sep 17 00:00:00 2001 From: surikat Date: Wed, 2 Mar 2016 18:43:28 +0100 Subject: [PATCH] improve by recurse the str_replace --- BeautifyHtml.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BeautifyHtml.php b/BeautifyHtml.php index 21d1eaf..b85f274 100644 --- a/BeautifyHtml.php +++ b/BeautifyHtml.php @@ -109,7 +109,10 @@ function beautify($buffer){ $indentionLevel++; } $buffer = implode("\n",$cleanContent); // write indented lines back to buffer - $buffer = str_replace(array_keys($this->tagsToIgnoreBlocks), $this->tagsToIgnoreBlocks, $buffer); // add blocks, which should not be processed + do{ + $buffer = str_replace(array_keys($this->tagsToIgnoreBlocks), array_values($this->tagsToIgnoreBlocks), $buffer, $replaced); // add blocks, which should not be processed + } + while($replaced); return $buffer; } } \ No newline at end of file