PageRenderTime 153ms CodeModel.GetById 29ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/ezfile/classes/ezgzipcompressionhandler.php

http://github.com/ezsystems/ezpublish
PHP | 59 lines | 28 code | 5 blank | 26 comment | 5 complexity | 0e439703893b70f4d83abf99229e410b MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.1
  1. <?php
  2. /**
  3. * File containing the eZGZIPCompressionHandler class.
  4. *
  5. * @copyright Copyright (C) eZ Systems AS. All rights reserved.
  6. * @license For full copyright and license information view LICENSE file distributed with this source code.
  7. * @version //autogentag//
  8. * @package lib
  9. */
  10. /*!
  11. \class eZGZIPCompressionHandler ezgzipcompressionhandler.php
  12. \brief Handles files compressed with gzip
  13. This class is a wrapper of the eZGZIPZLIBCompressionHandler and
  14. eZGZIPShellCompressionHandler classes.
  15. Duplication of this handler is done by the eZForwardCompressionHandler class.
  16. */
  17. class eZGZIPCompressionHandler extends eZForwardCompressionHandler
  18. {
  19. /*!
  20. See eZCompressionHandler::eZCompressionHandler and eZForwardCompressionHandler::eZForwardCompressionHandler.
  21. */
  22. public function __construct()
  23. {
  24. if ( eZGZIPZLIBCompressionHandler::isAvailable() )
  25. $handler = new eZGZIPZLIBCompressionHandler();
  26. else if ( eZGZIPShellCompressionHandler::isAvailable() )
  27. $handler = new eZGZIPShellCompressionHandler();
  28. else
  29. $handler = new eZNoCompressionHandler();
  30. parent::__construct( $handler, 'GZIP', 'gzip' );
  31. }
  32. /*!
  33. Forwards the compression level to the current handler.
  34. */
  35. function setCompressionLevel( $level )
  36. {
  37. $handler =& $this->handler();
  38. if ( method_exists( $handler, 'setCompressionLevel' ) )
  39. $handler->setCompressionLevel( $level );
  40. }
  41. /*!
  42. Forwards the request for compression level to the current handler and returns the value.
  43. */
  44. function compressionLevel()
  45. {
  46. $handler =& $this->handler();
  47. if ( method_exists( $handler, 'compressionLevel' ) )
  48. return $handler->compressionLevel();
  49. return false;
  50. }
  51. }
  52. ?>