eZ Publish  [4.0]
ezgzipcompressionhandler.php
Go to the documentation of this file.
00001 <?php
00002 //
00003 // Definition of eZGZIPCompressionHandler class
00004 //
00005 // Created on: <13-Aug-2003 16:20:19 amos>
00006 //
00007 // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00008 // SOFTWARE NAME: eZ Publish
00009 // SOFTWARE RELEASE: 4.0.x
00010 // COPYRIGHT NOTICE: Copyright (C) 1999-2008 eZ Systems AS
00011 // SOFTWARE LICENSE: GNU General Public License v2.0
00012 // NOTICE: >
00013 //   This program is free software; you can redistribute it and/or
00014 //   modify it under the terms of version 2.0  of the GNU General
00015 //   Public License as published by the Free Software Foundation.
00016 //
00017 //   This program is distributed in the hope that it will be useful,
00018 //   but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 //   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 //   GNU General Public License for more details.
00021 //
00022 //   You should have received a copy of version 2.0 of the GNU General
00023 //   Public License along with this program; if not, write to the Free
00024 //   Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
00025 //   MA 02110-1301, USA.
00026 //
00027 //
00028 // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
00029 //
00030 
00031 /*! \file ezgzipcompressionhandler.php
00032 */
00033 
00034 /*!
00035   \class eZGZIPCompressionHandler ezgzipcompressionhandler.php
00036   \brief Handles files compressed with gzip
00037 
00038   This class is a wrapper of the eZGZIPZLIBCompressionHandler and
00039   eZGZIPShellCompressionHandler classes.
00040 
00041   Duplication of this handler is done by the eZForwardCompressionHandler class.
00042 */
00043 
00044 //include_once( 'lib/ezfile/classes/ezforwardcompressionhandler.php' );
00045 //include_once( 'lib/ezfile/classes/ezgzipzlibcompressionhandler.php' );
00046 //include_once( 'lib/ezfile/classes/ezgzipshellcompressionhandler.php' );
00047 //include_once( 'lib/ezfile/classes/eznocompressionhandler.php' );
00048 
00049 class eZGZIPCompressionHandler extends eZForwardCompressionHandler
00050 {
00051     /*!
00052      See eZCompressionHandler::eZCompressionHandler and eZForwardCompressionHandler::eZForwardCompressionHandler.
00053     */
00054     function eZGZIPCompressionHandler()
00055     {
00056         if ( eZGZIPZLIBCompressionHandler::isAvailable() )
00057             $handler = new eZGZIPZLIBCompressionHandler();
00058         else if ( eZGZIPShellCompressionHandler::isAvailable() )
00059             $handler = new eZGZIPShellCompressionHandler();
00060         else
00061             $handler = new eZNoCompressionHandler();
00062         $this->eZForwardCompressionHandler( $handler,
00063                                             'GZIP', 'gzip' );
00064     }
00065 
00066     /*!
00067      Forwards the compression level to the current handler.
00068     */
00069     function setCompressionLevel( $level )
00070     {
00071         $handler =& $this->handler();
00072         if ( method_exists( $handler, 'setCompressionLevel' ) )
00073             $handler->setCompressionLevel( $level );
00074     }
00075 
00076     /*!
00077      Forwards the request for compression level to the current handler and returns the value.
00078     */
00079     function compressionLevel()
00080     {
00081         $handler =& $this->handler();
00082         if ( method_exists( $handler, 'compressionLevel' ) )
00083             return $handler->compressionLevel();
00084         return false;
00085     }
00086 }
00087 
00088 ?>