[ Index ]
 

Code source de Mantis 1.1.0rc3

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/core/ -> compress_api.php (source)

   1  <?php
   2  # Mantis - a php based bugtracking system
   3  
   4  # Copyright (C) 2000 - 2002  Kenzaburo Ito - kenito@300baud.org
   5  # Copyright (C) 2002 - 2007  Mantis Team   - mantisbt-dev@lists.sourceforge.net
   6  
   7  # Mantis is free software: you can redistribute it and/or modify
   8  # it under the terms of the GNU General Public License as published by
   9  # the Free Software Foundation, either version 2 of the License, or
  10  # (at your option) any later version.
  11  #
  12  # Mantis is distributed in the hope that it will be useful,
  13  # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  15  # GNU General Public License for more details.
  16  #
  17  # You should have received a copy of the GNU General Public License
  18  # along with Mantis.  If not, see <http://www.gnu.org/licenses/>.
  19  
  20      # --------------------------------------------------------
  21      # $Id: compress_api.php,v 1.16.22.1 2007-10-13 22:35:18 giallu Exp $
  22      # --------------------------------------------------------
  23  
  24      ### Compression API ###
  25  
  26      # Starts the buffering/compression (only if the compression option is ON)
  27      # This method should be called after all possible re-directs and
  28      #  access level checks.
  29  
  30      # This variable is used internally.  It is not used for configuration
  31      $g_compression_started = false;
  32  
  33      # ----------------
  34      # Check if compression should be enabled.
  35  	function compress_is_enabled() {
  36          global $g_compression_started;
  37  
  38          #@@@ temporarily disable compression when using IIS because of
  39          #   issue #2953
  40          return ( $g_compression_started &&
  41                  ON == config_get( 'compress_html' ) &&
  42                  OFF == config_get( 'use_iis' )  &&
  43                  ( 'ob_gzhandler' != ini_get('output_handler') ) &&
  44                  extension_loaded( 'zlib' ) &&
  45                  !ini_get('zlib.output_compression') );
  46      }
  47  
  48      # ----------------
  49      # Output Buffering handler that either compresses the buffer or just
  50      #  returns it, depending on the return value of compress_is_enabled()
  51  	function compress_handler( $p_buffer, $p_mode ) {
  52          if ( compress_is_enabled() ) {
  53              return ob_gzhandler( $p_buffer, $p_mode );
  54          } else {
  55              return $p_buffer;
  56          }
  57      }
  58  
  59      # ----------------
  60      # Enable output buffering with compression.
  61  	function compress_enable() {
  62          global $g_compression_started;
  63  
  64          $g_compression_started = true;
  65      }
  66  
  67      # ----------------
  68      # Disable output buffering with compression.
  69  	function compress_disable() {
  70          global $g_compression_started;
  71  
  72          $g_compression_started = false;
  73      }
  74  ?>


Généré le : Thu Nov 29 09:42:17 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics