[ Index ] |
|
Code source de osCommerce 2.2ms2-060817 |
1 <?php 2 /* 3 $Id: gzip_compression.php,v 1.3 2003/02/11 01:31:02 hpdl Exp $ 4 5 osCommerce, Open Source E-Commerce Solutions 6 http://www.oscommerce.com 7 8 Copyright (c) 2003 osCommerce 9 10 Released under the GNU General Public License 11 */ 12 13 function tep_check_gzip() { 14 global $HTTP_ACCEPT_ENCODING; 15 16 if (headers_sent() || connection_aborted()) { 17 return false; 18 } 19 20 if (strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false) return 'x-gzip'; 21 22 if (strpos($HTTP_ACCEPT_ENCODING,'gzip') !== false) return 'gzip'; 23 24 return false; 25 } 26 27 /* $level = compression level 0-9, 0=none, 9=max */ 28 function tep_gzip_output($level = 5) { 29 if ($encoding = tep_check_gzip()) { 30 $contents = ob_get_contents(); 31 ob_end_clean(); 32 33 header('Content-Encoding: ' . $encoding); 34 35 $size = strlen($contents); 36 $crc = crc32($contents); 37 38 $contents = gzcompress($contents, $level); 39 $contents = substr($contents, 0, strlen($contents) - 4); 40 41 echo "\x1f\x8b\x08\x00\x00\x00\x00\x00"; 42 echo $contents; 43 echo pack('V', $crc); 44 echo pack('V', $size); 45 } else { 46 ob_end_flush(); 47 } 48 } 49 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Mon Nov 26 19:48:25 2007 | par Balluche grâce à PHPXref 0.7 |
![]() |