Last active
November 13, 2018 14:31
-
-
Save Padilo300/387b7afd31d668bff91b78bb4d5b9074 to your computer and use it in GitHub Desktop.
просто вставить в самый верх head но после сессии, или кук.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function sanitize_output($buffer) { | |
$search = array( | |
'/\>[^\S ]+/s', // strip whitespaces after tags, except space | |
'/[^\S ]+\</s', // strip whitespaces before tags, except space | |
'/(\s)+/s', // shorten multiple whitespace sequences | |
'/<!--(.|\s)*?-->/' // Remove HTML comments | |
); | |
$replace = array( | |
'>', | |
'<', | |
'\\1', | |
'' | |
); | |
$buffer = preg_replace($search, $replace, $buffer); | |
return $buffer; | |
} | |
ob_start("sanitize_output"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment