3280 | | function wp_ob_end_flush_all() { |
3281 | | $levels = ob_get_level(); |
3282 | | for ($i=0; $i<$levels; $i++) |
3283 | | ob_end_flush(); |
| 3283 | function wp_ob_end_flush_all($disable_compression = false) { |
| 3284 | |
| 3285 | // Clean the output buffer |
| 3286 | while ( @ob_get_flush() ); |
| 3287 | |
| 3288 | if ( $disable_compression ) { |
| 3289 | /** |
| 3290 | * Turn off compression - make sure to flush the buffer BEFORE |
| 3291 | * turning off compression, see comment from Sam Yong |
| 3292 | * @link http://php.net/manual/en/function.ob-end-clean.php |
| 3293 | */ |
| 3294 | if ( !headers_sent() && ini_get('zlib.output_handler') ) { |
| 3295 | ini_set('zlib.output_handler', ''); |
| 3296 | ini_set('zlib.output_compression', 0); |
| 3297 | } |
| 3298 | |
| 3299 | // Tell apache to send an uncompressed non-chunked response |
| 3300 | if ( function_exists('apache_setenv') ) { |
| 3301 | |
| 3302 | /** |
| 3303 | * Turn off mod_deflate |
| 3304 | * @link http://httpd.apache.org/docs/2.2/env.html#no-gzip |
| 3305 | */ |
| 3306 | apache_setenv( 'no-gzip', '1' ); |
| 3307 | } |
| 3308 | |
| 3309 | // Turn off any default output handlers |
| 3310 | ini_set('output_handler', ''); |
| 3311 | ini_set('output_buffering', false); |
| 3312 | ini_set('implicit_flush', true); |
| 3313 | |
| 3314 | // Pad the output by a 4K block just to make sure that whatever apache/php |
| 3315 | // considers a "chunk" is sent |
| 3316 | echo str_repeat(chr(0), 4096); |
| 3317 | flush(); |
| 3318 | } |