From 689b2383f0a6a8517ef4b26fa2948e6c58e0bdc5 Mon Sep 17 00:00:00 2001 From: kmvan Date: Sun, 20 Jan 2019 00:03:14 +0800 Subject: [PATCH] remove html minify --- src/Components/Bootstrap/Bootstrap.php | 7 +--- src/Components/Helper/HelperApi.php | 56 -------------------------- 2 files changed, 1 insertion(+), 62 deletions(-) diff --git a/src/Components/Bootstrap/Bootstrap.php b/src/Components/Bootstrap/Bootstrap.php index b8a8ab53..24487faa 100644 --- a/src/Components/Bootstrap/Bootstrap.php +++ b/src/Components/Bootstrap/Bootstrap.php @@ -4,7 +4,6 @@ use InnStudio\Prober\Components\Config\ConfigApi; use InnStudio\Prober\Components\Events\EventsApi; -use InnStudio\Prober\Components\Helper\HelperApi; use InnStudio\Prober\Components\I18n\I18nApi; class Bootstrap @@ -13,11 +12,7 @@ public function __construct() { EventsApi::emit('init'); - if (DEBUG === true) { - echo $this->getDisplay(); - } else { - echo HelperApi::htmlMinify($this->getDisplay()); - } + echo $this->getDisplay(); } private function getFieldsets() diff --git a/src/Components/Helper/HelperApi.php b/src/Components/Helper/HelperApi.php index f4540de1..18f04fd5 100644 --- a/src/Components/Helper/HelperApi.php +++ b/src/Components/Helper/HelperApi.php @@ -309,62 +309,6 @@ public static function isWin() return \PHP_OS === 'WINNT'; } - public static function htmlMinify($buffer) - { - // @see https://stackoverflow.com/questions/27878158/php-bufffer-output-minify-not-textarea-pre - \preg_match_all('#\.*\<\/textarea\>#Uis', $buffer, $foundTxt); - \preg_match_all('#\.*\<\/pre\>#Uis', $buffer, $foundPre); - - // replacing both with /
$index
- $textareas = array(); - - foreach (\array_keys($foundTxt[0]) as $item) { - $textareas[] = ''; - } - - $pres = array(); - - foreach (\array_keys($foundPre[0]) as $item) { - $pres[] = '
' . $item . '
'; - } - - $buffer = \str_replace($foundTxt[0], $textareas, $buffer); - $buffer = \str_replace($foundPre[0], $pres, $buffer); - - // your stuff - $search = array( - '/\>[^\S ]+/s', // strip whitespaces after tags, except space - '/[^\S ]+\', - '<', - '\\1', - ); - - $buffer = \preg_replace($search, $replace, $buffer); - - // Replacing back with content - $textareas = array(); - - foreach (\array_keys($foundTxt[0]) as $item) { - $textareas[] = ''; - } - - $pres = array(); - - foreach (\array_keys($foundPre[0]) as $item) { - $pres[] = '
' . $item . '
'; - } - - $buffer = \str_replace($textareas, $foundTxt[0], $buffer); - $buffer = \str_replace($pres, $foundPre[0], $buffer); - - return $buffer; - } - public static function getClientIp() { $keys = array('HTTP_X_FORWARDED_FOR', 'HTTP_CLIENT_IP', 'REMOTE_ADDR');