[ Index ] |
|
Code source de Zen Cart E-Commerce Shopping Cart 1.3.7.1 |
1 <?php 2 // 3 // +----------------------------------------------------------------------+ 4 // |zen-cart Open Source E-commerce | 5 // +----------------------------------------------------------------------+ 6 // | Copyright (c) 2003 The zen-cart developers | 7 // | | 8 // | http://www.zen-cart.com/index.php | 9 // | | 10 // | Portions Copyright (c) 2003 osCommerce | 11 // +----------------------------------------------------------------------+ 12 // | This source file is subject to version 2.0 of the GPL license, | 13 // | that is bundled with this package in the file LICENSE, and is | 14 // | available through the world-wide-web at the following url: | 15 // | http://www.zen-cart.com/license/2_0.txt. | 16 // | If you did not receive a copy of the zen-cart license and are unable | 17 // | to obtain it through the world-wide-web, please send a note to | 18 // | license@zen-cart.com so we can mail you a copy immediately. | 19 // +----------------------------------------------------------------------+ 20 // $Id: gzip_compression.php 1969 2005-09-13 06:57:21Z drbyte $ 21 // 22 23 function zen_check_gzip() { 24 25 if (headers_sent() || connection_aborted()) { 26 return false; 27 } 28 29 if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'x-gzip') !== false) return 'x-gzip'; 30 31 if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'],'gzip') !== false) return 'gzip'; 32 33 return false; 34 } 35 36 /* $level = compression level 0-9, 0=none, 9=max */ 37 function zen_gzip_output($level = GZIP_LEVEL) { 38 if ($encoding = zen_check_gzip()) { 39 $contents = ob_get_contents(); 40 ob_end_clean(); 41 42 header('Content-Encoding: ' . $encoding); 43 44 $size = strlen($contents); 45 $crc = crc32($contents); 46 47 $contents = gzcompress($contents, $level); 48 $contents = substr($contents, 0, strlen($contents) - 4); 49 50 echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; 51 echo $contents; 52 echo pack('V', $crc); 53 echo pack('V', $size); 54 } else { 55 ob_end_flush(); 56 } 57 } 58 ?>
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 |
![]() |