PageRenderTime 46ms CodeModel.GetById 20ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/ezfile/classes/ezgzipcompressionhandler.php

https://github.com/aurelienRT1/ezpublish
PHP | 83 lines | 29 code | 6 blank | 48 comment | 5 complexity | 65b4a94740ea419ca5fb47eb27913c20 MD5 | raw file
Possible License(s): LGPL-2.1, GPL-2.0
  1. <?php
  2. //
  3. // Definition of eZGZIPCompressionHandler class
  4. //
  5. // Created on: <13-Aug-2003 16:20:19 amos>
  6. //
  7. // ## BEGIN COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
  8. // SOFTWARE NAME: eZ Publish
  9. // SOFTWARE RELEASE: 4.1.x
  10. // COPYRIGHT NOTICE: Copyright (C) 1999-2010 eZ Systems AS
  11. // SOFTWARE LICENSE: GNU General Public License v2.0
  12. // NOTICE: >
  13. // This program is free software; you can redistribute it and/or
  14. // modify it under the terms of version 2.0 of the GNU General
  15. // Public License as published by the Free Software Foundation.
  16. //
  17. // This program is distributed in the hope that it will be useful,
  18. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  20. // GNU General Public License for more details.
  21. //
  22. // You should have received a copy of version 2.0 of the GNU General
  23. // Public License along with this program; if not, write to the Free
  24. // Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
  25. // MA 02110-1301, USA.
  26. //
  27. //
  28. // ## END COPYRIGHT, LICENSE AND WARRANTY NOTICE ##
  29. //
  30. /*! \file
  31. */
  32. /*!
  33. \class eZGZIPCompressionHandler ezgzipcompressionhandler.php
  34. \brief Handles files compressed with gzip
  35. This class is a wrapper of the eZGZIPZLIBCompressionHandler and
  36. eZGZIPShellCompressionHandler classes.
  37. Duplication of this handler is done by the eZForwardCompressionHandler class.
  38. */
  39. class eZGZIPCompressionHandler extends eZForwardCompressionHandler
  40. {
  41. /*!
  42. See eZCompressionHandler::eZCompressionHandler and eZForwardCompressionHandler::eZForwardCompressionHandler.
  43. */
  44. function eZGZIPCompressionHandler()
  45. {
  46. if ( eZGZIPZLIBCompressionHandler::isAvailable() )
  47. $handler = new eZGZIPZLIBCompressionHandler();
  48. else if ( eZGZIPShellCompressionHandler::isAvailable() )
  49. $handler = new eZGZIPShellCompressionHandler();
  50. else
  51. $handler = new eZNoCompressionHandler();
  52. $this->eZForwardCompressionHandler( $handler,
  53. 'GZIP', 'gzip' );
  54. }
  55. /*!
  56. Forwards the compression level to the current handler.
  57. */
  58. function setCompressionLevel( $level )
  59. {
  60. $handler =& $this->handler();
  61. if ( method_exists( $handler, 'setCompressionLevel' ) )
  62. $handler->setCompressionLevel( $level );
  63. }
  64. /*!
  65. Forwards the request for compression level to the current handler and returns the value.
  66. */
  67. function compressionLevel()
  68. {
  69. $handler =& $this->handler();
  70. if ( method_exists( $handler, 'compressionLevel' ) )
  71. return $handler->compressionLevel();
  72. return false;
  73. }
  74. }
  75. ?>