1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
if (Director::isLive()) { 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 ); $replace = array( '>', '<', '\\1' ); $buffer = preg_replace( $search, $replace, $buffer ); return $buffer; } ob_start( "sanitize_output" ); }
You can clone a snippet to your computer for local editing. Learn more.