Exponential Basic 2.4.0.1 Exponential Basic CMS — PHP Class Reference

ezgzipzlibcompressionhandler.php
Go to the documentation of this file.
1 <?php
20 class eZGZIPZLIBCompressionHandler extends eZCompressionHandler
21 {
22 public function __construct()
23 {
24 $this->File = false;
25 $this->Level = false;
26 parent::__construct( 'GZIP (zlib)', 'gzipzlib' );
27 }
28
32 function setCompressionLevel( $level )
33 {
34 if ( $level < 0 or $level > 9 )
35 $level = false;
36 $this->Level = $level;
37 }
38
43 function compressionLevel()
44 {
45 return $this->Level;
46 }
47
52 static function isAvailable()
53 {
54 // Only check a few of the functions, it's assumed all used gz methods are here if these two are present
55 return function_exists('gzcompress') && function_exists('gzuncompress');
56 }
57
58 function doOpen( $filename, $mode )
59 {
60 $this->File = @gzopen( $filename, $mode );
61 return $this->File;
62 }
63
64 function doClose()
65 {
66 $result = @gzclose( $this->File );
67 $this->File = false;
68 return $result;
69 }
70
71 function doRead( $uncompressedLength = false )
72 {
73 return @gzread( $this->File, $uncompressedLength );
74 }
75
76 function doWrite( $data, $uncompressedLength = false )
77 {
78 if ( $uncompressedLength )
79 return @gzwrite( $this->File, $data, $uncompressedLength );
80 else
81 return @gzwrite( $this->File, $data );
82 }
83
84 function doFlush()
85 {
86 return @fflush( $this->File );
87 }
88
89 function doSeek( $offset, $whence )
90 {
91 if ( $whence == SEEK_CUR )
92 {
93 $offset = gztell( $this->File ) + $offset;
94 }
95 else if ( $whence == SEEK_END )
96 {
97 eZDebug::writeError( "Seeking from end is not supported for gzipped files", __METHOD__ );
98 return false;
99 }
100 return @gzseek( $this->File, $offset );
101 }
102
103 function doRewind()
104 {
105 return @gzrewind( $this->File );
106 }
107
108 function doTell()
109 {
110 return @gztell( $this->File );
111 }
112
113 function doEOF()
114 {
115 return @gzeof( $this->File );
116 }
117
118 function doPasstrough( $closeFile = true )
119 {
120 $result = @gzpassthru( $this->File );
121 if ( !$closeFile )
122 {
123 // The file must be reopened because gzpasstru will close the file.
124 $this->File = @gzopen( $this->filename(), $this->mode(), $this->isBinaryMode() );
125 }
126 else
127 $this->File = false;
128 return $result;
129 }
130
131 function compress( $source )
132 {
133 return @gzcompress( $source, $this->Level );
134 }
135
136 function decompress( $source )
137 {
138 return @gzuncompress( $source );
139 }
140
141 function errorString()
142 {
143 return false;
144 }
145
146 function errorNumber()
147 {
148 return false;
149 }
150
153 public $File;
155 public $Level;
156 }
157
158 ?>
$level
$level
Definition: admin/message.php:106
eZCompressionHandler
Interface for file handlers using compression.
Definition: ezcompressionhandler.php:35
eZDebug\writeError
static writeError( $string, $label="", $backgroundClass="")
Definition: ezdebug.php:546
eZFileHandler\mode
mode()
Definition: ezfilehandler.php:109
eZFileHandler\isBinaryMode
isBinaryMode()
Definition: ezfilehandler.php:93
eZFileHandler\filename
filename()
Definition: ezfilehandler.php:101
eZGZIPZLIBCompressionHandler
Handles files compressed with gzip using the zlib extension.
Definition: ezgzipzlibcompressionhandler.php:21
eZGZIPZLIBCompressionHandler\doWrite
doWrite( $data, $uncompressedLength=false)
Definition: ezgzipzlibcompressionhandler.php:76
eZGZIPZLIBCompressionHandler\doFlush
doFlush()
Definition: ezgzipzlibcompressionhandler.php:84
eZGZIPZLIBCompressionHandler\errorString
errorString()
Definition: ezgzipzlibcompressionhandler.php:141
eZGZIPZLIBCompressionHandler\__construct
__construct()
Definition: ezgzipzlibcompressionhandler.php:22
eZGZIPZLIBCompressionHandler\compress
compress( $source)
Definition: ezgzipzlibcompressionhandler.php:131
eZGZIPZLIBCompressionHandler\doOpen
doOpen( $filename, $mode)
Definition: ezgzipzlibcompressionhandler.php:58
eZGZIPZLIBCompressionHandler\doTell
doTell()
Definition: ezgzipzlibcompressionhandler.php:108
eZGZIPZLIBCompressionHandler\compressionLevel
compressionLevel()
Definition: ezgzipzlibcompressionhandler.php:43
eZGZIPZLIBCompressionHandler\errorNumber
errorNumber()
Definition: ezgzipzlibcompressionhandler.php:146
eZGZIPZLIBCompressionHandler\doEOF
doEOF()
Definition: ezgzipzlibcompressionhandler.php:113
eZGZIPZLIBCompressionHandler\doSeek
doSeek( $offset, $whence)
Definition: ezgzipzlibcompressionhandler.php:89
eZGZIPZLIBCompressionHandler\$Level
$Level
The compression level.
Definition: ezgzipzlibcompressionhandler.php:155
eZGZIPZLIBCompressionHandler\decompress
decompress( $source)
Definition: ezgzipzlibcompressionhandler.php:136
eZGZIPZLIBCompressionHandler\doClose
doClose()
Definition: ezgzipzlibcompressionhandler.php:64
eZGZIPZLIBCompressionHandler\setCompressionLevel
setCompressionLevel( $level)
Definition: ezgzipzlibcompressionhandler.php:32
eZGZIPZLIBCompressionHandler\doPasstrough
doPasstrough( $closeFile=true)
Definition: ezgzipzlibcompressionhandler.php:118
eZGZIPZLIBCompressionHandler\doRewind
doRewind()
Definition: ezgzipzlibcompressionhandler.php:103
eZGZIPZLIBCompressionHandler\doRead
doRead( $uncompressedLength=false)
Definition: ezgzipzlibcompressionhandler.php:71
eZGZIPZLIBCompressionHandler\isAvailable
static isAvailable()
Definition: ezgzipzlibcompressionhandler.php:52
eZGZIPZLIBCompressionHandler\$File
$File
Definition: ezgzipzlibcompressionhandler.php:153
$result
$result
Definition: companysearch.php:94
$offset
$offset
Definition: ezstats/admin/cron.php:51
Copyright © 1998 – 2026 7x. All rights reserved. Licensed under the GNU GPLv2+.