[ Index ] |
|
Code source de eZ Publish 3.9.0 |
1 <?php 2 // 3 // Definition of eZGZIPShellCompressionHandler class 4 // 5 // Created on: <13-Aug-2003 16:20:19 amos> 6 // 7 // SOFTWARE NAME: eZ publish 8 // SOFTWARE RELEASE: 3.9.0 9 // BUILD VERSION: 17785 10 // COPYRIGHT NOTICE: Copyright (C) 1999-2006 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 29 /*! \file ezgzipshellcompressionhandler.php 30 */ 31 32 /*! 33 \class eZGZIPShellCompressionHandler ezgzipshellcompressionhandler.php 34 \brief Handles files compressed with gzip using the shell commands 35 36 Handles GZIP compression by executing the 'gzip' executable, 37 without this the handler cannot work. 38 39 NOTE: This is not done yet. 40 */ 41 42 include_once ( 'lib/ezfile/classes/ezcompressionhandler.php' ); 43 44 class eZGZIPShellCompressionHandler extends eZCompressionHandler 45 { 46 /*! 47 */ 48 function eZGZIPShellCompressionHandler() 49 { 50 $this->File = false; 51 $thus->Level = false; 52 $this->eZCompressionHandler( 'GZIP (shell)', 'gzipshell' ); 53 } 54 55 /*! 56 Sets the current compression level. 57 */ 58 function setCompressionLevel( $level ) 59 { 60 if ( $level < 0 or $level > 9 ) 61 $level = false; 62 $this->Level = $level; 63 } 64 65 /*! 66 \return the current compression level which is a number between 0 and 9, 67 or \c false if the default is to be used. 68 */ 69 function compressionLevel() 70 { 71 return $this->Level; 72 } 73 74 /*! 75 \return true if this handler can be used. 76 */ 77 function isAvailable() 78 { 79 return false; 80 } 81 82 function gunzipFile( $filename ) 83 { 84 $command = 'gzip -dc $filename > $'; 85 } 86 87 /*! 88 \reimp 89 */ 90 function doOpen( $filename, $mode ) 91 { 92 $this->File = @gzopen( $filename, $mode ); 93 } 94 95 /*! 96 \reimp 97 */ 98 function doClose() 99 { 100 return @gzclose( $this->File ); 101 } 102 103 /*! 104 \reimp 105 */ 106 function doRead( $uncompressedLength = false ) 107 { 108 return @gzread( $this->File, $uncompressedLength ); 109 } 110 111 /*! 112 \reimp 113 */ 114 function doWrite( $data, $uncompressedLength = false ) 115 { 116 return @gzwrite( $this->File, $uncompressedLength ); 117 } 118 119 /*! 120 \reimp 121 */ 122 function doFlush() 123 { 124 return @fflush( $this->File ); 125 } 126 127 /*! 128 \reimp 129 */ 130 function doSeek( $offset, $whence ) 131 { 132 if ( $whence == SEEK_SET ) 133 $offset = $offset - gztell( $this->File ); 134 else if ( $whence == SEEK_END ) 135 { 136 eZDebugSetting::writeError( 'lib-ezfile-gziplibz', 137 "Seeking from end is not supported for gzipped files" ); 138 return false; 139 } 140 return @gzseek( $this->File, $offset ); 141 } 142 143 /*! 144 \reimp 145 */ 146 function doRewind() 147 { 148 return @gzrewind( $this->File ); 149 } 150 151 /*! 152 \reimp 153 */ 154 function doTell() 155 { 156 return @gztell( $this->File ); 157 } 158 159 /*! 160 \reimp 161 */ 162 function doEOF() 163 { 164 return @gzeof( $this->File ); 165 } 166 167 /*! 168 \reimp 169 */ 170 function doPasstrough() 171 { 172 return @gzpasstru( $this->File ); 173 } 174 175 /*! 176 \reimp 177 */ 178 function compress( $source ) 179 { 180 return @gzcompress( $source, $this->Level ); 181 } 182 183 /*! 184 \reimp 185 */ 186 function decompress( $source ) 187 { 188 return @gzuncompress( $source ); 189 } 190 191 /*! 192 \reimp 193 */ 194 function errorString() 195 { 196 return false; 197 } 198 199 /*! 200 \reimp 201 */ 202 function errorNumber() 203 { 204 return false; 205 } 206 207 /// \privatesection 208 /// File pointer, returned by gzopen 209 var $File; 210 /// The compression level 211 var $Level; 212 } 213 214 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 10:30:04 2007 | par Balluche grâce à PHPXref 0.7 |