[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 /** 3 * gzip_compression functions 4 * 5 * @package functions 6 * @copyright Copyright 2003-2005 Zen Cart Development Team 7 * @copyright Portions Copyright 2003 osCommerce 8 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0 9 * @version $Id: gzip_compression.php 2618 2005-12-20 00:35:47Z drbyte $ 10 */ 11 12 function zen_check_gzip() { 13 global $HTTP_ACCEPT_ENCODING; 14 15 if (headers_sent() || connection_aborted()) { 16 return false; 17 } 18 19 if (strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false) return 'x-gzip'; 20 21 if (strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false) return 'gzip'; 22 23 return false; 24 } 25 26 /* $level = compression level 0-9, 0=none, 9=max */ 27 function zen_gzip_output($level = GZIP_LEVEL) { 28 if ($encoding = zen_check_gzip()) { 29 $contents = ob_get_contents(); 30 ob_end_clean(); 31 32 header('Content-Encoding: ' . $encoding); 33 34 $size = strlen($contents); 35 $crc = crc32($contents); 36 37 $contents = gzcompress($contents, $level); 38 $contents = substr($contents, 0, strlen($contents) - 4); 39 40 echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; 41 echo $contents; 42 echo pack('V', $crc); 43 echo pack('V', $size); 44 } else { 45 ob_end_flush(); 46 } 47 } 48 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 16:45:43 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |